From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../language/expressions/addition/S11.6.1_A1.js | 62 + .../expressions/addition/S11.6.1_A2.1_T1.js | 43 + .../expressions/addition/S11.6.1_A2.1_T2.js | 21 + .../expressions/addition/S11.6.1_A2.1_T3.js | 21 + .../expressions/addition/S11.6.1_A2.2_T1.js | 71 + .../expressions/addition/S11.6.1_A2.2_T2.js | 34 + .../expressions/addition/S11.6.1_A2.2_T3.js | 46 + .../expressions/addition/S11.6.1_A2.3_T1.js | 28 + .../expressions/addition/S11.6.1_A2.4_T1.js | 22 + .../expressions/addition/S11.6.1_A2.4_T2.js | 26 + .../expressions/addition/S11.6.1_A2.4_T3.js | 21 + .../expressions/addition/S11.6.1_A2.4_T4.js | 16 + .../expressions/addition/S11.6.1_A3.1_T1.1.js | 34 + .../expressions/addition/S11.6.1_A3.1_T1.2.js | 34 + .../expressions/addition/S11.6.1_A3.1_T1.3.js | 34 + .../expressions/addition/S11.6.1_A3.1_T2.1.js | 55 + .../expressions/addition/S11.6.1_A3.1_T2.2.js | 34 + .../expressions/addition/S11.6.1_A3.1_T2.3.js | 34 + .../expressions/addition/S11.6.1_A3.1_T2.4.js | 34 + .../expressions/addition/S11.6.1_A3.1_T2.5.js | 34 + .../expressions/addition/S11.6.1_A3.2_T1.1.js | 45 + .../expressions/addition/S11.6.1_A3.2_T1.2.js | 35 + .../expressions/addition/S11.6.1_A3.2_T2.1.js | 66 + .../expressions/addition/S11.6.1_A3.2_T2.2.js | 56 + .../expressions/addition/S11.6.1_A3.2_T2.3.js | 35 + .../expressions/addition/S11.6.1_A3.2_T2.4.js | 35 + .../language/expressions/addition/S11.6.1_A4_T1.js | 42 + .../language/expressions/addition/S11.6.1_A4_T2.js | 22 + .../language/expressions/addition/S11.6.1_A4_T3.js | 24 + .../language/expressions/addition/S11.6.1_A4_T4.js | 54 + .../language/expressions/addition/S11.6.1_A4_T5.js | 50 + .../language/expressions/addition/S11.6.1_A4_T6.js | 54 + .../language/expressions/addition/S11.6.1_A4_T7.js | 41 + .../language/expressions/addition/S11.6.1_A4_T8.js | 34 + .../language/expressions/addition/S11.6.1_A4_T9.js | 34 + .../expressions/addition/bigint-and-number.js | 87 + .../expressions/addition/bigint-arithmetic.js | 1403 +++++++++++ .../language/expressions/addition/bigint-errors.js | 72 + .../expressions/addition/bigint-toprimitive.js | 374 +++ .../expressions/addition/bigint-wrapped-values.js | 47 + .../language/expressions/addition/browser.js | 0 .../addition/coerce-bigint-to-string.js | 35 + .../addition/coerce-symbol-to-prim-err.js | 57 + .../addition/coerce-symbol-to-prim-invocation.js | 61 + .../addition/coerce-symbol-to-prim-return-obj.js | 50 + .../addition/coerce-symbol-to-prim-return-prim.js | 66 + .../expressions/addition/get-symbol-to-prim-err.js | 53 + .../expressions/addition/order-of-evaluation.js | 142 ++ .../test262/language/expressions/addition/shell.js | 0 .../expressions/addition/symbol-to-string.js | 19 + .../test262/language/expressions/array/11.1.4-0.js | 15 + .../language/expressions/array/11.1.4_4-5-1.js | 28 + .../language/expressions/array/11.1.4_5-6-1.js | 28 + .../language/expressions/array/S11.1.4_A1.1.js | 34 + .../language/expressions/array/S11.1.4_A1.2.js | 34 + .../language/expressions/array/S11.1.4_A1.3.js | 59 + .../language/expressions/array/S11.1.4_A1.4.js | 59 + .../language/expressions/array/S11.1.4_A1.5.js | 59 + .../language/expressions/array/S11.1.4_A1.6.js | 61 + .../language/expressions/array/S11.1.4_A1.7.js | 61 + .../language/expressions/array/S11.1.4_A2.js | 130 + .../test262/language/expressions/array/browser.js | 0 .../test262/language/expressions/array/shell.js | 0 .../array/spread-err-mult-err-expr-throws.js | 39 + .../array/spread-err-mult-err-iter-get-value.js | 50 + .../array/spread-err-mult-err-itr-get-call.js | 48 + .../array/spread-err-mult-err-itr-get-get.js | 49 + .../array/spread-err-mult-err-itr-step.js | 58 + .../array/spread-err-mult-err-itr-value.js | 61 + .../array/spread-err-mult-err-obj-unresolvable.js | 40 + .../array/spread-err-mult-err-unresolvable.js | 44 + .../array/spread-err-sngl-err-expr-throws.js | 39 + .../array/spread-err-sngl-err-itr-get-call.js | 49 + .../array/spread-err-sngl-err-itr-get-get.js | 50 + .../array/spread-err-sngl-err-itr-get-value.js | 49 + .../array/spread-err-sngl-err-itr-step.js | 62 + .../array/spread-err-sngl-err-itr-value.js | 68 + .../array/spread-err-sngl-err-obj-unresolvable.js | 40 + .../array/spread-err-sngl-err-unresolvable.js | 45 + .../expressions/array/spread-mult-empty.js | 49 + .../language/expressions/array/spread-mult-expr.js | 54 + .../language/expressions/array/spread-mult-iter.js | 66 + .../expressions/array/spread-mult-literal.js | 51 + .../expressions/array/spread-mult-obj-ident.js | 76 + .../expressions/array/spread-mult-obj-null.js | 47 + .../expressions/array/spread-mult-obj-undefined.js | 47 + .../array/spread-obj-getter-descriptor.js | 61 + .../expressions/array/spread-obj-getter-init.js | 41 + .../spread-obj-manipulate-outter-obj-in-getter.js | 55 + .../array/spread-obj-mult-spread-getter.js | 55 + .../expressions/array/spread-obj-mult-spread.js | 53 + .../language/expressions/array/spread-obj-null.js | 45 + .../array/spread-obj-override-immutable.js | 54 + .../array/spread-obj-overrides-prev-properties.js | 51 + .../array/spread-obj-skip-non-enumerable.js | 39 + .../expressions/array/spread-obj-spread-order.js | 52 + .../array/spread-obj-symbol-property.js | 53 + .../expressions/array/spread-obj-undefined.js | 45 + .../expressions/array/spread-obj-with-overrides.js | 57 + .../expressions/array/spread-sngl-empty.js | 48 + .../language/expressions/array/spread-sngl-expr.js | 56 + .../language/expressions/array/spread-sngl-iter.js | 63 + .../expressions/array/spread-sngl-literal.js | 53 + .../expressions/array/spread-sngl-obj-ident.js | 62 + .../ArrowFunction_restricted-properties.js | 33 + .../array-destructuring-param-strict-body.js | 132 + .../arrow-function/arrow/binding-tests-1.js | 16 + .../arrow-function/arrow/binding-tests-2.js | 16 + .../arrow-function/arrow/binding-tests-3.js | 16 + .../expressions/arrow-function/arrow/browser.js | 0 .../arrow/capturing-closure-variables-1.js | 17 + .../arrow/capturing-closure-variables-2.js | 19 + ...concisebody-lookahead-assignmentexpression-1.js | 11 + ...concisebody-lookahead-assignmentexpression-2.js | 11 + .../expressions/arrow-function/arrow/shell.js | 0 .../language/expressions/arrow-function/browser.js | 0 .../cannot-override-this-with-thisArg.js | 31 + .../arrow-function/dflt-params-abrupt.js | 63 + .../dflt-params-arg-val-not-undefined.js | 85 + .../dflt-params-arg-val-undefined.js | 68 + .../arrow-function/dflt-params-duplicates.js | 61 + .../arrow-function/dflt-params-ref-later.js | 64 + .../arrow-function/dflt-params-ref-prior.js | 65 + .../arrow-function/dflt-params-ref-self.js | 64 + .../expressions/arrow-function/dflt-params-rest.js | 65 + .../arrow-function/dflt-params-trailing-comma.js | 59 + .../arrow-function/dstr/ary-init-iter-close.js | 73 + .../dstr/ary-init-iter-get-err-array-prototype.js | 64 + .../arrow-function/dstr/ary-init-iter-get-err.js | 58 + .../arrow-function/dstr/ary-init-iter-no-close.js | 73 + .../arrow-function/dstr/ary-name-iter-val.js | 72 + .../dstr/ary-ptrn-elem-ary-elem-init.js | 64 + .../dstr/ary-ptrn-elem-ary-elem-iter.js | 65 + .../dstr/ary-ptrn-elem-ary-elision-init.js | 71 + .../dstr/ary-ptrn-elem-ary-elision-iter.js | 68 + .../dstr/ary-ptrn-elem-ary-empty-init.js | 67 + .../dstr/ary-ptrn-elem-ary-empty-iter.js | 64 + .../dstr/ary-ptrn-elem-ary-rest-init.js | 68 + .../dstr/ary-ptrn-elem-ary-rest-iter.js | 71 + .../dstr/ary-ptrn-elem-ary-val-null.js | 65 + .../dstr/ary-ptrn-elem-id-init-exhausted.js | 63 + .../dstr/ary-ptrn-elem-id-init-fn-name-arrow.js | 64 + .../dstr/ary-ptrn-elem-id-init-fn-name-class.js | 66 + .../dstr/ary-ptrn-elem-id-init-fn-name-cover.js | 65 + .../dstr/ary-ptrn-elem-id-init-fn-name-fn.js | 65 + .../dstr/ary-ptrn-elem-id-init-fn-name-gen.js | 66 + .../dstr/ary-ptrn-elem-id-init-hole.js | 59 + .../dstr/ary-ptrn-elem-id-init-skipped.js | 68 + .../dstr/ary-ptrn-elem-id-init-throws.js | 56 + .../dstr/ary-ptrn-elem-id-init-undef.js | 62 + .../dstr/ary-ptrn-elem-id-init-unresolvable.js | 63 + .../dstr/ary-ptrn-elem-id-iter-complete.js | 66 + .../dstr/ary-ptrn-elem-id-iter-done.js | 61 + .../dstr/ary-ptrn-elem-id-iter-step-err.js | 65 + .../ary-ptrn-elem-id-iter-val-array-prototype.js | 82 + .../dstr/ary-ptrn-elem-id-iter-val-err.js | 76 + .../dstr/ary-ptrn-elem-id-iter-val.js | 72 + .../dstr/ary-ptrn-elem-obj-id-init.js | 64 + .../arrow-function/dstr/ary-ptrn-elem-obj-id.js | 64 + .../dstr/ary-ptrn-elem-obj-prop-id-init.js | 74 + .../dstr/ary-ptrn-elem-obj-prop-id.js | 74 + .../dstr/ary-ptrn-elem-obj-val-null.js | 65 + .../dstr/ary-ptrn-elem-obj-val-undef.js | 65 + .../dstr/ary-ptrn-elision-exhausted.js | 69 + .../dstr/ary-ptrn-elision-step-err.js | 72 + .../arrow-function/dstr/ary-ptrn-elision.js | 78 + .../arrow-function/dstr/ary-ptrn-empty.js | 61 + .../arrow-function/dstr/ary-ptrn-rest-ary-elem.js | 85 + .../dstr/ary-ptrn-rest-ary-elision.js | 91 + .../arrow-function/dstr/ary-ptrn-rest-ary-empty.js | 74 + .../arrow-function/dstr/ary-ptrn-rest-ary-rest.js | 70 + .../arrow-function/dstr/ary-ptrn-rest-id-direct.js | 65 + .../dstr/ary-ptrn-rest-id-elision-next-err.js | 58 + .../dstr/ary-ptrn-rest-id-elision.js | 66 + .../dstr/ary-ptrn-rest-id-exhausted.js | 62 + .../dstr/ary-ptrn-rest-id-iter-step-err.js | 69 + .../dstr/ary-ptrn-rest-id-iter-val-err.js | 71 + .../arrow-function/dstr/ary-ptrn-rest-id.js | 63 + .../arrow-function/dstr/ary-ptrn-rest-init-ary.js | 59 + .../arrow-function/dstr/ary-ptrn-rest-init-id.js | 59 + .../arrow-function/dstr/ary-ptrn-rest-init-obj.js | 59 + .../dstr/ary-ptrn-rest-not-final-ary.js | 59 + .../dstr/ary-ptrn-rest-not-final-id.js | 59 + .../dstr/ary-ptrn-rest-not-final-obj.js | 59 + .../arrow-function/dstr/ary-ptrn-rest-obj-id.js | 63 + .../dstr/ary-ptrn-rest-obj-prop-id.js | 70 + .../expressions/arrow-function/dstr/browser.js | 0 .../dstr/dflt-ary-init-iter-close.js | 73 + .../dflt-ary-init-iter-get-err-array-prototype.js | 64 + .../dstr/dflt-ary-init-iter-get-err.js | 58 + .../dstr/dflt-ary-init-iter-no-close.js | 73 + .../arrow-function/dstr/dflt-ary-name-iter-val.js | 72 + .../dstr/dflt-ary-ptrn-elem-ary-elem-init.js | 64 + .../dstr/dflt-ary-ptrn-elem-ary-elem-iter.js | 65 + .../dstr/dflt-ary-ptrn-elem-ary-elision-init.js | 71 + .../dstr/dflt-ary-ptrn-elem-ary-elision-iter.js | 68 + .../dstr/dflt-ary-ptrn-elem-ary-empty-init.js | 67 + .../dstr/dflt-ary-ptrn-elem-ary-empty-iter.js | 64 + .../dstr/dflt-ary-ptrn-elem-ary-rest-init.js | 68 + .../dstr/dflt-ary-ptrn-elem-ary-rest-iter.js | 71 + .../dstr/dflt-ary-ptrn-elem-ary-val-null.js | 65 + .../dstr/dflt-ary-ptrn-elem-id-init-exhausted.js | 63 + .../dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 64 + .../dflt-ary-ptrn-elem-id-init-fn-name-class.js | 66 + .../dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 65 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 65 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-init-hole.js | 59 + .../dstr/dflt-ary-ptrn-elem-id-init-skipped.js | 68 + .../dstr/dflt-ary-ptrn-elem-id-init-throws.js | 56 + .../dstr/dflt-ary-ptrn-elem-id-init-undef.js | 62 + .../dflt-ary-ptrn-elem-id-init-unresolvable.js | 63 + .../dstr/dflt-ary-ptrn-elem-id-iter-complete.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-iter-done.js | 61 + .../dstr/dflt-ary-ptrn-elem-id-iter-step-err.js | 65 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 82 + .../dstr/dflt-ary-ptrn-elem-id-iter-val-err.js | 76 + .../dstr/dflt-ary-ptrn-elem-id-iter-val.js | 72 + .../dstr/dflt-ary-ptrn-elem-obj-id-init.js | 64 + .../dstr/dflt-ary-ptrn-elem-obj-id.js | 64 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js | 74 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id.js | 74 + .../dstr/dflt-ary-ptrn-elem-obj-val-null.js | 65 + .../dstr/dflt-ary-ptrn-elem-obj-val-undef.js | 65 + .../dstr/dflt-ary-ptrn-elision-exhausted.js | 69 + .../dstr/dflt-ary-ptrn-elision-step-err.js | 72 + .../arrow-function/dstr/dflt-ary-ptrn-elision.js | 78 + .../arrow-function/dstr/dflt-ary-ptrn-empty.js | 61 + .../dstr/dflt-ary-ptrn-rest-ary-elem.js | 85 + .../dstr/dflt-ary-ptrn-rest-ary-elision.js | 91 + .../dstr/dflt-ary-ptrn-rest-ary-empty.js | 74 + .../dstr/dflt-ary-ptrn-rest-ary-rest.js | 70 + .../dstr/dflt-ary-ptrn-rest-id-direct.js | 65 + .../dstr/dflt-ary-ptrn-rest-id-elision-next-err.js | 58 + .../dstr/dflt-ary-ptrn-rest-id-elision.js | 66 + .../dstr/dflt-ary-ptrn-rest-id-exhausted.js | 62 + .../dstr/dflt-ary-ptrn-rest-id-iter-step-err.js | 69 + .../dstr/dflt-ary-ptrn-rest-id-iter-val-err.js | 71 + .../arrow-function/dstr/dflt-ary-ptrn-rest-id.js | 63 + .../dstr/dflt-ary-ptrn-rest-init-ary.js | 59 + .../dstr/dflt-ary-ptrn-rest-init-id.js | 59 + .../dstr/dflt-ary-ptrn-rest-init-obj.js | 59 + .../dstr/dflt-ary-ptrn-rest-not-final-ary.js | 59 + .../dstr/dflt-ary-ptrn-rest-not-final-id.js | 59 + .../dstr/dflt-ary-ptrn-rest-not-final-obj.js | 59 + .../dstr/dflt-ary-ptrn-rest-obj-id.js | 63 + .../dstr/dflt-ary-ptrn-rest-obj-prop-id.js | 70 + .../arrow-function/dstr/dflt-obj-init-null.js | 52 + .../arrow-function/dstr/dflt-obj-init-undefined.js | 52 + .../arrow-function/dstr/dflt-obj-ptrn-empty.js | 62 + .../dstr/dflt-obj-ptrn-id-get-value-err.js | 59 + .../dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js | 63 + .../dstr/dflt-obj-ptrn-id-init-fn-name-class.js | 65 + .../dstr/dflt-obj-ptrn-id-init-fn-name-cover.js | 64 + .../dstr/dflt-obj-ptrn-id-init-fn-name-fn.js | 64 + .../dstr/dflt-obj-ptrn-id-init-fn-name-gen.js | 65 + .../dstr/dflt-obj-ptrn-id-init-skipped.js | 67 + .../dstr/dflt-obj-ptrn-id-init-throws.js | 59 + .../dstr/dflt-obj-ptrn-id-init-unresolvable.js | 63 + .../dstr/dflt-obj-ptrn-id-trailing-comma.js | 57 + .../arrow-function/dstr/dflt-obj-ptrn-list-err.js | 60 + .../dstr/dflt-obj-ptrn-prop-ary-init.js | 66 + .../dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js | 57 + .../dstr/dflt-obj-ptrn-prop-ary-value-null.js | 54 + .../arrow-function/dstr/dflt-obj-ptrn-prop-ary.js | 64 + .../dstr/dflt-obj-ptrn-prop-eval-err.js | 56 + .../dstr/dflt-obj-ptrn-prop-id-get-value-err.js | 61 + .../dstr/dflt-obj-ptrn-prop-id-init-skipped.js | 79 + .../dstr/dflt-obj-ptrn-prop-id-init-throws.js | 59 + .../dflt-obj-ptrn-prop-id-init-unresolvable.js | 63 + .../dstr/dflt-obj-ptrn-prop-id-init.js | 60 + .../dstr/dflt-obj-ptrn-prop-id-trailing-comma.js | 61 + .../arrow-function/dstr/dflt-obj-ptrn-prop-id.js | 60 + .../dstr/dflt-obj-ptrn-prop-obj-init.js | 66 + .../dstr/dflt-obj-ptrn-prop-obj-value-null.js | 54 + .../dstr/dflt-obj-ptrn-prop-obj-value-undef.js | 54 + .../arrow-function/dstr/dflt-obj-ptrn-prop-obj.js | 64 + .../dstr/dflt-obj-ptrn-rest-getter.js | 59 + .../dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js | 67 + .../dstr/dflt-obj-ptrn-rest-val-obj.js | 66 + .../arrow-function/dstr/obj-init-null.js | 52 + .../arrow-function/dstr/obj-init-undefined.js | 52 + .../arrow-function/dstr/obj-ptrn-empty.js | 62 + .../dstr/obj-ptrn-id-get-value-err.js | 59 + .../dstr/obj-ptrn-id-init-fn-name-arrow.js | 63 + .../dstr/obj-ptrn-id-init-fn-name-class.js | 65 + .../dstr/obj-ptrn-id-init-fn-name-cover.js | 64 + .../dstr/obj-ptrn-id-init-fn-name-fn.js | 64 + .../dstr/obj-ptrn-id-init-fn-name-gen.js | 65 + .../dstr/obj-ptrn-id-init-skipped.js | 67 + .../arrow-function/dstr/obj-ptrn-id-init-throws.js | 59 + .../dstr/obj-ptrn-id-init-unresolvable.js | 63 + .../dstr/obj-ptrn-id-trailing-comma.js | 57 + .../arrow-function/dstr/obj-ptrn-list-err.js | 60 + .../arrow-function/dstr/obj-ptrn-prop-ary-init.js | 66 + .../dstr/obj-ptrn-prop-ary-trailing-comma.js | 57 + .../dstr/obj-ptrn-prop-ary-value-null.js | 54 + .../arrow-function/dstr/obj-ptrn-prop-ary.js | 64 + .../arrow-function/dstr/obj-ptrn-prop-eval-err.js | 56 + .../dstr/obj-ptrn-prop-id-get-value-err.js | 61 + .../dstr/obj-ptrn-prop-id-init-skipped.js | 79 + .../dstr/obj-ptrn-prop-id-init-throws.js | 59 + .../dstr/obj-ptrn-prop-id-init-unresolvable.js | 63 + .../arrow-function/dstr/obj-ptrn-prop-id-init.js | 60 + .../dstr/obj-ptrn-prop-id-trailing-comma.js | 61 + .../arrow-function/dstr/obj-ptrn-prop-id.js | 60 + .../arrow-function/dstr/obj-ptrn-prop-obj-init.js | 66 + .../dstr/obj-ptrn-prop-obj-value-null.js | 54 + .../dstr/obj-ptrn-prop-obj-value-undef.js | 54 + .../arrow-function/dstr/obj-ptrn-prop-obj.js | 64 + .../arrow-function/dstr/obj-ptrn-rest-getter.js | 59 + .../dstr/obj-ptrn-rest-skip-non-enumerable.js | 67 + .../arrow-function/dstr/obj-ptrn-rest-val-obj.js | 66 + .../expressions/arrow-function/dstr/shell.js | 0 .../dstr/syntax-error-ident-ref-break-escaped.js | 41 + .../dstr/syntax-error-ident-ref-case-escaped.js | 41 + .../dstr/syntax-error-ident-ref-catch-escaped.js | 41 + .../dstr/syntax-error-ident-ref-class-escaped.js | 41 + .../dstr/syntax-error-ident-ref-const-escaped.js | 41 + .../syntax-error-ident-ref-continue-escaped.js | 41 + .../syntax-error-ident-ref-debugger-escaped.js | 41 + .../syntax-error-ident-ref-default-escaped-ext.js | 41 + .../dstr/syntax-error-ident-ref-default-escaped.js | 41 + .../dstr/syntax-error-ident-ref-default.js | 41 + .../dstr/syntax-error-ident-ref-delete-escaped.js | 41 + .../dstr/syntax-error-ident-ref-do-escaped.js | 41 + .../dstr/syntax-error-ident-ref-else-escaped.js | 41 + .../dstr/syntax-error-ident-ref-enum-escaped.js | 41 + .../dstr/syntax-error-ident-ref-export-escaped.js | 41 + .../syntax-error-ident-ref-extends-escaped-ext.js | 41 + .../dstr/syntax-error-ident-ref-extends-escaped.js | 41 + .../dstr/syntax-error-ident-ref-extends.js | 41 + .../dstr/syntax-error-ident-ref-finally-escaped.js | 41 + .../dstr/syntax-error-ident-ref-for-escaped.js | 41 + .../syntax-error-ident-ref-function-escaped.js | 41 + .../dstr/syntax-error-ident-ref-if-escaped.js | 41 + ...ax-error-ident-ref-implements-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-import-escaped.js | 41 + .../dstr/syntax-error-ident-ref-in-escaped.js | 41 + .../syntax-error-ident-ref-instanceof-escaped.js | 41 + ...tax-error-ident-ref-interface-escaped-strict.js | 42 + .../syntax-error-ident-ref-let-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-new-escaped.js | 41 + ...yntax-error-ident-ref-package-escaped-strict.js | 42 + ...yntax-error-ident-ref-private-escaped-strict.js | 42 + ...tax-error-ident-ref-protected-escaped-strict.js | 42 + ...syntax-error-ident-ref-public-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-return-escaped.js | 41 + ...syntax-error-ident-ref-static-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-super-escaped.js | 41 + .../dstr/syntax-error-ident-ref-switch-escaped.js | 41 + .../dstr/syntax-error-ident-ref-this-escaped.js | 41 + .../dstr/syntax-error-ident-ref-throw-escaped.js | 41 + .../dstr/syntax-error-ident-ref-try-escaped.js | 41 + .../dstr/syntax-error-ident-ref-typeof-escaped.js | 41 + .../dstr/syntax-error-ident-ref-var-escaped.js | 41 + .../dstr/syntax-error-ident-ref-void-escaped.js | 41 + .../dstr/syntax-error-ident-ref-while-escaped.js | 41 + .../dstr/syntax-error-ident-ref-with-escaped.js | 41 + .../empty-function-body-returns-undefined.js | 12 + .../arrow-function/eval-var-scope-syntax-err.js | 59 + .../expression-body-implicit-return.js | 11 + .../expressions/arrow-function/extensibility.js | 31 + ...n-forbidden-ext-direct-access-prop-arguments.js | 37 + ...tion-forbidden-ext-direct-access-prop-caller.js | 37 + .../arrow-function/forbidden-ext/b1/browser.js | 0 .../arrow-function/forbidden-ext/b1/shell.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 62 + ...en-ext-indirect-access-own-prop-caller-value.js | 62 + ...on-forbidden-ext-indirect-access-prop-caller.js | 62 + .../arrow-function/forbidden-ext/b2/browser.js | 0 .../arrow-function/forbidden-ext/b2/shell.js | 0 .../arrow-function/forbidden-ext/browser.js | 0 .../arrow-function/forbidden-ext/shell.js | 0 .../expressions/arrow-function/length-dflt.js | 70 + .../arrow-function/lexical-arguments.js | 31 + ...gs-overriden-by-formal-parameters-non-strict.js | 16 + .../lexical-new.target-closure-returned.js | 33 + .../arrow-function/lexical-new.target.js | 36 + .../lexical-super-call-from-within-constructor.js | 48 + ...xical-super-property-from-within-constructor.js | 42 + .../arrow-function/lexical-super-property.js | 40 + ...cal-supercall-from-immediately-invoked-arrow.js | 37 + .../expressions/arrow-function/lexical-this.js | 33 + .../low-precedence-expression-body-no-parens.js | 12 + .../language/expressions/arrow-function/name.js | 26 + .../expressions/arrow-function/non-strict.js | 22 + .../object-destructuring-param-strict-body.js | 132 + .../object-literal-return-requires-body-parens.js | 12 + .../arrow-function/param-dflt-yield-expr.js | 29 + .../param-dflt-yield-id-non-strict.js | 26 + .../param-dflt-yield-id-strict-strict.js | 23 + .../expressions/arrow-function/params-duplicate.js | 34 + .../params-trailing-comma-multiple.js | 59 + .../arrow-function/params-trailing-comma-single.js | 58 + .../expressions/arrow-function/prototype-rules.js | 14 + .../arrow-function/rest-param-strict-body.js | 132 + .../rest-params-trailing-comma-early-error.js | 57 + .../arrow-function/scope-body-lex-distinct.js | 50 + .../arrow-function/scope-param-elem-var-close.js | 32 + .../arrow-function/scope-param-elem-var-open.js | 30 + .../scope-param-rest-elem-var-close.js | 30 + .../scope-param-rest-elem-var-open.js | 30 + .../arrow-function/scope-paramsbody-var-close.js | 36 + .../arrow-function/scope-paramsbody-var-open.js | 34 + .../language/expressions/arrow-function/shell.js | 0 ...quires-braces-must-return-explicitly-missing.js | 14 + ...-body-requires-braces-must-return-explicitly.js | 14 + .../arrow-function/static-init-await-binding.js | 19 + .../arrow-function/static-init-await-reference.js | 19 + .../expressions/arrow-function/strict-strict.js | 25 + .../arrowparameters-bindingidentifier-arguments.js | 19 + ...gidentifier-concisebody-assignmentexpression.js | 18 + ...s-bindingidentifier-concisebody-functionbody.js | 24 + .../arrowparameters-bindingidentifier-eval.js | 20 + ...eterminator-concisebody-assignmentexpression.js | 19 + ...fier-lineterminator-concisebody-functionbody.js | 19 + .../arrowparameters-bindingidentifier-yield.js | 16 + ...eters-cover-concisebody-assignmentexpression.js | 18 + ...rowparameters-cover-concisebody-functionbody.js | 17 + ...wparameters-cover-formalparameters-arguments.js | 19 + .../arrowparameters-cover-formalparameters-eval.js | 19 + ...arrowparameters-cover-formalparameters-yield.js | 19 + ...cover-includes-rest-concisebody-functionbody.js | 21 + .../syntax/arrowparameters-cover-initialize-1.js | 18 + .../syntax/arrowparameters-cover-initialize-2.js | 18 + ...eterminator-concisebody-assignmentexpression.js | 19 + ...over-lineterminator-concisebody-functionbody.js | 19 + ...rameters-cover-rest-concisebody-functionbody.js | 20 + ...rest-lineterminator-concisebody-functionbody.js | 21 + .../expressions/arrow-function/syntax/browser.js | 0 ...dingidentifier-identifier-futurereservedword.js | 25 + ...-identifier-strict-futurereservedword-strict.js | 29 + ...arrowparameters-bindingidentifier-identifier.js | 25 + ...meters-bindingidentifier-no-arguments-strict.js | 21 + ...wparameters-bindingidentifier-no-eval-strict.js | 22 + ...parameters-bindingidentifier-no-yield-strict.js | 22 + .../arrowparameters-bindingidentifier-rest.js | 17 + .../arrowparameters-cover-no-arguments-strict.js | 26 + ...rameters-cover-no-duplicates-binding-array-1.js | 26 + ...rameters-cover-no-duplicates-binding-array-2.js | 26 + ...rameters-cover-no-duplicates-binding-array-3.js | 28 + ...ameters-cover-no-duplicates-binding-object-1.js | 26 + ...ameters-cover-no-duplicates-binding-object-2.js | 28 + ...ameters-cover-no-duplicates-binding-object-3.js | 28 + ...ameters-cover-no-duplicates-binding-object-4.js | 30 + ...ameters-cover-no-duplicates-binding-object-5.js | 30 + ...ameters-cover-no-duplicates-binding-object-6.js | 28 + .../arrowparameters-cover-no-duplicates-rest.js | 24 + .../arrowparameters-cover-no-duplicates.js | 24 + .../arrowparameters-cover-no-eval-strict.js | 26 + .../arrowparameters-cover-no-yield-strict.js | 21 + ...invalid-parenless-parameters-expression-body.js | 17 + ...asi-restriction-invalid-parenless-parameters.js | 19 + .../syntax/early-errors/asi-restriction-invalid.js | 16 + .../arrow-function/syntax/early-errors/browser.js | 0 .../arrow-function/syntax/early-errors/shell.js | 0 .../use-strict-with-non-simple-param.js | 22 + .../expressions/arrow-function/syntax/shell.js | 0 .../arrow-function/syntax/variations.js | 16 + .../expressions/arrow-function/throw-new.js | 16 + .../unscopables-with-in-nested-fn.js | 102 + .../expressions/arrow-function/unscopables-with.js | 96 + .../expressions/assignment/11.13.1-1-6-s.js | 17 + .../expressions/assignment/11.13.1-1-s-strict.js | 26 + .../expressions/assignment/11.13.1-2-s-strict.js | 28 + .../expressions/assignment/11.13.1-3-s-strict.js | 21 + .../language/expressions/assignment/11.13.1-4-1.js | 25 + .../assignment/11.13.1-4-14-s-strict.js | 18 + .../assignment/11.13.1-4-27-s-strict.js | 18 + .../assignment/11.13.1-4-28gs-strict.js | 17 + .../assignment/11.13.1-4-29gs-strict.js | 17 + .../expressions/assignment/11.13.1-4-3-s-strict.js | 18 + .../expressions/assignment/11.13.1-4-6-s-strict.js | 18 + .../expressions/assignment/8.12.5-3-b_1.js | 29 + .../expressions/assignment/8.12.5-3-b_2.js | 33 + .../expressions/assignment/8.12.5-5-b_1.js | 30 + .../expressions/assignment/8.14.4-8-b_1.js | 19 + .../expressions/assignment/8.14.4-8-b_2-strict.js | 20 + .../expressions/assignment/S11.13.1_A2.1_T1.js | 49 + .../expressions/assignment/S11.13.1_A2.1_T2.js | 21 + .../expressions/assignment/S11.13.1_A3.1.js | 22 + .../expressions/assignment/S11.13.1_A3.2.js | 22 + .../expressions/assignment/S11.13.1_A4_T1.js | 17 + .../expressions/assignment/S11.13.1_A4_T2.js | 20 + .../expressions/assignment/S11.13.1_A5_T1.js | 33 + .../expressions/assignment/S11.13.1_A5_T2.js | 30 + .../expressions/assignment/S11.13.1_A5_T3.js | 32 + .../expressions/assignment/S11.13.1_A6_T1.js | 31 + .../expressions/assignment/S11.13.1_A6_T2.js | 31 + .../expressions/assignment/S11.13.1_A6_T3.js | 32 + .../expressions/assignment/S11.13.1_A7_T3.js | 28 + .../expressions/assignment/S11.13.1_A7_T4.js | 27 + .../language/expressions/assignment/S8.12.4_A1.js | 17 + .../language/expressions/assignment/S8.12.5_A1.js | 39 + .../language/expressions/assignment/S8.12.5_A2.js | 50 + ...gnment-operator-calls-putvalue-lref--rval--1.js | 43 + ...signment-operator-calls-putvalue-lref--rval-.js | 38 + .../language/expressions/assignment/browser.js | 0 .../assignment/destructuring/browser.js | 0 ...g-property-reference-target-evaluation-order.js | 82 + ...g-property-reference-target-evaluation-order.js | 77 + .../destructuring/obj-prop-__proto__dup.js | 34 + .../expressions/assignment/destructuring/shell.js | 0 .../assignment/dstr/array-elem-init-assignment.js | 33 + .../assignment/dstr/array-elem-init-evaluation.js | 31 + .../dstr/array-elem-init-fn-name-arrow.js | 45 + .../dstr/array-elem-init-fn-name-class.js | 48 + .../dstr/array-elem-init-fn-name-cover.js | 47 + .../assignment/dstr/array-elem-init-fn-name-fn.js | 47 + .../assignment/dstr/array-elem-init-fn-name-gen.js | 47 + .../assignment/dstr/array-elem-init-in.js | 29 + .../assignment/dstr/array-elem-init-let.js | 26 + .../assignment/dstr/array-elem-init-order.js | 32 + .../dstr/array-elem-init-simple-no-strict.js | 30 + .../assignment/dstr/array-elem-init-yield-expr.js | 45 + .../array-elem-init-yield-ident-invalid-strict.js | 25 + .../dstr/array-elem-init-yield-ident-valid.js | 30 + .../assignment/dstr/array-elem-iter-get-err.js | 34 + .../dstr/array-elem-iter-nrml-close-err.js | 51 + .../dstr/array-elem-iter-nrml-close-null.js | 57 + .../dstr/array-elem-iter-nrml-close-skip.js | 53 + .../assignment/dstr/array-elem-iter-nrml-close.js | 69 + .../dstr/array-elem-iter-rtrn-close-err.js | 68 + .../dstr/array-elem-iter-rtrn-close-null.js | 77 + .../assignment/dstr/array-elem-iter-rtrn-close.js | 84 + .../dstr/array-elem-iter-thrw-close-err.js | 56 + .../dstr/array-elem-iter-thrw-close-skip.js | 50 + .../assignment/dstr/array-elem-iter-thrw-close.js | 65 + .../dstr/array-elem-nested-array-invalid.js | 24 + .../dstr/array-elem-nested-array-null.js | 24 + .../dstr/array-elem-nested-array-undefined-hole.js | 24 + .../dstr/array-elem-nested-array-undefined-own.js | 24 + .../dstr/array-elem-nested-array-undefined.js | 24 + .../dstr/array-elem-nested-array-yield-expr.js | 47 + ...elem-nested-array-yield-ident-invalid-strict.js | 25 + .../array-elem-nested-array-yield-ident-valid.js | 30 + .../assignment/dstr/array-elem-nested-array.js | 29 + ...lem-nested-memberexpr-optchain-prop-ref-init.js | 57 + .../dstr/array-elem-nested-obj-invalid.js | 24 + .../assignment/dstr/array-elem-nested-obj-null.js | 24 + .../dstr/array-elem-nested-obj-undefined-hole.js | 24 + .../dstr/array-elem-nested-obj-undefined-own.js | 24 + .../dstr/array-elem-nested-obj-undefined.js | 24 + .../dstr/array-elem-nested-obj-yield-expr.js | 45 + ...y-elem-nested-obj-yield-ident-invalid-strict.js | 25 + .../array-elem-nested-obj-yield-ident-valid.js | 30 + .../assignment/dstr/array-elem-nested-obj.js | 29 + .../assignment/dstr/array-elem-put-const.js | 24 + .../assignment/dstr/array-elem-put-let.js | 25 + ...-elem-put-obj-literal-optchain-prop-ref-init.js | 60 + ...ay-elem-put-obj-literal-prop-ref-init-active.js | 70 + .../array-elem-put-obj-literal-prop-ref-init.js | 70 + .../dstr/array-elem-put-obj-literal-prop-ref.js | 70 + .../dstr/array-elem-put-prop-ref-no-get.js | 37 + .../dstr/array-elem-put-prop-ref-user-err.js | 28 + .../assignment/dstr/array-elem-put-prop-ref.js | 29 + .../dstr/array-elem-put-unresolvable-no-strict.js | 33 + .../array-elem-put-unresolvable-strict-strict.js | 24 + .../dstr/array-elem-target-identifier.js | 31 + .../dstr/array-elem-target-simple-no-strict.js | 30 + .../dstr/array-elem-target-simple-strict-strict.js | 25 + .../dstr/array-elem-target-yield-expr.js | 47 + .../dstr/array-elem-target-yield-invalid-strict.js | 25 + .../dstr/array-elem-target-yield-valid.js | 30 + .../dstr/array-elem-trlg-iter-elision-iter-abpt.js | 64 + ...y-elem-trlg-iter-elision-iter-nrml-close-err.js | 60 + ...-elem-trlg-iter-elision-iter-nrml-close-null.js | 63 + ...-elem-trlg-iter-elision-iter-nrml-close-skip.js | 61 + ...array-elem-trlg-iter-elision-iter-nrml-close.js | 76 + .../dstr/array-elem-trlg-iter-get-err.js | 35 + .../array-elem-trlg-iter-list-nrml-close-err.js | 60 + .../array-elem-trlg-iter-list-nrml-close-null.js | 63 + .../array-elem-trlg-iter-list-nrml-close-skip.js | 62 + .../dstr/array-elem-trlg-iter-list-nrml-close.js | 75 + .../array-elem-trlg-iter-list-rtrn-close-err.js | 82 + .../array-elem-trlg-iter-list-rtrn-close-null.js | 82 + .../dstr/array-elem-trlg-iter-list-rtrn-close.js | 93 + .../array-elem-trlg-iter-list-thrw-close-err.js | 68 + .../array-elem-trlg-iter-list-thrw-close-skip.js | 59 + .../dstr/array-elem-trlg-iter-list-thrw-close.js | 71 + .../array-elem-trlg-iter-rest-nrml-close-skip.js | 62 + .../array-elem-trlg-iter-rest-rtrn-close-err.js | 84 + .../array-elem-trlg-iter-rest-rtrn-close-null.js | 79 + .../dstr/array-elem-trlg-iter-rest-rtrn-close.js | 90 + .../array-elem-trlg-iter-rest-thrw-close-err.js | 69 + .../array-elem-trlg-iter-rest-thrw-close-skip.js | 62 + .../dstr/array-elem-trlg-iter-rest-thrw-close.js | 73 + .../assignment/dstr/array-elision-iter-abpt.js | 50 + .../assignment/dstr/array-elision-iter-get-err.js | 33 + .../dstr/array-elision-iter-nrml-close-err.js | 53 + .../dstr/array-elision-iter-nrml-close-null.js | 57 + .../dstr/array-elision-iter-nrml-close-skip.js | 54 + .../dstr/array-elision-iter-nrml-close.js | 69 + .../assignment/dstr/array-elision-val-array.js | 28 + .../assignment/dstr/array-elision-val-bool.js | 23 + .../assignment/dstr/array-elision-val-null.js | 23 + .../assignment/dstr/array-elision-val-num.js | 23 + .../assignment/dstr/array-elision-val-string.js | 28 + .../assignment/dstr/array-elision-val-symbol.js | 24 + .../assignment/dstr/array-elision-val-undef.js | 23 + .../assignment/dstr/array-empty-iter-close-err.js | 49 + .../assignment/dstr/array-empty-iter-close-null.js | 51 + .../assignment/dstr/array-empty-iter-close.js | 65 + .../assignment/dstr/array-empty-iter-get-err.js | 33 + .../assignment/dstr/array-empty-val-array.js | 28 + .../assignment/dstr/array-empty-val-bool.js | 23 + .../assignment/dstr/array-empty-val-null.js | 23 + .../assignment/dstr/array-empty-val-num.js | 23 + .../assignment/dstr/array-empty-val-string.js | 28 + .../assignment/dstr/array-empty-val-symbol.js | 24 + .../assignment/dstr/array-empty-val-undef.js | 23 + .../expressions/assignment/dstr/array-iteration.js | 36 + .../assignment/dstr/array-rest-after-element.js | 32 + .../assignment/dstr/array-rest-after-elision.js | 31 + .../assignment/dstr/array-rest-before-element.js | 24 + .../assignment/dstr/array-rest-before-elision.js | 24 + .../assignment/dstr/array-rest-before-rest.js | 24 + .../assignment/dstr/array-rest-elision-invalid.js | 24 + .../dstr/array-rest-elision-iter-abpt.js | 55 + .../assignment/dstr/array-rest-elision.js | 32 + .../expressions/assignment/dstr/array-rest-init.js | 25 + .../assignment/dstr/array-rest-iter-get-err.js | 34 + .../dstr/array-rest-iter-nrml-close-skip.js | 56 + .../dstr/array-rest-iter-rtrn-close-err.js | 79 + .../dstr/array-rest-iter-rtrn-close-null.js | 79 + .../assignment/dstr/array-rest-iter-rtrn-close.js | 94 + .../dstr/array-rest-iter-thrw-close-err.js | 69 + .../dstr/array-rest-iter-thrw-close-skip.js | 52 + .../assignment/dstr/array-rest-iter-thrw-close.js | 77 + .../assignment/dstr/array-rest-iteration.js | 37 + .../assignment/dstr/array-rest-lref-err.js | 61 + .../expressions/assignment/dstr/array-rest-lref.js | 65 + .../dstr/array-rest-nested-array-invalid.js | 24 + ...array-rest-nested-array-iter-thrw-close-skip.js | 64 + .../dstr/array-rest-nested-array-null.js | 30 + .../dstr/array-rest-nested-array-undefined-hole.js | 29 + .../dstr/array-rest-nested-array-undefined-own.js | 29 + .../dstr/array-rest-nested-array-undefined.js | 29 + .../dstr/array-rest-nested-array-yield-expr.js | 47 + ...rest-nested-array-yield-ident-invalid-strict.js | 25 + .../array-rest-nested-array-yield-ident-valid.js | 30 + .../assignment/dstr/array-rest-nested-array.js | 29 + .../dstr/array-rest-nested-obj-invalid.js | 24 + .../assignment/dstr/array-rest-nested-obj-null.js | 30 + .../dstr/array-rest-nested-obj-undefined-hole.js | 33 + .../dstr/array-rest-nested-obj-undefined-own.js | 33 + .../dstr/array-rest-nested-obj-undefined.js | 33 + .../dstr/array-rest-nested-obj-yield-expr.js | 45 + ...y-rest-nested-obj-yield-ident-invalid-strict.js | 25 + .../array-rest-nested-obj-yield-ident-valid.js | 30 + .../assignment/dstr/array-rest-nested-obj.js | 29 + .../assignment/dstr/array-rest-put-const.js | 24 + .../assignment/dstr/array-rest-put-let.js | 25 + .../dstr/array-rest-put-prop-ref-no-get.js | 40 + ...y-rest-put-prop-ref-user-err-iter-close-skip.js | 67 + .../dstr/array-rest-put-prop-ref-user-err.js | 28 + .../assignment/dstr/array-rest-put-prop-ref.js | 32 + .../dstr/array-rest-put-unresolvable-no-strict.js | 33 + .../array-rest-put-unresolvable-strict-strict.js | 24 + .../assignment/dstr/array-rest-yield-expr.js | 49 + .../dstr/array-rest-yield-ident-invalid-strict.js | 26 + .../dstr/array-rest-yield-ident-valid.js | 33 + .../expressions/assignment/dstr/browser.js | 0 .../ident-name-prop-name-literal-break-escaped.js | 44 + .../ident-name-prop-name-literal-case-escaped.js | 44 + .../ident-name-prop-name-literal-catch-escaped.js | 44 + .../ident-name-prop-name-literal-class-escaped.js | 44 + .../ident-name-prop-name-literal-const-escaped.js | 44 + ...dent-name-prop-name-literal-continue-escaped.js | 44 + ...dent-name-prop-name-literal-debugger-escaped.js | 44 + ...t-name-prop-name-literal-default-escaped-ext.js | 44 + ...ident-name-prop-name-literal-default-escaped.js | 44 + .../dstr/ident-name-prop-name-literal-default.js | 44 + .../ident-name-prop-name-literal-delete-escaped.js | 44 + .../ident-name-prop-name-literal-do-escaped.js | 44 + .../ident-name-prop-name-literal-else-escaped.js | 44 + .../ident-name-prop-name-literal-enum-escaped.js | 44 + .../ident-name-prop-name-literal-export-escaped.js | 44 + ...t-name-prop-name-literal-extends-escaped-ext.js | 44 + ...ident-name-prop-name-literal-extends-escaped.js | 44 + .../dstr/ident-name-prop-name-literal-extends.js | 44 + ...ident-name-prop-name-literal-finally-escaped.js | 44 + .../ident-name-prop-name-literal-for-escaped.js | 44 + ...dent-name-prop-name-literal-function-escaped.js | 44 + .../ident-name-prop-name-literal-if-escaped.js | 44 + ...nt-name-prop-name-literal-implements-escaped.js | 44 + .../ident-name-prop-name-literal-import-escaped.js | 44 + .../ident-name-prop-name-literal-in-escaped.js | 44 + ...nt-name-prop-name-literal-instanceof-escaped.js | 44 + ...ent-name-prop-name-literal-interface-escaped.js | 44 + .../ident-name-prop-name-literal-let-escaped.js | 44 + .../ident-name-prop-name-literal-new-escaped.js | 44 + ...ident-name-prop-name-literal-package-escaped.js | 44 + ...ident-name-prop-name-literal-private-escaped.js | 44 + ...ent-name-prop-name-literal-protected-escaped.js | 44 + .../ident-name-prop-name-literal-public-escaped.js | 44 + .../ident-name-prop-name-literal-return-escaped.js | 44 + .../ident-name-prop-name-literal-static-escaped.js | 44 + .../ident-name-prop-name-literal-super-escaped.js | 44 + .../ident-name-prop-name-literal-switch-escaped.js | 44 + .../ident-name-prop-name-literal-this-escaped.js | 44 + .../ident-name-prop-name-literal-throw-escaped.js | 44 + .../ident-name-prop-name-literal-try-escaped.js | 44 + .../ident-name-prop-name-literal-typeof-escaped.js | 44 + .../ident-name-prop-name-literal-var-escaped.js | 44 + .../ident-name-prop-name-literal-void-escaped.js | 44 + .../ident-name-prop-name-literal-while-escaped.js | 44 + .../ident-name-prop-name-literal-with-escaped.js | 44 + .../expressions/assignment/dstr/obj-empty-bool.js | 28 + .../expressions/assignment/dstr/obj-empty-null.js | 23 + .../expressions/assignment/dstr/obj-empty-num.js | 28 + .../expressions/assignment/dstr/obj-empty-obj.js | 28 + .../assignment/dstr/obj-empty-string.js | 28 + .../assignment/dstr/obj-empty-symbol.js | 29 + .../expressions/assignment/dstr/obj-empty-undef.js | 23 + .../dstr/obj-id-identifier-resolution-first.js | 30 + .../dstr/obj-id-identifier-resolution-last.js | 30 + .../dstr/obj-id-identifier-resolution-lone.js | 29 + .../dstr/obj-id-identifier-resolution-middle.js | 30 + .../dstr/obj-id-identifier-resolution-trlng.js | 29 + .../dstr/obj-id-identifier-yield-expr.js | 27 + ...obj-id-identifier-yield-ident-invalid-strict.js | 25 + .../dstr/obj-id-identifier-yield-ident-valid.js | 29 + .../dstr/obj-id-init-assignment-missing.js | 29 + .../assignment/dstr/obj-id-init-assignment-null.js | 29 + .../dstr/obj-id-init-assignment-truthy.js | 29 + .../dstr/obj-id-init-assignment-undef.js | 29 + .../assignment/dstr/obj-id-init-evaluation.js | 32 + .../assignment/dstr/obj-id-init-fn-name-arrow.js | 44 + .../assignment/dstr/obj-id-init-fn-name-class.js | 47 + .../assignment/dstr/obj-id-init-fn-name-cover.js | 46 + .../assignment/dstr/obj-id-init-fn-name-fn.js | 46 + .../assignment/dstr/obj-id-init-fn-name-gen.js | 46 + .../expressions/assignment/dstr/obj-id-init-in.js | 29 + .../expressions/assignment/dstr/obj-id-init-let.js | 26 + .../assignment/dstr/obj-id-init-order.js | 32 + .../dstr/obj-id-init-simple-no-strict.js | 30 + .../dstr/obj-id-init-simple-strict-strict.js | 25 + .../assignment/dstr/obj-id-init-yield-expr.js | 45 + .../dstr/obj-id-init-yield-ident-invalid-strict.js | 25 + .../dstr/obj-id-init-yield-ident-valid.js | 30 + .../assignment/dstr/obj-id-put-const.js | 24 + .../expressions/assignment/dstr/obj-id-put-let.js | 25 + .../dstr/obj-id-put-unresolvable-no-strict.js | 33 + .../dstr/obj-id-put-unresolvable-strict-strict.js | 24 + .../assignment/dstr/obj-id-simple-no-strict.js | 32 + .../assignment/dstr/obj-id-simple-strict-strict.js | 25 + .../dstr/obj-prop-elem-init-assignment-missing.js | 29 + .../dstr/obj-prop-elem-init-assignment-null.js | 29 + .../dstr/obj-prop-elem-init-assignment-truthy.js | 29 + .../dstr/obj-prop-elem-init-assignment-undef.js | 29 + .../dstr/obj-prop-elem-init-evaluation.js | 34 + .../dstr/obj-prop-elem-init-fn-name-arrow.js | 45 + .../dstr/obj-prop-elem-init-fn-name-class.js | 48 + .../dstr/obj-prop-elem-init-fn-name-cover.js | 47 + .../dstr/obj-prop-elem-init-fn-name-fn.js | 47 + .../dstr/obj-prop-elem-init-fn-name-gen.js | 47 + .../assignment/dstr/obj-prop-elem-init-in.js | 29 + .../assignment/dstr/obj-prop-elem-init-let.js | 26 + .../dstr/obj-prop-elem-init-yield-expr.js | 44 + ...bj-prop-elem-init-yield-ident-invalid-strict.js | 25 + .../dstr/obj-prop-elem-init-yield-ident-valid.js | 30 + ...lem-target-memberexpr-optchain-prop-ref-init.js | 57 + ...em-target-obj-literal-optchain-prop-ref-init.js | 60 + ...elem-target-obj-literal-prop-ref-init-active.js | 78 + ...j-prop-elem-target-obj-literal-prop-ref-init.js | 78 + .../obj-prop-elem-target-obj-literal-prop-ref.js | 78 + .../dstr/obj-prop-elem-target-yield-expr.js | 46 + ...-prop-elem-target-yield-ident-invalid-strict.js | 25 + .../dstr/obj-prop-elem-target-yield-ident-valid.js | 30 + .../dstr/obj-prop-identifier-resolution-first.js | 30 + .../dstr/obj-prop-identifier-resolution-last.js | 30 + .../dstr/obj-prop-identifier-resolution-lone.js | 29 + .../dstr/obj-prop-identifier-resolution-middle.js | 30 + .../dstr/obj-prop-identifier-resolution-trlng.js | 29 + .../dstr/obj-prop-name-evaluation-error.js | 24 + .../assignment/dstr/obj-prop-name-evaluation.js | 31 + .../dstr/obj-prop-nested-array-invalid.js | 24 + .../assignment/dstr/obj-prop-nested-array-null.js | 24 + .../dstr/obj-prop-nested-array-undefined-own.js | 24 + .../dstr/obj-prop-nested-array-undefined.js | 24 + .../dstr/obj-prop-nested-array-yield-expr.js | 45 + ...prop-nested-array-yield-ident-invalid-strict.js | 25 + .../obj-prop-nested-array-yield-ident-valid.js | 30 + .../assignment/dstr/obj-prop-nested-array.js | 29 + .../assignment/dstr/obj-prop-nested-obj-invalid.js | 24 + .../assignment/dstr/obj-prop-nested-obj-null.js | 24 + .../dstr/obj-prop-nested-obj-undefined-own.js | 24 + .../dstr/obj-prop-nested-obj-undefined.js | 24 + .../dstr/obj-prop-nested-obj-yield-expr.js | 45 + ...j-prop-nested-obj-yield-ident-invalid-strict.js | 25 + .../dstr/obj-prop-nested-obj-yield-ident-valid.js | 30 + .../assignment/dstr/obj-prop-nested-obj.js | 29 + .../assignment/dstr/obj-prop-put-const.js | 24 + .../assignment/dstr/obj-prop-put-let.js | 25 + .../assignment/dstr/obj-prop-put-order.js | 29 + .../dstr/obj-prop-put-prop-ref-no-get.js | 37 + .../dstr/obj-prop-put-prop-ref-user-err.js | 28 + .../assignment/dstr/obj-prop-put-prop-ref.js | 29 + .../dstr/obj-prop-put-unresolvable-no-strict.js | 33 + .../obj-prop-put-unresolvable-strict-strict.js | 24 + .../dstr/obj-rest-computed-property-no-strict.js | 47 + .../assignment/dstr/obj-rest-computed-property.js | 48 + .../assignment/dstr/obj-rest-descriptors.js | 46 + .../assignment/dstr/obj-rest-empty-obj.js | 33 + .../dstr/obj-rest-getter-abrupt-get-error.js | 28 + .../expressions/assignment/dstr/obj-rest-getter.js | 38 + .../obj-rest-non-string-computed-property-1.js | 41 + .../obj-rest-non-string-computed-property-1dot.js | 41 + .../obj-rest-non-string-computed-property-1dot0.js | 41 + .../obj-rest-non-string-computed-property-1e0.js | 41 + ...bj-rest-non-string-computed-property-array-1.js | 41 + ...-rest-non-string-computed-property-array-1e0.js | 42 + ...j-rest-non-string-computed-property-string-1.js | 41 + .../dstr/obj-rest-not-last-element-invalid.js | 26 + .../expressions/assignment/dstr/obj-rest-number.js | 33 + .../expressions/assignment/dstr/obj-rest-order.js | 35 + .../assignment/dstr/obj-rest-put-const.js | 25 + .../assignment/dstr/obj-rest-same-name.js | 43 + .../dstr/obj-rest-skip-non-enumerable.js | 46 + .../assignment/dstr/obj-rest-str-val.js | 34 + .../assignment/dstr/obj-rest-symbol-val.js | 33 + .../dstr/obj-rest-to-property-with-setter.js | 40 + .../assignment/dstr/obj-rest-to-property.js | 37 + .../assignment/dstr/obj-rest-val-null.js | 25 + .../assignment/dstr/obj-rest-val-undefined.js | 25 + .../assignment/dstr/obj-rest-valid-object.js | 46 + .../language/expressions/assignment/dstr/shell.js | 0 .../dstr/syntax-error-ident-ref-break-escaped.js | 41 + .../dstr/syntax-error-ident-ref-case-escaped.js | 41 + .../dstr/syntax-error-ident-ref-catch-escaped.js | 41 + .../dstr/syntax-error-ident-ref-class-escaped.js | 41 + .../dstr/syntax-error-ident-ref-const-escaped.js | 41 + .../syntax-error-ident-ref-continue-escaped.js | 41 + .../syntax-error-ident-ref-debugger-escaped.js | 41 + .../syntax-error-ident-ref-default-escaped-ext.js | 41 + .../dstr/syntax-error-ident-ref-default-escaped.js | 41 + .../dstr/syntax-error-ident-ref-default.js | 41 + .../dstr/syntax-error-ident-ref-delete-escaped.js | 41 + .../dstr/syntax-error-ident-ref-do-escaped.js | 41 + .../dstr/syntax-error-ident-ref-else-escaped.js | 41 + .../dstr/syntax-error-ident-ref-enum-escaped.js | 41 + .../dstr/syntax-error-ident-ref-export-escaped.js | 41 + .../syntax-error-ident-ref-extends-escaped-ext.js | 41 + .../dstr/syntax-error-ident-ref-extends-escaped.js | 41 + .../dstr/syntax-error-ident-ref-extends.js | 41 + .../dstr/syntax-error-ident-ref-finally-escaped.js | 41 + .../dstr/syntax-error-ident-ref-for-escaped.js | 41 + .../syntax-error-ident-ref-function-escaped.js | 41 + .../dstr/syntax-error-ident-ref-if-escaped.js | 41 + ...ax-error-ident-ref-implements-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-import-escaped.js | 41 + .../dstr/syntax-error-ident-ref-in-escaped.js | 41 + .../syntax-error-ident-ref-instanceof-escaped.js | 41 + ...tax-error-ident-ref-interface-escaped-strict.js | 42 + .../syntax-error-ident-ref-let-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-new-escaped.js | 41 + ...yntax-error-ident-ref-package-escaped-strict.js | 42 + ...yntax-error-ident-ref-private-escaped-strict.js | 42 + ...tax-error-ident-ref-protected-escaped-strict.js | 42 + ...syntax-error-ident-ref-public-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-return-escaped.js | 41 + ...syntax-error-ident-ref-static-escaped-strict.js | 42 + .../dstr/syntax-error-ident-ref-super-escaped.js | 41 + .../dstr/syntax-error-ident-ref-switch-escaped.js | 41 + .../dstr/syntax-error-ident-ref-this-escaped.js | 41 + .../dstr/syntax-error-ident-ref-throw-escaped.js | 41 + .../dstr/syntax-error-ident-ref-try-escaped.js | 41 + .../dstr/syntax-error-ident-ref-typeof-escaped.js | 41 + .../dstr/syntax-error-ident-ref-var-escaped.js | 41 + .../dstr/syntax-error-ident-ref-void-escaped.js | 41 + .../dstr/syntax-error-ident-ref-while-escaped.js | 41 + .../dstr/syntax-error-ident-ref-with-escaped.js | 41 + .../expressions/assignment/fn-name-arrow.js | 35 + .../expressions/assignment/fn-name-class.js | 41 + .../expressions/assignment/fn-name-cover.js | 39 + .../language/expressions/assignment/fn-name-fn.js | 38 + .../language/expressions/assignment/fn-name-gen.js | 39 + .../expressions/assignment/fn-name-lhs-cover.js | 29 + .../expressions/assignment/fn-name-lhs-member.js | 29 + .../assignment/id-arguments-strict-strict.js | 18 + .../assignment/id-eval-strict-strict.js | 18 + .../expressions/assignment/line-terminator.js | 20 + .../member-expr-ident-name-break-escaped.js | 24 + .../member-expr-ident-name-case-escaped.js | 24 + .../member-expr-ident-name-catch-escaped.js | 24 + .../member-expr-ident-name-class-escaped.js | 24 + .../member-expr-ident-name-const-escaped.js | 24 + .../member-expr-ident-name-continue-escaped.js | 24 + .../member-expr-ident-name-debugger-escaped.js | 24 + .../member-expr-ident-name-default-escaped-ext.js | 24 + .../member-expr-ident-name-default-escaped.js | 24 + .../assignment/member-expr-ident-name-default.js | 24 + .../member-expr-ident-name-delete-escaped.js | 24 + .../member-expr-ident-name-do-escaped.js | 24 + .../member-expr-ident-name-else-escaped.js | 24 + .../member-expr-ident-name-enum-escaped.js | 24 + .../member-expr-ident-name-export-escaped.js | 24 + .../member-expr-ident-name-extends-escaped-ext.js | 24 + .../member-expr-ident-name-extends-escaped.js | 24 + .../assignment/member-expr-ident-name-extends.js | 24 + .../member-expr-ident-name-finally-escaped.js | 24 + .../member-expr-ident-name-for-escaped.js | 24 + .../member-expr-ident-name-function-escaped.js | 24 + .../member-expr-ident-name-if-escaped.js | 24 + .../member-expr-ident-name-implements-escaped.js | 24 + .../member-expr-ident-name-import-escaped.js | 24 + .../member-expr-ident-name-in-escaped.js | 24 + .../member-expr-ident-name-instanceof-escaped.js | 24 + .../member-expr-ident-name-interface-escaped.js | 24 + .../member-expr-ident-name-let-escaped.js | 24 + .../member-expr-ident-name-new-escaped.js | 24 + .../member-expr-ident-name-package-escaped.js | 24 + .../member-expr-ident-name-private-escaped.js | 24 + .../member-expr-ident-name-protected-escaped.js | 24 + .../member-expr-ident-name-public-escaped.js | 24 + .../member-expr-ident-name-return-escaped.js | 24 + .../member-expr-ident-name-static-escaped.js | 24 + .../member-expr-ident-name-super-escaped.js | 24 + .../member-expr-ident-name-switch-escaped.js | 24 + .../member-expr-ident-name-this-escaped.js | 24 + .../member-expr-ident-name-throw-escaped.js | 24 + .../member-expr-ident-name-try-escaped.js | 24 + .../member-expr-ident-name-typeof-escaped.js | 24 + .../member-expr-ident-name-var-escaped.js | 24 + .../member-expr-ident-name-void-escaped.js | 24 + .../member-expr-ident-name-while-escaped.js | 24 + .../member-expr-ident-name-with-escaped.js | 24 + .../expressions/assignment/non-simple-target.js | 19 + .../language/expressions/assignment/shell.js | 0 .../target-assignment-inside-function.js | 24 + .../expressions/assignment/target-assignment.js | 22 + .../expressions/assignment/target-boolean.js | 23 + .../expressions/assignment/target-cover-id.js | 30 + .../assignment/target-cover-newtarget.js | 31 + .../assignment/target-cover-yieldexpr.js | 34 + .../target-member-computed-reference-null.js | 52 + .../target-member-computed-reference-undefined.js | 52 + .../target-member-identifier-reference-null.js | 33 + ...target-member-identifier-reference-undefined.js | 33 + .../expressions/assignment/target-newtarget.js | 31 + .../language/expressions/assignment/target-null.js | 23 + .../expressions/assignment/target-number.js | 23 + .../expressions/assignment/target-string.js | 23 + .../target-super-computed-reference-null.js | 39 + .../target-super-identifier-reference-null.js | 39 + .../language/expressions/assignment/white-space.js | 61 + .../expressions/assignmenttargettype/browser.js | 0 ...eexpression-minus-multiplicativeexpression-0.js | 21 + ...eexpression-minus-multiplicativeexpression-1.js | 21 + ...eexpression-minus-multiplicativeexpression-2.js | 21 + ...veexpression-plus-multiplicativeexpression-0.js | 21 + ...veexpression-plus-multiplicativeexpression-1.js | 21 + ...veexpression-plus-multiplicativeexpression-2.js | 21 + .../assignmenttargettype/direct-arrowfunction-0.js | 21 + .../assignmenttargettype/direct-arrowfunction-1.js | 21 + .../assignmenttargettype/direct-arrowfunction-2.js | 21 + .../assignmenttargettype/direct-arrowfunction-3.js | 21 + .../assignmenttargettype/direct-arrowfunction-4.js | 21 + .../assignmenttargettype/direct-arrowfunction-5.js | 21 + .../assignmenttargettype/direct-arrowfunction-6.js | 21 + .../direct-asyncarrowfunction-0.js | 21 + .../direct-asyncarrowfunction-1.js | 21 + .../direct-asyncarrowfunction-2.js | 21 + .../direct-asyncarrowfunction-3.js | 21 + .../direct-asyncarrowfunction-4.js | 21 + .../direct-asyncarrowfunction-5.js | 21 + .../direct-asyncarrowfunction-6.js | 21 + ...dexpression-bitwise-and-equalityexpression-0.js | 21 + ...dexpression-bitwise-and-equalityexpression-1.js | 21 + ...dexpression-bitwise-and-equalityexpression-2.js | 21 + ...expression-bitwise-or-bitwisexorexpression-0.js | 21 + ...expression-bitwise-or-bitwisexorexpression-1.js | 21 + ...expression-bitwise-or-bitwisexorexpression-2.js | 21 + ...xpression-bitwise-xor-bitwiseandexpression-0.js | 21 + ...xpression-bitwise-xor-bitwiseandexpression-1.js | 21 + ...xpression-bitwise-xor-bitwiseandexpression-2.js | 21 + .../direct-callexpression-arguments.js | 21 + .../direct-callexpression-templateliteral.js | 21 + ...xpressionhead-coalesce-bitwiseorexpression-0.js | 21 + ...xpressionhead-coalesce-bitwiseorexpression-1.js | 21 + ...xpressionhead-coalesce-bitwiseorexpression-2.js | 21 + ...ession-abstract-equal-relationalexpression-0.js | 21 + ...ession-abstract-equal-relationalexpression-1.js | 21 + ...ession-abstract-equal-relationalexpression-2.js | 21 + ...on-abstract-not-equal-relationalexpression-0.js | 21 + ...on-abstract-not-equal-relationalexpression-1.js | 21 + ...on-abstract-not-equal-relationalexpression-2.js | 21 + ...pression-strict-equal-relationalexpression-0.js | 21 + ...pression-strict-equal-relationalexpression-1.js | 21 + ...pression-strict-equal-relationalexpression-2.js | 21 + ...sion-strict-not-equal-relationalexpression-0.js | 21 + ...sion-strict-not-equal-relationalexpression-1.js | 21 + ...sion-strict-not-equal-relationalexpression-2.js | 21 + ...rect-expression-comma-assignmentexpression-0.js | 21 + ...rect-expression-comma-assignmentexpression-1.js | 21 + ...rect-expression-comma-assignmentexpression-2.js | 21 + ...-identifierreference-arguments-strict-strict.js | 18 + ...irect-identifierreference-eval-strict-strict.js | 18 + .../assignmenttargettype/direct-import.meta.js | 21 + .../assignmenttargettype/direct-importcall.js | 21 + ...expression-assignment-assignmentexpression-0.js | 21 + ...expression-assignment-assignmentexpression-1.js | 21 + ...expression-assignment-assignmentexpression-2.js | 21 + ...n-coalesce-assignment-assignmentexpression-0.js | 21 + ...n-coalesce-assignment-assignmentexpression-1.js | 21 + ...n-coalesce-assignment-assignmentexpression-2.js | 21 + ...ogical-and-assignment-assignmentexpression-0.js | 21 + ...ogical-and-assignment-assignmentexpression-1.js | 21 + ...ogical-and-assignment-assignmentexpression-2.js | 21 + ...logical-or-assignment-assignmentexpression-0.js | 21 + ...logical-or-assignment-assignmentexpression-1.js | 21 + ...logical-or-assignment-assignmentexpression-2.js | 21 + .../direct-lefthandsideexpression-minus-minus.js | 21 + .../direct-lefthandsideexpression-plus-plus.js | 21 + ...expression-logical-and-bitwiseorexpression-0.js | 21 + ...expression-logical-and-bitwiseorexpression-1.js | 21 + ...expression-logical-and-bitwiseorexpression-2.js | 21 + ...expression-logical-or-logicalandexpression-0.js | 21 + ...expression-logical-or-logicalandexpression-1.js | 21 + ...expression-logical-or-logicalandexpression-2.js | 21 + .../direct-memberexpression-templateliteral.js | 21 + .../direct-minus-minus-unaryexpression.js | 21 + ...plicativeoperator-exponentiationexpression-0.js | 21 + ...plicativeoperator-exponentiationexpression-1.js | 21 + ...plicativeoperator-exponentiationexpression-2.js | 21 + ...plicativeoperator-exponentiationexpression-3.js | 21 + ...plicativeoperator-exponentiationexpression-4.js | 21 + ...plicativeoperator-exponentiationexpression-5.js | 21 + .../direct-new-memberexpression-arguments.js | 21 + .../direct-new-newexpression.js | 21 + .../direct-optionalexpression.js | 22 + .../direct-plus-plus-unaryexpression.js | 21 + ...ct-primaryexpression-asyncfunctionexpression.js | 17 + ...t-primaryexpression-asyncgeneratorexpression.js | 17 + .../direct-primaryexpression-classexpression.js | 17 + .../direct-primaryexpression-functionexpression.js | 17 + ...direct-primaryexpression-generatorexpression.js | 17 + .../direct-primaryexpression-literal-boolean.js | 17 + .../direct-primaryexpression-literal-null.js | 17 + .../direct-primaryexpression-literal-numeric.js | 17 + .../direct-primaryexpression-literal-string.js | 17 + .../direct-primaryexpression-objectliteral.js | 17 + ...t-primaryexpression-regularexpressionliteral.js | 17 + .../direct-primaryexpression-templateliteral.js | 17 + .../direct-primaryexpression-this.js | 17 + ...n-greater-than-or-equal-to-shiftexpression-0.js | 21 + ...n-greater-than-or-equal-to-shiftexpression-1.js | 21 + ...n-greater-than-or-equal-to-shiftexpression-2.js | 21 + ...nalexpression-greater-than-shiftexpression-0.js | 21 + ...nalexpression-greater-than-shiftexpression-1.js | 21 + ...nalexpression-greater-than-shiftexpression-2.js | 21 + ...ct-relationalexpression-in-shiftexpression-0.js | 21 + ...ct-relationalexpression-in-shiftexpression-1.js | 21 + ...ct-relationalexpression-in-shiftexpression-2.js | 21 + ...ionalexpression-instanceof-shiftexpression-0.js | 21 + ...ionalexpression-instanceof-shiftexpression-1.js | 21 + ...ionalexpression-instanceof-shiftexpression-2.js | 21 + ...sion-less-than-or-equal-to-shiftexpression-0.js | 21 + ...sion-less-than-or-equal-to-shiftexpression-1.js | 21 + ...sion-less-than-or-equal-to-shiftexpression-2.js | 21 + ...tionalexpression-less-than-shiftexpression-0.js | 21 + ...tionalexpression-less-than-shiftexpression-1.js | 21 + ...tionalexpression-less-than-shiftexpression-2.js | 21 + ...expression-bitwise-left-additiveexpression-0.js | 21 + ...expression-bitwise-left-additiveexpression-1.js | 21 + ...expression-bitwise-left-additiveexpression-2.js | 21 + ...xpression-bitwise-right-additiveexpression-0.js | 21 + ...xpression-bitwise-right-additiveexpression-1.js | 21 + ...xpression-bitwise-right-additiveexpression-2.js | 21 + ...-unsigned-bitwise-right-additiveexpression-0.js | 21 + ...-unsigned-bitwise-right-additiveexpression-1.js | 21 + ...-unsigned-bitwise-right-additiveexpression-2.js | 21 + ...gnmentexpression-else-assignmentexpression-0.js | 21 + ...gnmentexpression-else-assignmentexpression-1.js | 21 + ...gnmentexpression-else-assignmentexpression-2.js | 21 + ...irect-unaryexpression-delete-unaryexpression.js | 21 + ...naryexpression-exclamation-unaryexpression-0.js | 21 + ...naryexpression-exclamation-unaryexpression-1.js | 21 + ...naryexpression-exclamation-unaryexpression-2.js | 21 + ...rect-unaryexpression-minus-unaryexpression-0.js | 21 + ...rect-unaryexpression-minus-unaryexpression-1.js | 21 + ...rect-unaryexpression-minus-unaryexpression-2.js | 21 + ...irect-unaryexpression-plus-unaryexpression-0.js | 21 + ...irect-unaryexpression-plus-unaryexpression-1.js | 21 + ...irect-unaryexpression-plus-unaryexpression-2.js | 21 + ...rect-unaryexpression-tilde-unaryexpression-0.js | 21 + ...rect-unaryexpression-tilde-unaryexpression-1.js | 21 + ...rect-unaryexpression-tilde-unaryexpression-2.js | 21 + ...ect-unaryexpression-typeof-unaryexpression-0.js | 21 + ...ect-unaryexpression-typeof-unaryexpression-1.js | 21 + ...ect-unaryexpression-typeof-unaryexpression-2.js | 21 + ...irect-unaryexpression-void-unaryexpression-0.js | 21 + ...irect-unaryexpression-void-unaryexpression-1.js | 21 + ...irect-unaryexpression-void-unaryexpression-2.js | 21 + ...ression-star-star-exponentiationexpression-0.js | 22 + ...ression-star-star-exponentiationexpression-1.js | 22 + ...ression-star-star-exponentiationexpression-2.js | 22 + .../direct-yieldexpression-0.js | 21 + .../direct-yieldexpression-1.js | 21 + ...eexpression-minus-multiplicativeexpression-0.js | 24 + ...eexpression-minus-multiplicativeexpression-1.js | 24 + ...eexpression-minus-multiplicativeexpression-2.js | 24 + ...veexpression-plus-multiplicativeexpression-0.js | 24 + ...veexpression-plus-multiplicativeexpression-1.js | 24 + ...veexpression-plus-multiplicativeexpression-2.js | 24 + .../parenthesized-arrowfunction-0.js | 24 + .../parenthesized-arrowfunction-1.js | 24 + .../parenthesized-arrowfunction-2.js | 24 + .../parenthesized-arrowfunction-3.js | 24 + .../parenthesized-arrowfunction-4.js | 24 + .../parenthesized-arrowfunction-5.js | 24 + .../parenthesized-arrowfunction-6.js | 24 + .../parenthesized-asyncarrowfunction-0.js | 24 + .../parenthesized-asyncarrowfunction-1.js | 24 + .../parenthesized-asyncarrowfunction-2.js | 24 + .../parenthesized-asyncarrowfunction-3.js | 24 + .../parenthesized-asyncarrowfunction-4.js | 24 + .../parenthesized-asyncarrowfunction-5.js | 24 + .../parenthesized-asyncarrowfunction-6.js | 24 + ...dexpression-bitwise-and-equalityexpression-0.js | 24 + ...dexpression-bitwise-and-equalityexpression-1.js | 24 + ...dexpression-bitwise-and-equalityexpression-2.js | 24 + ...expression-bitwise-or-bitwisexorexpression-0.js | 24 + ...expression-bitwise-or-bitwisexorexpression-1.js | 24 + ...expression-bitwise-or-bitwisexorexpression-2.js | 24 + ...xpression-bitwise-xor-bitwiseandexpression-0.js | 24 + ...xpression-bitwise-xor-bitwiseandexpression-1.js | 24 + ...xpression-bitwise-xor-bitwiseandexpression-2.js | 24 + .../parenthesized-callexpression-arguments.js | 24 + ...parenthesized-callexpression-templateliteral.js | 24 + ...xpressionhead-coalesce-bitwiseorexpression-0.js | 24 + ...xpressionhead-coalesce-bitwiseorexpression-1.js | 24 + ...xpressionhead-coalesce-bitwiseorexpression-2.js | 24 + ...ession-abstract-equal-relationalexpression-0.js | 24 + ...ession-abstract-equal-relationalexpression-1.js | 24 + ...ession-abstract-equal-relationalexpression-2.js | 24 + ...on-abstract-not-equal-relationalexpression-0.js | 24 + ...on-abstract-not-equal-relationalexpression-1.js | 24 + ...on-abstract-not-equal-relationalexpression-2.js | 24 + ...pression-strict-equal-relationalexpression-0.js | 24 + ...pression-strict-equal-relationalexpression-1.js | 24 + ...pression-strict-equal-relationalexpression-2.js | 24 + ...sion-strict-not-equal-relationalexpression-0.js | 24 + ...sion-strict-not-equal-relationalexpression-1.js | 24 + ...sion-strict-not-equal-relationalexpression-2.js | 24 + ...ized-expression-comma-assignmentexpression-0.js | 24 + ...ized-expression-comma-assignmentexpression-1.js | 24 + ...ized-expression-comma-assignmentexpression-2.js | 24 + ...-identifierreference-arguments-strict-strict.js | 21 + ...sized-identifierreference-eval-strict-strict.js | 21 + .../parenthesized-import.meta.js | 24 + .../parenthesized-importcall.js | 24 + ...expression-assignment-assignmentexpression-0.js | 24 + ...expression-assignment-assignmentexpression-1.js | 24 + ...expression-assignment-assignmentexpression-2.js | 24 + ...n-coalesce-assignment-assignmentexpression-0.js | 24 + ...n-coalesce-assignment-assignmentexpression-1.js | 24 + ...n-coalesce-assignment-assignmentexpression-2.js | 24 + ...ogical-and-assignment-assignmentexpression-0.js | 24 + ...ogical-and-assignment-assignmentexpression-1.js | 24 + ...ogical-and-assignment-assignmentexpression-2.js | 24 + ...logical-or-assignment-assignmentexpression-0.js | 24 + ...logical-or-assignment-assignmentexpression-1.js | 24 + ...logical-or-assignment-assignmentexpression-2.js | 24 + ...nthesized-lefthandsideexpression-minus-minus.js | 24 + ...renthesized-lefthandsideexpression-plus-plus.js | 24 + ...expression-logical-and-bitwiseorexpression-0.js | 24 + ...expression-logical-and-bitwiseorexpression-1.js | 24 + ...expression-logical-and-bitwiseorexpression-2.js | 24 + ...expression-logical-or-logicalandexpression-0.js | 24 + ...expression-logical-or-logicalandexpression-1.js | 24 + ...expression-logical-or-logicalandexpression-2.js | 24 + ...renthesized-memberexpression-templateliteral.js | 24 + .../parenthesized-minus-minus-unaryexpression.js | 24 + ...plicativeoperator-exponentiationexpression-0.js | 24 + ...plicativeoperator-exponentiationexpression-1.js | 24 + ...plicativeoperator-exponentiationexpression-2.js | 24 + ...plicativeoperator-exponentiationexpression-3.js | 24 + ...plicativeoperator-exponentiationexpression-4.js | 24 + ...plicativeoperator-exponentiationexpression-5.js | 24 + ...parenthesized-new-memberexpression-arguments.js | 24 + .../parenthesized-new-newexpression.js | 24 + .../parenthesized-optionalexpression.js | 25 + .../parenthesized-plus-plus-unaryexpression.js | 24 + ...ed-primaryexpression-asyncfunctionexpression.js | 20 + ...d-primaryexpression-asyncgeneratorexpression.js | 20 + ...enthesized-primaryexpression-classexpression.js | 20 + ...hesized-primaryexpression-functionexpression.js | 20 + ...esized-primaryexpression-generatorexpression.js | 20 + ...enthesized-primaryexpression-literal-boolean.js | 20 + ...parenthesized-primaryexpression-literal-null.js | 20 + ...enthesized-primaryexpression-literal-numeric.js | 20 + ...renthesized-primaryexpression-literal-string.js | 20 + ...arenthesized-primaryexpression-objectliteral.js | 20 + ...d-primaryexpression-regularexpressionliteral.js | 20 + ...enthesized-primaryexpression-templateliteral.js | 20 + .../parenthesized-primaryexpression-this.js | 20 + ...n-greater-than-or-equal-to-shiftexpression-0.js | 24 + ...n-greater-than-or-equal-to-shiftexpression-1.js | 24 + ...n-greater-than-or-equal-to-shiftexpression-2.js | 24 + ...nalexpression-greater-than-shiftexpression-0.js | 24 + ...nalexpression-greater-than-shiftexpression-1.js | 24 + ...nalexpression-greater-than-shiftexpression-2.js | 24 + ...ed-relationalexpression-in-shiftexpression-0.js | 24 + ...ed-relationalexpression-in-shiftexpression-1.js | 24 + ...ed-relationalexpression-in-shiftexpression-2.js | 24 + ...ionalexpression-instanceof-shiftexpression-0.js | 24 + ...ionalexpression-instanceof-shiftexpression-1.js | 24 + ...ionalexpression-instanceof-shiftexpression-2.js | 24 + ...sion-less-than-or-equal-to-shiftexpression-0.js | 24 + ...sion-less-than-or-equal-to-shiftexpression-1.js | 24 + ...sion-less-than-or-equal-to-shiftexpression-2.js | 24 + ...tionalexpression-less-than-shiftexpression-0.js | 24 + ...tionalexpression-less-than-shiftexpression-1.js | 24 + ...tionalexpression-less-than-shiftexpression-2.js | 24 + ...expression-bitwise-left-additiveexpression-0.js | 24 + ...expression-bitwise-left-additiveexpression-1.js | 24 + ...expression-bitwise-left-additiveexpression-2.js | 24 + ...xpression-bitwise-right-additiveexpression-0.js | 24 + ...xpression-bitwise-right-additiveexpression-1.js | 24 + ...xpression-bitwise-right-additiveexpression-2.js | 24 + ...-unsigned-bitwise-right-additiveexpression-0.js | 24 + ...-unsigned-bitwise-right-additiveexpression-1.js | 24 + ...-unsigned-bitwise-right-additiveexpression-2.js | 24 + ...gnmentexpression-else-assignmentexpression-0.js | 24 + ...gnmentexpression-else-assignmentexpression-1.js | 24 + ...gnmentexpression-else-assignmentexpression-2.js | 24 + ...sized-unaryexpression-delete-unaryexpression.js | 24 + ...naryexpression-exclamation-unaryexpression-0.js | 24 + ...naryexpression-exclamation-unaryexpression-1.js | 24 + ...naryexpression-exclamation-unaryexpression-2.js | 24 + ...ized-unaryexpression-minus-unaryexpression-0.js | 24 + ...ized-unaryexpression-minus-unaryexpression-1.js | 24 + ...ized-unaryexpression-minus-unaryexpression-2.js | 24 + ...sized-unaryexpression-plus-unaryexpression-0.js | 24 + ...sized-unaryexpression-plus-unaryexpression-1.js | 24 + ...sized-unaryexpression-plus-unaryexpression-2.js | 24 + ...ized-unaryexpression-tilde-unaryexpression-0.js | 24 + ...ized-unaryexpression-tilde-unaryexpression-1.js | 24 + ...ized-unaryexpression-tilde-unaryexpression-2.js | 24 + ...zed-unaryexpression-typeof-unaryexpression-0.js | 24 + ...zed-unaryexpression-typeof-unaryexpression-1.js | 24 + ...zed-unaryexpression-typeof-unaryexpression-2.js | 24 + ...sized-unaryexpression-void-unaryexpression-0.js | 24 + ...sized-unaryexpression-void-unaryexpression-1.js | 24 + ...sized-unaryexpression-void-unaryexpression-2.js | 24 + ...ression-star-star-exponentiationexpression-0.js | 25 + ...ression-star-star-exponentiationexpression-1.js | 25 + ...ression-star-star-exponentiationexpression-2.js | 25 + .../parenthesized-yieldexpression-0.js | 24 + .../parenthesized-yieldexpression-1.js | 24 + .../expressions/assignmenttargettype/shell.js | 0 .../simple-basic-identifierreference-arguments.js | 12 + .../simple-basic-identifierreference-await.js | 13 + .../simple-basic-identifierreference-eval.js | 12 + .../simple-basic-identifierreference-yield.js | 12 + .../simple-complex-callexpression-expression.js | 20 + ...simple-complex-callexpression.identifiername.js | 20 + .../simple-complex-memberexpression-expression.js | 20 + ...mple-complex-memberexpression.identifiername.js | 20 + .../array-destructuring-param-strict-body.js | 124 + .../async-arrow-function/arrow-returns-promise.js | 18 + .../async-lineterminator-identifier-throws.js | 21 + .../await-as-binding-identifier-escaped.js | 35 + .../await-as-binding-identifier.js | 35 + .../await-as-identifier-reference-escaped.js | 35 + .../await-as-identifier-reference.js | 35 + .../await-as-label-identifier-escaped.js | 35 + .../await-as-label-identifier.js | 35 + ...-param-ident-nested-arrow-parameter-position.js | 17 + .../await-as-param-nested-arrow-body-position.js | 17 + ...ait-as-param-nested-arrow-parameter-position.js | 17 + ...s-param-rest-nested-arrow-parameter-position.js | 17 + .../expressions/async-arrow-function/browser.js | 0 .../async-arrow-function/dflt-params-abrupt.js | 59 + .../dflt-params-arg-val-not-undefined.js | 78 + .../dflt-params-arg-val-undefined.js | 61 + .../async-arrow-function/dflt-params-duplicates.js | 53 + .../async-arrow-function/dflt-params-ref-later.js | 60 + .../async-arrow-function/dflt-params-ref-prior.js | 58 + .../async-arrow-function/dflt-params-ref-self.js | 60 + .../async-arrow-function/dflt-params-rest.js | 57 + .../dflt-params-trailing-comma.js | 53 + .../early-errors-arrow-NSPL-with-USD.js | 17 + ...-arrow-arguments-in-formal-parameters-strict.js | 19 + .../early-errors-arrow-await-in-formals-default.js | 15 + .../early-errors-arrow-await-in-formals.js | 15 + .../early-errors-arrow-body-contains-super-call.js | 16 + ...ly-errors-arrow-body-contains-super-property.js | 16 + .../early-errors-arrow-duplicate-parameters.js | 36 + ...rrors-arrow-eval-in-formal-parameters-strict.js | 18 + .../early-errors-arrow-formals-body-duplicate.js | 16 + ...rly-errors-arrow-formals-contains-super-call.js | 16 + ...errors-arrow-formals-contains-super-property.js | 16 + .../early-errors-arrow-formals-lineterminator.js | 34 + .../escaped-async-line-terminator.js | 31 + .../async-arrow-function/escaped-async.js | 25 + .../eval-var-scope-syntax-err.js | 55 + ...n-forbidden-ext-direct-access-prop-arguments.js | 43 + ...tion-forbidden-ext-direct-access-prop-caller.js | 43 + .../forbidden-ext/b1/browser.js | 0 .../async-arrow-function/forbidden-ext/b1/shell.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 69 + ...en-ext-indirect-access-own-prop-caller-value.js | 69 + ...on-forbidden-ext-indirect-access-prop-caller.js | 69 + .../forbidden-ext/b2/browser.js | 0 .../async-arrow-function/forbidden-ext/b2/shell.js | 0 .../async-arrow-function/forbidden-ext/browser.js | 0 .../async-arrow-function/forbidden-ext/shell.js | 0 .../expressions/async-arrow-function/name.js | 37 + .../object-destructuring-param-strict-body.js | 124 + .../params-trailing-comma-multiple.js | 53 + .../params-trailing-comma-single.js | 52 + .../async-arrow-function/rest-param-strict-body.js | 124 + .../rest-params-trailing-comma-early-error.js | 49 + .../expressions/async-arrow-function/shell.js | 0 .../try-reject-finally-reject.js | 28 + .../try-reject-finally-return.js | 26 + .../try-reject-finally-throw.js | 26 + .../try-return-finally-reject.js | 26 + .../try-return-finally-return.js | 26 + .../try-return-finally-throw.js | 24 + .../try-throw-finally-reject.js | 26 + .../try-throw-finally-return.js | 26 + .../try-throw-finally-throw.js | 24 + .../unscopables-with-in-nested-fn.js | 95 + .../async-arrow-function/unscopables-with.js | 89 + .../await-as-binding-identifier-escaped.js | 31 + .../async-function/await-as-binding-identifier.js | 31 + .../await-as-identifier-reference-escaped.js | 31 + .../await-as-identifier-reference.js | 31 + .../await-as-label-identifier-escaped.js | 31 + .../async-function/await-as-label-identifier.js | 31 + .../language/expressions/async-function/browser.js | 0 .../early-errors-expression-NSPL-with-USD.js | 17 + ...pression-binding-identifier-arguments-strict.js | 19 + ...rs-expression-binding-identifier-eval-strict.js | 18 + ...y-errors-expression-body-contains-super-call.js | 16 + ...rors-expression-body-contains-super-property.js | 17 + ...-expression-eval-in-formal-parameters-strict.js | 18 + ...rly-errors-expression-formals-body-duplicate.js | 16 + ...rrors-expression-formals-contains-super-call.js | 16 + ...s-expression-formals-contains-super-property.js | 16 + ...rors-expression-not-simple-assignment-target.js | 17 + .../expressions/async-function/escaped-async.js | 25 + .../async-function/expression-returns-promise.js | 14 + ...d-forbidden-ext-direct-access-prop-arguments.js | 38 + ...amed-forbidden-ext-direct-access-prop-caller.js | 38 + ...s-forbidden-ext-direct-access-prop-arguments.js | 38 + ...less-forbidden-ext-direct-access-prop-caller.js | 38 + .../async-function/forbidden-ext/b1/browser.js | 0 .../async-function/forbidden-ext/b1/shell.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 65 + ...en-ext-indirect-access-own-prop-caller-value.js | 65 + ...ed-forbidden-ext-indirect-access-prop-caller.js | 65 + ...dden-ext-indirect-access-own-prop-caller-get.js | 65 + ...en-ext-indirect-access-own-prop-caller-value.js | 65 + ...ss-forbidden-ext-indirect-access-prop-caller.js | 65 + .../async-function/forbidden-ext/b2/browser.js | 0 .../async-function/forbidden-ext/b2/shell.js | 0 .../async-function/forbidden-ext/browser.js | 0 .../async-function/forbidden-ext/shell.js | 0 .../language/expressions/async-function/name.js | 38 + .../named-array-destructuring-param-strict-body.js | 110 + .../named-await-as-binding-identifier-escaped.js | 31 + .../named-await-as-binding-identifier.js | 31 + .../named-await-as-identifier-reference-escaped.js | 31 + .../named-await-as-identifier-reference.js | 31 + .../named-await-as-label-identifier-escaped.js | 31 + .../named-await-as-label-identifier.js | 31 + .../async-function/named-dflt-params-abrupt.js | 43 + .../named-dflt-params-arg-val-not-undefined.js | 64 + .../named-dflt-params-arg-val-undefined.js | 47 + .../async-function/named-dflt-params-duplicates.js | 39 + .../async-function/named-dflt-params-ref-later.js | 44 + .../async-function/named-dflt-params-ref-prior.js | 44 + .../async-function/named-dflt-params-ref-self.js | 44 + .../async-function/named-dflt-params-rest.js | 43 + .../named-dflt-params-trailing-comma.js | 39 + .../named-eval-var-scope-syntax-err.js | 39 + ...named-object-destructuring-param-strict-body.js | 110 + .../named-params-trailing-comma-multiple.js | 39 + .../named-params-trailing-comma-single.js | 38 + .../named-reassign-fn-name-in-body-in-arrow.js | 33 + .../named-reassign-fn-name-in-body-in-eval.js | 31 + .../named-reassign-fn-name-in-body.js | 31 + .../async-function/named-rest-param-strict-body.js | 110 + ...named-rest-params-trailing-comma-early-error.js | 36 + ...arrow-returns-arguments-from-parent-function.js | 31 + .../named-returns-async-arrow-returns-newtarget.js | 30 + .../async-function/named-returns-async-arrow.js | 30 + ...function-returns-arguments-from-own-function.js | 31 + ...med-returns-async-function-returns-newtarget.js | 30 + .../async-function/named-returns-async-function.js | 30 + ...ror-reassign-fn-name-in-body-in-arrow-strict.js | 41 + ...rror-reassign-fn-name-in-body-in-eval-strict.js | 39 + ...strict-error-reassign-fn-name-in-body-strict.js | 39 + .../named-unscopables-with-in-nested-fn.js | 81 + .../async-function/named-unscopables-with.js | 75 + ...meless-array-destructuring-param-strict-body.js | 110 + .../async-function/nameless-dflt-params-abrupt.js | 43 + .../nameless-dflt-params-arg-val-not-undefined.js | 64 + .../nameless-dflt-params-arg-val-undefined.js | 47 + .../nameless-dflt-params-duplicates.js | 39 + .../nameless-dflt-params-ref-later.js | 44 + .../nameless-dflt-params-ref-prior.js | 44 + .../nameless-dflt-params-ref-self.js | 44 + .../async-function/nameless-dflt-params-rest.js | 43 + .../nameless-dflt-params-trailing-comma.js | 39 + .../nameless-eval-var-scope-syntax-err.js | 39 + ...eless-object-destructuring-param-strict-body.js | 110 + .../nameless-params-trailing-comma-multiple.js | 39 + .../nameless-params-trailing-comma-single.js | 38 + .../nameless-rest-param-strict-body.js | 110 + ...eless-rest-params-trailing-comma-early-error.js | 36 + .../nameless-unscopables-with-in-nested-fn.js | 81 + .../async-function/nameless-unscopables-with.js | 75 + .../language/expressions/async-function/shell.js | 113 + .../syntax-expression-is-PrimaryExpression.js | 13 + .../async-function/try-reject-finally-reject.js | 28 + .../async-function/try-reject-finally-return.js | 26 + .../async-function/try-reject-finally-throw.js | 26 + .../async-function/try-return-finally-reject.js | 26 + .../async-function/try-return-finally-return.js | 26 + .../async-function/try-return-finally-throw.js | 24 + .../async-function/try-throw-finally-reject.js | 26 + .../async-function/try-throw-finally-return.js | 26 + .../async-function/try-throw-finally-throw.js | 24 + .../array-destructuring-param-strict-body.js | 113 + .../await-as-binding-identifier-escaped.js | 32 + .../async-generator/await-as-binding-identifier.js | 32 + .../await-as-identifier-reference-escaped.js | 32 + .../await-as-identifier-reference.js | 32 + .../await-as-label-identifier-escaped.js | 32 + .../async-generator/await-as-label-identifier.js | 32 + .../expressions/async-generator/browser.js | 0 .../expressions/async-generator/default-proto.js | 53 + .../async-generator/dflt-params-abrupt.js | 44 + .../dflt-params-arg-val-not-undefined.js | 66 + .../dflt-params-arg-val-undefined.js | 49 + .../async-generator/dflt-params-duplicates.js | 42 + .../async-generator/dflt-params-ref-later.js | 45 + .../async-generator/dflt-params-ref-prior.js | 46 + .../async-generator/dflt-params-ref-self.js | 45 + .../async-generator/dflt-params-rest.js | 46 + .../async-generator/dflt-params-trailing-comma.js | 41 + .../async-generator/dstr/ary-init-iter-close.js | 54 + .../dstr/ary-init-iter-get-err-array-prototype.js | 47 + .../async-generator/dstr/ary-init-iter-get-err.js | 41 + .../async-generator/dstr/ary-init-iter-no-close.js | 54 + .../async-generator/dstr/ary-name-iter-val.js | 53 + .../dstr/ary-ptrn-elem-ary-elem-init.js | 45 + .../dstr/ary-ptrn-elem-ary-elem-iter.js | 46 + .../dstr/ary-ptrn-elem-ary-elision-init.js | 52 + .../dstr/ary-ptrn-elem-ary-elision-iter.js | 49 + .../dstr/ary-ptrn-elem-ary-empty-init.js | 48 + .../dstr/ary-ptrn-elem-ary-empty-iter.js | 45 + .../dstr/ary-ptrn-elem-ary-rest-init.js | 49 + .../dstr/ary-ptrn-elem-ary-rest-iter.js | 52 + .../dstr/ary-ptrn-elem-ary-val-null.js | 48 + .../dstr/ary-ptrn-elem-id-init-exhausted.js | 44 + .../dstr/ary-ptrn-elem-id-init-fn-name-arrow.js | 45 + .../dstr/ary-ptrn-elem-id-init-fn-name-class.js | 47 + .../dstr/ary-ptrn-elem-id-init-fn-name-cover.js | 46 + .../dstr/ary-ptrn-elem-id-init-fn-name-fn.js | 46 + .../dstr/ary-ptrn-elem-id-init-fn-name-gen.js | 47 + .../dstr/ary-ptrn-elem-id-init-hole.js | 40 + .../dstr/ary-ptrn-elem-id-init-skipped.js | 49 + .../dstr/ary-ptrn-elem-id-init-throws.js | 39 + .../dstr/ary-ptrn-elem-id-init-undef.js | 43 + .../dstr/ary-ptrn-elem-id-init-unresolvable.js | 46 + .../dstr/ary-ptrn-elem-id-iter-complete.js | 47 + .../dstr/ary-ptrn-elem-id-iter-done.js | 42 + .../dstr/ary-ptrn-elem-id-iter-step-err.js | 48 + .../ary-ptrn-elem-id-iter-val-array-prototype.js | 63 + .../dstr/ary-ptrn-elem-id-iter-val-err.js | 59 + .../dstr/ary-ptrn-elem-id-iter-val.js | 53 + .../dstr/ary-ptrn-elem-obj-id-init.js | 45 + .../async-generator/dstr/ary-ptrn-elem-obj-id.js | 45 + .../dstr/ary-ptrn-elem-obj-prop-id-init.js | 55 + .../dstr/ary-ptrn-elem-obj-prop-id.js | 55 + .../dstr/ary-ptrn-elem-obj-val-null.js | 48 + .../dstr/ary-ptrn-elem-obj-val-undef.js | 48 + .../dstr/ary-ptrn-elision-exhausted.js | 50 + .../dstr/ary-ptrn-elision-step-err.js | 55 + .../async-generator/dstr/ary-ptrn-elision.js | 59 + .../async-generator/dstr/ary-ptrn-empty.js | 42 + .../async-generator/dstr/ary-ptrn-rest-ary-elem.js | 66 + .../dstr/ary-ptrn-rest-ary-elision.js | 72 + .../dstr/ary-ptrn-rest-ary-empty.js | 55 + .../async-generator/dstr/ary-ptrn-rest-ary-rest.js | 51 + .../dstr/ary-ptrn-rest-id-direct.js | 46 + .../dstr/ary-ptrn-rest-id-elision-next-err.js | 41 + .../dstr/ary-ptrn-rest-id-elision.js | 47 + .../dstr/ary-ptrn-rest-id-exhausted.js | 43 + .../dstr/ary-ptrn-rest-id-iter-step-err.js | 52 + .../dstr/ary-ptrn-rest-id-iter-val-err.js | 54 + .../async-generator/dstr/ary-ptrn-rest-id.js | 44 + .../async-generator/dstr/ary-ptrn-rest-init-ary.js | 41 + .../async-generator/dstr/ary-ptrn-rest-init-id.js | 41 + .../async-generator/dstr/ary-ptrn-rest-init-obj.js | 41 + .../dstr/ary-ptrn-rest-not-final-ary.js | 41 + .../dstr/ary-ptrn-rest-not-final-id.js | 41 + .../dstr/ary-ptrn-rest-not-final-obj.js | 41 + .../async-generator/dstr/ary-ptrn-rest-obj-id.js | 44 + .../dstr/ary-ptrn-rest-obj-prop-id.js | 51 + .../expressions/async-generator/dstr/browser.js | 0 .../dstr/dflt-ary-init-iter-close.js | 54 + .../dflt-ary-init-iter-get-err-array-prototype.js | 46 + .../dstr/dflt-ary-init-iter-get-err.js | 40 + .../dstr/dflt-ary-init-iter-no-close.js | 54 + .../async-generator/dstr/dflt-ary-name-iter-val.js | 53 + .../dstr/dflt-ary-ptrn-elem-ary-elem-init.js | 45 + .../dstr/dflt-ary-ptrn-elem-ary-elem-iter.js | 46 + .../dstr/dflt-ary-ptrn-elem-ary-elision-init.js | 52 + .../dstr/dflt-ary-ptrn-elem-ary-elision-iter.js | 49 + .../dstr/dflt-ary-ptrn-elem-ary-empty-init.js | 48 + .../dstr/dflt-ary-ptrn-elem-ary-empty-iter.js | 45 + .../dstr/dflt-ary-ptrn-elem-ary-rest-init.js | 49 + .../dstr/dflt-ary-ptrn-elem-ary-rest-iter.js | 52 + .../dstr/dflt-ary-ptrn-elem-ary-val-null.js | 47 + .../dstr/dflt-ary-ptrn-elem-id-init-exhausted.js | 44 + .../dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 45 + .../dflt-ary-ptrn-elem-id-init-fn-name-class.js | 47 + .../dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 46 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 46 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 47 + .../dstr/dflt-ary-ptrn-elem-id-init-hole.js | 40 + .../dstr/dflt-ary-ptrn-elem-id-init-skipped.js | 49 + .../dstr/dflt-ary-ptrn-elem-id-init-throws.js | 38 + .../dstr/dflt-ary-ptrn-elem-id-init-undef.js | 43 + .../dflt-ary-ptrn-elem-id-init-unresolvable.js | 45 + .../dstr/dflt-ary-ptrn-elem-id-iter-complete.js | 47 + .../dstr/dflt-ary-ptrn-elem-id-iter-done.js | 42 + .../dstr/dflt-ary-ptrn-elem-id-iter-step-err.js | 47 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 63 + .../dstr/dflt-ary-ptrn-elem-id-iter-val-err.js | 58 + .../dstr/dflt-ary-ptrn-elem-id-iter-val.js | 53 + .../dstr/dflt-ary-ptrn-elem-obj-id-init.js | 45 + .../dstr/dflt-ary-ptrn-elem-obj-id.js | 45 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js | 55 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id.js | 55 + .../dstr/dflt-ary-ptrn-elem-obj-val-null.js | 47 + .../dstr/dflt-ary-ptrn-elem-obj-val-undef.js | 47 + .../dstr/dflt-ary-ptrn-elision-exhausted.js | 50 + .../dstr/dflt-ary-ptrn-elision-step-err.js | 54 + .../async-generator/dstr/dflt-ary-ptrn-elision.js | 59 + .../async-generator/dstr/dflt-ary-ptrn-empty.js | 42 + .../dstr/dflt-ary-ptrn-rest-ary-elem.js | 66 + .../dstr/dflt-ary-ptrn-rest-ary-elision.js | 72 + .../dstr/dflt-ary-ptrn-rest-ary-empty.js | 55 + .../dstr/dflt-ary-ptrn-rest-ary-rest.js | 51 + .../dstr/dflt-ary-ptrn-rest-id-direct.js | 46 + .../dstr/dflt-ary-ptrn-rest-id-elision-next-err.js | 40 + .../dstr/dflt-ary-ptrn-rest-id-elision.js | 47 + .../dstr/dflt-ary-ptrn-rest-id-exhausted.js | 43 + .../dstr/dflt-ary-ptrn-rest-id-iter-step-err.js | 51 + .../dstr/dflt-ary-ptrn-rest-id-iter-val-err.js | 53 + .../async-generator/dstr/dflt-ary-ptrn-rest-id.js | 44 + .../dstr/dflt-ary-ptrn-rest-init-ary.js | 41 + .../dstr/dflt-ary-ptrn-rest-init-id.js | 41 + .../dstr/dflt-ary-ptrn-rest-init-obj.js | 41 + .../dstr/dflt-ary-ptrn-rest-not-final-ary.js | 41 + .../dstr/dflt-ary-ptrn-rest-not-final-id.js | 41 + .../dstr/dflt-ary-ptrn-rest-not-final-obj.js | 41 + .../dstr/dflt-ary-ptrn-rest-obj-id.js | 44 + .../dstr/dflt-ary-ptrn-rest-obj-prop-id.js | 51 + .../async-generator/dstr/dflt-obj-init-null.js | 34 + .../dstr/dflt-obj-init-undefined.js | 34 + .../async-generator/dstr/dflt-obj-ptrn-empty.js | 43 + .../dstr/dflt-obj-ptrn-id-get-value-err.js | 41 + .../dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js | 44 + .../dstr/dflt-obj-ptrn-id-init-fn-name-class.js | 46 + .../dstr/dflt-obj-ptrn-id-init-fn-name-cover.js | 45 + .../dstr/dflt-obj-ptrn-id-init-fn-name-fn.js | 45 + .../dstr/dflt-obj-ptrn-id-init-fn-name-gen.js | 46 + .../dstr/dflt-obj-ptrn-id-init-skipped.js | 48 + .../dstr/dflt-obj-ptrn-id-init-throws.js | 41 + .../dstr/dflt-obj-ptrn-id-init-unresolvable.js | 45 + .../dstr/dflt-obj-ptrn-id-trailing-comma.js | 38 + .../async-generator/dstr/dflt-obj-ptrn-list-err.js | 42 + .../dstr/dflt-obj-ptrn-prop-ary-init.js | 47 + .../dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js | 38 + .../dstr/dflt-obj-ptrn-prop-ary-value-null.js | 36 + .../async-generator/dstr/dflt-obj-ptrn-prop-ary.js | 45 + .../dstr/dflt-obj-ptrn-prop-eval-err.js | 38 + .../dstr/dflt-obj-ptrn-prop-id-get-value-err.js | 43 + .../dstr/dflt-obj-ptrn-prop-id-init-skipped.js | 60 + .../dstr/dflt-obj-ptrn-prop-id-init-throws.js | 41 + .../dflt-obj-ptrn-prop-id-init-unresolvable.js | 45 + .../dstr/dflt-obj-ptrn-prop-id-init.js | 41 + .../dstr/dflt-obj-ptrn-prop-id-trailing-comma.js | 42 + .../async-generator/dstr/dflt-obj-ptrn-prop-id.js | 41 + .../dstr/dflt-obj-ptrn-prop-obj-init.js | 47 + .../dstr/dflt-obj-ptrn-prop-obj-value-null.js | 36 + .../dstr/dflt-obj-ptrn-prop-obj-value-undef.js | 36 + .../async-generator/dstr/dflt-obj-ptrn-prop-obj.js | 45 + .../dstr/dflt-obj-ptrn-rest-getter.js | 40 + .../dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js | 48 + .../dstr/dflt-obj-ptrn-rest-val-obj.js | 47 + .../dstr/named-ary-init-iter-close.js | 54 + .../named-ary-init-iter-get-err-array-prototype.js | 47 + .../dstr/named-ary-init-iter-get-err.js | 41 + .../dstr/named-ary-init-iter-no-close.js | 54 + .../dstr/named-ary-name-iter-val.js | 53 + .../dstr/named-ary-ptrn-elem-ary-elem-init.js | 45 + .../dstr/named-ary-ptrn-elem-ary-elem-iter.js | 46 + .../dstr/named-ary-ptrn-elem-ary-elision-init.js | 52 + .../dstr/named-ary-ptrn-elem-ary-elision-iter.js | 49 + .../dstr/named-ary-ptrn-elem-ary-empty-init.js | 48 + .../dstr/named-ary-ptrn-elem-ary-empty-iter.js | 45 + .../dstr/named-ary-ptrn-elem-ary-rest-init.js | 49 + .../dstr/named-ary-ptrn-elem-ary-rest-iter.js | 52 + .../dstr/named-ary-ptrn-elem-ary-val-null.js | 48 + .../dstr/named-ary-ptrn-elem-id-init-exhausted.js | 44 + .../named-ary-ptrn-elem-id-init-fn-name-arrow.js | 45 + .../named-ary-ptrn-elem-id-init-fn-name-class.js | 47 + .../named-ary-ptrn-elem-id-init-fn-name-cover.js | 46 + .../dstr/named-ary-ptrn-elem-id-init-fn-name-fn.js | 46 + .../named-ary-ptrn-elem-id-init-fn-name-gen.js | 47 + .../dstr/named-ary-ptrn-elem-id-init-hole.js | 40 + .../dstr/named-ary-ptrn-elem-id-init-skipped.js | 49 + .../dstr/named-ary-ptrn-elem-id-init-throws.js | 39 + .../dstr/named-ary-ptrn-elem-id-init-undef.js | 43 + .../named-ary-ptrn-elem-id-init-unresolvable.js | 46 + .../dstr/named-ary-ptrn-elem-id-iter-complete.js | 47 + .../dstr/named-ary-ptrn-elem-id-iter-done.js | 42 + .../dstr/named-ary-ptrn-elem-id-iter-step-err.js | 48 + ...ed-ary-ptrn-elem-id-iter-val-array-prototype.js | 63 + .../dstr/named-ary-ptrn-elem-id-iter-val-err.js | 59 + .../dstr/named-ary-ptrn-elem-id-iter-val.js | 53 + .../dstr/named-ary-ptrn-elem-obj-id-init.js | 45 + .../dstr/named-ary-ptrn-elem-obj-id.js | 45 + .../dstr/named-ary-ptrn-elem-obj-prop-id-init.js | 55 + .../dstr/named-ary-ptrn-elem-obj-prop-id.js | 55 + .../dstr/named-ary-ptrn-elem-obj-val-null.js | 48 + .../dstr/named-ary-ptrn-elem-obj-val-undef.js | 48 + .../dstr/named-ary-ptrn-elision-exhausted.js | 50 + .../dstr/named-ary-ptrn-elision-step-err.js | 55 + .../async-generator/dstr/named-ary-ptrn-elision.js | 59 + .../async-generator/dstr/named-ary-ptrn-empty.js | 42 + .../dstr/named-ary-ptrn-rest-ary-elem.js | 66 + .../dstr/named-ary-ptrn-rest-ary-elision.js | 72 + .../dstr/named-ary-ptrn-rest-ary-empty.js | 55 + .../dstr/named-ary-ptrn-rest-ary-rest.js | 51 + .../dstr/named-ary-ptrn-rest-id-direct.js | 46 + .../named-ary-ptrn-rest-id-elision-next-err.js | 41 + .../dstr/named-ary-ptrn-rest-id-elision.js | 47 + .../dstr/named-ary-ptrn-rest-id-exhausted.js | 43 + .../dstr/named-ary-ptrn-rest-id-iter-step-err.js | 52 + .../dstr/named-ary-ptrn-rest-id-iter-val-err.js | 54 + .../async-generator/dstr/named-ary-ptrn-rest-id.js | 44 + .../dstr/named-ary-ptrn-rest-init-ary.js | 41 + .../dstr/named-ary-ptrn-rest-init-id.js | 41 + .../dstr/named-ary-ptrn-rest-init-obj.js | 41 + .../dstr/named-ary-ptrn-rest-not-final-ary.js | 41 + .../dstr/named-ary-ptrn-rest-not-final-id.js | 41 + .../dstr/named-ary-ptrn-rest-not-final-obj.js | 41 + .../dstr/named-ary-ptrn-rest-obj-id.js | 44 + .../dstr/named-ary-ptrn-rest-obj-prop-id.js | 51 + .../dstr/named-dflt-ary-init-iter-close.js | 54 + ...d-dflt-ary-init-iter-get-err-array-prototype.js | 47 + .../dstr/named-dflt-ary-init-iter-get-err.js | 41 + .../dstr/named-dflt-ary-init-iter-no-close.js | 54 + .../dstr/named-dflt-ary-name-iter-val.js | 53 + .../dstr/named-dflt-ary-ptrn-elem-ary-elem-init.js | 45 + .../dstr/named-dflt-ary-ptrn-elem-ary-elem-iter.js | 46 + .../named-dflt-ary-ptrn-elem-ary-elision-init.js | 52 + .../named-dflt-ary-ptrn-elem-ary-elision-iter.js | 49 + .../named-dflt-ary-ptrn-elem-ary-empty-init.js | 48 + .../named-dflt-ary-ptrn-elem-ary-empty-iter.js | 45 + .../dstr/named-dflt-ary-ptrn-elem-ary-rest-init.js | 49 + .../dstr/named-dflt-ary-ptrn-elem-ary-rest-iter.js | 52 + .../dstr/named-dflt-ary-ptrn-elem-ary-val-null.js | 48 + .../named-dflt-ary-ptrn-elem-id-init-exhausted.js | 44 + ...med-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 45 + ...med-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 47 + ...med-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 46 + .../named-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 46 + ...named-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 47 + .../dstr/named-dflt-ary-ptrn-elem-id-init-hole.js | 40 + .../named-dflt-ary-ptrn-elem-id-init-skipped.js | 49 + .../named-dflt-ary-ptrn-elem-id-init-throws.js | 39 + .../dstr/named-dflt-ary-ptrn-elem-id-init-undef.js | 43 + ...amed-dflt-ary-ptrn-elem-id-init-unresolvable.js | 46 + .../named-dflt-ary-ptrn-elem-id-iter-complete.js | 47 + .../dstr/named-dflt-ary-ptrn-elem-id-iter-done.js | 42 + .../named-dflt-ary-ptrn-elem-id-iter-step-err.js | 48 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 63 + .../named-dflt-ary-ptrn-elem-id-iter-val-err.js | 59 + .../dstr/named-dflt-ary-ptrn-elem-id-iter-val.js | 53 + .../dstr/named-dflt-ary-ptrn-elem-obj-id-init.js | 45 + .../dstr/named-dflt-ary-ptrn-elem-obj-id.js | 45 + .../named-dflt-ary-ptrn-elem-obj-prop-id-init.js | 55 + .../dstr/named-dflt-ary-ptrn-elem-obj-prop-id.js | 55 + .../dstr/named-dflt-ary-ptrn-elem-obj-val-null.js | 48 + .../dstr/named-dflt-ary-ptrn-elem-obj-val-undef.js | 48 + .../dstr/named-dflt-ary-ptrn-elision-exhausted.js | 50 + .../dstr/named-dflt-ary-ptrn-elision-step-err.js | 55 + .../dstr/named-dflt-ary-ptrn-elision.js | 59 + .../dstr/named-dflt-ary-ptrn-empty.js | 42 + .../dstr/named-dflt-ary-ptrn-rest-ary-elem.js | 66 + .../dstr/named-dflt-ary-ptrn-rest-ary-elision.js | 72 + .../dstr/named-dflt-ary-ptrn-rest-ary-empty.js | 55 + .../dstr/named-dflt-ary-ptrn-rest-ary-rest.js | 51 + .../dstr/named-dflt-ary-ptrn-rest-id-direct.js | 46 + ...named-dflt-ary-ptrn-rest-id-elision-next-err.js | 41 + .../dstr/named-dflt-ary-ptrn-rest-id-elision.js | 47 + .../dstr/named-dflt-ary-ptrn-rest-id-exhausted.js | 43 + .../named-dflt-ary-ptrn-rest-id-iter-step-err.js | 52 + .../named-dflt-ary-ptrn-rest-id-iter-val-err.js | 54 + .../dstr/named-dflt-ary-ptrn-rest-id.js | 44 + .../dstr/named-dflt-ary-ptrn-rest-init-ary.js | 41 + .../dstr/named-dflt-ary-ptrn-rest-init-id.js | 41 + .../dstr/named-dflt-ary-ptrn-rest-init-obj.js | 41 + .../dstr/named-dflt-ary-ptrn-rest-not-final-ary.js | 41 + .../dstr/named-dflt-ary-ptrn-rest-not-final-id.js | 41 + .../dstr/named-dflt-ary-ptrn-rest-not-final-obj.js | 41 + .../dstr/named-dflt-ary-ptrn-rest-obj-id.js | 44 + .../dstr/named-dflt-ary-ptrn-rest-obj-prop-id.js | 51 + .../dstr/named-dflt-obj-init-null.js | 35 + .../dstr/named-dflt-obj-init-undefined.js | 35 + .../dstr/named-dflt-obj-ptrn-empty.js | 43 + .../dstr/named-dflt-obj-ptrn-id-get-value-err.js | 42 + .../named-dflt-obj-ptrn-id-init-fn-name-arrow.js | 44 + .../named-dflt-obj-ptrn-id-init-fn-name-class.js | 46 + .../named-dflt-obj-ptrn-id-init-fn-name-cover.js | 45 + .../dstr/named-dflt-obj-ptrn-id-init-fn-name-fn.js | 45 + .../named-dflt-obj-ptrn-id-init-fn-name-gen.js | 46 + .../dstr/named-dflt-obj-ptrn-id-init-skipped.js | 48 + .../dstr/named-dflt-obj-ptrn-id-init-throws.js | 42 + .../named-dflt-obj-ptrn-id-init-unresolvable.js | 46 + .../dstr/named-dflt-obj-ptrn-id-trailing-comma.js | 38 + .../dstr/named-dflt-obj-ptrn-list-err.js | 43 + .../dstr/named-dflt-obj-ptrn-prop-ary-init.js | 47 + .../named-dflt-obj-ptrn-prop-ary-trailing-comma.js | 38 + .../named-dflt-obj-ptrn-prop-ary-value-null.js | 37 + .../dstr/named-dflt-obj-ptrn-prop-ary.js | 45 + .../dstr/named-dflt-obj-ptrn-prop-eval-err.js | 39 + .../named-dflt-obj-ptrn-prop-id-get-value-err.js | 44 + .../named-dflt-obj-ptrn-prop-id-init-skipped.js | 60 + .../named-dflt-obj-ptrn-prop-id-init-throws.js | 42 + ...amed-dflt-obj-ptrn-prop-id-init-unresolvable.js | 46 + .../dstr/named-dflt-obj-ptrn-prop-id-init.js | 41 + .../named-dflt-obj-ptrn-prop-id-trailing-comma.js | 42 + .../dstr/named-dflt-obj-ptrn-prop-id.js | 41 + .../dstr/named-dflt-obj-ptrn-prop-obj-init.js | 47 + .../named-dflt-obj-ptrn-prop-obj-value-null.js | 37 + .../named-dflt-obj-ptrn-prop-obj-value-undef.js | 37 + .../dstr/named-dflt-obj-ptrn-prop-obj.js | 45 + .../dstr/named-dflt-obj-ptrn-rest-getter.js | 40 + ...named-dflt-obj-ptrn-rest-skip-non-enumerable.js | 48 + .../dstr/named-dflt-obj-ptrn-rest-val-obj.js | 47 + .../async-generator/dstr/named-obj-init-null.js | 35 + .../dstr/named-obj-init-undefined.js | 35 + .../async-generator/dstr/named-obj-ptrn-empty.js | 43 + .../dstr/named-obj-ptrn-id-get-value-err.js | 42 + .../dstr/named-obj-ptrn-id-init-fn-name-arrow.js | 44 + .../dstr/named-obj-ptrn-id-init-fn-name-class.js | 46 + .../dstr/named-obj-ptrn-id-init-fn-name-cover.js | 45 + .../dstr/named-obj-ptrn-id-init-fn-name-fn.js | 45 + .../dstr/named-obj-ptrn-id-init-fn-name-gen.js | 46 + .../dstr/named-obj-ptrn-id-init-skipped.js | 48 + .../dstr/named-obj-ptrn-id-init-throws.js | 42 + .../dstr/named-obj-ptrn-id-init-unresolvable.js | 46 + .../dstr/named-obj-ptrn-id-trailing-comma.js | 38 + .../dstr/named-obj-ptrn-list-err.js | 43 + .../dstr/named-obj-ptrn-prop-ary-init.js | 47 + .../dstr/named-obj-ptrn-prop-ary-trailing-comma.js | 38 + .../dstr/named-obj-ptrn-prop-ary-value-null.js | 37 + .../dstr/named-obj-ptrn-prop-ary.js | 45 + .../dstr/named-obj-ptrn-prop-eval-err.js | 39 + .../dstr/named-obj-ptrn-prop-id-get-value-err.js | 44 + .../dstr/named-obj-ptrn-prop-id-init-skipped.js | 60 + .../dstr/named-obj-ptrn-prop-id-init-throws.js | 42 + .../named-obj-ptrn-prop-id-init-unresolvable.js | 46 + .../dstr/named-obj-ptrn-prop-id-init.js | 41 + .../dstr/named-obj-ptrn-prop-id-trailing-comma.js | 42 + .../async-generator/dstr/named-obj-ptrn-prop-id.js | 41 + .../dstr/named-obj-ptrn-prop-obj-init.js | 47 + .../dstr/named-obj-ptrn-prop-obj-value-null.js | 37 + .../dstr/named-obj-ptrn-prop-obj-value-undef.js | 37 + .../dstr/named-obj-ptrn-prop-obj.js | 45 + .../dstr/named-obj-ptrn-rest-getter.js | 40 + .../named-obj-ptrn-rest-skip-non-enumerable.js | 48 + .../dstr/named-obj-ptrn-rest-val-obj.js | 47 + .../async-generator/dstr/obj-init-null.js | 35 + .../async-generator/dstr/obj-init-undefined.js | 35 + .../async-generator/dstr/obj-ptrn-empty.js | 43 + .../dstr/obj-ptrn-id-get-value-err.js | 42 + .../dstr/obj-ptrn-id-init-fn-name-arrow.js | 44 + .../dstr/obj-ptrn-id-init-fn-name-class.js | 46 + .../dstr/obj-ptrn-id-init-fn-name-cover.js | 45 + .../dstr/obj-ptrn-id-init-fn-name-fn.js | 45 + .../dstr/obj-ptrn-id-init-fn-name-gen.js | 46 + .../dstr/obj-ptrn-id-init-skipped.js | 48 + .../dstr/obj-ptrn-id-init-throws.js | 42 + .../dstr/obj-ptrn-id-init-unresolvable.js | 46 + .../dstr/obj-ptrn-id-trailing-comma.js | 38 + .../async-generator/dstr/obj-ptrn-list-err.js | 43 + .../async-generator/dstr/obj-ptrn-prop-ary-init.js | 47 + .../dstr/obj-ptrn-prop-ary-trailing-comma.js | 38 + .../dstr/obj-ptrn-prop-ary-value-null.js | 37 + .../async-generator/dstr/obj-ptrn-prop-ary.js | 45 + .../async-generator/dstr/obj-ptrn-prop-eval-err.js | 39 + .../dstr/obj-ptrn-prop-id-get-value-err.js | 44 + .../dstr/obj-ptrn-prop-id-init-skipped.js | 60 + .../dstr/obj-ptrn-prop-id-init-throws.js | 42 + .../dstr/obj-ptrn-prop-id-init-unresolvable.js | 46 + .../async-generator/dstr/obj-ptrn-prop-id-init.js | 41 + .../dstr/obj-ptrn-prop-id-trailing-comma.js | 42 + .../async-generator/dstr/obj-ptrn-prop-id.js | 41 + .../async-generator/dstr/obj-ptrn-prop-obj-init.js | 47 + .../dstr/obj-ptrn-prop-obj-value-null.js | 37 + .../dstr/obj-ptrn-prop-obj-value-undef.js | 37 + .../async-generator/dstr/obj-ptrn-prop-obj.js | 45 + .../async-generator/dstr/obj-ptrn-rest-getter.js | 40 + .../dstr/obj-ptrn-rest-skip-non-enumerable.js | 48 + .../async-generator/dstr/obj-ptrn-rest-val-obj.js | 47 + .../expressions/async-generator/dstr/shell.js | 0 .../early-errors-expression-NSPL-with-USD.js | 19 + ...ession-arguments-in-formal-parameters-strict.js | 20 + ...ression-await-as-function-binding-identifier.js | 18 + ...pression-binding-identifier-arguments-strict.js | 21 + ...rs-expression-binding-identifier-eval-strict.js | 21 + ...y-errors-expression-body-contains-super-call.js | 18 + ...rors-expression-body-contains-super-property.js | 18 + ...-expression-eval-in-formal-parameters-strict.js | 20 + ...rors-expression-formals-body-duplicate-const.js | 22 + ...errors-expression-formals-body-duplicate-let.js | 19 + ...rrors-expression-formals-contains-await-expr.js | 18 + ...rly-errors-expression-formals-contains-await.js | 19 + ...rrors-expression-formals-contains-super-call.js | 18 + ...s-expression-formals-contains-super-property.js | 18 + ...rrors-expression-formals-contains-yield-expr.js | 18 + ...rly-errors-expression-formals-contains-yield.js | 19 + .../early-errors-expression-label-name-await.js | 25 + .../early-errors-expression-label-name-yield.js | 27 + ...rors-expression-not-simple-assignment-target.js | 18 + ...ression-yield-as-function-binding-identifier.js | 18 + ...y-errors-expression-yield-star-after-newline.js | 21 + .../expressions/async-generator/escaped-async.js | 25 + .../async-generator/eval-body-proto-realm.js | 54 + .../async-generator/eval-var-scope-syntax-err.js | 40 + .../expression-await-as-yield-operand.js | 26 + .../expression-await-promise-as-yield-operand.js | 28 + .../expression-await-thenable-as-yield-operand.js | 32 + .../async-generator/expression-yield-as-operand.js | 33 + .../expression-yield-as-statement.js | 43 + .../async-generator/expression-yield-newline.js | 28 + .../expression-yield-star-before-newline.js | 22 + ...r-forbidden-ext-direct-access-prop-arguments.js | 39 + ...expr-forbidden-ext-direct-access-prop-caller.js | 39 + ...r-forbidden-ext-direct-access-prop-arguments.js | 39 + ...expr-forbidden-ext-direct-access-prop-caller.js | 39 + .../async-generator/forbidden-ext/b1/browser.js | 0 .../async-generator/forbidden-ext/b1/shell.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 65 + ...en-ext-indirect-access-own-prop-caller-value.js | 65 + ...pr-forbidden-ext-indirect-access-prop-caller.js | 65 + ...dden-ext-indirect-access-own-prop-caller-get.js | 65 + ...en-ext-indirect-access-own-prop-caller-value.js | 65 + ...pr-forbidden-ext-indirect-access-prop-caller.js | 65 + .../async-generator/forbidden-ext/b2/browser.js | 0 .../async-generator/forbidden-ext/b2/shell.js | 0 .../async-generator/forbidden-ext/browser.js | 0 .../async-generator/forbidden-ext/shell.js | 0 .../generator-created-after-decl-inst.js | 26 + .../language/expressions/async-generator/name.js | 38 + .../named-array-destructuring-param-strict-body.js | 113 + .../named-await-as-binding-identifier-escaped.js | 32 + .../named-await-as-binding-identifier.js | 32 + .../named-await-as-identifier-reference-escaped.js | 32 + .../named-await-as-identifier-reference.js | 32 + .../named-await-as-label-identifier-escaped.js | 32 + .../named-await-as-label-identifier.js | 32 + .../async-generator/named-dflt-params-abrupt.js | 44 + .../named-dflt-params-arg-val-not-undefined.js | 66 + .../named-dflt-params-arg-val-undefined.js | 49 + .../named-dflt-params-duplicates.js | 42 + .../async-generator/named-dflt-params-ref-later.js | 45 + .../async-generator/named-dflt-params-ref-prior.js | 46 + .../async-generator/named-dflt-params-ref-self.js | 45 + .../async-generator/named-dflt-params-rest.js | 46 + .../named-dflt-params-trailing-comma.js | 41 + .../named-eval-var-scope-syntax-err.js | 40 + ...-no-strict-reassign-fn-name-in-body-in-arrow.js | 31 + ...d-no-strict-reassign-fn-name-in-body-in-eval.js | 29 + .../named-no-strict-reassign-fn-name-in-body.js | 29 + ...named-object-destructuring-param-strict-body.js | 113 + .../named-params-trailing-comma-multiple.js | 41 + .../named-params-trailing-comma-single.js | 40 + .../named-rest-param-strict-body.js | 113 + ...named-rest-params-trailing-comma-early-error.js | 39 + ...ror-reassign-fn-name-in-body-in-arrow-strict.js | 39 + ...rror-reassign-fn-name-in-body-in-eval-strict.js | 37 + ...strict-error-reassign-fn-name-in-body-strict.js | 37 + .../named-unscopables-with-in-nested-fn.js | 83 + .../async-generator/named-unscopables-with.js | 77 + .../named-yield-as-binding-identifier-escaped.js | 32 + .../named-yield-as-binding-identifier.js | 32 + .../named-yield-as-identifier-reference-escaped.js | 32 + .../named-yield-as-identifier-reference.js | 32 + .../named-yield-as-label-identifier-escaped.js | 32 + .../named-yield-as-label-identifier.js | 32 + .../named-yield-identifier-non-strict.js | 46 + .../named-yield-identifier-spread-non-strict.js | 64 + .../named-yield-identifier-spread-strict-strict.js | 48 + .../named-yield-identifier-strict-strict.js | 39 + .../named-yield-promise-reject-next-catch.js | 44 + ...mise-reject-next-for-await-of-async-iterator.js | 50 + ...omise-reject-next-for-await-of-sync-iterator.js | 49 + ...romise-reject-next-yield-star-async-iterator.js | 48 + ...promise-reject-next-yield-star-sync-iterator.js | 47 + .../named-yield-promise-reject-next.js | 44 + .../named-yield-spread-arr-multiple.js | 50 + .../named-yield-spread-arr-single.js | 49 + .../async-generator/named-yield-spread-obj.js | 52 + .../async-generator/named-yield-star-async-next.js | 219 ++ .../named-yield-star-async-return.js | 235 ++ .../named-yield-star-async-throw.js | 243 ++ .../named-yield-star-expr-abrupt.js | 54 + .../named-yield-star-getiter-async-get-abrupt.js | 74 + ...tar-getiter-async-not-callable-boolean-throw.js | 73 + ...star-getiter-async-not-callable-number-throw.js | 73 + ...star-getiter-async-not-callable-object-throw.js | 73 + ...star-getiter-async-not-callable-string-throw.js | 73 + ...star-getiter-async-not-callable-symbol-throw.js | 73 + ...ield-star-getiter-async-null-sync-get-abrupt.js | 79 + ...amed-yield-star-getiter-async-returns-abrupt.js | 70 + ...eld-star-getiter-async-returns-boolean-throw.js | 70 + ...-yield-star-getiter-async-returns-null-throw.js | 70 + ...ield-star-getiter-async-returns-number-throw.js | 70 + ...ield-star-getiter-async-returns-string-throw.js | 70 + ...ield-star-getiter-async-returns-symbol-throw.js | 70 + ...d-star-getiter-async-returns-undefined-throw.js | 70 + ...star-getiter-async-undefined-sync-get-abrupt.js | 79 + .../named-yield-star-getiter-sync-get-abrupt.js | 73 + ...star-getiter-sync-not-callable-boolean-throw.js | 72 + ...-star-getiter-sync-not-callable-number-throw.js | 72 + ...-star-getiter-sync-not-callable-object-throw.js | 72 + ...-star-getiter-sync-not-callable-string-throw.js | 72 + ...-star-getiter-sync-not-callable-symbol-throw.js | 72 + ...named-yield-star-getiter-sync-returns-abrupt.js | 67 + ...ield-star-getiter-sync-returns-boolean-throw.js | 72 + ...d-yield-star-getiter-sync-returns-null-throw.js | 72 + ...yield-star-getiter-sync-returns-number-throw.js | 72 + ...yield-star-getiter-sync-returns-string-throw.js | 72 + ...yield-star-getiter-sync-returns-symbol-throw.js | 72 + ...ld-star-getiter-sync-returns-undefined-throw.js | 72 + .../named-yield-star-next-call-done-get-abrupt.js | 73 + .../named-yield-star-next-call-returns-abrupt.js | 65 + .../named-yield-star-next-call-value-get-abrupt.js | 75 + .../named-yield-star-next-get-abrupt.js | 65 + ...amed-yield-star-next-non-object-ignores-then.js | 85 + ...d-yield-star-next-not-callable-boolean-throw.js | 62 + ...amed-yield-star-next-not-callable-null-throw.js | 62 + ...ed-yield-star-next-not-callable-number-throw.js | 62 + ...ed-yield-star-next-not-callable-object-throw.js | 62 + ...ed-yield-star-next-not-callable-string-throw.js | 62 + ...ed-yield-star-next-not-callable-symbol-throw.js | 62 + ...yield-star-next-not-callable-undefined-throw.js | 62 + .../named-yield-star-next-then-get-abrupt.js | 89 + ...ext-then-non-callable-boolean-fulfillpromise.js | 83 + ...r-next-then-non-callable-null-fulfillpromise.js | 83 + ...next-then-non-callable-number-fulfillpromise.js | 83 + ...next-then-non-callable-object-fulfillpromise.js | 83 + ...next-then-non-callable-string-fulfillpromise.js | 83 + ...next-then-non-callable-symbol-fulfillpromise.js | 83 + ...t-then-non-callable-undefined-fulfillpromise.js | 83 + .../named-yield-star-next-then-returns-abrupt.js | 89 + .../async-generator/named-yield-star-sync-next.js | 222 ++ .../named-yield-star-sync-return.js | 197 ++ .../async-generator/named-yield-star-sync-throw.js | 203 ++ .../object-destructuring-param-strict-body.js | 113 + .../params-trailing-comma-multiple.js | 41 + .../params-trailing-comma-single.js | 40 + .../async-generator/rest-param-strict-body.js | 113 + .../rest-params-trailing-comma-early-error.js | 39 + .../language/expressions/async-generator/shell.js | 137 + .../unscopables-with-in-nested-fn.js | 83 + .../async-generator/unscopables-with.js | 77 + .../yield-as-binding-identifier-escaped.js | 32 + .../async-generator/yield-as-binding-identifier.js | 32 + .../yield-as-identifier-reference-escaped.js | 32 + .../yield-as-identifier-reference.js | 32 + .../yield-as-label-identifier-escaped.js | 32 + .../async-generator/yield-as-label-identifier.js | 32 + .../async-generator/yield-identifier-non-strict.js | 46 + .../yield-identifier-spread-non-strict.js | 64 + .../yield-identifier-spread-strict-strict.js | 48 + .../yield-identifier-strict-strict.js | 39 + .../yield-promise-reject-next-catch.js | 44 + ...mise-reject-next-for-await-of-async-iterator.js | 50 + ...omise-reject-next-for-await-of-sync-iterator.js | 49 + ...romise-reject-next-yield-star-async-iterator.js | 48 + ...promise-reject-next-yield-star-sync-iterator.js | 47 + .../async-generator/yield-promise-reject-next.js | 44 + .../async-generator/yield-spread-arr-multiple.js | 50 + .../async-generator/yield-spread-arr-single.js | 49 + .../async-generator/yield-spread-obj.js | 52 + .../async-generator/yield-star-async-next.js | 219 ++ .../async-generator/yield-star-async-return.js | 235 ++ .../async-generator/yield-star-async-throw.js | 243 ++ .../async-generator/yield-star-expr-abrupt.js | 54 + .../yield-star-getiter-async-get-abrupt.js | 74 + ...tar-getiter-async-not-callable-boolean-throw.js | 73 + ...star-getiter-async-not-callable-number-throw.js | 73 + ...star-getiter-async-not-callable-object-throw.js | 73 + ...star-getiter-async-not-callable-string-throw.js | 73 + ...star-getiter-async-not-callable-symbol-throw.js | 73 + ...ield-star-getiter-async-null-sync-get-abrupt.js | 79 + ...eld-star-getiter-async-return-method-is-null.js | 56 + .../yield-star-getiter-async-returns-abrupt.js | 70 + ...eld-star-getiter-async-returns-boolean-throw.js | 70 + .../yield-star-getiter-async-returns-null-throw.js | 70 + ...ield-star-getiter-async-returns-number-throw.js | 70 + ...ield-star-getiter-async-returns-string-throw.js | 70 + ...ield-star-getiter-async-returns-symbol-throw.js | 70 + ...d-star-getiter-async-returns-undefined-throw.js | 70 + ...ield-star-getiter-async-throw-method-is-null.js | 73 + ...star-getiter-async-undefined-sync-get-abrupt.js | 79 + .../yield-star-getiter-sync-get-abrupt.js | 73 + ...star-getiter-sync-not-callable-boolean-throw.js | 72 + ...-star-getiter-sync-not-callable-number-throw.js | 72 + ...-star-getiter-sync-not-callable-object-throw.js | 72 + ...-star-getiter-sync-not-callable-string-throw.js | 72 + ...-star-getiter-sync-not-callable-symbol-throw.js | 72 + .../yield-star-getiter-sync-returns-abrupt.js | 67 + ...ield-star-getiter-sync-returns-boolean-throw.js | 72 + .../yield-star-getiter-sync-returns-null-throw.js | 72 + ...yield-star-getiter-sync-returns-number-throw.js | 72 + ...yield-star-getiter-sync-returns-string-throw.js | 72 + ...yield-star-getiter-sync-returns-symbol-throw.js | 72 + ...ld-star-getiter-sync-returns-undefined-throw.js | 72 + .../yield-star-next-call-done-get-abrupt.js | 73 + .../yield-star-next-call-returns-abrupt.js | 65 + .../yield-star-next-call-value-get-abrupt.js | 75 + .../async-generator/yield-star-next-get-abrupt.js | 65 + .../yield-star-next-non-object-ignores-then.js | 85 + .../yield-star-next-not-callable-boolean-throw.js | 62 + .../yield-star-next-not-callable-null-throw.js | 62 + .../yield-star-next-not-callable-number-throw.js | 62 + .../yield-star-next-not-callable-object-throw.js | 62 + .../yield-star-next-not-callable-string-throw.js | 62 + .../yield-star-next-not-callable-symbol-throw.js | 62 + ...yield-star-next-not-callable-undefined-throw.js | 62 + .../yield-star-next-then-get-abrupt.js | 89 + ...ext-then-non-callable-boolean-fulfillpromise.js | 83 + ...r-next-then-non-callable-null-fulfillpromise.js | 83 + ...next-then-non-callable-number-fulfillpromise.js | 83 + ...next-then-non-callable-object-fulfillpromise.js | 83 + ...next-then-non-callable-string-fulfillpromise.js | 83 + ...next-then-non-callable-symbol-fulfillpromise.js | 83 + ...t-then-non-callable-undefined-fulfillpromise.js | 83 + .../yield-star-next-then-returns-abrupt.js | 89 + .../async-generator/yield-star-sync-next.js | 222 ++ .../async-generator/yield-star-sync-return.js | 197 ++ .../async-generator/yield-star-sync-throw.js | 203 ++ ...d-thenable-create-resolving-functions-reject.js | 75 + ...-thenable-create-resolving-functions-resolve.js | 75 + .../expressions/await/async-await-interleaved.js | 45 + .../await/async-generator-interleaved.js | 43 + .../await/await-BindingIdentifier-in-global.js | 15 + .../await/await-BindingIdentifier-nested.js | 20 + .../await/await-awaits-thenable-not-callable.js | 22 + .../await/await-awaits-thenables-that-throw.js | 33 + .../expressions/await/await-awaits-thenables.js | 23 + .../expressions/await/await-in-function.js | 14 + .../expressions/await/await-in-generator.js | 15 + .../language/expressions/await/await-in-global.js | 14 + .../expressions/await/await-in-nested-function.js | 22 + .../expressions/await/await-in-nested-generator.js | 23 + .../await/await-monkey-patched-promise.js | 51 + .../await/await-non-promise-thenable.js | 57 + .../expressions/await/await-non-promise.js | 45 + .../expressions/await/await-throws-rejections.js | 27 + .../test262/language/expressions/await/browser.js | 0 ...ly-errors-await-not-simple-assignment-target.js | 19 + .../expressions/await/for-await-of-interleaved.js | 59 + .../language/expressions/await/no-operand.js | 19 + .../test262/language/expressions/await/shell.js | 113 + ...naryExpression-with-MultiplicativeExpression.js | 19 + .../await/syntax-await-has-UnaryExpression.js | 20 + .../expressions/bitwise-and/S11.10.1_A1.js | 63 + .../expressions/bitwise-and/S11.10.1_A2.1_T1.js | 43 + .../expressions/bitwise-and/S11.10.1_A2.1_T2.js | 21 + .../expressions/bitwise-and/S11.10.1_A2.1_T3.js | 21 + .../expressions/bitwise-and/S11.10.1_A2.2_T1.js | 71 + .../expressions/bitwise-and/S11.10.1_A2.3_T1.js | 28 + .../expressions/bitwise-and/S11.10.1_A2.4_T1.js | 22 + .../expressions/bitwise-and/S11.10.1_A2.4_T2.js | 26 + .../expressions/bitwise-and/S11.10.1_A2.4_T3.js | 27 + .../expressions/bitwise-and/S11.10.1_A3_T1.1.js | 30 + .../expressions/bitwise-and/S11.10.1_A3_T1.2.js | 30 + .../expressions/bitwise-and/S11.10.1_A3_T1.3.js | 40 + .../expressions/bitwise-and/S11.10.1_A3_T1.4.js | 30 + .../expressions/bitwise-and/S11.10.1_A3_T1.5.js | 30 + .../expressions/bitwise-and/S11.10.1_A3_T2.1.js | 52 + .../expressions/bitwise-and/S11.10.1_A3_T2.2.js | 62 + .../expressions/bitwise-and/S11.10.1_A3_T2.3.js | 32 + .../expressions/bitwise-and/S11.10.1_A3_T2.4.js | 32 + .../expressions/bitwise-and/S11.10.1_A3_T2.5.js | 52 + .../expressions/bitwise-and/S11.10.1_A3_T2.6.js | 32 + .../expressions/bitwise-and/S11.10.1_A3_T2.7.js | 32 + .../expressions/bitwise-and/S11.10.1_A3_T2.8.js | 32 + .../expressions/bitwise-and/S11.10.1_A3_T2.9.js | 32 + .../expressions/bitwise-and/bigint-and-number.js | 92 + .../expressions/bitwise-and/bigint-errors.js | 72 + .../bitwise-and/bigint-non-primitive.js | 83 + .../expressions/bitwise-and/bigint-toprimitive.js | 374 +++ .../bitwise-and/bigint-wrapped-values.js | 47 + .../language/expressions/bitwise-and/bigint.js | 109 + .../language/expressions/bitwise-and/browser.js | 0 .../expressions/bitwise-and/order-of-evaluation.js | 140 ++ .../language/expressions/bitwise-and/shell.js | 0 .../language/expressions/bitwise-not/S11.4.8_A1.js | 62 + .../expressions/bitwise-not/S11.4.8_A2.1_T1.js | 39 + .../expressions/bitwise-not/S11.4.8_A2.1_T2.js | 21 + .../expressions/bitwise-not/S11.4.8_A2.2_T1.js | 79 + .../expressions/bitwise-not/S11.4.8_A3_T1.js | 25 + .../expressions/bitwise-not/S11.4.8_A3_T2.js | 45 + .../expressions/bitwise-not/S11.4.8_A3_T3.js | 35 + .../expressions/bitwise-not/S11.4.8_A3_T4.js | 20 + .../expressions/bitwise-not/S11.4.8_A3_T5.js | 20 + .../expressions/bitwise-not/S9.5_A2.1_T2.js | 32 + .../expressions/bitwise-not/S9.5_A2.2_T2.js | 70 + .../expressions/bitwise-not/S9.5_A2.3_T2.js | 40 + .../expressions/bitwise-not/S9.5_A3.1_T4.js | 79 + .../expressions/bitwise-not/S9.5_A3.2_T2.js | 20 + .../bitwise-not/bigint-non-primitive.js | 46 + .../language/expressions/bitwise-not/bigint.js | 39 + .../language/expressions/bitwise-not/browser.js | 0 .../language/expressions/bitwise-not/shell.js | 0 .../language/expressions/bitwise-or/S11.10.3_A1.js | 63 + .../expressions/bitwise-or/S11.10.3_A2.1_T1.js | 43 + .../expressions/bitwise-or/S11.10.3_A2.1_T2.js | 21 + .../expressions/bitwise-or/S11.10.3_A2.1_T3.js | 21 + .../expressions/bitwise-or/S11.10.3_A2.2_T1.js | 71 + .../expressions/bitwise-or/S11.10.3_A2.3_T1.js | 28 + .../expressions/bitwise-or/S11.10.3_A2.4_T1.js | 22 + .../expressions/bitwise-or/S11.10.3_A2.4_T2.js | 26 + .../expressions/bitwise-or/S11.10.3_A2.4_T3.js | 27 + .../expressions/bitwise-or/S11.10.3_A3_T1.1.js | 32 + .../expressions/bitwise-or/S11.10.3_A3_T1.2.js | 30 + .../expressions/bitwise-or/S11.10.3_A3_T1.3.js | 40 + .../expressions/bitwise-or/S11.10.3_A3_T1.4.js | 30 + .../expressions/bitwise-or/S11.10.3_A3_T1.5.js | 30 + .../expressions/bitwise-or/S11.10.3_A3_T2.1.js | 52 + .../expressions/bitwise-or/S11.10.3_A3_T2.2.js | 62 + .../expressions/bitwise-or/S11.10.3_A3_T2.3.js | 32 + .../expressions/bitwise-or/S11.10.3_A3_T2.4.js | 32 + .../expressions/bitwise-or/S11.10.3_A3_T2.5.js | 52 + .../expressions/bitwise-or/S11.10.3_A3_T2.6.js | 32 + .../expressions/bitwise-or/S11.10.3_A3_T2.7.js | 32 + .../expressions/bitwise-or/S11.10.3_A3_T2.8.js | 32 + .../expressions/bitwise-or/S11.10.3_A3_T2.9.js | 32 + .../expressions/bitwise-or/bigint-and-number.js | 92 + .../expressions/bitwise-or/bigint-errors.js | 72 + .../expressions/bitwise-or/bigint-non-primitive.js | 84 + .../expressions/bitwise-or/bigint-toprimitive.js | 374 +++ .../bitwise-or/bigint-wrapped-values.js | 47 + .../language/expressions/bitwise-or/bigint.js | 109 + .../language/expressions/bitwise-or/browser.js | 0 .../expressions/bitwise-or/order-of-evaluation.js | 140 ++ .../language/expressions/bitwise-or/shell.js | 0 .../expressions/bitwise-xor/S11.10.2_A1.js | 63 + .../expressions/bitwise-xor/S11.10.2_A2.1_T1.js | 43 + .../expressions/bitwise-xor/S11.10.2_A2.1_T2.js | 21 + .../expressions/bitwise-xor/S11.10.2_A2.1_T3.js | 21 + .../expressions/bitwise-xor/S11.10.2_A2.2_T1.js | 71 + .../expressions/bitwise-xor/S11.10.2_A2.3_T1.js | 28 + .../expressions/bitwise-xor/S11.10.2_A2.4_T1.js | 22 + .../expressions/bitwise-xor/S11.10.2_A2.4_T2.js | 26 + .../expressions/bitwise-xor/S11.10.2_A2.4_T3.js | 27 + .../expressions/bitwise-xor/S11.10.2_A3_T1.1.js | 30 + .../expressions/bitwise-xor/S11.10.2_A3_T1.2.js | 30 + .../expressions/bitwise-xor/S11.10.2_A3_T1.3.js | 40 + .../expressions/bitwise-xor/S11.10.2_A3_T1.4.js | 30 + .../expressions/bitwise-xor/S11.10.2_A3_T1.5.js | 30 + .../expressions/bitwise-xor/S11.10.2_A3_T2.1.js | 52 + .../expressions/bitwise-xor/S11.10.2_A3_T2.2.js | 62 + .../expressions/bitwise-xor/S11.10.2_A3_T2.3.js | 32 + .../expressions/bitwise-xor/S11.10.2_A3_T2.4.js | 32 + .../expressions/bitwise-xor/S11.10.2_A3_T2.5.js | 52 + .../expressions/bitwise-xor/S11.10.2_A3_T2.6.js | 32 + .../expressions/bitwise-xor/S11.10.2_A3_T2.7.js | 32 + .../expressions/bitwise-xor/S11.10.2_A3_T2.8.js | 32 + .../expressions/bitwise-xor/S11.10.2_A3_T2.9.js | 32 + .../expressions/bitwise-xor/bigint-and-number.js | 92 + .../expressions/bitwise-xor/bigint-errors.js | 72 + .../bitwise-xor/bigint-non-primitive.js | 84 + .../expressions/bitwise-xor/bigint-toprimitive.js | 374 +++ .../bitwise-xor/bigint-wrapped-values.js | 47 + .../language/expressions/bitwise-xor/bigint.js | 109 + .../language/expressions/bitwise-xor/browser.js | 0 .../expressions/bitwise-xor/order-of-evaluation.js | 140 ++ .../language/expressions/bitwise-xor/shell.js | 0 .../tests/test262/language/expressions/browser.js | 0 .../language/expressions/call/11.2.3-3_1.js | 21 + .../language/expressions/call/11.2.3-3_2.js | 21 + .../language/expressions/call/11.2.3-3_3.js | 21 + .../language/expressions/call/11.2.3-3_4.js | 25 + .../language/expressions/call/11.2.3-3_5.js | 21 + .../language/expressions/call/11.2.3-3_6.js | 21 + .../language/expressions/call/11.2.3-3_7.js | 21 + .../language/expressions/call/11.2.3-3_8.js | 20 + .../language/expressions/call/S11.2.3_A1.js | 62 + .../language/expressions/call/S11.2.3_A2.js | 32 + .../language/expressions/call/S11.2.3_A3_T1.js | 33 + .../language/expressions/call/S11.2.3_A3_T2.js | 33 + .../language/expressions/call/S11.2.3_A3_T3.js | 33 + .../language/expressions/call/S11.2.3_A3_T4.js | 33 + .../language/expressions/call/S11.2.3_A3_T5.js | 33 + .../language/expressions/call/S11.2.3_A4_T1.js | 35 + .../language/expressions/call/S11.2.3_A4_T2.js | 35 + .../language/expressions/call/S11.2.3_A4_T3.js | 35 + .../language/expressions/call/S11.2.3_A4_T4.js | 23 + .../language/expressions/call/S11.2.3_A4_T5.js | 23 + .../language/expressions/call/S11.2.4_A1.1_T1.js | 24 + .../language/expressions/call/S11.2.4_A1.1_T2.js | 29 + .../language/expressions/call/S11.2.4_A1.2_T1.js | 39 + .../language/expressions/call/S11.2.4_A1.2_T2.js | 44 + .../language/expressions/call/S11.2.4_A1.3_T1.js | 21 + .../language/expressions/call/S11.2.4_A1.4_T1.js | 22 + .../language/expressions/call/S11.2.4_A1.4_T2.js | 29 + .../language/expressions/call/S11.2.4_A1.4_T3.js | 25 + .../language/expressions/call/S11.2.4_A1.4_T4.js | 36 + .../test262/language/expressions/call/browser.js | 0 .../language/expressions/call/eval-err-args.js | 25 + .../language/expressions/call/eval-first-arg.js | 19 + .../language/expressions/call/eval-no-args.js | 17 + .../expressions/call/eval-realm-indirect.js | 30 + .../expressions/call/eval-spread-empty-leading.js | 43 + .../expressions/call/eval-spread-empty-trailing.js | 43 + .../language/expressions/call/eval-spread-empty.js | 36 + .../language/expressions/call/eval-spread.js | 51 + .../call/eval-strictness-inherit-non-strict.js | 32 + .../call/eval-strictness-inherit-strict-strict.js | 31 + .../language/expressions/call/scope-lex-close.js | 32 + .../language/expressions/call/scope-lex-open.js | 41 + .../language/expressions/call/scope-var-close.js | 31 + .../language/expressions/call/scope-var-open.js | 43 + .../test262/language/expressions/call/shell.js | 0 .../call/spread-err-mult-err-expr-throws.js | 37 + .../call/spread-err-mult-err-iter-get-value.js | 48 + .../call/spread-err-mult-err-itr-get-call.js | 46 + .../call/spread-err-mult-err-itr-get-get.js | 47 + .../call/spread-err-mult-err-itr-step.js | 56 + .../call/spread-err-mult-err-itr-value.js | 59 + .../call/spread-err-mult-err-obj-unresolvable.js | 38 + .../call/spread-err-mult-err-unresolvable.js | 42 + .../call/spread-err-sngl-err-expr-throws.js | 37 + .../call/spread-err-sngl-err-itr-get-call.js | 47 + .../call/spread-err-sngl-err-itr-get-get.js | 48 + .../call/spread-err-sngl-err-itr-get-value.js | 47 + .../call/spread-err-sngl-err-itr-step.js | 60 + .../call/spread-err-sngl-err-itr-value.js | 66 + .../call/spread-err-sngl-err-obj-unresolvable.js | 38 + .../call/spread-err-sngl-err-unresolvable.js | 43 + .../language/expressions/call/spread-mult-empty.js | 47 + .../language/expressions/call/spread-mult-expr.js | 52 + .../language/expressions/call/spread-mult-iter.js | 64 + .../expressions/call/spread-mult-literal.js | 49 + .../expressions/call/spread-mult-obj-ident.js | 74 + .../expressions/call/spread-mult-obj-null.js | 45 + .../expressions/call/spread-mult-obj-undefined.js | 45 + .../call/spread-obj-getter-descriptor.js | 59 + .../expressions/call/spread-obj-getter-init.js | 39 + .../spread-obj-manipulate-outter-obj-in-getter.js | 53 + .../call/spread-obj-mult-spread-getter.js | 53 + .../expressions/call/spread-obj-mult-spread.js | 51 + .../language/expressions/call/spread-obj-null.js | 43 + .../call/spread-obj-override-immutable.js | 52 + .../call/spread-obj-overrides-prev-properties.js | 49 + .../call/spread-obj-skip-non-enumerable.js | 37 + .../expressions/call/spread-obj-spread-order.js | 50 + .../expressions/call/spread-obj-symbol-property.js | 51 + .../expressions/call/spread-obj-undefined.js | 43 + .../expressions/call/spread-obj-with-overrides.js | 55 + .../language/expressions/call/spread-sngl-empty.js | 46 + .../language/expressions/call/spread-sngl-expr.js | 54 + .../language/expressions/call/spread-sngl-iter.js | 61 + .../expressions/call/spread-sngl-literal.js | 51 + .../expressions/call/spread-sngl-obj-ident.js | 60 + .../expressions/call/tco-call-args-strict.js | 24 + .../expressions/call/tco-member-args-strict.js | 23 + .../call/tco-non-eval-function-dynamic.js | 47 + .../expressions/call/tco-non-eval-function.js | 47 + .../expressions/call/tco-non-eval-global.js | 46 + .../language/expressions/call/tco-non-eval-with.js | 49 + .../language/expressions/call/trailing-comma.js | 14 + .../language/expressions/call/with-base-obj.js | 37 + .../class/accessor-name-inst-computed-in.js | 39 + .../accessor-name-inst-computed-yield-expr.js | 43 + .../class/accessor-name-inst/browser.js | 0 .../accessor-name-inst/computed-err-evaluation.js | 41 + .../accessor-name-inst/computed-err-to-prop-key.js | 57 + .../computed-err-unresolvable.js | 39 + .../class/accessor-name-inst/computed.js | 42 + .../accessor-name-inst/literal-numeric-binary.js | 40 + .../accessor-name-inst/literal-numeric-exponent.js | 40 + .../accessor-name-inst/literal-numeric-hex.js | 40 + .../literal-numeric-leading-decimal.js | 40 + .../literal-numeric-non-canonical.js | 40 + .../accessor-name-inst/literal-numeric-octal.js | 40 + .../accessor-name-inst/literal-numeric-zero.js | 40 + .../literal-string-char-escape.js | 40 + .../literal-string-default-escaped-ext.js | 40 + .../literal-string-default-escaped.js | 40 + .../accessor-name-inst/literal-string-default.js | 40 + .../literal-string-double-quote.js | 40 + .../accessor-name-inst/literal-string-empty.js | 40 + .../literal-string-hex-escape.js | 40 + .../literal-string-line-continuation.js | 42 + .../literal-string-single-quote.js | 40 + .../literal-string-unicode-escape.js | 40 + .../expressions/class/accessor-name-inst/shell.js | 0 .../class/accessor-name-static-computed-in.js | 41 + .../accessor-name-static-computed-yield-expr.js | 45 + .../class/accessor-name-static/browser.js | 0 .../computed-err-evaluation.js | 43 + .../computed-err-to-prop-key.js | 59 + .../computed-err-unresolvable.js | 41 + .../class/accessor-name-static/computed.js | 44 + .../accessor-name-static/literal-numeric-binary.js | 42 + .../literal-numeric-exponent.js | 42 + .../accessor-name-static/literal-numeric-hex.js | 42 + .../literal-numeric-leading-decimal.js | 42 + .../literal-numeric-non-canonical.js | 42 + .../accessor-name-static/literal-numeric-octal.js | 42 + .../accessor-name-static/literal-numeric-zero.js | 42 + .../literal-string-char-escape.js | 42 + .../literal-string-default-escaped-ext.js | 42 + .../literal-string-default-escaped.js | 42 + .../accessor-name-static/literal-string-default.js | 42 + .../literal-string-double-quote.js | 42 + .../accessor-name-static/literal-string-empty.js | 42 + .../literal-string-hex-escape.js | 42 + .../literal-string-line-continuation.js | 44 + .../literal-string-single-quote.js | 42 + .../literal-string-unicode-escape.js | 42 + .../class/accessor-name-static/shell.js | 0 .../array-destructuring-param-strict-body.js | 138 + .../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 + .../class/async-gen-method-static/browser.js | 0 .../async-gen-method-static/dflt-params-abrupt.js | 68 + .../dflt-params-arg-val-not-undefined.js | 92 + .../dflt-params-arg-val-undefined.js | 75 + .../dflt-params-duplicates.js | 67 + .../dflt-params-ref-later.js | 69 + .../dflt-params-ref-prior.js | 72 + .../dflt-params-ref-self.js | 69 + .../async-gen-method-static/dflt-params-rest.js | 71 + .../dflt-params-trailing-comma.js | 67 + .../forbidden-ext/b1/browser.js | 0 ...c-forbidden-ext-direct-access-prop-arguments.js | 38 + ...atic-forbidden-ext-direct-access-prop-caller.js | 38 + .../forbidden-ext/b1/shell.js | 0 .../forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 64 + ...en-ext-indirect-access-own-prop-caller-value.js | 64 + ...ic-forbidden-ext-indirect-access-prop-caller.js | 64 + .../forbidden-ext/b2/shell.js | 0 .../forbidden-ext/browser.js | 0 .../async-gen-method-static/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 138 + .../params-trailing-comma-multiple.js | 67 + .../params-trailing-comma-single.js | 66 + .../rest-param-strict-body.js | 138 + .../rest-params-trailing-comma-early-error.js | 64 + .../class/async-gen-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 | 55 + .../yield-identifier-strict-strict.js | 46 + .../yield-promise-reject-next-catch.js | 51 + ...mise-reject-next-for-await-of-async-iterator.js | 57 + ...omise-reject-next-for-await-of-sync-iterator.js | 56 + ...romise-reject-next-yield-star-async-iterator.js | 55 + ...promise-reject-next-yield-star-sync-iterator.js | 54 + .../yield-promise-reject-next.js | 51 + .../yield-spread-arr-multiple.js | 57 + .../yield-spread-arr-single.js | 56 + .../async-gen-method-static/yield-spread-obj.js | 59 + .../yield-star-async-next.js | 226 ++ .../yield-star-async-return.js | 242 ++ .../yield-star-async-throw.js | 250 ++ .../yield-star-expr-abrupt.js | 61 + .../yield-star-getiter-async-get-abrupt.js | 81 + ...tar-getiter-async-not-callable-boolean-throw.js | 80 + ...star-getiter-async-not-callable-number-throw.js | 80 + ...star-getiter-async-not-callable-object-throw.js | 80 + ...star-getiter-async-not-callable-string-throw.js | 80 + ...star-getiter-async-not-callable-symbol-throw.js | 80 + ...ield-star-getiter-async-null-sync-get-abrupt.js | 86 + .../yield-star-getiter-async-returns-abrupt.js | 77 + ...eld-star-getiter-async-returns-boolean-throw.js | 77 + .../yield-star-getiter-async-returns-null-throw.js | 77 + ...ield-star-getiter-async-returns-number-throw.js | 77 + ...ield-star-getiter-async-returns-string-throw.js | 77 + ...ield-star-getiter-async-returns-symbol-throw.js | 77 + ...d-star-getiter-async-returns-undefined-throw.js | 77 + ...star-getiter-async-undefined-sync-get-abrupt.js | 86 + .../yield-star-getiter-sync-get-abrupt.js | 80 + ...star-getiter-sync-not-callable-boolean-throw.js | 79 + ...-star-getiter-sync-not-callable-number-throw.js | 79 + ...-star-getiter-sync-not-callable-object-throw.js | 79 + ...-star-getiter-sync-not-callable-string-throw.js | 79 + ...-star-getiter-sync-not-callable-symbol-throw.js | 79 + .../yield-star-getiter-sync-returns-abrupt.js | 74 + ...ield-star-getiter-sync-returns-boolean-throw.js | 79 + .../yield-star-getiter-sync-returns-null-throw.js | 79 + ...yield-star-getiter-sync-returns-number-throw.js | 79 + ...yield-star-getiter-sync-returns-string-throw.js | 79 + ...yield-star-getiter-sync-returns-symbol-throw.js | 79 + ...ld-star-getiter-sync-returns-undefined-throw.js | 79 + .../yield-star-next-call-done-get-abrupt.js | 80 + .../yield-star-next-call-returns-abrupt.js | 72 + .../yield-star-next-call-value-get-abrupt.js | 82 + .../yield-star-next-get-abrupt.js | 72 + .../yield-star-next-non-object-ignores-then.js | 92 + .../yield-star-next-not-callable-boolean-throw.js | 69 + .../yield-star-next-not-callable-null-throw.js | 69 + .../yield-star-next-not-callable-number-throw.js | 69 + .../yield-star-next-not-callable-object-throw.js | 69 + .../yield-star-next-not-callable-string-throw.js | 69 + .../yield-star-next-not-callable-symbol-throw.js | 69 + ...yield-star-next-not-callable-undefined-throw.js | 69 + .../yield-star-next-then-get-abrupt.js | 96 + ...ext-then-non-callable-boolean-fulfillpromise.js | 90 + ...r-next-then-non-callable-null-fulfillpromise.js | 90 + ...next-then-non-callable-number-fulfillpromise.js | 90 + ...next-then-non-callable-object-fulfillpromise.js | 90 + ...next-then-non-callable-string-fulfillpromise.js | 90 + ...next-then-non-callable-symbol-fulfillpromise.js | 90 + ...t-then-non-callable-undefined-fulfillpromise.js | 90 + .../yield-star-next-then-returns-abrupt.js | 96 + .../yield-star-sync-next.js | 229 ++ .../yield-star-sync-return.js | 204 ++ .../yield-star-sync-throw.js | 210 ++ .../array-destructuring-param-strict-body.js | 138 + .../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 + .../async-gen-method/await-as-label-identifier.js | 37 + .../expressions/class/async-gen-method/browser.js | 0 .../class/async-gen-method/dflt-params-abrupt.js | 89 + .../dflt-params-arg-val-not-undefined.js | 93 + .../dflt-params-arg-val-undefined.js | 76 + .../async-gen-method/dflt-params-duplicates.js | 67 + .../async-gen-method/dflt-params-ref-later.js | 90 + .../async-gen-method/dflt-params-ref-prior.js | 73 + .../class/async-gen-method/dflt-params-ref-self.js | 90 + .../class/async-gen-method/dflt-params-rest.js | 71 + .../async-gen-method/dflt-params-trailing-comma.js | 68 + .../async-gen-method/forbidden-ext/b1/browser.js | 0 ...h-forbidden-ext-direct-access-prop-arguments.js | 38 + ...meth-forbidden-ext-direct-access-prop-caller.js | 38 + .../async-gen-method/forbidden-ext/b1/shell.js | 0 .../async-gen-method/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 64 + ...en-ext-indirect-access-own-prop-caller-value.js | 64 + ...th-forbidden-ext-indirect-access-prop-caller.js | 64 + .../async-gen-method/forbidden-ext/b2/shell.js | 0 .../async-gen-method/forbidden-ext/browser.js | 0 .../class/async-gen-method/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 138 + .../params-trailing-comma-multiple.js | 68 + .../params-trailing-comma-single.js | 67 + .../async-gen-method/rest-param-strict-body.js | 138 + .../rest-params-trailing-comma-early-error.js | 64 + .../expressions/class/async-gen-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 + .../async-gen-method/yield-as-label-identifier.js | 37 + .../yield-identifier-spread-strict-strict.js | 55 + .../yield-identifier-strict-strict.js | 46 + .../yield-promise-reject-next-catch.js | 51 + ...mise-reject-next-for-await-of-async-iterator.js | 57 + ...omise-reject-next-for-await-of-sync-iterator.js | 56 + ...romise-reject-next-yield-star-async-iterator.js | 55 + ...promise-reject-next-yield-star-sync-iterator.js | 54 + .../async-gen-method/yield-promise-reject-next.js | 51 + .../async-gen-method/yield-spread-arr-multiple.js | 57 + .../async-gen-method/yield-spread-arr-single.js | 56 + .../class/async-gen-method/yield-spread-obj.js | 59 + .../async-gen-method/yield-star-async-next.js | 226 ++ .../async-gen-method/yield-star-async-return.js | 242 ++ .../async-gen-method/yield-star-async-throw.js | 250 ++ .../async-gen-method/yield-star-expr-abrupt.js | 61 + .../yield-star-getiter-async-get-abrupt.js | 81 + ...tar-getiter-async-not-callable-boolean-throw.js | 80 + ...star-getiter-async-not-callable-number-throw.js | 80 + ...star-getiter-async-not-callable-object-throw.js | 80 + ...star-getiter-async-not-callable-string-throw.js | 80 + ...star-getiter-async-not-callable-symbol-throw.js | 80 + ...ield-star-getiter-async-null-sync-get-abrupt.js | 86 + .../yield-star-getiter-async-returns-abrupt.js | 77 + ...eld-star-getiter-async-returns-boolean-throw.js | 77 + .../yield-star-getiter-async-returns-null-throw.js | 77 + ...ield-star-getiter-async-returns-number-throw.js | 77 + ...ield-star-getiter-async-returns-string-throw.js | 77 + ...ield-star-getiter-async-returns-symbol-throw.js | 77 + ...d-star-getiter-async-returns-undefined-throw.js | 77 + ...star-getiter-async-undefined-sync-get-abrupt.js | 86 + .../yield-star-getiter-sync-get-abrupt.js | 80 + ...star-getiter-sync-not-callable-boolean-throw.js | 79 + ...-star-getiter-sync-not-callable-number-throw.js | 79 + ...-star-getiter-sync-not-callable-object-throw.js | 79 + ...-star-getiter-sync-not-callable-string-throw.js | 79 + ...-star-getiter-sync-not-callable-symbol-throw.js | 79 + .../yield-star-getiter-sync-returns-abrupt.js | 74 + ...ield-star-getiter-sync-returns-boolean-throw.js | 79 + .../yield-star-getiter-sync-returns-null-throw.js | 79 + ...yield-star-getiter-sync-returns-number-throw.js | 79 + ...yield-star-getiter-sync-returns-string-throw.js | 79 + ...yield-star-getiter-sync-returns-symbol-throw.js | 79 + ...ld-star-getiter-sync-returns-undefined-throw.js | 79 + .../yield-star-next-call-done-get-abrupt.js | 80 + .../yield-star-next-call-returns-abrupt.js | 72 + .../yield-star-next-call-value-get-abrupt.js | 82 + .../async-gen-method/yield-star-next-get-abrupt.js | 72 + .../yield-star-next-non-object-ignores-then.js | 92 + .../yield-star-next-not-callable-boolean-throw.js | 69 + .../yield-star-next-not-callable-null-throw.js | 69 + .../yield-star-next-not-callable-number-throw.js | 69 + .../yield-star-next-not-callable-object-throw.js | 69 + .../yield-star-next-not-callable-string-throw.js | 69 + .../yield-star-next-not-callable-symbol-throw.js | 69 + ...yield-star-next-not-callable-undefined-throw.js | 69 + .../yield-star-next-then-get-abrupt.js | 96 + ...ext-then-non-callable-boolean-fulfillpromise.js | 90 + ...r-next-then-non-callable-null-fulfillpromise.js | 90 + ...next-then-non-callable-number-fulfillpromise.js | 90 + ...next-then-non-callable-object-fulfillpromise.js | 90 + ...next-then-non-callable-string-fulfillpromise.js | 90 + ...next-then-non-callable-symbol-fulfillpromise.js | 90 + ...t-then-non-callable-undefined-fulfillpromise.js | 90 + .../yield-star-next-then-returns-abrupt.js | 96 + .../class/async-gen-method/yield-star-sync-next.js | 229 ++ .../async-gen-method/yield-star-sync-return.js | 204 ++ .../async-gen-method/yield-star-sync-throw.js | 210 ++ .../array-destructuring-param-strict-body.js | 136 + .../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/async-method-static/browser.js | 0 .../async-method-static/dflt-params-abrupt.js | 71 + .../dflt-params-arg-val-not-undefined.js | 90 + .../dflt-params-arg-val-undefined.js | 73 + .../async-method-static/dflt-params-duplicates.js | 65 + .../async-method-static/dflt-params-ref-later.js | 72 + .../async-method-static/dflt-params-ref-prior.js | 70 + .../async-method-static/dflt-params-ref-self.js | 72 + .../class/async-method-static/dflt-params-rest.js | 69 + .../dflt-params-trailing-comma.js | 65 + .../forbidden-ext/b1/browser.js | 0 ...c-forbidden-ext-direct-access-prop-arguments.js | 40 + ...atic-forbidden-ext-direct-access-prop-caller.js | 40 + .../async-method-static/forbidden-ext/b1/shell.js | 0 .../forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 66 + ...en-ext-indirect-access-own-prop-caller-value.js | 66 + ...ic-forbidden-ext-indirect-access-prop-caller.js | 66 + .../async-method-static/forbidden-ext/b2/shell.js | 0 .../async-method-static/forbidden-ext/browser.js | 0 .../async-method-static/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 136 + .../params-trailing-comma-multiple.js | 65 + .../params-trailing-comma-single.js | 64 + .../async-method-static/rest-param-strict-body.js | 136 + .../rest-params-trailing-comma-early-error.js | 61 + ...arrow-returns-arguments-from-parent-function.js | 41 + .../returns-async-arrow-returns-newtarget.js | 40 + .../async-method-static/returns-async-arrow.js | 40 + ...function-returns-arguments-from-own-function.js | 41 + .../returns-async-function-returns-newtarget.js | 40 + .../async-method-static/returns-async-function.js | 40 + .../expressions/class/async-method-static/shell.js | 0 .../array-destructuring-param-strict-body.js | 136 + .../await-as-binding-identifier-escaped.js | 40 + .../async-method/await-as-binding-identifier.js | 40 + .../await-as-identifier-reference-escaped.js | 40 + .../async-method/await-as-identifier-reference.js | 40 + .../await-as-label-identifier-escaped.js | 40 + .../async-method/await-as-label-identifier.js | 40 + .../expressions/class/async-method/browser.js | 0 .../class/async-method/dflt-params-abrupt.js | 70 + .../dflt-params-arg-val-not-undefined.js | 90 + .../async-method/dflt-params-arg-val-undefined.js | 73 + .../class/async-method/dflt-params-duplicates.js | 65 + .../class/async-method/dflt-params-ref-later.js | 71 + .../class/async-method/dflt-params-ref-prior.js | 70 + .../class/async-method/dflt-params-ref-self.js | 71 + .../class/async-method/dflt-params-rest.js | 69 + .../async-method/dflt-params-trailing-comma.js | 65 + .../class/async-method/forbidden-ext/b1/browser.js | 0 ...h-forbidden-ext-direct-access-prop-arguments.js | 39 + ...meth-forbidden-ext-direct-access-prop-caller.js | 39 + .../class/async-method/forbidden-ext/b1/shell.js | 0 .../class/async-method/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 65 + ...en-ext-indirect-access-own-prop-caller-value.js | 65 + ...th-forbidden-ext-indirect-access-prop-caller.js | 65 + .../class/async-method/forbidden-ext/b2/shell.js | 0 .../class/async-method/forbidden-ext/browser.js | 0 .../class/async-method/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 136 + .../async-method/params-trailing-comma-multiple.js | 65 + .../async-method/params-trailing-comma-single.js | 64 + .../class/async-method/rest-param-strict-body.js | 136 + .../rest-params-trailing-comma-early-error.js | 61 + ...arrow-returns-arguments-from-parent-function.js | 42 + .../returns-async-arrow-returns-newtarget.js | 41 + .../class/async-method/returns-async-arrow.js | 41 + ...function-returns-arguments-from-own-function.js | 42 + .../returns-async-function-returns-newtarget.js | 41 + .../class/async-method/returns-async-function.js | 41 + .../expressions/class/async-method/shell.js | 0 .../test262/language/expressions/class/browser.js | 0 .../class/class-name-ident-await-escaped-module.js | 24 + .../class/class-name-ident-await-escaped.js | 19 + .../class/class-name-ident-await-module.js | 23 + .../expressions/class/class-name-ident-await.js | 18 + .../class/class-name-ident-let-escaped.js | 28 + .../expressions/class/class-name-ident-let.js | 28 + .../class/class-name-ident-static-escaped.js | 28 + .../expressions/class/class-name-ident-static.js | 28 + .../class/class-name-ident-yield-escaped.js | 28 + .../expressions/class/class-name-ident-yield.js | 26 + .../constructor-this-tdz-during-initializers.js | 45 + ...d-property-name-from-additive-expression-add.js | 93 + ...perty-name-from-additive-expression-subtract.js | 93 + ...property-name-from-arrow-function-expression.js | 93 + ...y-name-from-assignment-expression-assignment.js | 96 + ...y-name-from-assignment-expression-bitwise-or.js | 96 + ...rty-name-from-assignment-expression-coalesce.js | 96 + ...-name-from-assignment-expression-logical-and.js | 96 + ...y-name-from-assignment-expression-logical-or.js | 96 + ...ty-name-from-async-arrow-function-expression.js | 93 + ...computed-property-name-from-await-expression.js | 98 + ...roperty-name-from-condition-expression-false.js | 93 + ...property-name-from-condition-expression-true.js | 93 + ...perty-name-from-decimal-e-notational-literal.js | 93 + ...-computed-property-name-from-decimal-literal.js | 93 + ...-property-name-from-exponetiation-expression.js | 93 + ...puted-property-name-from-expression-coalesce.js | 96 + ...ed-property-name-from-expression-logical-and.js | 96 + ...ted-property-name-from-expression-logical-or.js | 96 + ...uted-property-name-from-function-declaration.js | 94 + ...puted-property-name-from-function-expression.js | 93 + ...rty-name-from-generator-function-declaration.js | 94 + ...ssors-computed-property-name-from-identifier.js | 95 + ...perty-name-from-integer-e-notational-literal.js | 93 + ...mputed-property-name-from-integer-separators.js | 93 + ...r-accessors-computed-property-name-from-math.js | 93 + ...erty-name-from-multiplicative-expression-div.js | 93 + ...rty-name-from-multiplicative-expression-mult.js | 93 + ...r-accessors-computed-property-name-from-null.js | 93 + ...-computed-property-name-from-numeric-literal.js | 93 + ...s-computed-property-name-from-string-literal.js | 93 + ...computed-property-name-from-yield-expression.js | 98 + ...d-property-name-from-additive-expression-add.js | 66 + ...perty-name-from-additive-expression-subtract.js | 66 + ...property-name-from-arrow-function-expression.js | 66 + ...y-name-from-assignment-expression-assignment.js | 69 + ...y-name-from-assignment-expression-bitwise-or.js | 69 + ...rty-name-from-assignment-expression-coalesce.js | 69 + ...-name-from-assignment-expression-logical-and.js | 69 + ...y-name-from-assignment-expression-logical-or.js | 69 + ...ty-name-from-async-arrow-function-expression.js | 66 + ...computed-property-name-from-await-expression.js | 71 + ...roperty-name-from-condition-expression-false.js | 66 + ...property-name-from-condition-expression-true.js | 66 + ...perty-name-from-decimal-e-notational-literal.js | 66 + ...-computed-property-name-from-decimal-literal.js | 66 + ...-property-name-from-exponetiation-expression.js | 66 + ...puted-property-name-from-expression-coalesce.js | 69 + ...ed-property-name-from-expression-logical-and.js | 69 + ...ted-property-name-from-expression-logical-or.js | 69 + ...uted-property-name-from-function-declaration.js | 67 + ...puted-property-name-from-function-expression.js | 66 + ...rty-name-from-generator-function-declaration.js | 67 + ...-expr-computed-property-name-from-identifier.js | 68 + ...perty-name-from-integer-e-notational-literal.js | 66 + ...mputed-property-name-from-integer-separators.js | 66 + ...-class-expr-computed-property-name-from-math.js | 66 + ...erty-name-from-multiplicative-expression-div.js | 66 + ...rty-name-from-multiplicative-expression-mult.js | 66 + ...-class-expr-computed-property-name-from-null.js | 66 + ...-computed-property-name-from-numeric-literal.js | 66 + ...r-computed-property-name-from-string-literal.js | 66 + ...computed-property-name-from-yield-expression.js | 71 + ...d-property-name-from-additive-expression-add.js | 63 + ...perty-name-from-additive-expression-subtract.js | 63 + ...property-name-from-arrow-function-expression.js | 63 + ...y-name-from-assignment-expression-assignment.js | 66 + ...y-name-from-assignment-expression-bitwise-or.js | 66 + ...rty-name-from-assignment-expression-coalesce.js | 66 + ...-name-from-assignment-expression-logical-and.js | 66 + ...y-name-from-assignment-expression-logical-or.js | 66 + ...ty-name-from-async-arrow-function-expression.js | 63 + ...computed-property-name-from-await-expression.js | 68 + ...roperty-name-from-condition-expression-false.js | 63 + ...property-name-from-condition-expression-true.js | 63 + ...perty-name-from-decimal-e-notational-literal.js | 63 + ...-computed-property-name-from-decimal-literal.js | 63 + ...-property-name-from-exponetiation-expression.js | 63 + ...puted-property-name-from-expression-coalesce.js | 66 + ...ed-property-name-from-expression-logical-and.js | 66 + ...ted-property-name-from-expression-logical-or.js | 66 + ...uted-property-name-from-function-declaration.js | 64 + ...puted-property-name-from-function-expression.js | 63 + ...rty-name-from-generator-function-declaration.js | 64 + ...ields-computed-property-name-from-identifier.js | 65 + ...perty-name-from-integer-e-notational-literal.js | 63 + ...mputed-property-name-from-integer-separators.js | 63 + ...expr-fields-computed-property-name-from-math.js | 63 + ...erty-name-from-multiplicative-expression-div.js | 63 + ...rty-name-from-multiplicative-expression-mult.js | 63 + ...expr-fields-computed-property-name-from-null.js | 63 + ...-computed-property-name-from-numeric-literal.js | 63 + ...s-computed-property-name-from-string-literal.js | 63 + ...computed-property-name-from-yield-expression.js | 68 + ...d-property-name-from-additive-expression-add.js | 67 + ...perty-name-from-additive-expression-subtract.js | 67 + ...property-name-from-arrow-function-expression.js | 67 + ...y-name-from-assignment-expression-assignment.js | 70 + ...y-name-from-assignment-expression-bitwise-or.js | 70 + ...rty-name-from-assignment-expression-coalesce.js | 70 + ...-name-from-assignment-expression-logical-and.js | 70 + ...y-name-from-assignment-expression-logical-or.js | 70 + ...ty-name-from-async-arrow-function-expression.js | 67 + ...computed-property-name-from-await-expression.js | 72 + ...roperty-name-from-condition-expression-false.js | 67 + ...property-name-from-condition-expression-true.js | 67 + ...perty-name-from-decimal-e-notational-literal.js | 67 + ...-computed-property-name-from-decimal-literal.js | 67 + ...-property-name-from-exponetiation-expression.js | 67 + ...puted-property-name-from-expression-coalesce.js | 70 + ...ed-property-name-from-expression-logical-and.js | 70 + ...ted-property-name-from-expression-logical-or.js | 70 + ...uted-property-name-from-function-declaration.js | 68 + ...puted-property-name-from-function-expression.js | 67 + ...rty-name-from-generator-function-declaration.js | 68 + ...thods-computed-property-name-from-identifier.js | 69 + ...perty-name-from-integer-e-notational-literal.js | 67 + ...mputed-property-name-from-integer-separators.js | 67 + ...lds-methods-computed-property-name-from-math.js | 67 + ...erty-name-from-multiplicative-expression-div.js | 67 + ...rty-name-from-multiplicative-expression-mult.js | 67 + ...lds-methods-computed-property-name-from-null.js | 67 + ...-computed-property-name-from-numeric-literal.js | 67 + ...s-computed-property-name-from-string-literal.js | 67 + ...computed-property-name-from-yield-expression.js | 72 + .../expressions/class/decorator/browser.js | 0 .../language/expressions/class/decorator/shell.js | 0 .../expressions/class/decorator/syntax/browser.js | 0 .../class/decorator/syntax/class-valid/browser.js | 0 .../decorator-member-expr-private-identifier.js | 58 + .../class/decorator/syntax/class-valid/shell.js | 0 .../expressions/class/decorator/syntax/shell.js | 0 .../class/decorator/syntax/valid/browser.js | 0 ...corator-call-expr-identifier-reference-yield.js | 47 + .../decorator-call-expr-identifier-reference.js | 60 + .../decorator-member-expr-decorator-member-expr.js | 53 + ...rator-member-expr-identifier-reference-yield.js | 36 + .../decorator-member-expr-identifier-reference.js | 49 + ...arenthesized-expr-identifier-reference-yield.js | 54 + ...ator-parenthesized-expr-identifier-reference.js | 62 + .../class/decorator/syntax/valid/shell.js | 0 .../dstr/async-gen-meth-ary-init-iter-close.js | 79 + ...n-meth-ary-init-iter-get-err-array-prototype.js | 74 + .../dstr/async-gen-meth-ary-init-iter-get-err.js | 68 + .../dstr/async-gen-meth-ary-init-iter-no-close.js | 79 + .../class/dstr/async-gen-meth-ary-name-iter-val.js | 78 + .../async-gen-meth-ary-ptrn-elem-ary-elem-init.js | 70 + .../async-gen-meth-ary-ptrn-elem-ary-elem-iter.js | 71 + ...sync-gen-meth-ary-ptrn-elem-ary-elision-init.js | 77 + ...sync-gen-meth-ary-ptrn-elem-ary-elision-iter.js | 74 + .../async-gen-meth-ary-ptrn-elem-ary-empty-init.js | 73 + .../async-gen-meth-ary-ptrn-elem-ary-empty-iter.js | 70 + .../async-gen-meth-ary-ptrn-elem-ary-rest-init.js | 74 + .../async-gen-meth-ary-ptrn-elem-ary-rest-iter.js | 77 + .../async-gen-meth-ary-ptrn-elem-ary-val-null.js | 75 + ...ync-gen-meth-ary-ptrn-elem-id-init-exhausted.js | 69 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 70 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-class.js | 72 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js | 71 + ...nc-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js | 71 + ...c-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js | 72 + .../async-gen-meth-ary-ptrn-elem-id-init-hole.js | 65 + ...async-gen-meth-ary-ptrn-elem-id-init-skipped.js | 74 + .../async-gen-meth-ary-ptrn-elem-id-init-throws.js | 66 + .../async-gen-meth-ary-ptrn-elem-id-init-undef.js | 68 + ...-gen-meth-ary-ptrn-elem-id-init-unresolvable.js | 73 + ...sync-gen-meth-ary-ptrn-elem-id-iter-complete.js | 72 + .../async-gen-meth-ary-ptrn-elem-id-iter-done.js | 67 + ...sync-gen-meth-ary-ptrn-elem-id-iter-step-err.js | 75 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 88 + ...async-gen-meth-ary-ptrn-elem-id-iter-val-err.js | 86 + .../async-gen-meth-ary-ptrn-elem-id-iter-val.js | 78 + .../async-gen-meth-ary-ptrn-elem-obj-id-init.js | 70 + .../dstr/async-gen-meth-ary-ptrn-elem-obj-id.js | 70 + ...sync-gen-meth-ary-ptrn-elem-obj-prop-id-init.js | 80 + .../async-gen-meth-ary-ptrn-elem-obj-prop-id.js | 80 + .../async-gen-meth-ary-ptrn-elem-obj-val-null.js | 75 + .../async-gen-meth-ary-ptrn-elem-obj-val-undef.js | 75 + .../async-gen-meth-ary-ptrn-elision-exhausted.js | 75 + .../async-gen-meth-ary-ptrn-elision-step-err.js | 82 + .../class/dstr/async-gen-meth-ary-ptrn-elision.js | 84 + .../class/dstr/async-gen-meth-ary-ptrn-empty.js | 67 + .../dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js | 91 + .../async-gen-meth-ary-ptrn-rest-ary-elision.js | 97 + .../dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js | 80 + .../dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js | 76 + .../dstr/async-gen-meth-ary-ptrn-rest-id-direct.js | 71 + ...c-gen-meth-ary-ptrn-rest-id-elision-next-err.js | 68 + .../async-gen-meth-ary-ptrn-rest-id-elision.js | 72 + .../async-gen-meth-ary-ptrn-rest-id-exhausted.js | 68 + ...sync-gen-meth-ary-ptrn-rest-id-iter-step-err.js | 79 + ...async-gen-meth-ary-ptrn-rest-id-iter-val-err.js | 81 + .../class/dstr/async-gen-meth-ary-ptrn-rest-id.js | 69 + .../dstr/async-gen-meth-ary-ptrn-rest-init-ary.js | 66 + .../dstr/async-gen-meth-ary-ptrn-rest-init-id.js | 66 + .../dstr/async-gen-meth-ary-ptrn-rest-init-obj.js | 66 + .../async-gen-meth-ary-ptrn-rest-not-final-ary.js | 66 + .../async-gen-meth-ary-ptrn-rest-not-final-id.js | 66 + .../async-gen-meth-ary-ptrn-rest-not-final-obj.js | 66 + .../dstr/async-gen-meth-ary-ptrn-rest-obj-id.js | 69 + .../async-gen-meth-ary-ptrn-rest-obj-prop-id.js | 76 + .../async-gen-meth-dflt-ary-init-iter-close.js | 79 + ...h-dflt-ary-init-iter-get-err-array-prototype.js | 74 + .../async-gen-meth-dflt-ary-init-iter-get-err.js | 68 + .../async-gen-meth-dflt-ary-init-iter-no-close.js | 79 + .../dstr/async-gen-meth-dflt-ary-name-iter-val.js | 78 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js | 70 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 71 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js | 77 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 74 + ...c-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js | 73 + ...c-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 70 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js | 74 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 77 + ...ync-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js | 75 + ...en-meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 69 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 70 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 72 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 71 + ...n-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 71 + ...-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 72 + ...ync-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js | 65 + ...-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js | 74 + ...c-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js | 66 + ...nc-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js | 68 + ...meth-dflt-ary-ptrn-elem-id-init-unresolvable.js | 73 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js | 72 + ...ync-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js | 67 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js | 75 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 88 + ...-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js | 86 + ...sync-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js | 78 + ...sync-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js | 70 + .../async-gen-meth-dflt-ary-ptrn-elem-obj-id.js | 70 + ...gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 80 + ...sync-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js | 80 + ...ync-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js | 75 + ...nc-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js | 75 + ...ync-gen-meth-dflt-ary-ptrn-elision-exhausted.js | 75 + ...sync-gen-meth-dflt-ary-ptrn-elision-step-err.js | 82 + .../dstr/async-gen-meth-dflt-ary-ptrn-elision.js | 84 + .../dstr/async-gen-meth-dflt-ary-ptrn-empty.js | 67 + .../async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js | 91 + ...sync-gen-meth-dflt-ary-ptrn-rest-ary-elision.js | 97 + .../async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js | 80 + .../async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js | 76 + .../async-gen-meth-dflt-ary-ptrn-rest-id-direct.js | 71 + ...-meth-dflt-ary-ptrn-rest-id-elision-next-err.js | 68 + ...async-gen-meth-dflt-ary-ptrn-rest-id-elision.js | 72 + ...ync-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js | 68 + ...gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js | 79 + ...-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js | 81 + .../dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js | 69 + .../async-gen-meth-dflt-ary-ptrn-rest-init-ary.js | 66 + .../async-gen-meth-dflt-ary-ptrn-rest-init-id.js | 66 + .../async-gen-meth-dflt-ary-ptrn-rest-init-obj.js | 66 + ...nc-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js | 66 + ...ync-gen-meth-dflt-ary-ptrn-rest-not-final-id.js | 66 + ...nc-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js | 66 + .../async-gen-meth-dflt-ary-ptrn-rest-obj-id.js | 69 + ...sync-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js | 76 + .../dstr/async-gen-meth-dflt-obj-init-null.js | 62 + .../dstr/async-gen-meth-dflt-obj-init-undefined.js | 62 + .../dstr/async-gen-meth-dflt-obj-ptrn-empty.js | 68 + ...sync-gen-meth-dflt-obj-ptrn-id-get-value-err.js | 69 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 69 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js | 71 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 70 + ...nc-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 70 + ...c-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 71 + ...async-gen-meth-dflt-obj-ptrn-id-init-skipped.js | 73 + .../async-gen-meth-dflt-obj-ptrn-id-init-throws.js | 69 + ...-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js | 73 + ...ync-gen-meth-dflt-obj-ptrn-id-trailing-comma.js | 63 + .../dstr/async-gen-meth-dflt-obj-ptrn-list-err.js | 70 + .../async-gen-meth-dflt-obj-ptrn-prop-ary-init.js | 72 + ...n-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 63 + ...c-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js | 64 + .../dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js | 70 + .../async-gen-meth-dflt-obj-ptrn-prop-eval-err.js | 66 + ...gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js | 71 + ...-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js | 85 + ...c-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js | 69 + ...meth-dflt-obj-ptrn-prop-id-init-unresolvable.js | 73 + .../async-gen-meth-dflt-obj-ptrn-prop-id-init.js | 66 + ...en-meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 67 + .../dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js | 66 + .../async-gen-meth-dflt-obj-ptrn-prop-obj-init.js | 72 + ...c-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js | 64 + ...-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js | 64 + .../dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js | 70 + .../async-gen-meth-dflt-obj-ptrn-rest-getter.js | 65 + ...-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 73 + .../async-gen-meth-dflt-obj-ptrn-rest-val-obj.js | 72 + .../class/dstr/async-gen-meth-obj-init-null.js | 62 + .../dstr/async-gen-meth-obj-init-undefined.js | 62 + .../class/dstr/async-gen-meth-obj-ptrn-empty.js | 68 + .../async-gen-meth-obj-ptrn-id-get-value-err.js | 69 + ...sync-gen-meth-obj-ptrn-id-init-fn-name-arrow.js | 69 + ...sync-gen-meth-obj-ptrn-id-init-fn-name-class.js | 71 + ...sync-gen-meth-obj-ptrn-id-init-fn-name-cover.js | 70 + .../async-gen-meth-obj-ptrn-id-init-fn-name-fn.js | 70 + .../async-gen-meth-obj-ptrn-id-init-fn-name-gen.js | 71 + .../async-gen-meth-obj-ptrn-id-init-skipped.js | 73 + .../dstr/async-gen-meth-obj-ptrn-id-init-throws.js | 69 + ...async-gen-meth-obj-ptrn-id-init-unresolvable.js | 73 + .../async-gen-meth-obj-ptrn-id-trailing-comma.js | 63 + .../class/dstr/async-gen-meth-obj-ptrn-list-err.js | 70 + .../dstr/async-gen-meth-obj-ptrn-prop-ary-init.js | 72 + ...nc-gen-meth-obj-ptrn-prop-ary-trailing-comma.js | 63 + .../async-gen-meth-obj-ptrn-prop-ary-value-null.js | 64 + .../class/dstr/async-gen-meth-obj-ptrn-prop-ary.js | 70 + .../dstr/async-gen-meth-obj-ptrn-prop-eval-err.js | 66 + ...sync-gen-meth-obj-ptrn-prop-id-get-value-err.js | 71 + ...async-gen-meth-obj-ptrn-prop-id-init-skipped.js | 85 + .../async-gen-meth-obj-ptrn-prop-id-init-throws.js | 69 + ...-gen-meth-obj-ptrn-prop-id-init-unresolvable.js | 73 + .../dstr/async-gen-meth-obj-ptrn-prop-id-init.js | 66 + ...ync-gen-meth-obj-ptrn-prop-id-trailing-comma.js | 67 + .../class/dstr/async-gen-meth-obj-ptrn-prop-id.js | 66 + .../dstr/async-gen-meth-obj-ptrn-prop-obj-init.js | 72 + .../async-gen-meth-obj-ptrn-prop-obj-value-null.js | 64 + ...async-gen-meth-obj-ptrn-prop-obj-value-undef.js | 64 + .../class/dstr/async-gen-meth-obj-ptrn-prop-obj.js | 70 + .../dstr/async-gen-meth-obj-ptrn-rest-getter.js | 65 + ...c-gen-meth-obj-ptrn-rest-skip-non-enumerable.js | 73 + .../dstr/async-gen-meth-obj-ptrn-rest-val-obj.js | 72 + .../async-gen-meth-static-ary-init-iter-close.js | 79 + ...static-ary-init-iter-get-err-array-prototype.js | 74 + .../async-gen-meth-static-ary-init-iter-get-err.js | 68 + ...async-gen-meth-static-ary-init-iter-no-close.js | 79 + .../async-gen-meth-static-ary-name-iter-val.js | 78 + ...-gen-meth-static-ary-ptrn-elem-ary-elem-init.js | 70 + ...-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js | 71 + ...n-meth-static-ary-ptrn-elem-ary-elision-init.js | 77 + ...n-meth-static-ary-ptrn-elem-ary-elision-iter.js | 74 + ...gen-meth-static-ary-ptrn-elem-ary-empty-init.js | 73 + ...gen-meth-static-ary-ptrn-elem-ary-empty-iter.js | 70 + ...-gen-meth-static-ary-ptrn-elem-ary-rest-init.js | 74 + ...-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js | 77 + ...c-gen-meth-static-ary-ptrn-elem-ary-val-null.js | 75 + ...-meth-static-ary-ptrn-elem-id-init-exhausted.js | 69 + ...h-static-ary-ptrn-elem-id-init-fn-name-arrow.js | 70 + ...h-static-ary-ptrn-elem-id-init-fn-name-class.js | 72 + ...h-static-ary-ptrn-elem-id-init-fn-name-cover.js | 71 + ...meth-static-ary-ptrn-elem-id-init-fn-name-fn.js | 71 + ...eth-static-ary-ptrn-elem-id-init-fn-name-gen.js | 72 + ...c-gen-meth-static-ary-ptrn-elem-id-init-hole.js | 65 + ...en-meth-static-ary-ptrn-elem-id-init-skipped.js | 74 + ...gen-meth-static-ary-ptrn-elem-id-init-throws.js | 66 + ...-gen-meth-static-ary-ptrn-elem-id-init-undef.js | 68 + ...th-static-ary-ptrn-elem-id-init-unresolvable.js | 73 + ...n-meth-static-ary-ptrn-elem-id-iter-complete.js | 72 + ...c-gen-meth-static-ary-ptrn-elem-id-iter-done.js | 67 + ...n-meth-static-ary-ptrn-elem-id-iter-step-err.js | 75 + ...ic-ary-ptrn-elem-id-iter-val-array-prototype.js | 88 + ...en-meth-static-ary-ptrn-elem-id-iter-val-err.js | 86 + ...nc-gen-meth-static-ary-ptrn-elem-id-iter-val.js | 78 + ...nc-gen-meth-static-ary-ptrn-elem-obj-id-init.js | 70 + .../async-gen-meth-static-ary-ptrn-elem-obj-id.js | 70 + ...n-meth-static-ary-ptrn-elem-obj-prop-id-init.js | 80 + ...nc-gen-meth-static-ary-ptrn-elem-obj-prop-id.js | 80 + ...c-gen-meth-static-ary-ptrn-elem-obj-val-null.js | 75 + ...-gen-meth-static-ary-ptrn-elem-obj-val-undef.js | 75 + ...c-gen-meth-static-ary-ptrn-elision-exhausted.js | 75 + ...nc-gen-meth-static-ary-ptrn-elision-step-err.js | 82 + .../dstr/async-gen-meth-static-ary-ptrn-elision.js | 84 + .../dstr/async-gen-meth-static-ary-ptrn-empty.js | 67 + ...async-gen-meth-static-ary-ptrn-rest-ary-elem.js | 91 + ...nc-gen-meth-static-ary-ptrn-rest-ary-elision.js | 97 + ...sync-gen-meth-static-ary-ptrn-rest-ary-empty.js | 80 + ...async-gen-meth-static-ary-ptrn-rest-ary-rest.js | 76 + ...sync-gen-meth-static-ary-ptrn-rest-id-direct.js | 71 + ...eth-static-ary-ptrn-rest-id-elision-next-err.js | 68 + ...ync-gen-meth-static-ary-ptrn-rest-id-elision.js | 72 + ...c-gen-meth-static-ary-ptrn-rest-id-exhausted.js | 68 + ...n-meth-static-ary-ptrn-rest-id-iter-step-err.js | 79 + ...en-meth-static-ary-ptrn-rest-id-iter-val-err.js | 81 + .../dstr/async-gen-meth-static-ary-ptrn-rest-id.js | 69 + ...async-gen-meth-static-ary-ptrn-rest-init-ary.js | 66 + .../async-gen-meth-static-ary-ptrn-rest-init-id.js | 66 + ...async-gen-meth-static-ary-ptrn-rest-init-obj.js | 66 + ...-gen-meth-static-ary-ptrn-rest-not-final-ary.js | 66 + ...c-gen-meth-static-ary-ptrn-rest-not-final-id.js | 66 + ...-gen-meth-static-ary-ptrn-rest-not-final-obj.js | 66 + .../async-gen-meth-static-ary-ptrn-rest-obj-id.js | 69 + ...nc-gen-meth-static-ary-ptrn-rest-obj-prop-id.js | 76 + ...ync-gen-meth-static-dflt-ary-init-iter-close.js | 79 + ...c-dflt-ary-init-iter-get-err-array-prototype.js | 74 + ...c-gen-meth-static-dflt-ary-init-iter-get-err.js | 68 + ...-gen-meth-static-dflt-ary-init-iter-no-close.js | 79 + ...async-gen-meth-static-dflt-ary-name-iter-val.js | 78 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-init.js | 70 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js | 71 + ...h-static-dflt-ary-ptrn-elem-ary-elision-init.js | 77 + ...h-static-dflt-ary-ptrn-elem-ary-elision-iter.js | 74 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-init.js | 73 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-iter.js | 70 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-init.js | 74 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js | 77 + ...-meth-static-dflt-ary-ptrn-elem-ary-val-null.js | 75 + ...-static-dflt-ary-ptrn-elem-id-init-exhausted.js | 69 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 70 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 72 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 71 + ...static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 71 + ...tatic-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 72 + ...-meth-static-dflt-ary-ptrn-elem-id-init-hole.js | 65 + ...th-static-dflt-ary-ptrn-elem-id-init-skipped.js | 74 + ...eth-static-dflt-ary-ptrn-elem-id-init-throws.js | 66 + ...meth-static-dflt-ary-ptrn-elem-id-init-undef.js | 68 + ...atic-dflt-ary-ptrn-elem-id-init-unresolvable.js | 73 + ...h-static-dflt-ary-ptrn-elem-id-iter-complete.js | 72 + ...-meth-static-dflt-ary-ptrn-elem-id-iter-done.js | 67 + ...h-static-dflt-ary-ptrn-elem-id-iter-step-err.js | 75 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 88 + ...th-static-dflt-ary-ptrn-elem-id-iter-val-err.js | 86 + ...n-meth-static-dflt-ary-ptrn-elem-id-iter-val.js | 78 + ...n-meth-static-dflt-ary-ptrn-elem-obj-id-init.js | 70 + ...nc-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js | 70 + ...h-static-dflt-ary-ptrn-elem-obj-prop-id-init.js | 80 + ...n-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js | 80 + ...-meth-static-dflt-ary-ptrn-elem-obj-val-null.js | 75 + ...meth-static-dflt-ary-ptrn-elem-obj-val-undef.js | 75 + ...-meth-static-dflt-ary-ptrn-elision-exhausted.js | 75 + ...n-meth-static-dflt-ary-ptrn-elision-step-err.js | 82 + .../async-gen-meth-static-dflt-ary-ptrn-elision.js | 84 + .../async-gen-meth-static-dflt-ary-ptrn-empty.js | 67 + ...-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js | 91 + ...n-meth-static-dflt-ary-ptrn-rest-ary-elision.js | 97 + ...gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js | 80 + ...-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js | 76 + ...gen-meth-static-dflt-ary-ptrn-rest-id-direct.js | 71 + ...tatic-dflt-ary-ptrn-rest-id-elision-next-err.js | 68 + ...en-meth-static-dflt-ary-ptrn-rest-id-elision.js | 72 + ...-meth-static-dflt-ary-ptrn-rest-id-exhausted.js | 68 + ...h-static-dflt-ary-ptrn-rest-id-iter-step-err.js | 79 + ...th-static-dflt-ary-ptrn-rest-id-iter-val-err.js | 81 + .../async-gen-meth-static-dflt-ary-ptrn-rest-id.js | 69 + ...-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js | 66 + ...c-gen-meth-static-dflt-ary-ptrn-rest-init-id.js | 66 + ...-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js | 66 + ...meth-static-dflt-ary-ptrn-rest-not-final-ary.js | 66 + ...-meth-static-dflt-ary-ptrn-rest-not-final-id.js | 66 + ...meth-static-dflt-ary-ptrn-rest-not-final-obj.js | 66 + ...nc-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js | 69 + ...n-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js | 76 + .../async-gen-meth-static-dflt-obj-init-null.js | 62 + ...sync-gen-meth-static-dflt-obj-init-undefined.js | 62 + .../async-gen-meth-static-dflt-obj-ptrn-empty.js | 68 + ...n-meth-static-dflt-obj-ptrn-id-get-value-err.js | 69 + ...h-static-dflt-obj-ptrn-id-init-fn-name-arrow.js | 69 + ...h-static-dflt-obj-ptrn-id-init-fn-name-class.js | 71 + ...h-static-dflt-obj-ptrn-id-init-fn-name-cover.js | 70 + ...meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js | 70 + ...eth-static-dflt-obj-ptrn-id-init-fn-name-gen.js | 71 + ...en-meth-static-dflt-obj-ptrn-id-init-skipped.js | 73 + ...gen-meth-static-dflt-obj-ptrn-id-init-throws.js | 69 + ...th-static-dflt-obj-ptrn-id-init-unresolvable.js | 73 + ...-meth-static-dflt-obj-ptrn-id-trailing-comma.js | 63 + ...async-gen-meth-static-dflt-obj-ptrn-list-err.js | 70 + ...-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js | 72 + ...static-dflt-obj-ptrn-prop-ary-trailing-comma.js | 63 + ...eth-static-dflt-obj-ptrn-prop-ary-value-null.js | 64 + ...async-gen-meth-static-dflt-obj-ptrn-prop-ary.js | 70 + ...-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js | 66 + ...h-static-dflt-obj-ptrn-prop-id-get-value-err.js | 71 + ...th-static-dflt-obj-ptrn-prop-id-init-skipped.js | 85 + ...eth-static-dflt-obj-ptrn-prop-id-init-throws.js | 69 + ...atic-dflt-obj-ptrn-prop-id-init-unresolvable.js | 73 + ...c-gen-meth-static-dflt-obj-ptrn-prop-id-init.js | 66 + ...-static-dflt-obj-ptrn-prop-id-trailing-comma.js | 67 + .../async-gen-meth-static-dflt-obj-ptrn-prop-id.js | 66 + ...-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js | 72 + ...eth-static-dflt-obj-ptrn-prop-obj-value-null.js | 64 + ...th-static-dflt-obj-ptrn-prop-obj-value-undef.js | 64 + ...async-gen-meth-static-dflt-obj-ptrn-prop-obj.js | 70 + ...nc-gen-meth-static-dflt-obj-ptrn-rest-getter.js | 65 + ...tatic-dflt-obj-ptrn-rest-skip-non-enumerable.js | 73 + ...c-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js | 72 + .../dstr/async-gen-meth-static-obj-init-null.js | 62 + .../async-gen-meth-static-obj-init-undefined.js | 62 + .../dstr/async-gen-meth-static-obj-ptrn-empty.js | 68 + ...nc-gen-meth-static-obj-ptrn-id-get-value-err.js | 69 + ...n-meth-static-obj-ptrn-id-init-fn-name-arrow.js | 69 + ...n-meth-static-obj-ptrn-id-init-fn-name-class.js | 71 + ...n-meth-static-obj-ptrn-id-init-fn-name-cover.js | 70 + ...-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js | 70 + ...gen-meth-static-obj-ptrn-id-init-fn-name-gen.js | 71 + ...ync-gen-meth-static-obj-ptrn-id-init-skipped.js | 73 + ...sync-gen-meth-static-obj-ptrn-id-init-throws.js | 69 + ...en-meth-static-obj-ptrn-id-init-unresolvable.js | 73 + ...c-gen-meth-static-obj-ptrn-id-trailing-comma.js | 63 + .../async-gen-meth-static-obj-ptrn-list-err.js | 70 + ...async-gen-meth-static-obj-ptrn-prop-ary-init.js | 72 + ...meth-static-obj-ptrn-prop-ary-trailing-comma.js | 63 + ...gen-meth-static-obj-ptrn-prop-ary-value-null.js | 64 + .../async-gen-meth-static-obj-ptrn-prop-ary.js | 70 + ...async-gen-meth-static-obj-ptrn-prop-eval-err.js | 66 + ...n-meth-static-obj-ptrn-prop-id-get-value-err.js | 71 + ...en-meth-static-obj-ptrn-prop-id-init-skipped.js | 85 + ...gen-meth-static-obj-ptrn-prop-id-init-throws.js | 69 + ...th-static-obj-ptrn-prop-id-init-unresolvable.js | 73 + .../async-gen-meth-static-obj-ptrn-prop-id-init.js | 66 + ...-meth-static-obj-ptrn-prop-id-trailing-comma.js | 67 + .../dstr/async-gen-meth-static-obj-ptrn-prop-id.js | 66 + ...async-gen-meth-static-obj-ptrn-prop-obj-init.js | 72 + ...gen-meth-static-obj-ptrn-prop-obj-value-null.js | 64 + ...en-meth-static-obj-ptrn-prop-obj-value-undef.js | 64 + .../async-gen-meth-static-obj-ptrn-prop-obj.js | 70 + .../async-gen-meth-static-obj-ptrn-rest-getter.js | 65 + ...eth-static-obj-ptrn-rest-skip-non-enumerable.js | 73 + .../async-gen-meth-static-obj-ptrn-rest-val-obj.js | 72 + .../async-private-gen-meth-ary-init-iter-close.js | 83 + ...sync-private-gen-meth-ary-init-iter-no-close.js | 83 + .../async-private-gen-meth-ary-name-iter-val.js | 82 + ...private-gen-meth-ary-ptrn-elem-ary-elem-init.js | 74 + ...private-gen-meth-ary-ptrn-elem-ary-elem-iter.js | 75 + ...vate-gen-meth-ary-ptrn-elem-ary-elision-init.js | 81 + ...vate-gen-meth-ary-ptrn-elem-ary-elision-iter.js | 78 + ...rivate-gen-meth-ary-ptrn-elem-ary-empty-init.js | 77 + ...rivate-gen-meth-ary-ptrn-elem-ary-empty-iter.js | 74 + ...private-gen-meth-ary-ptrn-elem-ary-rest-init.js | 78 + ...private-gen-meth-ary-ptrn-elem-ary-rest-iter.js | 81 + ...ate-gen-meth-ary-ptrn-elem-id-init-exhausted.js | 73 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 74 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-class.js | 76 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js | 75 + ...te-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js | 75 + ...e-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js | 76 + ...-private-gen-meth-ary-ptrn-elem-id-init-hole.js | 69 + ...ivate-gen-meth-ary-ptrn-elem-id-init-skipped.js | 78 + ...private-gen-meth-ary-ptrn-elem-id-init-undef.js | 72 + ...vate-gen-meth-ary-ptrn-elem-id-iter-complete.js | 76 + ...-private-gen-meth-ary-ptrn-elem-id-iter-done.js | 71 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 92 + ...c-private-gen-meth-ary-ptrn-elem-id-iter-val.js | 82 + ...c-private-gen-meth-ary-ptrn-elem-obj-id-init.js | 74 + .../async-private-gen-meth-ary-ptrn-elem-obj-id.js | 74 + ...vate-gen-meth-ary-ptrn-elem-obj-prop-id-init.js | 84 + ...c-private-gen-meth-ary-ptrn-elem-obj-prop-id.js | 84 + ...-private-gen-meth-ary-ptrn-elision-exhausted.js | 79 + .../async-private-gen-meth-ary-ptrn-elision.js | 88 + .../dstr/async-private-gen-meth-ary-ptrn-empty.js | 71 + ...sync-private-gen-meth-ary-ptrn-rest-ary-elem.js | 95 + ...c-private-gen-meth-ary-ptrn-rest-ary-elision.js | 101 + ...ync-private-gen-meth-ary-ptrn-rest-ary-empty.js | 84 + ...sync-private-gen-meth-ary-ptrn-rest-ary-rest.js | 80 + ...ync-private-gen-meth-ary-ptrn-rest-id-direct.js | 75 + ...nc-private-gen-meth-ary-ptrn-rest-id-elision.js | 76 + ...-private-gen-meth-ary-ptrn-rest-id-exhausted.js | 72 + .../async-private-gen-meth-ary-ptrn-rest-id.js | 73 + ...sync-private-gen-meth-ary-ptrn-rest-init-ary.js | 70 + ...async-private-gen-meth-ary-ptrn-rest-init-id.js | 70 + ...sync-private-gen-meth-ary-ptrn-rest-init-obj.js | 70 + ...private-gen-meth-ary-ptrn-rest-not-final-ary.js | 70 + ...-private-gen-meth-ary-ptrn-rest-not-final-id.js | 70 + ...private-gen-meth-ary-ptrn-rest-not-final-obj.js | 70 + .../async-private-gen-meth-ary-ptrn-rest-obj-id.js | 73 + ...c-private-gen-meth-ary-ptrn-rest-obj-prop-id.js | 80 + ...nc-private-gen-meth-dflt-ary-init-iter-close.js | 83 + ...private-gen-meth-dflt-ary-init-iter-no-close.js | 83 + ...sync-private-gen-meth-dflt-ary-name-iter-val.js | 82 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js | 74 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 75 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js | 81 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 78 + ...e-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js | 77 + ...e-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 74 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js | 78 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 81 + ...en-meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 73 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 74 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 76 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 75 + ...n-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 75 + ...-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 76 + ...ate-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js | 69 + ...-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js | 78 + ...te-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js | 72 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js | 76 + ...ate-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js | 71 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 92 + ...vate-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js | 82 + ...vate-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js | 74 + ...c-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js | 74 + ...gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 84 + ...vate-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js | 84 + ...ate-gen-meth-dflt-ary-ptrn-elision-exhausted.js | 79 + ...async-private-gen-meth-dflt-ary-ptrn-elision.js | 88 + .../async-private-gen-meth-dflt-ary-ptrn-empty.js | 71 + ...private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js | 95 + ...vate-gen-meth-dflt-ary-ptrn-rest-ary-elision.js | 101 + ...rivate-gen-meth-dflt-ary-ptrn-rest-ary-empty.js | 84 + ...private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js | 80 + ...rivate-gen-meth-dflt-ary-ptrn-rest-id-direct.js | 75 + ...ivate-gen-meth-dflt-ary-ptrn-rest-id-elision.js | 76 + ...ate-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js | 72 + ...async-private-gen-meth-dflt-ary-ptrn-rest-id.js | 73 + ...private-gen-meth-dflt-ary-ptrn-rest-init-ary.js | 70 + ...-private-gen-meth-dflt-ary-ptrn-rest-init-id.js | 70 + ...private-gen-meth-dflt-ary-ptrn-rest-init-obj.js | 70 + ...te-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js | 70 + ...ate-gen-meth-dflt-ary-ptrn-rest-not-final-id.js | 70 + ...te-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js | 70 + ...c-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js | 73 + ...vate-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js | 80 + .../async-private-gen-meth-dflt-obj-ptrn-empty.js | 72 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 73 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js | 75 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 74 + ...te-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 74 + ...e-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 75 + ...ivate-gen-meth-dflt-obj-ptrn-id-init-skipped.js | 77 + ...ate-gen-meth-dflt-obj-ptrn-id-trailing-comma.js | 67 + ...private-gen-meth-dflt-obj-ptrn-prop-ary-init.js | 76 + ...n-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 67 + ...sync-private-gen-meth-dflt-obj-ptrn-prop-ary.js | 74 + ...-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js | 89 + ...-private-gen-meth-dflt-obj-ptrn-prop-id-init.js | 70 + ...en-meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 71 + ...async-private-gen-meth-dflt-obj-ptrn-prop-id.js | 70 + ...private-gen-meth-dflt-obj-ptrn-prop-obj-init.js | 76 + ...sync-private-gen-meth-dflt-obj-ptrn-prop-obj.js | 74 + ...c-private-gen-meth-dflt-obj-ptrn-rest-getter.js | 69 + ...-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 77 + ...-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js | 76 + .../dstr/async-private-gen-meth-obj-ptrn-empty.js | 72 + ...vate-gen-meth-obj-ptrn-id-init-fn-name-arrow.js | 73 + ...vate-gen-meth-obj-ptrn-id-init-fn-name-class.js | 75 + ...vate-gen-meth-obj-ptrn-id-init-fn-name-cover.js | 74 + ...private-gen-meth-obj-ptrn-id-init-fn-name-fn.js | 74 + ...rivate-gen-meth-obj-ptrn-id-init-fn-name-gen.js | 75 + ...nc-private-gen-meth-obj-ptrn-id-init-skipped.js | 77 + ...-private-gen-meth-obj-ptrn-id-trailing-comma.js | 67 + ...sync-private-gen-meth-obj-ptrn-prop-ary-init.js | 76 + ...te-gen-meth-obj-ptrn-prop-ary-trailing-comma.js | 67 + .../async-private-gen-meth-obj-ptrn-prop-ary.js | 74 + ...ivate-gen-meth-obj-ptrn-prop-id-init-skipped.js | 89 + ...async-private-gen-meth-obj-ptrn-prop-id-init.js | 70 + ...ate-gen-meth-obj-ptrn-prop-id-trailing-comma.js | 71 + .../async-private-gen-meth-obj-ptrn-prop-id.js | 70 + ...sync-private-gen-meth-obj-ptrn-prop-obj-init.js | 76 + .../async-private-gen-meth-obj-ptrn-prop-obj.js | 74 + .../async-private-gen-meth-obj-ptrn-rest-getter.js | 69 + ...e-gen-meth-obj-ptrn-rest-skip-non-enumerable.js | 77 + ...async-private-gen-meth-obj-ptrn-rest-val-obj.js | 76 + ...-private-gen-meth-static-ary-init-iter-close.js | 83 + ...ivate-gen-meth-static-ary-init-iter-no-close.js | 83 + ...nc-private-gen-meth-static-ary-name-iter-val.js | 82 + ...-gen-meth-static-ary-ptrn-elem-ary-elem-init.js | 74 + ...-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js | 75 + ...n-meth-static-ary-ptrn-elem-ary-elision-init.js | 81 + ...n-meth-static-ary-ptrn-elem-ary-elision-iter.js | 78 + ...gen-meth-static-ary-ptrn-elem-ary-empty-init.js | 77 + ...gen-meth-static-ary-ptrn-elem-ary-empty-iter.js | 74 + ...-gen-meth-static-ary-ptrn-elem-ary-rest-init.js | 78 + ...-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js | 81 + ...-meth-static-ary-ptrn-elem-id-init-exhausted.js | 73 + ...h-static-ary-ptrn-elem-id-init-fn-name-arrow.js | 74 + ...h-static-ary-ptrn-elem-id-init-fn-name-class.js | 76 + ...h-static-ary-ptrn-elem-id-init-fn-name-cover.js | 75 + ...meth-static-ary-ptrn-elem-id-init-fn-name-fn.js | 75 + ...eth-static-ary-ptrn-elem-id-init-fn-name-gen.js | 76 + ...e-gen-meth-static-ary-ptrn-elem-id-init-hole.js | 69 + ...en-meth-static-ary-ptrn-elem-id-init-skipped.js | 78 + ...-gen-meth-static-ary-ptrn-elem-id-init-undef.js | 72 + ...n-meth-static-ary-ptrn-elem-id-iter-complete.js | 76 + ...e-gen-meth-static-ary-ptrn-elem-id-iter-done.js | 71 + ...ic-ary-ptrn-elem-id-iter-val-array-prototype.js | 92 + ...te-gen-meth-static-ary-ptrn-elem-id-iter-val.js | 82 + ...te-gen-meth-static-ary-ptrn-elem-obj-id-init.js | 74 + ...private-gen-meth-static-ary-ptrn-elem-obj-id.js | 74 + ...n-meth-static-ary-ptrn-elem-obj-prop-id-init.js | 84 + ...te-gen-meth-static-ary-ptrn-elem-obj-prop-id.js | 84 + ...e-gen-meth-static-ary-ptrn-elision-exhausted.js | 79 + ...ync-private-gen-meth-static-ary-ptrn-elision.js | 88 + ...async-private-gen-meth-static-ary-ptrn-empty.js | 71 + ...ivate-gen-meth-static-ary-ptrn-rest-ary-elem.js | 95 + ...te-gen-meth-static-ary-ptrn-rest-ary-elision.js | 101 + ...vate-gen-meth-static-ary-ptrn-rest-ary-empty.js | 84 + ...ivate-gen-meth-static-ary-ptrn-rest-ary-rest.js | 80 + ...vate-gen-meth-static-ary-ptrn-rest-id-direct.js | 75 + ...ate-gen-meth-static-ary-ptrn-rest-id-elision.js | 76 + ...e-gen-meth-static-ary-ptrn-rest-id-exhausted.js | 72 + ...ync-private-gen-meth-static-ary-ptrn-rest-id.js | 73 + ...ivate-gen-meth-static-ary-ptrn-rest-init-ary.js | 70 + ...rivate-gen-meth-static-ary-ptrn-rest-init-id.js | 70 + ...ivate-gen-meth-static-ary-ptrn-rest-init-obj.js | 70 + ...-gen-meth-static-ary-ptrn-rest-not-final-ary.js | 70 + ...e-gen-meth-static-ary-ptrn-rest-not-final-id.js | 70 + ...-gen-meth-static-ary-ptrn-rest-not-final-obj.js | 70 + ...private-gen-meth-static-ary-ptrn-rest-obj-id.js | 73 + ...te-gen-meth-static-ary-ptrn-rest-obj-prop-id.js | 80 + ...ate-gen-meth-static-dflt-ary-init-iter-close.js | 83 + ...-gen-meth-static-dflt-ary-init-iter-no-close.js | 83 + ...ivate-gen-meth-static-dflt-ary-name-iter-val.js | 82 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-init.js | 74 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js | 75 + ...h-static-dflt-ary-ptrn-elem-ary-elision-init.js | 81 + ...h-static-dflt-ary-ptrn-elem-ary-elision-iter.js | 78 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-init.js | 77 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-iter.js | 74 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-init.js | 78 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js | 81 + ...-static-dflt-ary-ptrn-elem-id-init-exhausted.js | 73 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 74 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 76 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 75 + ...static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 75 + ...tatic-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 76 + ...-meth-static-dflt-ary-ptrn-elem-id-init-hole.js | 69 + ...th-static-dflt-ary-ptrn-elem-id-init-skipped.js | 78 + ...meth-static-dflt-ary-ptrn-elem-id-init-undef.js | 72 + ...h-static-dflt-ary-ptrn-elem-id-iter-complete.js | 76 + ...-meth-static-dflt-ary-ptrn-elem-id-iter-done.js | 71 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 92 + ...n-meth-static-dflt-ary-ptrn-elem-id-iter-val.js | 82 + ...n-meth-static-dflt-ary-ptrn-elem-obj-id-init.js | 74 + ...te-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js | 74 + ...h-static-dflt-ary-ptrn-elem-obj-prop-id-init.js | 84 + ...n-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js | 84 + ...-meth-static-dflt-ary-ptrn-elision-exhausted.js | 79 + ...rivate-gen-meth-static-dflt-ary-ptrn-elision.js | 88 + ...-private-gen-meth-static-dflt-ary-ptrn-empty.js | 71 + ...-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js | 95 + ...n-meth-static-dflt-ary-ptrn-rest-ary-elision.js | 101 + ...gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js | 84 + ...-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js | 80 + ...gen-meth-static-dflt-ary-ptrn-rest-id-direct.js | 75 + ...en-meth-static-dflt-ary-ptrn-rest-id-elision.js | 76 + ...-meth-static-dflt-ary-ptrn-rest-id-exhausted.js | 72 + ...rivate-gen-meth-static-dflt-ary-ptrn-rest-id.js | 73 + ...-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js | 70 + ...e-gen-meth-static-dflt-ary-ptrn-rest-init-id.js | 70 + ...-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js | 70 + ...meth-static-dflt-ary-ptrn-rest-not-final-ary.js | 70 + ...-meth-static-dflt-ary-ptrn-rest-not-final-id.js | 70 + ...meth-static-dflt-ary-ptrn-rest-not-final-obj.js | 70 + ...te-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js | 73 + ...n-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js | 80 + ...-private-gen-meth-static-dflt-obj-ptrn-empty.js | 72 + ...h-static-dflt-obj-ptrn-id-init-fn-name-arrow.js | 73 + ...h-static-dflt-obj-ptrn-id-init-fn-name-class.js | 75 + ...h-static-dflt-obj-ptrn-id-init-fn-name-cover.js | 74 + ...meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js | 74 + ...eth-static-dflt-obj-ptrn-id-init-fn-name-gen.js | 75 + ...en-meth-static-dflt-obj-ptrn-id-init-skipped.js | 77 + ...-meth-static-dflt-obj-ptrn-id-trailing-comma.js | 67 + ...-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js | 76 + ...static-dflt-obj-ptrn-prop-ary-trailing-comma.js | 67 + ...ivate-gen-meth-static-dflt-obj-ptrn-prop-ary.js | 74 + ...th-static-dflt-obj-ptrn-prop-id-init-skipped.js | 89 + ...e-gen-meth-static-dflt-obj-ptrn-prop-id-init.js | 70 + ...-static-dflt-obj-ptrn-prop-id-trailing-comma.js | 71 + ...rivate-gen-meth-static-dflt-obj-ptrn-prop-id.js | 70 + ...-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js | 76 + ...ivate-gen-meth-static-dflt-obj-ptrn-prop-obj.js | 74 + ...te-gen-meth-static-dflt-obj-ptrn-rest-getter.js | 69 + ...tatic-dflt-obj-ptrn-rest-skip-non-enumerable.js | 77 + ...e-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js | 76 + ...async-private-gen-meth-static-obj-ptrn-empty.js | 72 + ...n-meth-static-obj-ptrn-id-init-fn-name-arrow.js | 73 + ...n-meth-static-obj-ptrn-id-init-fn-name-class.js | 75 + ...n-meth-static-obj-ptrn-id-init-fn-name-cover.js | 74 + ...-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js | 74 + ...gen-meth-static-obj-ptrn-id-init-fn-name-gen.js | 75 + ...ate-gen-meth-static-obj-ptrn-id-init-skipped.js | 77 + ...e-gen-meth-static-obj-ptrn-id-trailing-comma.js | 67 + ...ivate-gen-meth-static-obj-ptrn-prop-ary-init.js | 76 + ...meth-static-obj-ptrn-prop-ary-trailing-comma.js | 67 + ...nc-private-gen-meth-static-obj-ptrn-prop-ary.js | 74 + ...en-meth-static-obj-ptrn-prop-id-init-skipped.js | 89 + ...rivate-gen-meth-static-obj-ptrn-prop-id-init.js | 70 + ...-meth-static-obj-ptrn-prop-id-trailing-comma.js | 71 + ...ync-private-gen-meth-static-obj-ptrn-prop-id.js | 70 + ...ivate-gen-meth-static-obj-ptrn-prop-obj-init.js | 76 + ...nc-private-gen-meth-static-obj-ptrn-prop-obj.js | 74 + ...private-gen-meth-static-obj-ptrn-rest-getter.js | 69 + ...eth-static-obj-ptrn-rest-skip-non-enumerable.js | 77 + ...rivate-gen-meth-static-obj-ptrn-rest-val-obj.js | 76 + .../language/expressions/class/dstr/browser.js | 0 .../class/dstr/gen-meth-ary-init-iter-close.js | 98 + ...n-meth-ary-init-iter-get-err-array-prototype.js | 91 + .../class/dstr/gen-meth-ary-init-iter-get-err.js | 85 + .../class/dstr/gen-meth-ary-init-iter-no-close.js | 98 + .../class/dstr/gen-meth-ary-name-iter-val.js | 97 + .../dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js | 89 + .../dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js | 90 + .../gen-meth-ary-ptrn-elem-ary-elision-init.js | 96 + .../gen-meth-ary-ptrn-elem-ary-elision-iter.js | 93 + .../dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js | 92 + .../dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js | 89 + .../dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js | 93 + .../dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js | 96 + .../dstr/gen-meth-ary-ptrn-elem-ary-val-null.js | 92 + .../gen-meth-ary-ptrn-elem-id-init-exhausted.js | 88 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 89 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-class.js | 91 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js | 90 + .../gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js | 90 + .../gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js | 91 + .../dstr/gen-meth-ary-ptrn-elem-id-init-hole.js | 84 + .../dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js | 93 + .../dstr/gen-meth-ary-ptrn-elem-id-init-throws.js | 83 + .../dstr/gen-meth-ary-ptrn-elem-id-init-undef.js | 87 + .../gen-meth-ary-ptrn-elem-id-init-unresolvable.js | 90 + .../gen-meth-ary-ptrn-elem-id-iter-complete.js | 91 + .../dstr/gen-meth-ary-ptrn-elem-id-iter-done.js | 86 + .../gen-meth-ary-ptrn-elem-id-iter-step-err.js | 92 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 107 + .../dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js | 103 + .../dstr/gen-meth-ary-ptrn-elem-id-iter-val.js | 97 + .../dstr/gen-meth-ary-ptrn-elem-obj-id-init.js | 89 + .../class/dstr/gen-meth-ary-ptrn-elem-obj-id.js | 89 + .../gen-meth-ary-ptrn-elem-obj-prop-id-init.js | 99 + .../dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js | 99 + .../dstr/gen-meth-ary-ptrn-elem-obj-val-null.js | 92 + .../dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js | 92 + .../dstr/gen-meth-ary-ptrn-elision-exhausted.js | 94 + .../dstr/gen-meth-ary-ptrn-elision-step-err.js | 99 + .../class/dstr/gen-meth-ary-ptrn-elision.js | 103 + .../class/dstr/gen-meth-ary-ptrn-empty.js | 86 + .../class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js | 110 + .../dstr/gen-meth-ary-ptrn-rest-ary-elision.js | 116 + .../class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js | 99 + .../class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js | 95 + .../class/dstr/gen-meth-ary-ptrn-rest-id-direct.js | 90 + .../gen-meth-ary-ptrn-rest-id-elision-next-err.js | 85 + .../dstr/gen-meth-ary-ptrn-rest-id-elision.js | 91 + .../dstr/gen-meth-ary-ptrn-rest-id-exhausted.js | 87 + .../gen-meth-ary-ptrn-rest-id-iter-step-err.js | 96 + .../dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js | 98 + .../class/dstr/gen-meth-ary-ptrn-rest-id.js | 88 + .../class/dstr/gen-meth-ary-ptrn-rest-init-ary.js | 84 + .../class/dstr/gen-meth-ary-ptrn-rest-init-id.js | 84 + .../class/dstr/gen-meth-ary-ptrn-rest-init-obj.js | 84 + .../dstr/gen-meth-ary-ptrn-rest-not-final-ary.js | 84 + .../dstr/gen-meth-ary-ptrn-rest-not-final-id.js | 84 + .../dstr/gen-meth-ary-ptrn-rest-not-final-obj.js | 84 + .../class/dstr/gen-meth-ary-ptrn-rest-obj-id.js | 88 + .../dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js | 95 + .../dstr/gen-meth-dflt-ary-init-iter-close.js | 98 + ...h-dflt-ary-init-iter-get-err-array-prototype.js | 91 + .../dstr/gen-meth-dflt-ary-init-iter-get-err.js | 85 + .../dstr/gen-meth-dflt-ary-init-iter-no-close.js | 98 + .../class/dstr/gen-meth-dflt-ary-name-iter-val.js | 97 + .../gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js | 89 + .../gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 90 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js | 96 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 93 + .../gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js | 92 + .../gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 89 + .../gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js | 93 + .../gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 96 + .../gen-meth-dflt-ary-ptrn-elem-ary-val-null.js | 92 + ...en-meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 88 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 89 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 91 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 90 + ...n-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 90 + ...-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 91 + .../gen-meth-dflt-ary-ptrn-elem-id-init-hole.js | 84 + .../gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js | 93 + .../gen-meth-dflt-ary-ptrn-elem-id-init-throws.js | 83 + .../gen-meth-dflt-ary-ptrn-elem-id-init-undef.js | 87 + ...meth-dflt-ary-ptrn-elem-id-init-unresolvable.js | 90 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js | 91 + .../gen-meth-dflt-ary-ptrn-elem-id-iter-done.js | 86 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js | 92 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 107 + .../gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js | 103 + .../gen-meth-dflt-ary-ptrn-elem-id-iter-val.js | 97 + .../gen-meth-dflt-ary-ptrn-elem-obj-id-init.js | 89 + .../dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js | 89 + ...gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 99 + .../gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js | 99 + .../gen-meth-dflt-ary-ptrn-elem-obj-val-null.js | 92 + .../gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js | 92 + .../gen-meth-dflt-ary-ptrn-elision-exhausted.js | 94 + .../gen-meth-dflt-ary-ptrn-elision-step-err.js | 99 + .../class/dstr/gen-meth-dflt-ary-ptrn-elision.js | 103 + .../class/dstr/gen-meth-dflt-ary-ptrn-empty.js | 86 + .../dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js | 110 + .../gen-meth-dflt-ary-ptrn-rest-ary-elision.js | 116 + .../dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js | 99 + .../dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js | 95 + .../dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js | 90 + ...-meth-dflt-ary-ptrn-rest-id-elision-next-err.js | 85 + .../dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js | 91 + .../gen-meth-dflt-ary-ptrn-rest-id-exhausted.js | 87 + ...gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js | 96 + .../gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js | 98 + .../class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js | 88 + .../dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js | 84 + .../dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js | 84 + .../dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js | 84 + .../gen-meth-dflt-ary-ptrn-rest-not-final-ary.js | 84 + .../gen-meth-dflt-ary-ptrn-rest-not-final-id.js | 84 + .../gen-meth-dflt-ary-ptrn-rest-not-final-obj.js | 84 + .../dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js | 88 + .../gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js | 95 + .../class/dstr/gen-meth-dflt-obj-init-null.js | 79 + .../class/dstr/gen-meth-dflt-obj-init-undefined.js | 79 + .../class/dstr/gen-meth-dflt-obj-ptrn-empty.js | 87 + .../gen-meth-dflt-obj-ptrn-id-get-value-err.js | 86 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 88 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js | 90 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 89 + .../gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 89 + .../gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 90 + .../dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js | 92 + .../dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js | 86 + .../gen-meth-dflt-obj-ptrn-id-init-unresolvable.js | 90 + .../gen-meth-dflt-obj-ptrn-id-trailing-comma.js | 82 + .../class/dstr/gen-meth-dflt-obj-ptrn-list-err.js | 87 + .../dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js | 91 + ...n-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 82 + .../gen-meth-dflt-obj-ptrn-prop-ary-value-null.js | 81 + .../class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js | 89 + .../dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js | 83 + ...gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js | 88 + .../gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js | 104 + .../gen-meth-dflt-obj-ptrn-prop-id-init-throws.js | 86 + ...meth-dflt-obj-ptrn-prop-id-init-unresolvable.js | 90 + .../dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js | 85 + ...en-meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 86 + .../class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js | 85 + .../dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js | 91 + .../gen-meth-dflt-obj-ptrn-prop-obj-value-null.js | 81 + .../gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js | 81 + .../class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js | 89 + .../dstr/gen-meth-dflt-obj-ptrn-rest-getter.js | 84 + ...-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 92 + .../dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js | 91 + .../class/dstr/gen-meth-obj-init-null.js | 79 + .../class/dstr/gen-meth-obj-init-undefined.js | 79 + .../class/dstr/gen-meth-obj-ptrn-empty.js | 87 + .../dstr/gen-meth-obj-ptrn-id-get-value-err.js | 86 + .../gen-meth-obj-ptrn-id-init-fn-name-arrow.js | 88 + .../gen-meth-obj-ptrn-id-init-fn-name-class.js | 90 + .../gen-meth-obj-ptrn-id-init-fn-name-cover.js | 89 + .../dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js | 89 + .../dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js | 90 + .../dstr/gen-meth-obj-ptrn-id-init-skipped.js | 92 + .../class/dstr/gen-meth-obj-ptrn-id-init-throws.js | 86 + .../dstr/gen-meth-obj-ptrn-id-init-unresolvable.js | 90 + .../dstr/gen-meth-obj-ptrn-id-trailing-comma.js | 82 + .../class/dstr/gen-meth-obj-ptrn-list-err.js | 87 + .../class/dstr/gen-meth-obj-ptrn-prop-ary-init.js | 91 + .../gen-meth-obj-ptrn-prop-ary-trailing-comma.js | 82 + .../dstr/gen-meth-obj-ptrn-prop-ary-value-null.js | 81 + .../class/dstr/gen-meth-obj-ptrn-prop-ary.js | 89 + .../class/dstr/gen-meth-obj-ptrn-prop-eval-err.js | 83 + .../gen-meth-obj-ptrn-prop-id-get-value-err.js | 88 + .../dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js | 104 + .../dstr/gen-meth-obj-ptrn-prop-id-init-throws.js | 86 + .../gen-meth-obj-ptrn-prop-id-init-unresolvable.js | 90 + .../class/dstr/gen-meth-obj-ptrn-prop-id-init.js | 85 + .../gen-meth-obj-ptrn-prop-id-trailing-comma.js | 86 + .../class/dstr/gen-meth-obj-ptrn-prop-id.js | 85 + .../class/dstr/gen-meth-obj-ptrn-prop-obj-init.js | 91 + .../dstr/gen-meth-obj-ptrn-prop-obj-value-null.js | 81 + .../dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js | 81 + .../class/dstr/gen-meth-obj-ptrn-prop-obj.js | 89 + .../class/dstr/gen-meth-obj-ptrn-rest-getter.js | 84 + .../gen-meth-obj-ptrn-rest-skip-non-enumerable.js | 92 + .../class/dstr/gen-meth-obj-ptrn-rest-val-obj.js | 91 + .../dstr/gen-meth-static-ary-init-iter-close.js | 98 + ...static-ary-init-iter-get-err-array-prototype.js | 90 + .../dstr/gen-meth-static-ary-init-iter-get-err.js | 84 + .../dstr/gen-meth-static-ary-init-iter-no-close.js | 98 + .../dstr/gen-meth-static-ary-name-iter-val.js | 97 + .../gen-meth-static-ary-ptrn-elem-ary-elem-init.js | 89 + .../gen-meth-static-ary-ptrn-elem-ary-elem-iter.js | 90 + ...n-meth-static-ary-ptrn-elem-ary-elision-init.js | 96 + ...n-meth-static-ary-ptrn-elem-ary-elision-iter.js | 93 + ...gen-meth-static-ary-ptrn-elem-ary-empty-init.js | 92 + ...gen-meth-static-ary-ptrn-elem-ary-empty-iter.js | 89 + .../gen-meth-static-ary-ptrn-elem-ary-rest-init.js | 93 + .../gen-meth-static-ary-ptrn-elem-ary-rest-iter.js | 96 + .../gen-meth-static-ary-ptrn-elem-ary-val-null.js | 91 + ...-meth-static-ary-ptrn-elem-id-init-exhausted.js | 88 + ...h-static-ary-ptrn-elem-id-init-fn-name-arrow.js | 89 + ...h-static-ary-ptrn-elem-id-init-fn-name-class.js | 91 + ...h-static-ary-ptrn-elem-id-init-fn-name-cover.js | 90 + ...meth-static-ary-ptrn-elem-id-init-fn-name-fn.js | 90 + ...eth-static-ary-ptrn-elem-id-init-fn-name-gen.js | 91 + .../gen-meth-static-ary-ptrn-elem-id-init-hole.js | 84 + ...en-meth-static-ary-ptrn-elem-id-init-skipped.js | 93 + ...gen-meth-static-ary-ptrn-elem-id-init-throws.js | 82 + .../gen-meth-static-ary-ptrn-elem-id-init-undef.js | 87 + ...th-static-ary-ptrn-elem-id-init-unresolvable.js | 89 + ...n-meth-static-ary-ptrn-elem-id-iter-complete.js | 91 + .../gen-meth-static-ary-ptrn-elem-id-iter-done.js | 86 + ...n-meth-static-ary-ptrn-elem-id-iter-step-err.js | 91 + ...ic-ary-ptrn-elem-id-iter-val-array-prototype.js | 107 + ...en-meth-static-ary-ptrn-elem-id-iter-val-err.js | 102 + .../gen-meth-static-ary-ptrn-elem-id-iter-val.js | 97 + .../gen-meth-static-ary-ptrn-elem-obj-id-init.js | 89 + .../dstr/gen-meth-static-ary-ptrn-elem-obj-id.js | 89 + ...n-meth-static-ary-ptrn-elem-obj-prop-id-init.js | 99 + .../gen-meth-static-ary-ptrn-elem-obj-prop-id.js | 99 + .../gen-meth-static-ary-ptrn-elem-obj-val-null.js | 91 + .../gen-meth-static-ary-ptrn-elem-obj-val-undef.js | 91 + .../gen-meth-static-ary-ptrn-elision-exhausted.js | 94 + .../gen-meth-static-ary-ptrn-elision-step-err.js | 98 + .../class/dstr/gen-meth-static-ary-ptrn-elision.js | 103 + .../class/dstr/gen-meth-static-ary-ptrn-empty.js | 86 + .../dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js | 110 + .../gen-meth-static-ary-ptrn-rest-ary-elision.js | 116 + .../gen-meth-static-ary-ptrn-rest-ary-empty.js | 99 + .../dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js | 95 + .../gen-meth-static-ary-ptrn-rest-id-direct.js | 90 + ...eth-static-ary-ptrn-rest-id-elision-next-err.js | 84 + .../gen-meth-static-ary-ptrn-rest-id-elision.js | 91 + .../gen-meth-static-ary-ptrn-rest-id-exhausted.js | 87 + ...n-meth-static-ary-ptrn-rest-id-iter-step-err.js | 95 + ...en-meth-static-ary-ptrn-rest-id-iter-val-err.js | 97 + .../class/dstr/gen-meth-static-ary-ptrn-rest-id.js | 88 + .../dstr/gen-meth-static-ary-ptrn-rest-init-ary.js | 84 + .../dstr/gen-meth-static-ary-ptrn-rest-init-id.js | 84 + .../dstr/gen-meth-static-ary-ptrn-rest-init-obj.js | 84 + .../gen-meth-static-ary-ptrn-rest-not-final-ary.js | 84 + .../gen-meth-static-ary-ptrn-rest-not-final-id.js | 84 + .../gen-meth-static-ary-ptrn-rest-not-final-obj.js | 84 + .../dstr/gen-meth-static-ary-ptrn-rest-obj-id.js | 88 + .../gen-meth-static-ary-ptrn-rest-obj-prop-id.js | 95 + .../gen-meth-static-dflt-ary-init-iter-close.js | 98 + ...c-dflt-ary-init-iter-get-err-array-prototype.js | 90 + .../gen-meth-static-dflt-ary-init-iter-get-err.js | 84 + .../gen-meth-static-dflt-ary-init-iter-no-close.js | 98 + .../dstr/gen-meth-static-dflt-ary-name-iter-val.js | 97 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-init.js | 89 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js | 90 + ...h-static-dflt-ary-ptrn-elem-ary-elision-init.js | 96 + ...h-static-dflt-ary-ptrn-elem-ary-elision-iter.js | 93 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-init.js | 92 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-iter.js | 89 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-init.js | 93 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js | 96 + ...-meth-static-dflt-ary-ptrn-elem-ary-val-null.js | 91 + ...-static-dflt-ary-ptrn-elem-id-init-exhausted.js | 88 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 89 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 91 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 90 + ...static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 90 + ...tatic-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 91 + ...-meth-static-dflt-ary-ptrn-elem-id-init-hole.js | 84 + ...th-static-dflt-ary-ptrn-elem-id-init-skipped.js | 93 + ...eth-static-dflt-ary-ptrn-elem-id-init-throws.js | 82 + ...meth-static-dflt-ary-ptrn-elem-id-init-undef.js | 87 + ...atic-dflt-ary-ptrn-elem-id-init-unresolvable.js | 89 + ...h-static-dflt-ary-ptrn-elem-id-iter-complete.js | 91 + ...-meth-static-dflt-ary-ptrn-elem-id-iter-done.js | 86 + ...h-static-dflt-ary-ptrn-elem-id-iter-step-err.js | 91 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 107 + ...th-static-dflt-ary-ptrn-elem-id-iter-val-err.js | 102 + ...n-meth-static-dflt-ary-ptrn-elem-id-iter-val.js | 97 + ...n-meth-static-dflt-ary-ptrn-elem-obj-id-init.js | 89 + .../gen-meth-static-dflt-ary-ptrn-elem-obj-id.js | 89 + ...h-static-dflt-ary-ptrn-elem-obj-prop-id-init.js | 99 + ...n-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js | 99 + ...-meth-static-dflt-ary-ptrn-elem-obj-val-null.js | 91 + ...meth-static-dflt-ary-ptrn-elem-obj-val-undef.js | 91 + ...-meth-static-dflt-ary-ptrn-elision-exhausted.js | 94 + ...n-meth-static-dflt-ary-ptrn-elision-step-err.js | 98 + .../dstr/gen-meth-static-dflt-ary-ptrn-elision.js | 103 + .../dstr/gen-meth-static-dflt-ary-ptrn-empty.js | 86 + .../gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js | 110 + ...n-meth-static-dflt-ary-ptrn-rest-ary-elision.js | 116 + ...gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js | 99 + .../gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js | 95 + ...gen-meth-static-dflt-ary-ptrn-rest-id-direct.js | 90 + ...tatic-dflt-ary-ptrn-rest-id-elision-next-err.js | 84 + ...en-meth-static-dflt-ary-ptrn-rest-id-elision.js | 91 + ...-meth-static-dflt-ary-ptrn-rest-id-exhausted.js | 87 + ...h-static-dflt-ary-ptrn-rest-id-iter-step-err.js | 95 + ...th-static-dflt-ary-ptrn-rest-id-iter-val-err.js | 97 + .../dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js | 88 + .../gen-meth-static-dflt-ary-ptrn-rest-init-ary.js | 84 + .../gen-meth-static-dflt-ary-ptrn-rest-init-id.js | 84 + .../gen-meth-static-dflt-ary-ptrn-rest-init-obj.js | 84 + ...meth-static-dflt-ary-ptrn-rest-not-final-ary.js | 84 + ...-meth-static-dflt-ary-ptrn-rest-not-final-id.js | 84 + ...meth-static-dflt-ary-ptrn-rest-not-final-obj.js | 84 + .../gen-meth-static-dflt-ary-ptrn-rest-obj-id.js | 88 + ...n-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js | 95 + .../dstr/gen-meth-static-dflt-obj-init-null.js | 78 + .../gen-meth-static-dflt-obj-init-undefined.js | 78 + .../dstr/gen-meth-static-dflt-obj-ptrn-empty.js | 87 + ...n-meth-static-dflt-obj-ptrn-id-get-value-err.js | 85 + ...h-static-dflt-obj-ptrn-id-init-fn-name-arrow.js | 88 + ...h-static-dflt-obj-ptrn-id-init-fn-name-class.js | 90 + ...h-static-dflt-obj-ptrn-id-init-fn-name-cover.js | 89 + ...meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js | 89 + ...eth-static-dflt-obj-ptrn-id-init-fn-name-gen.js | 90 + ...en-meth-static-dflt-obj-ptrn-id-init-skipped.js | 92 + ...gen-meth-static-dflt-obj-ptrn-id-init-throws.js | 85 + ...th-static-dflt-obj-ptrn-id-init-unresolvable.js | 89 + ...-meth-static-dflt-obj-ptrn-id-trailing-comma.js | 82 + .../dstr/gen-meth-static-dflt-obj-ptrn-list-err.js | 86 + .../gen-meth-static-dflt-obj-ptrn-prop-ary-init.js | 91 + ...static-dflt-obj-ptrn-prop-ary-trailing-comma.js | 82 + ...eth-static-dflt-obj-ptrn-prop-ary-value-null.js | 80 + .../dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js | 89 + .../gen-meth-static-dflt-obj-ptrn-prop-eval-err.js | 82 + ...h-static-dflt-obj-ptrn-prop-id-get-value-err.js | 87 + ...th-static-dflt-obj-ptrn-prop-id-init-skipped.js | 104 + ...eth-static-dflt-obj-ptrn-prop-id-init-throws.js | 85 + ...atic-dflt-obj-ptrn-prop-id-init-unresolvable.js | 89 + .../gen-meth-static-dflt-obj-ptrn-prop-id-init.js | 85 + ...-static-dflt-obj-ptrn-prop-id-trailing-comma.js | 86 + .../dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js | 85 + .../gen-meth-static-dflt-obj-ptrn-prop-obj-init.js | 91 + ...eth-static-dflt-obj-ptrn-prop-obj-value-null.js | 80 + ...th-static-dflt-obj-ptrn-prop-obj-value-undef.js | 80 + .../dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js | 89 + .../gen-meth-static-dflt-obj-ptrn-rest-getter.js | 84 + ...tatic-dflt-obj-ptrn-rest-skip-non-enumerable.js | 92 + .../gen-meth-static-dflt-obj-ptrn-rest-val-obj.js | 91 + .../class/dstr/gen-meth-static-obj-init-null.js | 78 + .../dstr/gen-meth-static-obj-init-undefined.js | 78 + .../class/dstr/gen-meth-static-obj-ptrn-empty.js | 87 + .../gen-meth-static-obj-ptrn-id-get-value-err.js | 85 + ...n-meth-static-obj-ptrn-id-init-fn-name-arrow.js | 88 + ...n-meth-static-obj-ptrn-id-init-fn-name-class.js | 90 + ...n-meth-static-obj-ptrn-id-init-fn-name-cover.js | 89 + .../gen-meth-static-obj-ptrn-id-init-fn-name-fn.js | 89 + ...gen-meth-static-obj-ptrn-id-init-fn-name-gen.js | 90 + .../gen-meth-static-obj-ptrn-id-init-skipped.js | 92 + .../gen-meth-static-obj-ptrn-id-init-throws.js | 85 + ...en-meth-static-obj-ptrn-id-init-unresolvable.js | 89 + .../gen-meth-static-obj-ptrn-id-trailing-comma.js | 82 + .../dstr/gen-meth-static-obj-ptrn-list-err.js | 86 + .../dstr/gen-meth-static-obj-ptrn-prop-ary-init.js | 91 + ...meth-static-obj-ptrn-prop-ary-trailing-comma.js | 82 + ...gen-meth-static-obj-ptrn-prop-ary-value-null.js | 80 + .../dstr/gen-meth-static-obj-ptrn-prop-ary.js | 89 + .../dstr/gen-meth-static-obj-ptrn-prop-eval-err.js | 82 + ...n-meth-static-obj-ptrn-prop-id-get-value-err.js | 87 + ...en-meth-static-obj-ptrn-prop-id-init-skipped.js | 104 + ...gen-meth-static-obj-ptrn-prop-id-init-throws.js | 85 + ...th-static-obj-ptrn-prop-id-init-unresolvable.js | 89 + .../dstr/gen-meth-static-obj-ptrn-prop-id-init.js | 85 + ...-meth-static-obj-ptrn-prop-id-trailing-comma.js | 86 + .../class/dstr/gen-meth-static-obj-ptrn-prop-id.js | 85 + .../dstr/gen-meth-static-obj-ptrn-prop-obj-init.js | 91 + ...gen-meth-static-obj-ptrn-prop-obj-value-null.js | 80 + ...en-meth-static-obj-ptrn-prop-obj-value-undef.js | 80 + .../dstr/gen-meth-static-obj-ptrn-prop-obj.js | 89 + .../dstr/gen-meth-static-obj-ptrn-rest-getter.js | 84 + ...eth-static-obj-ptrn-rest-skip-non-enumerable.js | 92 + .../dstr/gen-meth-static-obj-ptrn-rest-val-obj.js | 91 + .../class/dstr/meth-ary-init-iter-close.js | 95 + .../meth-ary-init-iter-get-err-array-prototype.js | 89 + .../class/dstr/meth-ary-init-iter-get-err.js | 83 + .../class/dstr/meth-ary-init-iter-no-close.js | 95 + .../class/dstr/meth-ary-name-iter-val.js | 94 + .../class/dstr/meth-ary-ptrn-elem-ary-elem-init.js | 86 + .../class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js | 87 + .../dstr/meth-ary-ptrn-elem-ary-elision-init.js | 93 + .../dstr/meth-ary-ptrn-elem-ary-elision-iter.js | 90 + .../dstr/meth-ary-ptrn-elem-ary-empty-init.js | 89 + .../dstr/meth-ary-ptrn-elem-ary-empty-iter.js | 86 + .../class/dstr/meth-ary-ptrn-elem-ary-rest-init.js | 90 + .../class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js | 93 + .../class/dstr/meth-ary-ptrn-elem-ary-val-null.js | 90 + .../dstr/meth-ary-ptrn-elem-id-init-exhausted.js | 85 + .../meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 86 + .../meth-ary-ptrn-elem-id-init-fn-name-class.js | 88 + .../meth-ary-ptrn-elem-id-init-fn-name-cover.js | 87 + .../dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js | 87 + .../dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js | 88 + .../class/dstr/meth-ary-ptrn-elem-id-init-hole.js | 81 + .../dstr/meth-ary-ptrn-elem-id-init-skipped.js | 90 + .../dstr/meth-ary-ptrn-elem-id-init-throws.js | 81 + .../class/dstr/meth-ary-ptrn-elem-id-init-undef.js | 84 + .../meth-ary-ptrn-elem-id-init-unresolvable.js | 88 + .../dstr/meth-ary-ptrn-elem-id-iter-complete.js | 88 + .../class/dstr/meth-ary-ptrn-elem-id-iter-done.js | 83 + .../dstr/meth-ary-ptrn-elem-id-iter-step-err.js | 90 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 104 + .../dstr/meth-ary-ptrn-elem-id-iter-val-err.js | 101 + .../class/dstr/meth-ary-ptrn-elem-id-iter-val.js | 94 + .../class/dstr/meth-ary-ptrn-elem-obj-id-init.js | 86 + .../class/dstr/meth-ary-ptrn-elem-obj-id.js | 86 + .../dstr/meth-ary-ptrn-elem-obj-prop-id-init.js | 96 + .../class/dstr/meth-ary-ptrn-elem-obj-prop-id.js | 96 + .../class/dstr/meth-ary-ptrn-elem-obj-val-null.js | 90 + .../class/dstr/meth-ary-ptrn-elem-obj-val-undef.js | 90 + .../class/dstr/meth-ary-ptrn-elision-exhausted.js | 91 + .../class/dstr/meth-ary-ptrn-elision-step-err.js | 97 + .../class/dstr/meth-ary-ptrn-elision.js | 100 + .../expressions/class/dstr/meth-ary-ptrn-empty.js | 83 + .../class/dstr/meth-ary-ptrn-rest-ary-elem.js | 107 + .../class/dstr/meth-ary-ptrn-rest-ary-elision.js | 113 + .../class/dstr/meth-ary-ptrn-rest-ary-empty.js | 96 + .../class/dstr/meth-ary-ptrn-rest-ary-rest.js | 92 + .../class/dstr/meth-ary-ptrn-rest-id-direct.js | 87 + .../dstr/meth-ary-ptrn-rest-id-elision-next-err.js | 83 + .../class/dstr/meth-ary-ptrn-rest-id-elision.js | 88 + .../class/dstr/meth-ary-ptrn-rest-id-exhausted.js | 84 + .../dstr/meth-ary-ptrn-rest-id-iter-step-err.js | 94 + .../dstr/meth-ary-ptrn-rest-id-iter-val-err.js | 96 + .../class/dstr/meth-ary-ptrn-rest-id.js | 85 + .../class/dstr/meth-ary-ptrn-rest-init-ary.js | 81 + .../class/dstr/meth-ary-ptrn-rest-init-id.js | 81 + .../class/dstr/meth-ary-ptrn-rest-init-obj.js | 81 + .../class/dstr/meth-ary-ptrn-rest-not-final-ary.js | 81 + .../class/dstr/meth-ary-ptrn-rest-not-final-id.js | 81 + .../class/dstr/meth-ary-ptrn-rest-not-final-obj.js | 81 + .../class/dstr/meth-ary-ptrn-rest-obj-id.js | 85 + .../class/dstr/meth-ary-ptrn-rest-obj-prop-id.js | 92 + .../class/dstr/meth-dflt-ary-init-iter-close.js | 95 + ...h-dflt-ary-init-iter-get-err-array-prototype.js | 89 + .../class/dstr/meth-dflt-ary-init-iter-get-err.js | 83 + .../class/dstr/meth-dflt-ary-init-iter-no-close.js | 95 + .../class/dstr/meth-dflt-ary-name-iter-val.js | 94 + .../dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js | 86 + .../dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 87 + .../meth-dflt-ary-ptrn-elem-ary-elision-init.js | 93 + .../meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 90 + .../dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js | 89 + .../dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 86 + .../dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js | 90 + .../dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 93 + .../dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js | 90 + .../meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 85 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 86 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 88 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 87 + .../meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 87 + .../meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 88 + .../dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js | 81 + .../meth-dflt-ary-ptrn-elem-id-init-skipped.js | 90 + .../dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js | 81 + .../dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js | 84 + ...meth-dflt-ary-ptrn-elem-id-init-unresolvable.js | 88 + .../meth-dflt-ary-ptrn-elem-id-iter-complete.js | 88 + .../dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js | 83 + .../meth-dflt-ary-ptrn-elem-id-iter-step-err.js | 90 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 104 + .../meth-dflt-ary-ptrn-elem-id-iter-val-err.js | 101 + .../dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js | 94 + .../dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js | 86 + .../class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js | 86 + .../meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 96 + .../dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js | 96 + .../dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js | 90 + .../dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js | 90 + .../dstr/meth-dflt-ary-ptrn-elision-exhausted.js | 91 + .../dstr/meth-dflt-ary-ptrn-elision-step-err.js | 97 + .../class/dstr/meth-dflt-ary-ptrn-elision.js | 100 + .../class/dstr/meth-dflt-ary-ptrn-empty.js | 83 + .../class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js | 107 + .../dstr/meth-dflt-ary-ptrn-rest-ary-elision.js | 113 + .../dstr/meth-dflt-ary-ptrn-rest-ary-empty.js | 96 + .../class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js | 92 + .../dstr/meth-dflt-ary-ptrn-rest-id-direct.js | 87 + .../meth-dflt-ary-ptrn-rest-id-elision-next-err.js | 83 + .../dstr/meth-dflt-ary-ptrn-rest-id-elision.js | 88 + .../dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js | 84 + .../meth-dflt-ary-ptrn-rest-id-iter-step-err.js | 94 + .../meth-dflt-ary-ptrn-rest-id-iter-val-err.js | 96 + .../class/dstr/meth-dflt-ary-ptrn-rest-id.js | 85 + .../class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js | 81 + .../class/dstr/meth-dflt-ary-ptrn-rest-init-id.js | 81 + .../class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js | 81 + .../dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js | 81 + .../dstr/meth-dflt-ary-ptrn-rest-not-final-id.js | 81 + .../dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js | 81 + .../class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js | 85 + .../dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js | 92 + .../class/dstr/meth-dflt-obj-init-null.js | 77 + .../class/dstr/meth-dflt-obj-init-undefined.js | 77 + .../class/dstr/meth-dflt-obj-ptrn-empty.js | 84 + .../dstr/meth-dflt-obj-ptrn-id-get-value-err.js | 84 + .../meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 85 + .../meth-dflt-obj-ptrn-id-init-fn-name-class.js | 87 + .../meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 86 + .../dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 86 + .../dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 87 + .../dstr/meth-dflt-obj-ptrn-id-init-skipped.js | 89 + .../dstr/meth-dflt-obj-ptrn-id-init-throws.js | 84 + .../meth-dflt-obj-ptrn-id-init-unresolvable.js | 88 + .../dstr/meth-dflt-obj-ptrn-id-trailing-comma.js | 79 + .../class/dstr/meth-dflt-obj-ptrn-list-err.js | 85 + .../class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js | 88 + .../meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 79 + .../dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js | 79 + .../class/dstr/meth-dflt-obj-ptrn-prop-ary.js | 86 + .../class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js | 81 + .../meth-dflt-obj-ptrn-prop-id-get-value-err.js | 86 + .../meth-dflt-obj-ptrn-prop-id-init-skipped.js | 101 + .../dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js | 84 + ...meth-dflt-obj-ptrn-prop-id-init-unresolvable.js | 88 + .../class/dstr/meth-dflt-obj-ptrn-prop-id-init.js | 82 + .../meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 83 + .../class/dstr/meth-dflt-obj-ptrn-prop-id.js | 82 + .../class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js | 88 + .../dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js | 79 + .../meth-dflt-obj-ptrn-prop-obj-value-undef.js | 79 + .../class/dstr/meth-dflt-obj-ptrn-prop-obj.js | 86 + .../class/dstr/meth-dflt-obj-ptrn-rest-getter.js | 81 + .../meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 89 + .../class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js | 88 + .../expressions/class/dstr/meth-obj-init-null.js | 77 + .../class/dstr/meth-obj-init-undefined.js | 77 + .../expressions/class/dstr/meth-obj-ptrn-empty.js | 84 + .../class/dstr/meth-obj-ptrn-id-get-value-err.js | 84 + .../dstr/meth-obj-ptrn-id-init-fn-name-arrow.js | 85 + .../dstr/meth-obj-ptrn-id-init-fn-name-class.js | 87 + .../dstr/meth-obj-ptrn-id-init-fn-name-cover.js | 86 + .../class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js | 86 + .../dstr/meth-obj-ptrn-id-init-fn-name-gen.js | 87 + .../class/dstr/meth-obj-ptrn-id-init-skipped.js | 89 + .../class/dstr/meth-obj-ptrn-id-init-throws.js | 84 + .../dstr/meth-obj-ptrn-id-init-unresolvable.js | 88 + .../class/dstr/meth-obj-ptrn-id-trailing-comma.js | 79 + .../class/dstr/meth-obj-ptrn-list-err.js | 85 + .../class/dstr/meth-obj-ptrn-prop-ary-init.js | 88 + .../dstr/meth-obj-ptrn-prop-ary-trailing-comma.js | 79 + .../dstr/meth-obj-ptrn-prop-ary-value-null.js | 79 + .../class/dstr/meth-obj-ptrn-prop-ary.js | 86 + .../class/dstr/meth-obj-ptrn-prop-eval-err.js | 81 + .../dstr/meth-obj-ptrn-prop-id-get-value-err.js | 86 + .../dstr/meth-obj-ptrn-prop-id-init-skipped.js | 101 + .../dstr/meth-obj-ptrn-prop-id-init-throws.js | 84 + .../meth-obj-ptrn-prop-id-init-unresolvable.js | 88 + .../class/dstr/meth-obj-ptrn-prop-id-init.js | 82 + .../dstr/meth-obj-ptrn-prop-id-trailing-comma.js | 83 + .../class/dstr/meth-obj-ptrn-prop-id.js | 82 + .../class/dstr/meth-obj-ptrn-prop-obj-init.js | 88 + .../dstr/meth-obj-ptrn-prop-obj-value-null.js | 79 + .../dstr/meth-obj-ptrn-prop-obj-value-undef.js | 79 + .../class/dstr/meth-obj-ptrn-prop-obj.js | 86 + .../class/dstr/meth-obj-ptrn-rest-getter.js | 81 + .../dstr/meth-obj-ptrn-rest-skip-non-enumerable.js | 89 + .../class/dstr/meth-obj-ptrn-rest-val-obj.js | 88 + .../class/dstr/meth-static-ary-init-iter-close.js | 95 + ...static-ary-init-iter-get-err-array-prototype.js | 87 + .../dstr/meth-static-ary-init-iter-get-err.js | 81 + .../dstr/meth-static-ary-init-iter-no-close.js | 95 + .../class/dstr/meth-static-ary-name-iter-val.js | 94 + .../meth-static-ary-ptrn-elem-ary-elem-init.js | 86 + .../meth-static-ary-ptrn-elem-ary-elem-iter.js | 87 + .../meth-static-ary-ptrn-elem-ary-elision-init.js | 93 + .../meth-static-ary-ptrn-elem-ary-elision-iter.js | 90 + .../meth-static-ary-ptrn-elem-ary-empty-init.js | 89 + .../meth-static-ary-ptrn-elem-ary-empty-iter.js | 86 + .../meth-static-ary-ptrn-elem-ary-rest-init.js | 90 + .../meth-static-ary-ptrn-elem-ary-rest-iter.js | 93 + .../dstr/meth-static-ary-ptrn-elem-ary-val-null.js | 88 + .../meth-static-ary-ptrn-elem-id-init-exhausted.js | 85 + ...h-static-ary-ptrn-elem-id-init-fn-name-arrow.js | 86 + ...h-static-ary-ptrn-elem-id-init-fn-name-class.js | 88 + ...h-static-ary-ptrn-elem-id-init-fn-name-cover.js | 87 + ...meth-static-ary-ptrn-elem-id-init-fn-name-fn.js | 87 + ...eth-static-ary-ptrn-elem-id-init-fn-name-gen.js | 88 + .../dstr/meth-static-ary-ptrn-elem-id-init-hole.js | 81 + .../meth-static-ary-ptrn-elem-id-init-skipped.js | 90 + .../meth-static-ary-ptrn-elem-id-init-throws.js | 79 + .../meth-static-ary-ptrn-elem-id-init-undef.js | 84 + ...th-static-ary-ptrn-elem-id-init-unresolvable.js | 86 + .../meth-static-ary-ptrn-elem-id-iter-complete.js | 88 + .../dstr/meth-static-ary-ptrn-elem-id-iter-done.js | 83 + .../meth-static-ary-ptrn-elem-id-iter-step-err.js | 88 + ...ic-ary-ptrn-elem-id-iter-val-array-prototype.js | 104 + .../meth-static-ary-ptrn-elem-id-iter-val-err.js | 99 + .../dstr/meth-static-ary-ptrn-elem-id-iter-val.js | 94 + .../dstr/meth-static-ary-ptrn-elem-obj-id-init.js | 86 + .../class/dstr/meth-static-ary-ptrn-elem-obj-id.js | 86 + .../meth-static-ary-ptrn-elem-obj-prop-id-init.js | 96 + .../dstr/meth-static-ary-ptrn-elem-obj-prop-id.js | 96 + .../dstr/meth-static-ary-ptrn-elem-obj-val-null.js | 88 + .../meth-static-ary-ptrn-elem-obj-val-undef.js | 88 + .../dstr/meth-static-ary-ptrn-elision-exhausted.js | 91 + .../dstr/meth-static-ary-ptrn-elision-step-err.js | 95 + .../class/dstr/meth-static-ary-ptrn-elision.js | 100 + .../class/dstr/meth-static-ary-ptrn-empty.js | 83 + .../dstr/meth-static-ary-ptrn-rest-ary-elem.js | 107 + .../dstr/meth-static-ary-ptrn-rest-ary-elision.js | 113 + .../dstr/meth-static-ary-ptrn-rest-ary-empty.js | 96 + .../dstr/meth-static-ary-ptrn-rest-ary-rest.js | 92 + .../dstr/meth-static-ary-ptrn-rest-id-direct.js | 87 + ...eth-static-ary-ptrn-rest-id-elision-next-err.js | 81 + .../dstr/meth-static-ary-ptrn-rest-id-elision.js | 88 + .../dstr/meth-static-ary-ptrn-rest-id-exhausted.js | 84 + .../meth-static-ary-ptrn-rest-id-iter-step-err.js | 92 + .../meth-static-ary-ptrn-rest-id-iter-val-err.js | 94 + .../class/dstr/meth-static-ary-ptrn-rest-id.js | 85 + .../dstr/meth-static-ary-ptrn-rest-init-ary.js | 81 + .../dstr/meth-static-ary-ptrn-rest-init-id.js | 81 + .../dstr/meth-static-ary-ptrn-rest-init-obj.js | 81 + .../meth-static-ary-ptrn-rest-not-final-ary.js | 81 + .../dstr/meth-static-ary-ptrn-rest-not-final-id.js | 81 + .../meth-static-ary-ptrn-rest-not-final-obj.js | 81 + .../class/dstr/meth-static-ary-ptrn-rest-obj-id.js | 85 + .../dstr/meth-static-ary-ptrn-rest-obj-prop-id.js | 92 + .../dstr/meth-static-dflt-ary-init-iter-close.js | 95 + ...c-dflt-ary-init-iter-get-err-array-prototype.js | 87 + .../dstr/meth-static-dflt-ary-init-iter-get-err.js | 81 + .../meth-static-dflt-ary-init-iter-no-close.js | 95 + .../dstr/meth-static-dflt-ary-name-iter-val.js | 94 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-init.js | 86 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js | 87 + ...h-static-dflt-ary-ptrn-elem-ary-elision-init.js | 93 + ...h-static-dflt-ary-ptrn-elem-ary-elision-iter.js | 90 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-init.js | 89 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-iter.js | 86 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-init.js | 90 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js | 93 + .../meth-static-dflt-ary-ptrn-elem-ary-val-null.js | 88 + ...-static-dflt-ary-ptrn-elem-id-init-exhausted.js | 85 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 86 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 88 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 87 + ...static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 87 + ...tatic-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 88 + .../meth-static-dflt-ary-ptrn-elem-id-init-hole.js | 81 + ...th-static-dflt-ary-ptrn-elem-id-init-skipped.js | 90 + ...eth-static-dflt-ary-ptrn-elem-id-init-throws.js | 79 + ...meth-static-dflt-ary-ptrn-elem-id-init-undef.js | 84 + ...atic-dflt-ary-ptrn-elem-id-init-unresolvable.js | 86 + ...h-static-dflt-ary-ptrn-elem-id-iter-complete.js | 88 + .../meth-static-dflt-ary-ptrn-elem-id-iter-done.js | 83 + ...h-static-dflt-ary-ptrn-elem-id-iter-step-err.js | 88 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 104 + ...th-static-dflt-ary-ptrn-elem-id-iter-val-err.js | 99 + .../meth-static-dflt-ary-ptrn-elem-id-iter-val.js | 94 + .../meth-static-dflt-ary-ptrn-elem-obj-id-init.js | 86 + .../dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js | 86 + ...h-static-dflt-ary-ptrn-elem-obj-prop-id-init.js | 96 + .../meth-static-dflt-ary-ptrn-elem-obj-prop-id.js | 96 + .../meth-static-dflt-ary-ptrn-elem-obj-val-null.js | 88 + ...meth-static-dflt-ary-ptrn-elem-obj-val-undef.js | 88 + .../meth-static-dflt-ary-ptrn-elision-exhausted.js | 91 + .../meth-static-dflt-ary-ptrn-elision-step-err.js | 95 + .../dstr/meth-static-dflt-ary-ptrn-elision.js | 100 + .../class/dstr/meth-static-dflt-ary-ptrn-empty.js | 83 + .../meth-static-dflt-ary-ptrn-rest-ary-elem.js | 107 + .../meth-static-dflt-ary-ptrn-rest-ary-elision.js | 113 + .../meth-static-dflt-ary-ptrn-rest-ary-empty.js | 96 + .../meth-static-dflt-ary-ptrn-rest-ary-rest.js | 92 + .../meth-static-dflt-ary-ptrn-rest-id-direct.js | 87 + ...tatic-dflt-ary-ptrn-rest-id-elision-next-err.js | 81 + .../meth-static-dflt-ary-ptrn-rest-id-elision.js | 88 + .../meth-static-dflt-ary-ptrn-rest-id-exhausted.js | 84 + ...h-static-dflt-ary-ptrn-rest-id-iter-step-err.js | 92 + ...th-static-dflt-ary-ptrn-rest-id-iter-val-err.js | 94 + .../dstr/meth-static-dflt-ary-ptrn-rest-id.js | 85 + .../meth-static-dflt-ary-ptrn-rest-init-ary.js | 81 + .../dstr/meth-static-dflt-ary-ptrn-rest-init-id.js | 81 + .../meth-static-dflt-ary-ptrn-rest-init-obj.js | 81 + ...meth-static-dflt-ary-ptrn-rest-not-final-ary.js | 81 + .../meth-static-dflt-ary-ptrn-rest-not-final-id.js | 81 + ...meth-static-dflt-ary-ptrn-rest-not-final-obj.js | 81 + .../dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js | 85 + .../meth-static-dflt-ary-ptrn-rest-obj-prop-id.js | 92 + .../class/dstr/meth-static-dflt-obj-init-null.js | 75 + .../dstr/meth-static-dflt-obj-init-undefined.js | 75 + .../class/dstr/meth-static-dflt-obj-ptrn-empty.js | 84 + .../meth-static-dflt-obj-ptrn-id-get-value-err.js | 82 + ...h-static-dflt-obj-ptrn-id-init-fn-name-arrow.js | 85 + ...h-static-dflt-obj-ptrn-id-init-fn-name-class.js | 87 + ...h-static-dflt-obj-ptrn-id-init-fn-name-cover.js | 86 + ...meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js | 86 + ...eth-static-dflt-obj-ptrn-id-init-fn-name-gen.js | 87 + .../meth-static-dflt-obj-ptrn-id-init-skipped.js | 89 + .../meth-static-dflt-obj-ptrn-id-init-throws.js | 82 + ...th-static-dflt-obj-ptrn-id-init-unresolvable.js | 86 + .../meth-static-dflt-obj-ptrn-id-trailing-comma.js | 79 + .../dstr/meth-static-dflt-obj-ptrn-list-err.js | 83 + .../meth-static-dflt-obj-ptrn-prop-ary-init.js | 88 + ...static-dflt-obj-ptrn-prop-ary-trailing-comma.js | 79 + ...eth-static-dflt-obj-ptrn-prop-ary-value-null.js | 77 + .../dstr/meth-static-dflt-obj-ptrn-prop-ary.js | 86 + .../meth-static-dflt-obj-ptrn-prop-eval-err.js | 79 + ...h-static-dflt-obj-ptrn-prop-id-get-value-err.js | 84 + ...th-static-dflt-obj-ptrn-prop-id-init-skipped.js | 101 + ...eth-static-dflt-obj-ptrn-prop-id-init-throws.js | 82 + ...atic-dflt-obj-ptrn-prop-id-init-unresolvable.js | 86 + .../dstr/meth-static-dflt-obj-ptrn-prop-id-init.js | 82 + ...-static-dflt-obj-ptrn-prop-id-trailing-comma.js | 83 + .../dstr/meth-static-dflt-obj-ptrn-prop-id.js | 82 + .../meth-static-dflt-obj-ptrn-prop-obj-init.js | 88 + ...eth-static-dflt-obj-ptrn-prop-obj-value-null.js | 77 + ...th-static-dflt-obj-ptrn-prop-obj-value-undef.js | 77 + .../dstr/meth-static-dflt-obj-ptrn-prop-obj.js | 86 + .../dstr/meth-static-dflt-obj-ptrn-rest-getter.js | 81 + ...tatic-dflt-obj-ptrn-rest-skip-non-enumerable.js | 89 + .../dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js | 88 + .../class/dstr/meth-static-obj-init-null.js | 75 + .../class/dstr/meth-static-obj-init-undefined.js | 75 + .../class/dstr/meth-static-obj-ptrn-empty.js | 84 + .../dstr/meth-static-obj-ptrn-id-get-value-err.js | 82 + .../meth-static-obj-ptrn-id-init-fn-name-arrow.js | 85 + .../meth-static-obj-ptrn-id-init-fn-name-class.js | 87 + .../meth-static-obj-ptrn-id-init-fn-name-cover.js | 86 + .../meth-static-obj-ptrn-id-init-fn-name-fn.js | 86 + .../meth-static-obj-ptrn-id-init-fn-name-gen.js | 87 + .../dstr/meth-static-obj-ptrn-id-init-skipped.js | 89 + .../dstr/meth-static-obj-ptrn-id-init-throws.js | 82 + .../meth-static-obj-ptrn-id-init-unresolvable.js | 86 + .../dstr/meth-static-obj-ptrn-id-trailing-comma.js | 79 + .../class/dstr/meth-static-obj-ptrn-list-err.js | 83 + .../dstr/meth-static-obj-ptrn-prop-ary-init.js | 88 + ...meth-static-obj-ptrn-prop-ary-trailing-comma.js | 79 + .../meth-static-obj-ptrn-prop-ary-value-null.js | 77 + .../class/dstr/meth-static-obj-ptrn-prop-ary.js | 86 + .../dstr/meth-static-obj-ptrn-prop-eval-err.js | 79 + .../meth-static-obj-ptrn-prop-id-get-value-err.js | 84 + .../meth-static-obj-ptrn-prop-id-init-skipped.js | 101 + .../meth-static-obj-ptrn-prop-id-init-throws.js | 82 + ...th-static-obj-ptrn-prop-id-init-unresolvable.js | 86 + .../dstr/meth-static-obj-ptrn-prop-id-init.js | 82 + .../meth-static-obj-ptrn-prop-id-trailing-comma.js | 83 + .../class/dstr/meth-static-obj-ptrn-prop-id.js | 82 + .../dstr/meth-static-obj-ptrn-prop-obj-init.js | 88 + .../meth-static-obj-ptrn-prop-obj-value-null.js | 77 + .../meth-static-obj-ptrn-prop-obj-value-undef.js | 77 + .../class/dstr/meth-static-obj-ptrn-prop-obj.js | 86 + .../class/dstr/meth-static-obj-ptrn-rest-getter.js | 81 + ...eth-static-obj-ptrn-rest-skip-non-enumerable.js | 89 + .../dstr/meth-static-obj-ptrn-rest-val-obj.js | 88 + .../dstr/private-gen-meth-ary-init-iter-close.js | 102 + .../private-gen-meth-ary-init-iter-no-close.js | 102 + .../dstr/private-gen-meth-ary-name-iter-val.js | 101 + ...private-gen-meth-ary-ptrn-elem-ary-elem-init.js | 93 + ...private-gen-meth-ary-ptrn-elem-ary-elem-iter.js | 94 + ...vate-gen-meth-ary-ptrn-elem-ary-elision-init.js | 100 + ...vate-gen-meth-ary-ptrn-elem-ary-elision-iter.js | 97 + ...rivate-gen-meth-ary-ptrn-elem-ary-empty-init.js | 96 + ...rivate-gen-meth-ary-ptrn-elem-ary-empty-iter.js | 93 + ...private-gen-meth-ary-ptrn-elem-ary-rest-init.js | 97 + ...private-gen-meth-ary-ptrn-elem-ary-rest-iter.js | 100 + ...ate-gen-meth-ary-ptrn-elem-id-init-exhausted.js | 92 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 93 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-class.js | 95 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js | 94 + ...te-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js | 94 + ...e-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js | 95 + .../private-gen-meth-ary-ptrn-elem-id-init-hole.js | 88 + ...ivate-gen-meth-ary-ptrn-elem-id-init-skipped.js | 97 + ...private-gen-meth-ary-ptrn-elem-id-init-undef.js | 91 + ...vate-gen-meth-ary-ptrn-elem-id-iter-complete.js | 95 + .../private-gen-meth-ary-ptrn-elem-id-iter-done.js | 90 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 111 + .../private-gen-meth-ary-ptrn-elem-id-iter-val.js | 101 + .../private-gen-meth-ary-ptrn-elem-obj-id-init.js | 93 + .../dstr/private-gen-meth-ary-ptrn-elem-obj-id.js | 93 + ...vate-gen-meth-ary-ptrn-elem-obj-prop-id-init.js | 103 + .../private-gen-meth-ary-ptrn-elem-obj-prop-id.js | 103 + .../private-gen-meth-ary-ptrn-elision-exhausted.js | 98 + .../dstr/private-gen-meth-ary-ptrn-elision.js | 107 + .../class/dstr/private-gen-meth-ary-ptrn-empty.js | 90 + .../private-gen-meth-ary-ptrn-rest-ary-elem.js | 114 + .../private-gen-meth-ary-ptrn-rest-ary-elision.js | 120 + .../private-gen-meth-ary-ptrn-rest-ary-empty.js | 103 + .../private-gen-meth-ary-ptrn-rest-ary-rest.js | 99 + .../private-gen-meth-ary-ptrn-rest-id-direct.js | 94 + .../private-gen-meth-ary-ptrn-rest-id-elision.js | 95 + .../private-gen-meth-ary-ptrn-rest-id-exhausted.js | 91 + .../dstr/private-gen-meth-ary-ptrn-rest-id.js | 92 + .../private-gen-meth-ary-ptrn-rest-init-ary.js | 88 + .../dstr/private-gen-meth-ary-ptrn-rest-init-id.js | 88 + .../private-gen-meth-ary-ptrn-rest-init-obj.js | 88 + ...private-gen-meth-ary-ptrn-rest-not-final-ary.js | 88 + .../private-gen-meth-ary-ptrn-rest-not-final-id.js | 88 + ...private-gen-meth-ary-ptrn-rest-not-final-obj.js | 88 + .../dstr/private-gen-meth-ary-ptrn-rest-obj-id.js | 92 + .../private-gen-meth-ary-ptrn-rest-obj-prop-id.js | 99 + .../private-gen-meth-dflt-ary-init-iter-close.js | 102 + ...private-gen-meth-dflt-ary-init-iter-no-close.js | 102 + .../private-gen-meth-dflt-ary-name-iter-val.js | 101 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js | 93 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 94 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js | 100 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 97 + ...e-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js | 96 + ...e-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 93 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js | 97 + ...te-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 100 + ...en-meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 92 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 93 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 95 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 94 + ...n-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 94 + ...-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 95 + ...ate-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js | 88 + ...-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js | 97 + ...te-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js | 91 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js | 95 + ...ate-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js | 90 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 111 + ...vate-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js | 101 + ...vate-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js | 93 + .../private-gen-meth-dflt-ary-ptrn-elem-obj-id.js | 93 + ...gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 103 + ...vate-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js | 103 + ...ate-gen-meth-dflt-ary-ptrn-elision-exhausted.js | 98 + .../dstr/private-gen-meth-dflt-ary-ptrn-elision.js | 107 + .../dstr/private-gen-meth-dflt-ary-ptrn-empty.js | 90 + ...private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js | 114 + ...vate-gen-meth-dflt-ary-ptrn-rest-ary-elision.js | 120 + ...rivate-gen-meth-dflt-ary-ptrn-rest-ary-empty.js | 103 + ...private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js | 99 + ...rivate-gen-meth-dflt-ary-ptrn-rest-id-direct.js | 94 + ...ivate-gen-meth-dflt-ary-ptrn-rest-id-elision.js | 95 + ...ate-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js | 91 + .../dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js | 92 + ...private-gen-meth-dflt-ary-ptrn-rest-init-ary.js | 88 + .../private-gen-meth-dflt-ary-ptrn-rest-init-id.js | 88 + ...private-gen-meth-dflt-ary-ptrn-rest-init-obj.js | 88 + ...te-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js | 88 + ...ate-gen-meth-dflt-ary-ptrn-rest-not-final-id.js | 88 + ...te-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js | 88 + .../private-gen-meth-dflt-ary-ptrn-rest-obj-id.js | 92 + ...vate-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js | 99 + .../dstr/private-gen-meth-dflt-obj-ptrn-empty.js | 91 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 92 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js | 94 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 93 + ...te-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 93 + ...e-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 94 + ...ivate-gen-meth-dflt-obj-ptrn-id-init-skipped.js | 96 + ...ate-gen-meth-dflt-obj-ptrn-id-trailing-comma.js | 86 + ...private-gen-meth-dflt-obj-ptrn-prop-ary-init.js | 95 + ...n-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 86 + .../private-gen-meth-dflt-obj-ptrn-prop-ary.js | 93 + ...-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js | 108 + .../private-gen-meth-dflt-obj-ptrn-prop-id-init.js | 89 + ...en-meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 90 + .../dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js | 89 + ...private-gen-meth-dflt-obj-ptrn-prop-obj-init.js | 95 + .../private-gen-meth-dflt-obj-ptrn-prop-obj.js | 93 + .../private-gen-meth-dflt-obj-ptrn-rest-getter.js | 88 + ...-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 96 + .../private-gen-meth-dflt-obj-ptrn-rest-val-obj.js | 95 + .../class/dstr/private-gen-meth-obj-ptrn-empty.js | 91 + ...vate-gen-meth-obj-ptrn-id-init-fn-name-arrow.js | 92 + ...vate-gen-meth-obj-ptrn-id-init-fn-name-class.js | 94 + ...vate-gen-meth-obj-ptrn-id-init-fn-name-cover.js | 93 + ...private-gen-meth-obj-ptrn-id-init-fn-name-fn.js | 93 + ...rivate-gen-meth-obj-ptrn-id-init-fn-name-gen.js | 94 + .../private-gen-meth-obj-ptrn-id-init-skipped.js | 96 + .../private-gen-meth-obj-ptrn-id-trailing-comma.js | 86 + .../private-gen-meth-obj-ptrn-prop-ary-init.js | 95 + ...te-gen-meth-obj-ptrn-prop-ary-trailing-comma.js | 86 + .../dstr/private-gen-meth-obj-ptrn-prop-ary.js | 93 + ...ivate-gen-meth-obj-ptrn-prop-id-init-skipped.js | 108 + .../dstr/private-gen-meth-obj-ptrn-prop-id-init.js | 89 + ...ate-gen-meth-obj-ptrn-prop-id-trailing-comma.js | 90 + .../dstr/private-gen-meth-obj-ptrn-prop-id.js | 89 + .../private-gen-meth-obj-ptrn-prop-obj-init.js | 95 + .../dstr/private-gen-meth-obj-ptrn-prop-obj.js | 93 + .../dstr/private-gen-meth-obj-ptrn-rest-getter.js | 88 + ...e-gen-meth-obj-ptrn-rest-skip-non-enumerable.js | 96 + .../dstr/private-gen-meth-obj-ptrn-rest-val-obj.js | 95 + .../private-gen-meth-static-ary-init-iter-close.js | 102 + ...ivate-gen-meth-static-ary-init-iter-no-close.js | 102 + .../private-gen-meth-static-ary-name-iter-val.js | 101 + ...-gen-meth-static-ary-ptrn-elem-ary-elem-init.js | 93 + ...-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js | 94 + ...n-meth-static-ary-ptrn-elem-ary-elision-init.js | 100 + ...n-meth-static-ary-ptrn-elem-ary-elision-iter.js | 97 + ...gen-meth-static-ary-ptrn-elem-ary-empty-init.js | 96 + ...gen-meth-static-ary-ptrn-elem-ary-empty-iter.js | 93 + ...-gen-meth-static-ary-ptrn-elem-ary-rest-init.js | 97 + ...-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js | 100 + ...-meth-static-ary-ptrn-elem-id-init-exhausted.js | 92 + ...h-static-ary-ptrn-elem-id-init-fn-name-arrow.js | 93 + ...h-static-ary-ptrn-elem-id-init-fn-name-class.js | 95 + ...h-static-ary-ptrn-elem-id-init-fn-name-cover.js | 94 + ...meth-static-ary-ptrn-elem-id-init-fn-name-fn.js | 94 + ...eth-static-ary-ptrn-elem-id-init-fn-name-gen.js | 95 + ...e-gen-meth-static-ary-ptrn-elem-id-init-hole.js | 88 + ...en-meth-static-ary-ptrn-elem-id-init-skipped.js | 97 + ...-gen-meth-static-ary-ptrn-elem-id-init-undef.js | 91 + ...n-meth-static-ary-ptrn-elem-id-iter-complete.js | 95 + ...e-gen-meth-static-ary-ptrn-elem-id-iter-done.js | 90 + ...ic-ary-ptrn-elem-id-iter-val-array-prototype.js | 111 + ...te-gen-meth-static-ary-ptrn-elem-id-iter-val.js | 101 + ...te-gen-meth-static-ary-ptrn-elem-obj-id-init.js | 93 + ...private-gen-meth-static-ary-ptrn-elem-obj-id.js | 93 + ...n-meth-static-ary-ptrn-elem-obj-prop-id-init.js | 103 + ...te-gen-meth-static-ary-ptrn-elem-obj-prop-id.js | 103 + ...e-gen-meth-static-ary-ptrn-elision-exhausted.js | 98 + .../private-gen-meth-static-ary-ptrn-elision.js | 107 + .../dstr/private-gen-meth-static-ary-ptrn-empty.js | 90 + ...ivate-gen-meth-static-ary-ptrn-rest-ary-elem.js | 114 + ...te-gen-meth-static-ary-ptrn-rest-ary-elision.js | 120 + ...vate-gen-meth-static-ary-ptrn-rest-ary-empty.js | 103 + ...ivate-gen-meth-static-ary-ptrn-rest-ary-rest.js | 99 + ...vate-gen-meth-static-ary-ptrn-rest-id-direct.js | 94 + ...ate-gen-meth-static-ary-ptrn-rest-id-elision.js | 95 + ...e-gen-meth-static-ary-ptrn-rest-id-exhausted.js | 91 + .../private-gen-meth-static-ary-ptrn-rest-id.js | 92 + ...ivate-gen-meth-static-ary-ptrn-rest-init-ary.js | 88 + ...rivate-gen-meth-static-ary-ptrn-rest-init-id.js | 88 + ...ivate-gen-meth-static-ary-ptrn-rest-init-obj.js | 88 + ...-gen-meth-static-ary-ptrn-rest-not-final-ary.js | 88 + ...e-gen-meth-static-ary-ptrn-rest-not-final-id.js | 88 + ...-gen-meth-static-ary-ptrn-rest-not-final-obj.js | 88 + ...private-gen-meth-static-ary-ptrn-rest-obj-id.js | 92 + ...te-gen-meth-static-ary-ptrn-rest-obj-prop-id.js | 99 + ...ate-gen-meth-static-dflt-ary-init-iter-close.js | 102 + ...-gen-meth-static-dflt-ary-init-iter-no-close.js | 102 + ...ivate-gen-meth-static-dflt-ary-name-iter-val.js | 101 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-init.js | 93 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js | 94 + ...h-static-dflt-ary-ptrn-elem-ary-elision-init.js | 100 + ...h-static-dflt-ary-ptrn-elem-ary-elision-iter.js | 97 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-init.js | 96 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-iter.js | 93 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-init.js | 97 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js | 100 + ...-static-dflt-ary-ptrn-elem-id-init-exhausted.js | 92 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 93 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 95 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 94 + ...static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 94 + ...tatic-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 95 + ...-meth-static-dflt-ary-ptrn-elem-id-init-hole.js | 88 + ...th-static-dflt-ary-ptrn-elem-id-init-skipped.js | 97 + ...meth-static-dflt-ary-ptrn-elem-id-init-undef.js | 91 + ...h-static-dflt-ary-ptrn-elem-id-iter-complete.js | 95 + ...-meth-static-dflt-ary-ptrn-elem-id-iter-done.js | 90 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 111 + ...n-meth-static-dflt-ary-ptrn-elem-id-iter-val.js | 101 + ...n-meth-static-dflt-ary-ptrn-elem-obj-id-init.js | 93 + ...te-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js | 93 + ...h-static-dflt-ary-ptrn-elem-obj-prop-id-init.js | 103 + ...n-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js | 103 + ...-meth-static-dflt-ary-ptrn-elision-exhausted.js | 98 + ...rivate-gen-meth-static-dflt-ary-ptrn-elision.js | 107 + .../private-gen-meth-static-dflt-ary-ptrn-empty.js | 90 + ...-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js | 114 + ...n-meth-static-dflt-ary-ptrn-rest-ary-elision.js | 120 + ...gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js | 103 + ...-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js | 99 + ...gen-meth-static-dflt-ary-ptrn-rest-id-direct.js | 94 + ...en-meth-static-dflt-ary-ptrn-rest-id-elision.js | 95 + ...-meth-static-dflt-ary-ptrn-rest-id-exhausted.js | 91 + ...rivate-gen-meth-static-dflt-ary-ptrn-rest-id.js | 92 + ...-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js | 88 + ...e-gen-meth-static-dflt-ary-ptrn-rest-init-id.js | 88 + ...-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js | 88 + ...meth-static-dflt-ary-ptrn-rest-not-final-ary.js | 88 + ...-meth-static-dflt-ary-ptrn-rest-not-final-id.js | 88 + ...meth-static-dflt-ary-ptrn-rest-not-final-obj.js | 88 + ...te-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js | 92 + ...n-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js | 99 + .../private-gen-meth-static-dflt-obj-ptrn-empty.js | 91 + ...h-static-dflt-obj-ptrn-id-init-fn-name-arrow.js | 92 + ...h-static-dflt-obj-ptrn-id-init-fn-name-class.js | 94 + ...h-static-dflt-obj-ptrn-id-init-fn-name-cover.js | 93 + ...meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js | 93 + ...eth-static-dflt-obj-ptrn-id-init-fn-name-gen.js | 94 + ...en-meth-static-dflt-obj-ptrn-id-init-skipped.js | 96 + ...-meth-static-dflt-obj-ptrn-id-trailing-comma.js | 86 + ...-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js | 95 + ...static-dflt-obj-ptrn-prop-ary-trailing-comma.js | 86 + ...ivate-gen-meth-static-dflt-obj-ptrn-prop-ary.js | 93 + ...th-static-dflt-obj-ptrn-prop-id-init-skipped.js | 108 + ...e-gen-meth-static-dflt-obj-ptrn-prop-id-init.js | 89 + ...-static-dflt-obj-ptrn-prop-id-trailing-comma.js | 90 + ...rivate-gen-meth-static-dflt-obj-ptrn-prop-id.js | 89 + ...-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js | 95 + ...ivate-gen-meth-static-dflt-obj-ptrn-prop-obj.js | 93 + ...te-gen-meth-static-dflt-obj-ptrn-rest-getter.js | 88 + ...tatic-dflt-obj-ptrn-rest-skip-non-enumerable.js | 96 + ...e-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js | 95 + .../dstr/private-gen-meth-static-obj-ptrn-empty.js | 91 + ...n-meth-static-obj-ptrn-id-init-fn-name-arrow.js | 92 + ...n-meth-static-obj-ptrn-id-init-fn-name-class.js | 94 + ...n-meth-static-obj-ptrn-id-init-fn-name-cover.js | 93 + ...-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js | 93 + ...gen-meth-static-obj-ptrn-id-init-fn-name-gen.js | 94 + ...ate-gen-meth-static-obj-ptrn-id-init-skipped.js | 96 + ...e-gen-meth-static-obj-ptrn-id-trailing-comma.js | 86 + ...ivate-gen-meth-static-obj-ptrn-prop-ary-init.js | 95 + ...meth-static-obj-ptrn-prop-ary-trailing-comma.js | 86 + .../private-gen-meth-static-obj-ptrn-prop-ary.js | 93 + ...en-meth-static-obj-ptrn-prop-id-init-skipped.js | 108 + ...rivate-gen-meth-static-obj-ptrn-prop-id-init.js | 89 + ...-meth-static-obj-ptrn-prop-id-trailing-comma.js | 90 + .../private-gen-meth-static-obj-ptrn-prop-id.js | 89 + ...ivate-gen-meth-static-obj-ptrn-prop-obj-init.js | 95 + .../private-gen-meth-static-obj-ptrn-prop-obj.js | 93 + ...private-gen-meth-static-obj-ptrn-rest-getter.js | 88 + ...eth-static-obj-ptrn-rest-skip-non-enumerable.js | 96 + ...rivate-gen-meth-static-obj-ptrn-rest-val-obj.js | 95 + .../class/dstr/private-meth-ary-init-iter-close.js | 99 + .../dstr/private-meth-ary-init-iter-no-close.js | 99 + .../class/dstr/private-meth-ary-name-iter-val.js | 98 + .../private-meth-ary-ptrn-elem-ary-elem-init.js | 90 + .../private-meth-ary-ptrn-elem-ary-elem-iter.js | 91 + .../private-meth-ary-ptrn-elem-ary-elision-init.js | 97 + .../private-meth-ary-ptrn-elem-ary-elision-iter.js | 94 + .../private-meth-ary-ptrn-elem-ary-empty-init.js | 93 + .../private-meth-ary-ptrn-elem-ary-empty-iter.js | 90 + .../private-meth-ary-ptrn-elem-ary-rest-init.js | 94 + .../private-meth-ary-ptrn-elem-ary-rest-iter.js | 97 + ...private-meth-ary-ptrn-elem-id-init-exhausted.js | 89 + ...ate-meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 90 + ...ate-meth-ary-ptrn-elem-id-init-fn-name-class.js | 92 + ...ate-meth-ary-ptrn-elem-id-init-fn-name-cover.js | 91 + ...rivate-meth-ary-ptrn-elem-id-init-fn-name-fn.js | 91 + ...ivate-meth-ary-ptrn-elem-id-init-fn-name-gen.js | 92 + .../private-meth-ary-ptrn-elem-id-init-hole.js | 85 + .../private-meth-ary-ptrn-elem-id-init-skipped.js | 94 + .../private-meth-ary-ptrn-elem-id-init-undef.js | 88 + .../private-meth-ary-ptrn-elem-id-iter-complete.js | 92 + .../private-meth-ary-ptrn-elem-id-iter-done.js | 87 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 108 + .../dstr/private-meth-ary-ptrn-elem-id-iter-val.js | 98 + .../dstr/private-meth-ary-ptrn-elem-obj-id-init.js | 90 + .../dstr/private-meth-ary-ptrn-elem-obj-id.js | 90 + .../private-meth-ary-ptrn-elem-obj-prop-id-init.js | 100 + .../dstr/private-meth-ary-ptrn-elem-obj-prop-id.js | 100 + .../private-meth-ary-ptrn-elision-exhausted.js | 95 + .../class/dstr/private-meth-ary-ptrn-elision.js | 104 + .../class/dstr/private-meth-ary-ptrn-empty.js | 87 + .../dstr/private-meth-ary-ptrn-rest-ary-elem.js | 111 + .../dstr/private-meth-ary-ptrn-rest-ary-elision.js | 117 + .../dstr/private-meth-ary-ptrn-rest-ary-empty.js | 100 + .../dstr/private-meth-ary-ptrn-rest-ary-rest.js | 96 + .../dstr/private-meth-ary-ptrn-rest-id-direct.js | 91 + .../dstr/private-meth-ary-ptrn-rest-id-elision.js | 92 + .../private-meth-ary-ptrn-rest-id-exhausted.js | 88 + .../class/dstr/private-meth-ary-ptrn-rest-id.js | 89 + .../dstr/private-meth-ary-ptrn-rest-init-ary.js | 85 + .../dstr/private-meth-ary-ptrn-rest-init-id.js | 85 + .../dstr/private-meth-ary-ptrn-rest-init-obj.js | 85 + .../private-meth-ary-ptrn-rest-not-final-ary.js | 85 + .../private-meth-ary-ptrn-rest-not-final-id.js | 85 + .../private-meth-ary-ptrn-rest-not-final-obj.js | 85 + .../dstr/private-meth-ary-ptrn-rest-obj-id.js | 89 + .../dstr/private-meth-ary-ptrn-rest-obj-prop-id.js | 96 + .../dstr/private-meth-dflt-ary-init-iter-close.js | 99 + .../private-meth-dflt-ary-init-iter-no-close.js | 99 + .../dstr/private-meth-dflt-ary-name-iter-val.js | 98 + ...rivate-meth-dflt-ary-ptrn-elem-ary-elem-init.js | 90 + ...rivate-meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 91 + ...ate-meth-dflt-ary-ptrn-elem-ary-elision-init.js | 97 + ...ate-meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 94 + ...ivate-meth-dflt-ary-ptrn-elem-ary-empty-init.js | 93 + ...ivate-meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 90 + ...rivate-meth-dflt-ary-ptrn-elem-ary-rest-init.js | 94 + ...rivate-meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 97 + ...te-meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 89 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 90 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 92 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 91 + ...e-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 91 + ...-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 92 + ...private-meth-dflt-ary-ptrn-elem-id-init-hole.js | 85 + ...vate-meth-dflt-ary-ptrn-elem-id-init-skipped.js | 94 + ...rivate-meth-dflt-ary-ptrn-elem-id-init-undef.js | 88 + ...ate-meth-dflt-ary-ptrn-elem-id-iter-complete.js | 92 + ...private-meth-dflt-ary-ptrn-elem-id-iter-done.js | 87 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 108 + .../private-meth-dflt-ary-ptrn-elem-id-iter-val.js | 98 + .../private-meth-dflt-ary-ptrn-elem-obj-id-init.js | 90 + .../dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js | 90 + ...ate-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 100 + .../private-meth-dflt-ary-ptrn-elem-obj-prop-id.js | 100 + ...private-meth-dflt-ary-ptrn-elision-exhausted.js | 95 + .../dstr/private-meth-dflt-ary-ptrn-elision.js | 104 + .../class/dstr/private-meth-dflt-ary-ptrn-empty.js | 87 + .../private-meth-dflt-ary-ptrn-rest-ary-elem.js | 111 + .../private-meth-dflt-ary-ptrn-rest-ary-elision.js | 117 + .../private-meth-dflt-ary-ptrn-rest-ary-empty.js | 100 + .../private-meth-dflt-ary-ptrn-rest-ary-rest.js | 96 + .../private-meth-dflt-ary-ptrn-rest-id-direct.js | 91 + .../private-meth-dflt-ary-ptrn-rest-id-elision.js | 92 + ...private-meth-dflt-ary-ptrn-rest-id-exhausted.js | 88 + .../dstr/private-meth-dflt-ary-ptrn-rest-id.js | 89 + .../private-meth-dflt-ary-ptrn-rest-init-ary.js | 85 + .../private-meth-dflt-ary-ptrn-rest-init-id.js | 85 + .../private-meth-dflt-ary-ptrn-rest-init-obj.js | 85 + ...rivate-meth-dflt-ary-ptrn-rest-not-final-ary.js | 85 + ...private-meth-dflt-ary-ptrn-rest-not-final-id.js | 85 + ...rivate-meth-dflt-ary-ptrn-rest-not-final-obj.js | 85 + .../dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js | 89 + .../private-meth-dflt-ary-ptrn-rest-obj-prop-id.js | 96 + .../class/dstr/private-meth-dflt-obj-ptrn-empty.js | 88 + ...ate-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 89 + ...ate-meth-dflt-obj-ptrn-id-init-fn-name-class.js | 91 + ...ate-meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 90 + ...rivate-meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 90 + ...ivate-meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 91 + .../private-meth-dflt-obj-ptrn-id-init-skipped.js | 93 + ...private-meth-dflt-obj-ptrn-id-trailing-comma.js | 83 + .../private-meth-dflt-obj-ptrn-prop-ary-init.js | 92 + ...e-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 83 + .../dstr/private-meth-dflt-obj-ptrn-prop-ary.js | 90 + ...vate-meth-dflt-obj-ptrn-prop-id-init-skipped.js | 105 + .../private-meth-dflt-obj-ptrn-prop-id-init.js | 86 + ...te-meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 87 + .../dstr/private-meth-dflt-obj-ptrn-prop-id.js | 86 + .../private-meth-dflt-obj-ptrn-prop-obj-init.js | 92 + .../dstr/private-meth-dflt-obj-ptrn-prop-obj.js | 90 + .../dstr/private-meth-dflt-obj-ptrn-rest-getter.js | 85 + ...-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 93 + .../private-meth-dflt-obj-ptrn-rest-val-obj.js | 92 + .../class/dstr/private-meth-obj-ptrn-empty.js | 88 + .../private-meth-obj-ptrn-id-init-fn-name-arrow.js | 89 + .../private-meth-obj-ptrn-id-init-fn-name-class.js | 91 + .../private-meth-obj-ptrn-id-init-fn-name-cover.js | 90 + .../private-meth-obj-ptrn-id-init-fn-name-fn.js | 90 + .../private-meth-obj-ptrn-id-init-fn-name-gen.js | 91 + .../dstr/private-meth-obj-ptrn-id-init-skipped.js | 93 + .../private-meth-obj-ptrn-id-trailing-comma.js | 83 + .../dstr/private-meth-obj-ptrn-prop-ary-init.js | 92 + ...rivate-meth-obj-ptrn-prop-ary-trailing-comma.js | 83 + .../class/dstr/private-meth-obj-ptrn-prop-ary.js | 90 + .../private-meth-obj-ptrn-prop-id-init-skipped.js | 105 + .../dstr/private-meth-obj-ptrn-prop-id-init.js | 86 + ...private-meth-obj-ptrn-prop-id-trailing-comma.js | 87 + .../class/dstr/private-meth-obj-ptrn-prop-id.js | 86 + .../dstr/private-meth-obj-ptrn-prop-obj-init.js | 92 + .../class/dstr/private-meth-obj-ptrn-prop-obj.js | 90 + .../dstr/private-meth-obj-ptrn-rest-getter.js | 85 + ...ivate-meth-obj-ptrn-rest-skip-non-enumerable.js | 93 + .../dstr/private-meth-obj-ptrn-rest-val-obj.js | 92 + .../private-meth-static-ary-init-iter-close.js | 99 + .../private-meth-static-ary-init-iter-no-close.js | 99 + .../dstr/private-meth-static-ary-name-iter-val.js | 98 + ...vate-meth-static-ary-ptrn-elem-ary-elem-init.js | 90 + ...vate-meth-static-ary-ptrn-elem-ary-elem-iter.js | 91 + ...e-meth-static-ary-ptrn-elem-ary-elision-init.js | 97 + ...e-meth-static-ary-ptrn-elem-ary-elision-iter.js | 94 + ...ate-meth-static-ary-ptrn-elem-ary-empty-init.js | 93 + ...ate-meth-static-ary-ptrn-elem-ary-empty-iter.js | 90 + ...vate-meth-static-ary-ptrn-elem-ary-rest-init.js | 94 + ...vate-meth-static-ary-ptrn-elem-ary-rest-iter.js | 97 + ...-meth-static-ary-ptrn-elem-id-init-exhausted.js | 89 + ...h-static-ary-ptrn-elem-id-init-fn-name-arrow.js | 90 + ...h-static-ary-ptrn-elem-id-init-fn-name-class.js | 92 + ...h-static-ary-ptrn-elem-id-init-fn-name-cover.js | 91 + ...meth-static-ary-ptrn-elem-id-init-fn-name-fn.js | 91 + ...eth-static-ary-ptrn-elem-id-init-fn-name-gen.js | 92 + ...ivate-meth-static-ary-ptrn-elem-id-init-hole.js | 85 + ...te-meth-static-ary-ptrn-elem-id-init-skipped.js | 94 + ...vate-meth-static-ary-ptrn-elem-id-init-undef.js | 88 + ...e-meth-static-ary-ptrn-elem-id-iter-complete.js | 92 + ...ivate-meth-static-ary-ptrn-elem-id-iter-done.js | 87 + ...ic-ary-ptrn-elem-id-iter-val-array-prototype.js | 108 + ...rivate-meth-static-ary-ptrn-elem-id-iter-val.js | 98 + ...rivate-meth-static-ary-ptrn-elem-obj-id-init.js | 90 + .../private-meth-static-ary-ptrn-elem-obj-id.js | 90 + ...e-meth-static-ary-ptrn-elem-obj-prop-id-init.js | 100 + ...rivate-meth-static-ary-ptrn-elem-obj-prop-id.js | 100 + ...ivate-meth-static-ary-ptrn-elision-exhausted.js | 95 + .../dstr/private-meth-static-ary-ptrn-elision.js | 104 + .../dstr/private-meth-static-ary-ptrn-empty.js | 87 + .../private-meth-static-ary-ptrn-rest-ary-elem.js | 111 + ...rivate-meth-static-ary-ptrn-rest-ary-elision.js | 117 + .../private-meth-static-ary-ptrn-rest-ary-empty.js | 100 + .../private-meth-static-ary-ptrn-rest-ary-rest.js | 96 + .../private-meth-static-ary-ptrn-rest-id-direct.js | 91 + ...private-meth-static-ary-ptrn-rest-id-elision.js | 92 + ...ivate-meth-static-ary-ptrn-rest-id-exhausted.js | 88 + .../dstr/private-meth-static-ary-ptrn-rest-id.js | 89 + .../private-meth-static-ary-ptrn-rest-init-ary.js | 85 + .../private-meth-static-ary-ptrn-rest-init-id.js | 85 + .../private-meth-static-ary-ptrn-rest-init-obj.js | 85 + ...vate-meth-static-ary-ptrn-rest-not-final-ary.js | 85 + ...ivate-meth-static-ary-ptrn-rest-not-final-id.js | 85 + ...vate-meth-static-ary-ptrn-rest-not-final-obj.js | 85 + .../private-meth-static-ary-ptrn-rest-obj-id.js | 89 + ...rivate-meth-static-ary-ptrn-rest-obj-prop-id.js | 96 + ...private-meth-static-dflt-ary-init-iter-close.js | 99 + ...vate-meth-static-dflt-ary-init-iter-no-close.js | 99 + .../private-meth-static-dflt-ary-name-iter-val.js | 98 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-init.js | 90 + ...meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js | 91 + ...h-static-dflt-ary-ptrn-elem-ary-elision-init.js | 97 + ...h-static-dflt-ary-ptrn-elem-ary-elision-iter.js | 94 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-init.js | 93 + ...eth-static-dflt-ary-ptrn-elem-ary-empty-iter.js | 90 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-init.js | 94 + ...meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js | 97 + ...-static-dflt-ary-ptrn-elem-id-init-exhausted.js | 89 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 90 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 92 + ...tic-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 91 + ...static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 91 + ...tatic-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 92 + ...-meth-static-dflt-ary-ptrn-elem-id-init-hole.js | 85 + ...th-static-dflt-ary-ptrn-elem-id-init-skipped.js | 94 + ...meth-static-dflt-ary-ptrn-elem-id-init-undef.js | 88 + ...h-static-dflt-ary-ptrn-elem-id-iter-complete.js | 92 + ...-meth-static-dflt-ary-ptrn-elem-id-iter-done.js | 87 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 108 + ...e-meth-static-dflt-ary-ptrn-elem-id-iter-val.js | 98 + ...e-meth-static-dflt-ary-ptrn-elem-obj-id-init.js | 90 + ...rivate-meth-static-dflt-ary-ptrn-elem-obj-id.js | 90 + ...h-static-dflt-ary-ptrn-elem-obj-prop-id-init.js | 100 + ...e-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js | 100 + ...-meth-static-dflt-ary-ptrn-elision-exhausted.js | 95 + .../private-meth-static-dflt-ary-ptrn-elision.js | 104 + .../private-meth-static-dflt-ary-ptrn-empty.js | 87 + ...vate-meth-static-dflt-ary-ptrn-rest-ary-elem.js | 111 + ...e-meth-static-dflt-ary-ptrn-rest-ary-elision.js | 117 + ...ate-meth-static-dflt-ary-ptrn-rest-ary-empty.js | 100 + ...vate-meth-static-dflt-ary-ptrn-rest-ary-rest.js | 96 + ...ate-meth-static-dflt-ary-ptrn-rest-id-direct.js | 91 + ...te-meth-static-dflt-ary-ptrn-rest-id-elision.js | 92 + ...-meth-static-dflt-ary-ptrn-rest-id-exhausted.js | 88 + .../private-meth-static-dflt-ary-ptrn-rest-id.js | 89 + ...vate-meth-static-dflt-ary-ptrn-rest-init-ary.js | 85 + ...ivate-meth-static-dflt-ary-ptrn-rest-init-id.js | 85 + ...vate-meth-static-dflt-ary-ptrn-rest-init-obj.js | 85 + ...meth-static-dflt-ary-ptrn-rest-not-final-ary.js | 85 + ...-meth-static-dflt-ary-ptrn-rest-not-final-id.js | 85 + ...meth-static-dflt-ary-ptrn-rest-not-final-obj.js | 85 + ...rivate-meth-static-dflt-ary-ptrn-rest-obj-id.js | 89 + ...e-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js | 96 + .../private-meth-static-dflt-obj-ptrn-empty.js | 88 + ...h-static-dflt-obj-ptrn-id-init-fn-name-arrow.js | 89 + ...h-static-dflt-obj-ptrn-id-init-fn-name-class.js | 91 + ...h-static-dflt-obj-ptrn-id-init-fn-name-cover.js | 90 + ...meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js | 90 + ...eth-static-dflt-obj-ptrn-id-init-fn-name-gen.js | 91 + ...te-meth-static-dflt-obj-ptrn-id-init-skipped.js | 93 + ...-meth-static-dflt-obj-ptrn-id-trailing-comma.js | 83 + ...vate-meth-static-dflt-obj-ptrn-prop-ary-init.js | 92 + ...static-dflt-obj-ptrn-prop-ary-trailing-comma.js | 83 + .../private-meth-static-dflt-obj-ptrn-prop-ary.js | 90 + ...th-static-dflt-obj-ptrn-prop-id-init-skipped.js | 105 + ...ivate-meth-static-dflt-obj-ptrn-prop-id-init.js | 86 + ...-static-dflt-obj-ptrn-prop-id-trailing-comma.js | 87 + .../private-meth-static-dflt-obj-ptrn-prop-id.js | 86 + ...vate-meth-static-dflt-obj-ptrn-prop-obj-init.js | 92 + .../private-meth-static-dflt-obj-ptrn-prop-obj.js | 90 + ...rivate-meth-static-dflt-obj-ptrn-rest-getter.js | 85 + ...tatic-dflt-obj-ptrn-rest-skip-non-enumerable.js | 93 + ...ivate-meth-static-dflt-obj-ptrn-rest-val-obj.js | 92 + .../dstr/private-meth-static-obj-ptrn-empty.js | 88 + ...e-meth-static-obj-ptrn-id-init-fn-name-arrow.js | 89 + ...e-meth-static-obj-ptrn-id-init-fn-name-class.js | 91 + ...e-meth-static-obj-ptrn-id-init-fn-name-cover.js | 90 + ...vate-meth-static-obj-ptrn-id-init-fn-name-fn.js | 90 + ...ate-meth-static-obj-ptrn-id-init-fn-name-gen.js | 91 + ...private-meth-static-obj-ptrn-id-init-skipped.js | 93 + ...ivate-meth-static-obj-ptrn-id-trailing-comma.js | 83 + .../private-meth-static-obj-ptrn-prop-ary-init.js | 92 + ...meth-static-obj-ptrn-prop-ary-trailing-comma.js | 83 + .../dstr/private-meth-static-obj-ptrn-prop-ary.js | 90 + ...te-meth-static-obj-ptrn-prop-id-init-skipped.js | 105 + .../private-meth-static-obj-ptrn-prop-id-init.js | 86 + ...-meth-static-obj-ptrn-prop-id-trailing-comma.js | 87 + .../dstr/private-meth-static-obj-ptrn-prop-id.js | 86 + .../private-meth-static-obj-ptrn-prop-obj-init.js | 92 + .../dstr/private-meth-static-obj-ptrn-prop-obj.js | 90 + .../private-meth-static-obj-ptrn-rest-getter.js | 85 + ...eth-static-obj-ptrn-rest-skip-non-enumerable.js | 93 + .../private-meth-static-obj-ptrn-rest-val-obj.js | 92 + .../language/expressions/class/dstr/shell.js | 0 .../elements/after-same-line-gen-computed-names.js | 107 + .../after-same-line-gen-computed-symbol-names.js | 105 + ...privatename-identifier-semantics-stringvalue.js | 109 + .../after-same-line-gen-literal-names-asi.js | 77 + .../elements/after-same-line-gen-literal-names.js | 96 + .../after-same-line-gen-private-field-usage.js | 49 + ...er-same-line-gen-private-method-getter-usage.js | 49 + .../after-same-line-gen-private-method-usage.js | 49 + .../elements/after-same-line-gen-private-names.js | 71 + ...ame-line-gen-rs-field-identifier-initializer.js | 87 + .../after-same-line-gen-rs-field-identifier.js | 94 + .../after-same-line-gen-rs-private-getter-alt.js | 128 + .../after-same-line-gen-rs-private-getter.js | 128 + .../after-same-line-gen-rs-private-method-alt.js | 127 + .../after-same-line-gen-rs-private-method.js | 127 + .../after-same-line-gen-rs-private-setter-alt.js | 127 + .../after-same-line-gen-rs-private-setter.js | 127 + ...-same-line-gen-rs-privatename-identifier-alt.js | 109 + ...en-rs-privatename-identifier-initializer-alt.js | 103 + ...ne-gen-rs-privatename-identifier-initializer.js | 103 + ...fter-same-line-gen-rs-privatename-identifier.js | 109 + ...-generator-method-privatename-identifier-alt.js | 134 + ...sync-generator-method-privatename-identifier.js | 135 + ...atic-async-method-privatename-identifier-alt.js | 134 + ...s-static-async-method-privatename-identifier.js | 135 + ...-generator-method-privatename-identifier-alt.js | 124 + ...atic-generator-method-privatename-identifier.js | 125 + ...-rs-static-method-privatename-identifier-alt.js | 122 + ...-gen-rs-static-method-privatename-identifier.js | 122 + ...atic-privatename-identifier-alt-by-classname.js | 110 + ...ine-gen-rs-static-privatename-identifier-alt.js | 110 + ...s-static-privatename-identifier-by-classname.js | 110 + ...name-identifier-initializer-alt-by-classname.js | 104 + ...tatic-privatename-identifier-initializer-alt.js | 104 + ...rs-static-privatename-identifier-initializer.js | 104 + ...me-line-gen-rs-static-privatename-identifier.js | 110 + .../after-same-line-gen-static-private-fields.js | 71 + ...-line-gen-static-private-methods-with-fields.js | 88 + .../after-same-line-gen-static-private-methods.js | 75 + .../after-same-line-gen-string-literal-names.js | 109 + .../after-same-line-method-computed-names.js | 107 + ...after-same-line-method-computed-symbol-names.js | 105 + ...privatename-identifier-semantics-stringvalue.js | 109 + .../after-same-line-method-literal-names-asi.js | 77 + .../after-same-line-method-literal-names.js | 96 + .../after-same-line-method-private-field-usage.js | 49 + ...same-line-method-private-method-getter-usage.js | 49 + .../after-same-line-method-private-method-usage.js | 49 + .../after-same-line-method-private-names.js | 71 + ...-line-method-rs-field-identifier-initializer.js | 87 + .../after-same-line-method-rs-field-identifier.js | 94 + ...after-same-line-method-rs-private-getter-alt.js | 128 + .../after-same-line-method-rs-private-getter.js | 128 + ...after-same-line-method-rs-private-method-alt.js | 127 + .../after-same-line-method-rs-private-method.js | 127 + ...after-same-line-method-rs-private-setter-alt.js | 127 + .../after-same-line-method-rs-private-setter.js | 127 + ...me-line-method-rs-privatename-identifier-alt.js | 109 + ...od-rs-privatename-identifier-initializer-alt.js | 103 + ...method-rs-privatename-identifier-initializer.js | 103 + ...r-same-line-method-rs-privatename-identifier.js | 109 + ...-generator-method-privatename-identifier-alt.js | 134 + ...sync-generator-method-privatename-identifier.js | 135 + ...atic-async-method-privatename-identifier-alt.js | 134 + ...s-static-async-method-privatename-identifier.js | 135 + ...-generator-method-privatename-identifier-alt.js | 124 + ...atic-generator-method-privatename-identifier.js | 125 + ...-rs-static-method-privatename-identifier-alt.js | 122 + ...thod-rs-static-method-privatename-identifier.js | 122 + ...atic-privatename-identifier-alt-by-classname.js | 110 + ...-method-rs-static-privatename-identifier-alt.js | 110 + ...s-static-privatename-identifier-by-classname.js | 110 + ...name-identifier-initializer-alt-by-classname.js | 104 + ...tatic-privatename-identifier-initializer-alt.js | 104 + ...rs-static-privatename-identifier-initializer.js | 104 + ...line-method-rs-static-privatename-identifier.js | 110 + ...after-same-line-method-static-private-fields.js | 71 + ...ne-method-static-private-methods-with-fields.js | 88 + ...fter-same-line-method-static-private-methods.js | 75 + .../after-same-line-method-string-literal-names.js | 109 + ...er-same-line-static-async-gen-computed-names.js | 123 + ...-line-static-async-gen-computed-symbol-names.js | 121 + ...privatename-identifier-semantics-stringvalue.js | 125 + ...same-line-static-async-gen-literal-names-asi.js | 93 + ...ter-same-line-static-async-gen-literal-names.js | 112 + ...me-line-static-async-gen-private-field-usage.js | 65 + ...static-async-gen-private-method-getter-usage.js | 65 + ...e-line-static-async-gen-private-method-usage.js | 65 + ...ter-same-line-static-async-gen-private-names.js | 87 + ...ic-async-gen-rs-field-identifier-initializer.js | 103 + ...me-line-static-async-gen-rs-field-identifier.js | 110 + ...-line-static-async-gen-rs-private-getter-alt.js | 144 ++ ...same-line-static-async-gen-rs-private-getter.js | 144 ++ ...-line-static-async-gen-rs-private-method-alt.js | 143 ++ ...same-line-static-async-gen-rs-private-method.js | 143 ++ ...-line-static-async-gen-rs-private-setter-alt.js | 143 ++ ...same-line-static-async-gen-rs-private-setter.js | 143 ++ ...atic-async-gen-rs-privatename-identifier-alt.js | 125 + ...en-rs-privatename-identifier-initializer-alt.js | 119 + ...nc-gen-rs-privatename-identifier-initializer.js | 119 + ...e-static-async-gen-rs-privatename-identifier.js | 125 + ...-generator-method-privatename-identifier-alt.js | 151 ++ ...sync-generator-method-privatename-identifier.js | 152 ++ ...atic-async-method-privatename-identifier-alt.js | 151 ++ ...s-static-async-method-privatename-identifier.js | 152 ++ ...-generator-method-privatename-identifier-alt.js | 140 ++ ...atic-generator-method-privatename-identifier.js | 141 ++ ...-rs-static-method-privatename-identifier-alt.js | 138 + ...-gen-rs-static-method-privatename-identifier.js | 138 + ...atic-privatename-identifier-alt-by-classname.js | 126 + ...ync-gen-rs-static-privatename-identifier-alt.js | 126 + ...s-static-privatename-identifier-by-classname.js | 126 + ...name-identifier-initializer-alt-by-classname.js | 120 + ...tatic-privatename-identifier-initializer-alt.js | 120 + ...rs-static-privatename-identifier-initializer.js | 120 + ...c-async-gen-rs-static-privatename-identifier.js | 126 + ...-line-static-async-gen-static-private-fields.js | 87 + ...async-gen-static-private-methods-with-fields.js | 104 + ...line-static-async-gen-static-private-methods.js | 91 + ...e-line-static-async-gen-string-literal-names.js | 125 + ...same-line-static-async-method-computed-names.js | 122 + ...ne-static-async-method-computed-symbol-names.js | 120 + ...privatename-identifier-semantics-stringvalue.js | 124 + ...e-line-static-async-method-literal-names-asi.js | 92 + ...-same-line-static-async-method-literal-names.js | 111 + ...line-static-async-method-private-field-usage.js | 64 + ...tic-async-method-private-method-getter-usage.js | 64 + ...ine-static-async-method-private-method-usage.js | 64 + ...-same-line-static-async-method-private-names.js | 86 + ...async-method-rs-field-identifier-initializer.js | 102 + ...line-static-async-method-rs-field-identifier.js | 109 + ...ne-static-async-method-rs-private-getter-alt.js | 143 ++ ...e-line-static-async-method-rs-private-getter.js | 143 ++ ...ne-static-async-method-rs-private-method-alt.js | 142 ++ ...e-line-static-async-method-rs-private-method.js | 142 ++ ...ne-static-async-method-rs-private-setter-alt.js | 142 ++ ...e-line-static-async-method-rs-private-setter.js | 142 ++ ...c-async-method-rs-privatename-identifier-alt.js | 124 + ...od-rs-privatename-identifier-initializer-alt.js | 118 + ...method-rs-privatename-identifier-initializer.js | 118 + ...tatic-async-method-rs-privatename-identifier.js | 124 + ...-generator-method-privatename-identifier-alt.js | 150 ++ ...sync-generator-method-privatename-identifier.js | 151 ++ ...atic-async-method-privatename-identifier-alt.js | 150 ++ ...s-static-async-method-privatename-identifier.js | 151 ++ ...-generator-method-privatename-identifier-alt.js | 139 + ...atic-generator-method-privatename-identifier.js | 140 ++ ...-rs-static-method-privatename-identifier-alt.js | 137 + ...thod-rs-static-method-privatename-identifier.js | 137 + ...atic-privatename-identifier-alt-by-classname.js | 125 + ...-method-rs-static-privatename-identifier-alt.js | 125 + ...s-static-privatename-identifier-by-classname.js | 125 + ...name-identifier-initializer-alt-by-classname.js | 119 + ...tatic-privatename-identifier-initializer-alt.js | 119 + ...rs-static-privatename-identifier-initializer.js | 119 + ...sync-method-rs-static-privatename-identifier.js | 125 + ...ne-static-async-method-static-private-fields.js | 86 + ...nc-method-static-private-methods-with-fields.js | 103 + ...e-static-async-method-static-private-methods.js | 90 + ...ine-static-async-method-string-literal-names.js | 124 + .../after-same-line-static-gen-computed-names.js | 110 + ...r-same-line-static-gen-computed-symbol-names.js | 108 + ...privatename-identifier-semantics-stringvalue.js | 112 + ...after-same-line-static-gen-literal-names-asi.js | 80 + .../after-same-line-static-gen-literal-names.js | 99 + ...ter-same-line-static-gen-private-field-usage.js | 52 + ...-line-static-gen-private-method-getter-usage.js | 52 + ...er-same-line-static-gen-private-method-usage.js | 52 + .../after-same-line-static-gen-private-names.js | 74 + ...e-static-gen-rs-field-identifier-initializer.js | 90 + ...ter-same-line-static-gen-rs-field-identifier.js | 97 + ...r-same-line-static-gen-rs-private-getter-alt.js | 131 + ...after-same-line-static-gen-rs-private-getter.js | 131 + ...r-same-line-static-gen-rs-private-method-alt.js | 130 + ...after-same-line-static-gen-rs-private-method.js | 130 + ...r-same-line-static-gen-rs-private-setter-alt.js | 130 + ...after-same-line-static-gen-rs-private-setter.js | 130 + ...ine-static-gen-rs-privatename-identifier-alt.js | 112 + ...en-rs-privatename-identifier-initializer-alt.js | 106 + ...ic-gen-rs-privatename-identifier-initializer.js | 106 + ...me-line-static-gen-rs-privatename-identifier.js | 112 + ...-generator-method-privatename-identifier-alt.js | 137 + ...sync-generator-method-privatename-identifier.js | 138 + ...atic-async-method-privatename-identifier-alt.js | 137 + ...s-static-async-method-privatename-identifier.js | 138 + ...-generator-method-privatename-identifier-alt.js | 127 + ...atic-generator-method-privatename-identifier.js | 128 + ...-rs-static-method-privatename-identifier-alt.js | 125 + ...-gen-rs-static-method-privatename-identifier.js | 125 + ...atic-privatename-identifier-alt-by-classname.js | 113 + ...tic-gen-rs-static-privatename-identifier-alt.js | 113 + ...s-static-privatename-identifier-by-classname.js | 113 + ...name-identifier-initializer-alt-by-classname.js | 107 + ...tatic-privatename-identifier-initializer-alt.js | 107 + ...rs-static-privatename-identifier-initializer.js | 107 + ...-static-gen-rs-static-privatename-identifier.js | 113 + ...r-same-line-static-gen-static-private-fields.js | 74 + ...tatic-gen-static-private-methods-with-fields.js | 91 + ...-same-line-static-gen-static-private-methods.js | 78 + ...er-same-line-static-gen-string-literal-names.js | 112 + ...after-same-line-static-method-computed-names.js | 110 + ...ame-line-static-method-computed-symbol-names.js | 108 + ...privatename-identifier-semantics-stringvalue.js | 112 + ...er-same-line-static-method-literal-names-asi.js | 80 + .../after-same-line-static-method-literal-names.js | 99 + ...-same-line-static-method-private-field-usage.js | 52 + ...ne-static-method-private-method-getter-usage.js | 52 + ...same-line-static-method-private-method-usage.js | 52 + .../after-same-line-static-method-private-names.js | 74 + ...tatic-method-rs-field-identifier-initializer.js | 90 + ...-same-line-static-method-rs-field-identifier.js | 97 + ...ame-line-static-method-rs-private-getter-alt.js | 131 + ...er-same-line-static-method-rs-private-getter.js | 131 + ...ame-line-static-method-rs-private-method-alt.js | 130 + ...er-same-line-static-method-rs-private-method.js | 130 + ...ame-line-static-method-rs-private-setter-alt.js | 130 + ...er-same-line-static-method-rs-private-setter.js | 130 + ...-static-method-rs-privatename-identifier-alt.js | 112 + ...od-rs-privatename-identifier-initializer-alt.js | 106 + ...method-rs-privatename-identifier-initializer.js | 106 + ...line-static-method-rs-privatename-identifier.js | 112 + ...-generator-method-privatename-identifier-alt.js | 137 + ...sync-generator-method-privatename-identifier.js | 138 + ...atic-async-method-privatename-identifier-alt.js | 137 + ...s-static-async-method-privatename-identifier.js | 138 + ...-generator-method-privatename-identifier-alt.js | 127 + ...atic-generator-method-privatename-identifier.js | 128 + ...-rs-static-method-privatename-identifier-alt.js | 125 + ...thod-rs-static-method-privatename-identifier.js | 125 + ...atic-privatename-identifier-alt-by-classname.js | 113 + ...-method-rs-static-privatename-identifier-alt.js | 113 + ...s-static-privatename-identifier-by-classname.js | 113 + ...name-identifier-initializer-alt-by-classname.js | 107 + ...tatic-privatename-identifier-initializer-alt.js | 107 + ...rs-static-privatename-identifier-initializer.js | 107 + ...atic-method-rs-static-privatename-identifier.js | 113 + ...ame-line-static-method-static-private-fields.js | 74 + ...ic-method-static-private-methods-with-fields.js | 91 + ...me-line-static-method-static-private-methods.js | 78 + ...same-line-static-method-string-literal-names.js | 112 + ...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 | 39 + ...ved-cls-direct-eval-contains-superproperty-2.js | 36 + ...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 + ...y-private-direct-eval-err-contains-arguments.js | 38 + ...y-private-direct-eval-err-contains-newtarget.js | 39 + ...private-indirect-eval-err-contains-newtarget.js | 35 + .../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 | 76 + .../yield-identifier-strict-strict.js | 67 + .../yield-promise-reject-next-catch.js | 72 + ...mise-reject-next-for-await-of-async-iterator.js | 78 + ...omise-reject-next-for-await-of-sync-iterator.js | 77 + ...romise-reject-next-yield-star-async-iterator.js | 76 + ...promise-reject-next-yield-star-sync-iterator.js | 75 + .../yield-promise-reject-next.js | 72 + .../yield-spread-arr-multiple.js | 78 + .../yield-spread-arr-single.js | 77 + .../yield-spread-obj.js | 80 + .../yield-star-async-next.js | 247 ++ .../yield-star-async-return.js | 263 ++ .../yield-star-async-throw.js | 271 ++ .../yield-star-expr-abrupt.js | 82 + .../yield-star-getiter-async-get-abrupt.js | 102 + ...tar-getiter-async-not-callable-boolean-throw.js | 101 + ...star-getiter-async-not-callable-number-throw.js | 101 + ...star-getiter-async-not-callable-object-throw.js | 101 + ...star-getiter-async-not-callable-string-throw.js | 101 + ...star-getiter-async-not-callable-symbol-throw.js | 101 + ...ield-star-getiter-async-null-sync-get-abrupt.js | 107 + .../yield-star-getiter-async-returns-abrupt.js | 98 + ...eld-star-getiter-async-returns-boolean-throw.js | 98 + .../yield-star-getiter-async-returns-null-throw.js | 98 + ...ield-star-getiter-async-returns-number-throw.js | 98 + ...ield-star-getiter-async-returns-string-throw.js | 98 + ...ield-star-getiter-async-returns-symbol-throw.js | 98 + ...d-star-getiter-async-returns-undefined-throw.js | 98 + ...star-getiter-async-undefined-sync-get-abrupt.js | 107 + .../yield-star-getiter-sync-get-abrupt.js | 101 + ...star-getiter-sync-not-callable-boolean-throw.js | 100 + ...-star-getiter-sync-not-callable-number-throw.js | 100 + ...-star-getiter-sync-not-callable-object-throw.js | 100 + ...-star-getiter-sync-not-callable-string-throw.js | 100 + ...-star-getiter-sync-not-callable-symbol-throw.js | 100 + .../yield-star-getiter-sync-returns-abrupt.js | 95 + ...ield-star-getiter-sync-returns-boolean-throw.js | 100 + .../yield-star-getiter-sync-returns-null-throw.js | 100 + ...yield-star-getiter-sync-returns-number-throw.js | 100 + ...yield-star-getiter-sync-returns-string-throw.js | 100 + ...yield-star-getiter-sync-returns-symbol-throw.js | 100 + ...ld-star-getiter-sync-returns-undefined-throw.js | 100 + .../yield-star-next-call-done-get-abrupt.js | 101 + .../yield-star-next-call-returns-abrupt.js | 93 + .../yield-star-next-call-value-get-abrupt.js | 103 + .../yield-star-next-get-abrupt.js | 93 + .../yield-star-next-non-object-ignores-then.js | 113 + .../yield-star-next-not-callable-boolean-throw.js | 90 + .../yield-star-next-not-callable-null-throw.js | 90 + .../yield-star-next-not-callable-number-throw.js | 90 + .../yield-star-next-not-callable-object-throw.js | 90 + .../yield-star-next-not-callable-string-throw.js | 90 + .../yield-star-next-not-callable-symbol-throw.js | 90 + ...yield-star-next-not-callable-undefined-throw.js | 90 + .../yield-star-next-then-get-abrupt.js | 117 + ...ext-then-non-callable-boolean-fulfillpromise.js | 111 + ...r-next-then-non-callable-null-fulfillpromise.js | 111 + ...next-then-non-callable-number-fulfillpromise.js | 111 + ...next-then-non-callable-object-fulfillpromise.js | 111 + ...next-then-non-callable-string-fulfillpromise.js | 111 + ...next-then-non-callable-symbol-fulfillpromise.js | 111 + ...t-then-non-callable-undefined-fulfillpromise.js | 111 + .../yield-star-next-then-returns-abrupt.js | 117 + .../yield-star-sync-next.js | 250 ++ .../yield-star-sync-return.js | 225 ++ .../yield-star-sync-throw.js | 231 ++ .../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 | 86 + .../yield-identifier-strict-strict.js | 77 + .../yield-promise-reject-next-catch.js | 82 + ...mise-reject-next-for-await-of-async-iterator.js | 88 + ...omise-reject-next-for-await-of-sync-iterator.js | 87 + ...romise-reject-next-yield-star-async-iterator.js | 86 + ...promise-reject-next-yield-star-sync-iterator.js | 85 + .../yield-promise-reject-next.js | 82 + .../yield-spread-arr-multiple.js | 88 + .../yield-spread-arr-single.js | 87 + .../async-gen-private-method/yield-spread-obj.js | 90 + .../yield-star-async-next.js | 257 ++ .../yield-star-async-return.js | 273 ++ .../yield-star-async-throw.js | 281 +++ .../yield-star-expr-abrupt.js | 92 + .../yield-star-getiter-async-get-abrupt.js | 112 + ...tar-getiter-async-not-callable-boolean-throw.js | 111 + ...star-getiter-async-not-callable-number-throw.js | 111 + ...star-getiter-async-not-callable-object-throw.js | 111 + ...star-getiter-async-not-callable-string-throw.js | 111 + ...star-getiter-async-not-callable-symbol-throw.js | 111 + ...ield-star-getiter-async-null-sync-get-abrupt.js | 117 + .../yield-star-getiter-async-returns-abrupt.js | 108 + ...eld-star-getiter-async-returns-boolean-throw.js | 108 + .../yield-star-getiter-async-returns-null-throw.js | 108 + ...ield-star-getiter-async-returns-number-throw.js | 108 + ...ield-star-getiter-async-returns-string-throw.js | 108 + ...ield-star-getiter-async-returns-symbol-throw.js | 108 + ...d-star-getiter-async-returns-undefined-throw.js | 108 + ...star-getiter-async-undefined-sync-get-abrupt.js | 117 + .../yield-star-getiter-sync-get-abrupt.js | 111 + ...star-getiter-sync-not-callable-boolean-throw.js | 110 + ...-star-getiter-sync-not-callable-number-throw.js | 110 + ...-star-getiter-sync-not-callable-object-throw.js | 110 + ...-star-getiter-sync-not-callable-string-throw.js | 110 + ...-star-getiter-sync-not-callable-symbol-throw.js | 110 + .../yield-star-getiter-sync-returns-abrupt.js | 105 + ...ield-star-getiter-sync-returns-boolean-throw.js | 110 + .../yield-star-getiter-sync-returns-null-throw.js | 110 + ...yield-star-getiter-sync-returns-number-throw.js | 110 + ...yield-star-getiter-sync-returns-string-throw.js | 110 + ...yield-star-getiter-sync-returns-symbol-throw.js | 110 + ...ld-star-getiter-sync-returns-undefined-throw.js | 110 + .../yield-star-next-call-done-get-abrupt.js | 111 + .../yield-star-next-call-returns-abrupt.js | 103 + .../yield-star-next-call-value-get-abrupt.js | 113 + .../yield-star-next-get-abrupt.js | 103 + .../yield-star-next-non-object-ignores-then.js | 123 + .../yield-star-next-not-callable-boolean-throw.js | 100 + .../yield-star-next-not-callable-null-throw.js | 100 + .../yield-star-next-not-callable-number-throw.js | 100 + .../yield-star-next-not-callable-object-throw.js | 100 + .../yield-star-next-not-callable-string-throw.js | 100 + .../yield-star-next-not-callable-symbol-throw.js | 100 + ...yield-star-next-not-callable-undefined-throw.js | 100 + .../yield-star-next-then-get-abrupt.js | 127 + ...ext-then-non-callable-boolean-fulfillpromise.js | 121 + ...r-next-then-non-callable-null-fulfillpromise.js | 121 + ...next-then-non-callable-number-fulfillpromise.js | 121 + ...next-then-non-callable-object-fulfillpromise.js | 121 + ...next-then-non-callable-string-fulfillpromise.js | 121 + ...next-then-non-callable-symbol-fulfillpromise.js | 121 + ...t-then-non-callable-undefined-fulfillpromise.js | 121 + .../yield-star-next-then-returns-abrupt.js | 127 + .../yield-star-sync-next.js | 260 ++ .../yield-star-sync-return.js | 235 ++ .../yield-star-sync-throw.js | 241 ++ .../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 | 123 + .../class/elements/computed-name-toprimitive.js | 120 + .../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 | 111 + ...field-definition-accessor-no-line-terminator.js | 52 + .../elements/fields-anonymous-function-length.js | 48 + .../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 | 41 + .../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 | 75 + .../yield-identifier-strict-strict.js | 66 + .../yield-spread-arr-multiple.js | 73 + .../yield-spread-arr-single.js | 75 + .../gen-private-method-static/yield-spread-obj.js | 78 + .../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 | 85 + .../yield-identifier-strict-strict.js | 76 + .../yield-spread-arr-multiple.js | 83 + .../gen-private-method/yield-spread-arr-single.js | 85 + .../gen-private-method/yield-spread-obj.js | 88 + .../grammar-private-field-optional-chaining.js | 42 + .../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 | 158 ++ .../multiple-definitions-computed-symbol-names.js | 156 ++ ...privatename-identifier-semantics-stringvalue.js | 160 ++ .../multiple-definitions-literal-names-asi.js | 128 + .../elements/multiple-definitions-literal-names.js | 147 ++ .../multiple-definitions-private-field-usage.js | 100 + ...iple-definitions-private-method-getter-usage.js | 100 + .../multiple-definitions-private-method-usage.js | 100 + .../elements/multiple-definitions-private-names.js | 122 + ...-definitions-rs-field-identifier-initializer.js | 138 + .../multiple-definitions-rs-field-identifier.js | 145 ++ .../multiple-definitions-rs-private-getter-alt.js | 179 ++ .../multiple-definitions-rs-private-getter.js | 179 ++ .../multiple-definitions-rs-private-method-alt.js | 178 ++ .../multiple-definitions-rs-private-method.js | 178 ++ .../multiple-definitions-rs-private-setter-alt.js | 178 ++ .../multiple-definitions-rs-private-setter.js | 178 ++ ...le-definitions-rs-privatename-identifier-alt.js | 160 ++ ...ns-rs-privatename-identifier-initializer-alt.js | 154 ++ ...itions-rs-privatename-identifier-initializer.js | 154 ++ ...ltiple-definitions-rs-privatename-identifier.js | 160 ++ ...-generator-method-privatename-identifier-alt.js | 185 ++ ...sync-generator-method-privatename-identifier.js | 186 ++ ...atic-async-method-privatename-identifier-alt.js | 185 ++ ...s-static-async-method-privatename-identifier.js | 186 ++ ...-generator-method-privatename-identifier-alt.js | 175 ++ ...atic-generator-method-privatename-identifier.js | 176 ++ ...-rs-static-method-privatename-identifier-alt.js | 173 ++ ...ions-rs-static-method-privatename-identifier.js | 173 ++ ...atic-privatename-identifier-alt-by-classname.js | 161 ++ ...nitions-rs-static-privatename-identifier-alt.js | 161 ++ ...s-static-privatename-identifier-by-classname.js | 161 ++ ...name-identifier-initializer-alt-by-classname.js | 155 ++ ...tatic-privatename-identifier-initializer-alt.js | 155 ++ ...rs-static-privatename-identifier-initializer.js | 155 ++ ...definitions-rs-static-privatename-identifier.js | 161 ++ .../multiple-definitions-static-private-fields.js | 122 + ...finitions-static-private-methods-with-fields.js | 139 + .../multiple-definitions-static-private-methods.js | 126 + .../multiple-definitions-string-literal-names.js | 160 ++ .../multiple-stacked-definitions-computed-names.js | 130 + ...le-stacked-definitions-computed-symbol-names.js | 128 + ...privatename-identifier-semantics-stringvalue.js | 132 + ...ltiple-stacked-definitions-literal-names-asi.js | 100 + .../multiple-stacked-definitions-literal-names.js | 119 + ...iple-stacked-definitions-private-field-usage.js | 72 + ...cked-definitions-private-method-getter-usage.js | 72 + ...ple-stacked-definitions-private-method-usage.js | 72 + .../multiple-stacked-definitions-private-names.js | 94 + ...-definitions-rs-field-identifier-initializer.js | 110 + ...iple-stacked-definitions-rs-field-identifier.js | 117 + ...le-stacked-definitions-rs-private-getter-alt.js | 151 ++ ...ltiple-stacked-definitions-rs-private-getter.js | 151 ++ ...le-stacked-definitions-rs-private-method-alt.js | 150 ++ ...ltiple-stacked-definitions-rs-private-method.js | 150 ++ ...le-stacked-definitions-rs-private-setter-alt.js | 150 ++ ...ltiple-stacked-definitions-rs-private-setter.js | 150 ++ ...ed-definitions-rs-privatename-identifier-alt.js | 132 + ...ns-rs-privatename-identifier-initializer-alt.js | 126 + ...itions-rs-privatename-identifier-initializer.js | 126 + ...tacked-definitions-rs-privatename-identifier.js | 132 + ...-generator-method-privatename-identifier-alt.js | 157 ++ ...sync-generator-method-privatename-identifier.js | 158 ++ ...atic-async-method-privatename-identifier-alt.js | 157 ++ ...s-static-async-method-privatename-identifier.js | 158 ++ ...-generator-method-privatename-identifier-alt.js | 147 ++ ...atic-generator-method-privatename-identifier.js | 148 ++ ...-rs-static-method-privatename-identifier-alt.js | 145 ++ ...ions-rs-static-method-privatename-identifier.js | 145 ++ ...atic-privatename-identifier-alt-by-classname.js | 133 + ...nitions-rs-static-privatename-identifier-alt.js | 133 + ...s-static-privatename-identifier-by-classname.js | 133 + ...name-identifier-initializer-alt-by-classname.js | 127 + ...tatic-privatename-identifier-initializer-alt.js | 127 + ...rs-static-privatename-identifier-initializer.js | 127 + ...definitions-rs-static-privatename-identifier.js | 133 + ...le-stacked-definitions-static-private-fields.js | 94 + ...finitions-static-private-methods-with-fields.js | 111 + ...e-stacked-definitions-static-private-methods.js | 98 + ...ple-stacked-definitions-string-literal-names.js | 132 + ...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 | 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 + ...d-private-direct-eval-err-contains-arguments.js | 41 + ...d-private-direct-eval-err-contains-newtarget.js | 36 + ...ted-private-indirect-eval-contains-arguments.js | 26 + ...private-indirect-eval-err-contains-newtarget.js | 37 + ...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 | 108 + .../new-no-sc-line-method-computed-symbol-names.js | 106 + ...privatename-identifier-semantics-stringvalue.js | 110 + .../new-no-sc-line-method-literal-names-asi.js | 78 + .../new-no-sc-line-method-literal-names.js | 97 + .../new-no-sc-line-method-private-field-usage.js | 50 + ...o-sc-line-method-private-method-getter-usage.js | 50 + .../new-no-sc-line-method-private-method-usage.js | 50 + .../new-no-sc-line-method-private-names.js | 72 + ...-line-method-rs-field-identifier-initializer.js | 88 + .../new-no-sc-line-method-rs-field-identifier.js | 95 + .../new-no-sc-line-method-rs-private-getter-alt.js | 129 + .../new-no-sc-line-method-rs-private-getter.js | 129 + .../new-no-sc-line-method-rs-private-method-alt.js | 128 + .../new-no-sc-line-method-rs-private-method.js | 128 + .../new-no-sc-line-method-rs-private-setter-alt.js | 128 + .../new-no-sc-line-method-rs-private-setter.js | 128 + ...sc-line-method-rs-privatename-identifier-alt.js | 110 + ...od-rs-privatename-identifier-initializer-alt.js | 104 + ...method-rs-privatename-identifier-initializer.js | 104 + ...-no-sc-line-method-rs-privatename-identifier.js | 110 + ...-generator-method-privatename-identifier-alt.js | 135 + ...sync-generator-method-privatename-identifier.js | 136 + ...atic-async-method-privatename-identifier-alt.js | 135 + ...s-static-async-method-privatename-identifier.js | 136 + ...-generator-method-privatename-identifier-alt.js | 125 + ...atic-generator-method-privatename-identifier.js | 126 + ...-rs-static-method-privatename-identifier-alt.js | 123 + ...thod-rs-static-method-privatename-identifier.js | 123 + ...atic-privatename-identifier-alt-by-classname.js | 111 + ...-method-rs-static-privatename-identifier-alt.js | 111 + ...s-static-privatename-identifier-by-classname.js | 111 + ...name-identifier-initializer-alt-by-classname.js | 105 + ...tatic-privatename-identifier-initializer-alt.js | 105 + ...rs-static-privatename-identifier-initializer.js | 105 + ...line-method-rs-static-privatename-identifier.js | 111 + .../new-no-sc-line-method-static-private-fields.js | 72 + ...ne-method-static-private-methods-with-fields.js | 89 + ...new-no-sc-line-method-static-private-methods.js | 76 + .../new-no-sc-line-method-string-literal-names.js | 110 + .../elements/new-sc-line-gen-computed-names.js | 108 + .../new-sc-line-gen-computed-symbol-names.js | 106 + ...privatename-identifier-semantics-stringvalue.js | 110 + .../elements/new-sc-line-gen-literal-names-asi.js | 78 + .../elements/new-sc-line-gen-literal-names.js | 97 + .../new-sc-line-gen-private-field-usage.js | 50 + .../new-sc-line-gen-private-method-getter-usage.js | 50 + .../new-sc-line-gen-private-method-usage.js | 50 + .../elements/new-sc-line-gen-private-names.js | 72 + ...-sc-line-gen-rs-field-identifier-initializer.js | 88 + .../new-sc-line-gen-rs-field-identifier.js | 95 + .../new-sc-line-gen-rs-private-getter-alt.js | 129 + .../elements/new-sc-line-gen-rs-private-getter.js | 129 + .../new-sc-line-gen-rs-private-method-alt.js | 128 + .../elements/new-sc-line-gen-rs-private-method.js | 128 + .../new-sc-line-gen-rs-private-setter-alt.js | 128 + .../elements/new-sc-line-gen-rs-private-setter.js | 128 + ...ew-sc-line-gen-rs-privatename-identifier-alt.js | 110 + ...en-rs-privatename-identifier-initializer-alt.js | 104 + ...ne-gen-rs-privatename-identifier-initializer.js | 104 + .../new-sc-line-gen-rs-privatename-identifier.js | 110 + ...-generator-method-privatename-identifier-alt.js | 135 + ...sync-generator-method-privatename-identifier.js | 136 + ...atic-async-method-privatename-identifier-alt.js | 135 + ...s-static-async-method-privatename-identifier.js | 136 + ...-generator-method-privatename-identifier-alt.js | 125 + ...atic-generator-method-privatename-identifier.js | 126 + ...-rs-static-method-privatename-identifier-alt.js | 123 + ...-gen-rs-static-method-privatename-identifier.js | 123 + ...atic-privatename-identifier-alt-by-classname.js | 111 + ...ine-gen-rs-static-privatename-identifier-alt.js | 111 + ...s-static-privatename-identifier-by-classname.js | 111 + ...name-identifier-initializer-alt-by-classname.js | 105 + ...tatic-privatename-identifier-initializer-alt.js | 105 + ...rs-static-privatename-identifier-initializer.js | 105 + ...sc-line-gen-rs-static-privatename-identifier.js | 111 + .../new-sc-line-gen-static-private-fields.js | 72 + ...-line-gen-static-private-methods-with-fields.js | 89 + .../new-sc-line-gen-static-private-methods.js | 76 + .../new-sc-line-gen-string-literal-names.js | 110 + .../elements/new-sc-line-method-computed-names.js | 108 + .../new-sc-line-method-computed-symbol-names.js | 106 + ...privatename-identifier-semantics-stringvalue.js | 110 + .../new-sc-line-method-literal-names-asi.js | 78 + .../elements/new-sc-line-method-literal-names.js | 97 + .../new-sc-line-method-private-field-usage.js | 50 + ...w-sc-line-method-private-method-getter-usage.js | 50 + .../new-sc-line-method-private-method-usage.js | 50 + .../elements/new-sc-line-method-private-names.js | 72 + ...-line-method-rs-field-identifier-initializer.js | 88 + .../new-sc-line-method-rs-field-identifier.js | 95 + .../new-sc-line-method-rs-private-getter-alt.js | 129 + .../new-sc-line-method-rs-private-getter.js | 129 + .../new-sc-line-method-rs-private-method-alt.js | 128 + .../new-sc-line-method-rs-private-method.js | 128 + .../new-sc-line-method-rs-private-setter-alt.js | 128 + .../new-sc-line-method-rs-private-setter.js | 128 + ...sc-line-method-rs-privatename-identifier-alt.js | 110 + ...od-rs-privatename-identifier-initializer-alt.js | 104 + ...method-rs-privatename-identifier-initializer.js | 104 + ...new-sc-line-method-rs-privatename-identifier.js | 110 + ...-generator-method-privatename-identifier-alt.js | 135 + ...sync-generator-method-privatename-identifier.js | 136 + ...atic-async-method-privatename-identifier-alt.js | 135 + ...s-static-async-method-privatename-identifier.js | 136 + ...-generator-method-privatename-identifier-alt.js | 125 + ...atic-generator-method-privatename-identifier.js | 126 + ...-rs-static-method-privatename-identifier-alt.js | 123 + ...thod-rs-static-method-privatename-identifier.js | 123 + ...atic-privatename-identifier-alt-by-classname.js | 111 + ...-method-rs-static-privatename-identifier-alt.js | 111 + ...s-static-privatename-identifier-by-classname.js | 111 + ...name-identifier-initializer-alt-by-classname.js | 105 + ...tatic-privatename-identifier-initializer-alt.js | 105 + ...rs-static-privatename-identifier-initializer.js | 105 + ...line-method-rs-static-privatename-identifier.js | 111 + .../new-sc-line-method-static-private-fields.js | 72 + ...ne-method-static-private-methods-with-fields.js | 89 + .../new-sc-line-method-static-private-methods.js | 76 + .../new-sc-line-method-string-literal-names.js | 110 + .../elements/private-accessor-name/browser.js | 0 .../inst-private-escape-sequence-ZWJ.js | 80 + .../inst-private-escape-sequence-ZWNJ.js | 80 + .../inst-private-escape-sequence-u2118.js | 80 + .../inst-private-escape-sequence-u6F.js | 80 + .../private-accessor-name/inst-private-name-ZWJ.js | 80 + .../inst-private-name-ZWNJ.js | 80 + .../inst-private-name-common.js | 80 + .../inst-private-name-dollar.js | 80 + .../inst-private-name-u2118.js | 80 + .../inst-private-name-underscore.js | 80 + .../class/elements/private-accessor-name/shell.js | 0 .../static-private-escape-sequence-ZWJ.js | 80 + .../static-private-escape-sequence-ZWNJ.js | 80 + .../static-private-escape-sequence-u2118.js | 80 + .../static-private-escape-sequence-u6F.js | 80 + .../static-private-name-ZWJ.js | 80 + .../static-private-name-ZWNJ.js | 80 + .../static-private-name-common.js | 80 + .../static-private-name-dollar.js | 80 + .../static-private-name-u2118.js | 80 + .../static-private-name-underscore.js | 80 + ...rivate-arrow-fnc-init-err-contains-arguments.js | 35 + .../private-arrow-fnc-init-err-contains-super.js | 28 + .../private-async-generator-method-name.js | 61 + .../class/elements/private-async-method-name.js | 61 + ...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 + .../private-direct-eval-err-contains-arguments.js | 38 + .../private-direct-eval-err-contains-newtarget.js | 36 + ...private-field-access-on-inner-arrow-function.js | 43 + .../private-field-access-on-inner-function.js | 44 + .../elements/private-field-after-optional-chain.js | 46 + .../elements/private-field-as-arrow-function.js | 35 + .../private-field-as-async-arrow-function.js | 37 + .../elements/private-field-as-async-function.js | 37 + .../class/elements/private-field-as-function.js | 35 + .../elements/private-field-on-nested-class.js | 47 + .../private-fields-proxy-default-handler-throws.js | 32 + .../elements/private-generator-method-name.js | 61 + ...rivate-getter-access-on-inner-arrow-function.js | 43 + .../private-getter-access-on-inner-function.js | 44 + .../private-getter-is-not-a-own-property.js | 47 + .../elements/private-getter-on-nested-class.js | 38 + ...ate-getter-shadowed-by-field-on-nested-class.js | 46 + ...te-getter-shadowed-by-getter-on-nested-class.js | 46 + ...te-getter-shadowed-by-method-on-nested-class.js | 43 + ...te-getter-shadowed-by-setter-on-nested-class.js | 51 + .../private-indirect-eval-contains-arguments.js | 26 + ...private-indirect-eval-err-contains-newtarget.js | 37 + ...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 | 43 + .../private-method-access-on-inner-function.js | 44 + .../class/elements/private-method-comparison.js | 47 + .../class/elements/private-method-get-and-call.js | 49 + .../private-method-is-not-a-own-property.js | 45 + .../class/elements/private-method-length.js | 49 + .../elements/private-method-on-nested-class.js | 38 + ...private-method-referenced-from-static-method.js | 40 + ...ate-method-shadowed-by-field-on-nested-class.js | 46 + ...te-method-shadowed-by-getter-on-nested-class.js | 49 + ...te-method-shadowed-by-setter-on-nested-class.js | 51 + .../private-method-shadowed-on-nested-class.js | 40 + .../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 | 127 + .../prod-private-method-initialize-order.js | 142 ++ .../private-methods/prod-private-method.js | 123 + .../class/elements/private-methods/shell.js | 0 ...rivate-setter-access-on-inner-arrow-function.js | 44 + .../private-setter-access-on-inner-function.js | 45 + .../private-setter-is-not-a-own-property.js | 48 + .../elements/private-setter-on-nested-class.js | 39 + ...ate-setter-shadowed-by-field-on-nested-class.js | 53 + ...te-setter-shadowed-by-getter-on-nested-class.js | 52 + ...te-setter-shadowed-by-method-on-nested-class.js | 52 + ...te-setter-shadowed-by-setter-on-nested-class.js | 51 + .../private-static-async-generator-method-name.js | 62 + .../elements/private-static-async-method-name.js | 62 + ...atic-field-shadowed-by-field-on-nested-class.js | 91 + ...tic-field-shadowed-by-getter-on-nested-class.js | 92 + ...tic-field-shadowed-by-method-on-nested-class.js | 92 + ...tic-field-shadowed-by-setter-on-nested-class.js | 93 + ...ivate-static-field-usage-inside-nested-class.js | 81 + .../private-static-generator-method-name.js | 62 + .../class/elements/private-static-method-length.js | 48 + .../class/elements/private-static-method-name.js | 73 + ...tic-method-shadowed-by-field-on-nested-class.js | 91 + ...ic-method-shadowed-by-getter-on-nested-class.js | 92 + ...ic-method-shadowed-by-method-on-nested-class.js | 92 + ...ic-method-shadowed-by-setter-on-nested-class.js | 93 + ...vate-static-method-usage-inside-nested-class.js | 83 + .../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 | 48 + ...ter-before-super-return-in-field-initializer.js | 46 + ...te-method-before-super-return-in-constructor.js | 48 + ...hod-before-super-return-in-field-initializer.js | 46 + ...te-setter-before-super-return-in-constructor.js | 48 + ...ter-before-super-return-in-field-initializer.js | 46 + .../class/elements/redeclaration-symbol.js | 63 + .../expressions/class/elements/redeclaration.js | 63 + .../elements/regular-definitions-computed-names.js | 94 + .../regular-definitions-computed-symbol-names.js | 92 + ...privatename-identifier-semantics-stringvalue.js | 95 + .../regular-definitions-literal-names-asi.js | 64 + .../elements/regular-definitions-literal-names.js | 83 + .../regular-definitions-private-field-usage.js | 35 + ...ular-definitions-private-method-getter-usage.js | 35 + .../regular-definitions-private-method-usage.js | 35 + .../elements/regular-definitions-private-names.js | 57 + ...-definitions-rs-field-identifier-initializer.js | 73 + .../regular-definitions-rs-field-identifier.js | 80 + .../regular-definitions-rs-private-getter-alt.js | 114 + .../regular-definitions-rs-private-getter.js | 114 + .../regular-definitions-rs-private-method-alt.js | 113 + .../regular-definitions-rs-private-method.js | 113 + .../regular-definitions-rs-private-setter-alt.js | 113 + .../regular-definitions-rs-private-setter.js | 113 + ...ar-definitions-rs-privatename-identifier-alt.js | 95 + ...ns-rs-privatename-identifier-initializer-alt.js | 89 + ...itions-rs-privatename-identifier-initializer.js | 89 + ...egular-definitions-rs-privatename-identifier.js | 95 + ...-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 | 110 + ...atic-generator-method-privatename-identifier.js | 111 + ...-rs-static-method-privatename-identifier-alt.js | 108 + ...ions-rs-static-method-privatename-identifier.js | 108 + ...atic-privatename-identifier-alt-by-classname.js | 96 + ...nitions-rs-static-privatename-identifier-alt.js | 96 + ...s-static-privatename-identifier-by-classname.js | 96 + ...name-identifier-initializer-alt-by-classname.js | 90 + ...tatic-privatename-identifier-initializer-alt.js | 90 + ...rs-static-privatename-identifier-initializer.js | 90 + ...definitions-rs-static-privatename-identifier.js | 96 + .../regular-definitions-static-private-fields.js | 57 + ...finitions-static-private-methods-with-fields.js | 74 + .../regular-definitions-static-private-methods.js | 61 + .../regular-definitions-string-literal-names.js | 96 + .../elements/same-line-async-gen-computed-names.js | 120 + .../same-line-async-gen-computed-symbol-names.js | 118 + ...privatename-identifier-semantics-stringvalue.js | 122 + .../same-line-async-gen-literal-names-asi.js | 90 + .../elements/same-line-async-gen-literal-names.js | 109 + .../same-line-async-gen-private-field-usage.js | 62 + ...e-line-async-gen-private-method-getter-usage.js | 62 + .../same-line-async-gen-private-method-usage.js | 62 + .../elements/same-line-async-gen-private-names.js | 84 + ...ne-async-gen-rs-field-identifier-initializer.js | 100 + .../same-line-async-gen-rs-field-identifier.js | 107 + .../same-line-async-gen-rs-private-getter-alt.js | 141 ++ .../same-line-async-gen-rs-private-getter.js | 141 ++ .../same-line-async-gen-rs-private-method-alt.js | 140 ++ .../same-line-async-gen-rs-private-method.js | 140 ++ .../same-line-async-gen-rs-private-setter-alt.js | 140 ++ .../same-line-async-gen-rs-private-setter.js | 140 ++ ...line-async-gen-rs-privatename-identifier-alt.js | 122 + ...en-rs-privatename-identifier-initializer-alt.js | 116 + ...nc-gen-rs-privatename-identifier-initializer.js | 116 + ...ame-line-async-gen-rs-privatename-identifier.js | 122 + ...-generator-method-privatename-identifier-alt.js | 148 ++ ...sync-generator-method-privatename-identifier.js | 149 ++ ...atic-async-method-privatename-identifier-alt.js | 148 ++ ...s-static-async-method-privatename-identifier.js | 149 ++ ...-generator-method-privatename-identifier-alt.js | 137 + ...atic-generator-method-privatename-identifier.js | 138 + ...-rs-static-method-privatename-identifier-alt.js | 135 + ...-gen-rs-static-method-privatename-identifier.js | 135 + ...atic-privatename-identifier-alt-by-classname.js | 123 + ...ync-gen-rs-static-privatename-identifier-alt.js | 123 + ...s-static-privatename-identifier-by-classname.js | 123 + ...name-identifier-initializer-alt-by-classname.js | 117 + ...tatic-privatename-identifier-initializer-alt.js | 117 + ...rs-static-privatename-identifier-initializer.js | 117 + ...e-async-gen-rs-static-privatename-identifier.js | 123 + .../same-line-async-gen-static-private-fields.js | 84 + ...async-gen-static-private-methods-with-fields.js | 101 + .../same-line-async-gen-static-private-methods.js | 88 + .../same-line-async-gen-string-literal-names.js | 122 + .../same-line-async-method-computed-names.js | 119 + ...same-line-async-method-computed-symbol-names.js | 117 + ...privatename-identifier-semantics-stringvalue.js | 121 + .../same-line-async-method-literal-names-asi.js | 89 + .../same-line-async-method-literal-names.js | 108 + .../same-line-async-method-private-field-usage.js | 61 + ...ine-async-method-private-method-getter-usage.js | 61 + .../same-line-async-method-private-method-usage.js | 61 + .../same-line-async-method-private-names.js | 83 + ...async-method-rs-field-identifier-initializer.js | 99 + .../same-line-async-method-rs-field-identifier.js | 106 + ...same-line-async-method-rs-private-getter-alt.js | 140 ++ .../same-line-async-method-rs-private-getter.js | 140 ++ ...same-line-async-method-rs-private-method-alt.js | 139 + .../same-line-async-method-rs-private-method.js | 139 + ...same-line-async-method-rs-private-setter-alt.js | 139 + .../same-line-async-method-rs-private-setter.js | 139 + ...e-async-method-rs-privatename-identifier-alt.js | 121 + ...od-rs-privatename-identifier-initializer-alt.js | 115 + ...method-rs-privatename-identifier-initializer.js | 115 + ...-line-async-method-rs-privatename-identifier.js | 121 + ...-generator-method-privatename-identifier-alt.js | 147 ++ ...sync-generator-method-privatename-identifier.js | 148 ++ ...atic-async-method-privatename-identifier-alt.js | 147 ++ ...s-static-async-method-privatename-identifier.js | 148 ++ ...-generator-method-privatename-identifier-alt.js | 136 + ...atic-generator-method-privatename-identifier.js | 137 + ...-rs-static-method-privatename-identifier-alt.js | 134 + ...thod-rs-static-method-privatename-identifier.js | 134 + ...atic-privatename-identifier-alt-by-classname.js | 122 + ...-method-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 + ...sync-method-rs-static-privatename-identifier.js | 122 + ...same-line-async-method-static-private-fields.js | 83 + ...nc-method-static-private-methods-with-fields.js | 100 + ...ame-line-async-method-static-private-methods.js | 87 + .../same-line-async-method-string-literal-names.js | 121 + .../class/elements/same-line-gen-computed-names.js | 107 + .../same-line-gen-computed-symbol-names.js | 105 + ...privatename-identifier-semantics-stringvalue.js | 109 + .../elements/same-line-gen-literal-names-asi.js | 77 + .../class/elements/same-line-gen-literal-names.js | 96 + .../elements/same-line-gen-private-field-usage.js | 49 + .../same-line-gen-private-method-getter-usage.js | 49 + .../elements/same-line-gen-private-method-usage.js | 49 + .../class/elements/same-line-gen-private-names.js | 71 + ...ame-line-gen-rs-field-identifier-initializer.js | 87 + .../elements/same-line-gen-rs-field-identifier.js | 94 + .../same-line-gen-rs-private-getter-alt.js | 128 + .../elements/same-line-gen-rs-private-getter.js | 128 + .../same-line-gen-rs-private-method-alt.js | 127 + .../elements/same-line-gen-rs-private-method.js | 127 + .../same-line-gen-rs-private-setter-alt.js | 127 + .../elements/same-line-gen-rs-private-setter.js | 127 + .../same-line-gen-rs-privatename-identifier-alt.js | 109 + ...en-rs-privatename-identifier-initializer-alt.js | 103 + ...ne-gen-rs-privatename-identifier-initializer.js | 103 + .../same-line-gen-rs-privatename-identifier.js | 109 + ...-generator-method-privatename-identifier-alt.js | 134 + ...sync-generator-method-privatename-identifier.js | 135 + ...atic-async-method-privatename-identifier-alt.js | 134 + ...s-static-async-method-privatename-identifier.js | 135 + ...-generator-method-privatename-identifier-alt.js | 124 + ...atic-generator-method-privatename-identifier.js | 125 + ...-rs-static-method-privatename-identifier-alt.js | 122 + ...-gen-rs-static-method-privatename-identifier.js | 122 + ...atic-privatename-identifier-alt-by-classname.js | 110 + ...ine-gen-rs-static-privatename-identifier-alt.js | 110 + ...s-static-privatename-identifier-by-classname.js | 110 + ...name-identifier-initializer-alt-by-classname.js | 104 + ...tatic-privatename-identifier-initializer-alt.js | 104 + ...rs-static-privatename-identifier-initializer.js | 104 + ...me-line-gen-rs-static-privatename-identifier.js | 110 + .../same-line-gen-static-private-fields.js | 71 + ...-line-gen-static-private-methods-with-fields.js | 88 + .../same-line-gen-static-private-methods.js | 75 + .../elements/same-line-gen-string-literal-names.js | 109 + .../elements/same-line-method-computed-names.js | 107 + .../same-line-method-computed-symbol-names.js | 105 + ...privatename-identifier-semantics-stringvalue.js | 109 + .../elements/same-line-method-literal-names-asi.js | 77 + .../elements/same-line-method-literal-names.js | 96 + .../same-line-method-private-field-usage.js | 49 + ...same-line-method-private-method-getter-usage.js | 49 + .../same-line-method-private-method-usage.js | 49 + .../elements/same-line-method-private-names.js | 71 + ...-line-method-rs-field-identifier-initializer.js | 87 + .../same-line-method-rs-field-identifier.js | 94 + .../same-line-method-rs-private-getter-alt.js | 128 + .../elements/same-line-method-rs-private-getter.js | 128 + .../same-line-method-rs-private-method-alt.js | 127 + .../elements/same-line-method-rs-private-method.js | 127 + .../same-line-method-rs-private-setter-alt.js | 127 + .../elements/same-line-method-rs-private-setter.js | 127 + ...me-line-method-rs-privatename-identifier-alt.js | 109 + ...od-rs-privatename-identifier-initializer-alt.js | 103 + ...method-rs-privatename-identifier-initializer.js | 103 + .../same-line-method-rs-privatename-identifier.js | 109 + ...-generator-method-privatename-identifier-alt.js | 134 + ...sync-generator-method-privatename-identifier.js | 135 + ...atic-async-method-privatename-identifier-alt.js | 134 + ...s-static-async-method-privatename-identifier.js | 135 + ...-generator-method-privatename-identifier-alt.js | 124 + ...atic-generator-method-privatename-identifier.js | 125 + ...-rs-static-method-privatename-identifier-alt.js | 122 + ...thod-rs-static-method-privatename-identifier.js | 122 + ...atic-privatename-identifier-alt-by-classname.js | 110 + ...-method-rs-static-privatename-identifier-alt.js | 110 + ...s-static-privatename-identifier-by-classname.js | 110 + ...name-identifier-initializer-alt-by-classname.js | 104 + ...tatic-privatename-identifier-initializer-alt.js | 104 + ...rs-static-privatename-identifier-initializer.js | 104 + ...line-method-rs-static-privatename-identifier.js | 110 + .../same-line-method-static-private-fields.js | 71 + ...ne-method-static-private-methods-with-fields.js | 88 + .../same-line-method-static-private-methods.js | 75 + .../same-line-method-string-literal-names.js | 109 + .../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 | 63 + .../static-field-anonymous-function-name.js | 72 + .../class/elements/static-field-declaration.js | 132 + ...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 | 30 + ...rivate-getter-access-on-inner-arrow-function.js | 46 + .../static-private-getter-access-on-inner-class.js | 44 + ...atic-private-getter-access-on-inner-function.js | 48 + .../class/elements/static-private-getter.js | 57 + .../static-private-init-err-contains-arguments.js | 35 + .../static-private-init-err-contains-super.js | 28 + ...rivate-method-access-on-inner-arrow-function.js | 44 + ...atic-private-method-access-on-inner-function.js | 46 + ...ivate-method-and-instance-method-brand-check.js | 66 + ...ivate-method-referenced-from-instance-method.js | 40 + .../static-private-method-subclass-receiver.js | 39 + ...private-methods-proxy-default-handler-throws.js | 33 + ...rivate-setter-access-on-inner-arrow-function.js | 47 + .../static-private-setter-access-on-inner-class.js | 46 + ...atic-private-setter-access-on-inner-function.js | 49 + .../class/elements/static-private-setter.js | 58 + ...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 + .../super-access-from-arrow-func-on-field.js | 39 + .../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 + .../syntax/valid/grammar-field-accessor.js | 27 + ...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 | 23 + ...r-privatemeth-duplicate-meth-nestedclassmeth.js | 28 + ...privatename-classelementname-initializer-alt.js | 69 + ...mar-privatename-classelementname-initializer.js | 69 + .../syntax/valid/grammar-privatename-identifier.js | 66 + ...ammar-privatename-no-initializer-with-method.js | 34 + .../valid/grammar-privatenames-multi-line.js | 34 + ...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 | 22 + .../grammar-static-private-async-meth-prototype.js | 22 + .../grammar-static-private-gen-meth-prototype.js | 22 + .../valid/grammar-static-private-meth-prototype.js | 22 + .../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 | 96 + .../wrapped-in-sc-computed-symbol-names.js | 94 + ...privatename-identifier-semantics-stringvalue.js | 97 + .../elements/wrapped-in-sc-literal-names-asi.js | 66 + .../class/elements/wrapped-in-sc-literal-names.js | 85 + .../elements/wrapped-in-sc-private-field-usage.js | 37 + .../wrapped-in-sc-private-method-getter-usage.js | 37 + .../elements/wrapped-in-sc-private-method-usage.js | 37 + .../class/elements/wrapped-in-sc-private-names.js | 59 + ...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 | 116 + .../elements/wrapped-in-sc-rs-private-getter.js | 116 + .../wrapped-in-sc-rs-private-method-alt.js | 115 + .../elements/wrapped-in-sc-rs-private-method.js | 115 + .../wrapped-in-sc-rs-private-setter-alt.js | 115 + .../elements/wrapped-in-sc-rs-private-setter.js | 115 + .../wrapped-in-sc-rs-privatename-identifier-alt.js | 97 + ...sc-rs-privatename-identifier-initializer-alt.js | 91 + ...-in-sc-rs-privatename-identifier-initializer.js | 91 + .../wrapped-in-sc-rs-privatename-identifier.js | 97 + ...-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 | 112 + ...atic-generator-method-privatename-identifier.js | 113 + ...-rs-static-method-privatename-identifier-alt.js | 110 + ...n-sc-rs-static-method-privatename-identifier.js | 110 + ...atic-privatename-identifier-alt-by-classname.js | 98 + ...d-in-sc-rs-static-privatename-identifier-alt.js | 98 + ...s-static-privatename-identifier-by-classname.js | 98 + ...name-identifier-initializer-alt-by-classname.js | 92 + ...tatic-privatename-identifier-initializer-alt.js | 92 + ...rs-static-privatename-identifier-initializer.js | 92 + ...apped-in-sc-rs-static-privatename-identifier.js | 98 + .../wrapped-in-sc-static-private-fields.js | 59 + ...ped-in-sc-static-private-methods-with-fields.js | 76 + .../wrapped-in-sc-static-private-methods.js | 63 + .../elements/wrapped-in-sc-string-literal-names.js | 98 + .../expressions/class/gen-method-length-dflt.js | 69 + .../class/gen-method-param-dflt-yield.js | 28 + .../array-destructuring-param-strict-body.js | 159 ++ .../expressions/class/gen-method-static/browser.js | 0 .../class/gen-method-static/dflt-params-abrupt.js | 89 + .../dflt-params-arg-val-not-undefined.js | 114 + .../dflt-params-arg-val-undefined.js | 97 + .../gen-method-static/dflt-params-duplicates.js | 88 + .../gen-method-static/dflt-params-ref-later.js | 90 + .../gen-method-static/dflt-params-ref-prior.js | 94 + .../gen-method-static/dflt-params-ref-self.js | 90 + .../class/gen-method-static/dflt-params-rest.js | 92 + .../dflt-params-trailing-comma.js | 89 + .../gen-method-static/forbidden-ext/b1/browser.js | 0 ...c-forbidden-ext-direct-access-prop-arguments.js | 37 + ...atic-forbidden-ext-direct-access-prop-caller.js | 37 + .../gen-method-static/forbidden-ext/b1/shell.js | 0 .../gen-method-static/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 63 + ...en-ext-indirect-access-own-prop-caller-value.js | 63 + ...ic-forbidden-ext-indirect-access-prop-caller.js | 63 + .../gen-method-static/forbidden-ext/b2/shell.js | 0 .../gen-method-static/forbidden-ext/browser.js | 0 .../class/gen-method-static/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 159 ++ .../params-trailing-comma-multiple.js | 89 + .../params-trailing-comma-single.js | 88 + .../gen-method-static/rest-param-strict-body.js | 159 ++ .../rest-params-trailing-comma-early-error.js | 85 + .../expressions/class/gen-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 + .../gen-method-static/yield-as-label-identifier.js | 36 + .../yield-identifier-spread-strict-strict.js | 54 + .../yield-identifier-strict-strict.js | 45 + .../gen-method-static/yield-spread-arr-multiple.js | 52 + .../gen-method-static/yield-spread-arr-single.js | 54 + .../class/gen-method-static/yield-spread-obj.js | 57 + .../array-destructuring-param-strict-body.js | 159 ++ .../expressions/class/gen-method/browser.js | 0 .../class/gen-method/dflt-params-abrupt.js | 89 + .../dflt-params-arg-val-not-undefined.js | 114 + .../gen-method/dflt-params-arg-val-undefined.js | 97 + .../class/gen-method/dflt-params-duplicates.js | 88 + .../class/gen-method/dflt-params-ref-later.js | 90 + .../class/gen-method/dflt-params-ref-prior.js | 94 + .../class/gen-method/dflt-params-ref-self.js | 90 + .../class/gen-method/dflt-params-rest.js | 92 + .../class/gen-method/dflt-params-trailing-comma.js | 89 + .../class/gen-method/forbidden-ext/b1/browser.js | 0 ...h-forbidden-ext-direct-access-prop-arguments.js | 37 + ...meth-forbidden-ext-direct-access-prop-caller.js | 37 + .../class/gen-method/forbidden-ext/b1/shell.js | 0 .../class/gen-method/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 64 + ...en-ext-indirect-access-own-prop-caller-value.js | 64 + ...th-forbidden-ext-indirect-access-prop-caller.js | 64 + .../class/gen-method/forbidden-ext/b2/shell.js | 0 .../class/gen-method/forbidden-ext/browser.js | 0 .../class/gen-method/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 159 ++ .../gen-method/params-trailing-comma-multiple.js | 89 + .../gen-method/params-trailing-comma-single.js | 88 + .../class/gen-method/rest-param-strict-body.js | 159 ++ .../rest-params-trailing-comma-early-error.js | 85 + .../language/expressions/class/gen-method/shell.js | 0 .../yield-as-binding-identifier-escaped.js | 36 + .../gen-method/yield-as-binding-identifier.js | 36 + .../yield-as-identifier-reference-escaped.js | 36 + .../gen-method/yield-as-identifier-reference.js | 36 + .../yield-as-label-identifier-escaped.js | 36 + .../class/gen-method/yield-as-label-identifier.js | 36 + .../yield-identifier-spread-strict-strict.js | 54 + .../gen-method/yield-identifier-strict-strict.js | 45 + .../class/gen-method/yield-spread-arr-multiple.js | 52 + .../class/gen-method/yield-spread-arr-single.js | 54 + .../class/gen-method/yield-spread-obj.js | 57 + .../expressions/class/getter-param-dflt.js | 24 + .../expressions/class/heritage-arrow-function.js | 33 + .../class/heritage-async-arrow-function.js | 33 + .../class/ident-name-method-def-break-escaped.js | 48 + .../class/ident-name-method-def-case-escaped.js | 48 + .../class/ident-name-method-def-catch-escaped.js | 48 + .../class/ident-name-method-def-class-escaped.js | 48 + .../class/ident-name-method-def-const-escaped.js | 48 + .../ident-name-method-def-continue-escaped.js | 48 + .../ident-name-method-def-debugger-escaped.js | 48 + .../ident-name-method-def-default-escaped-ext.js | 48 + .../class/ident-name-method-def-default-escaped.js | 48 + .../class/ident-name-method-def-default.js | 48 + .../class/ident-name-method-def-delete-escaped.js | 48 + .../class/ident-name-method-def-do-escaped.js | 48 + .../class/ident-name-method-def-else-escaped.js | 48 + .../class/ident-name-method-def-enum-escaped.js | 48 + .../class/ident-name-method-def-export-escaped.js | 48 + .../ident-name-method-def-extends-escaped-ext.js | 48 + .../class/ident-name-method-def-extends-escaped.js | 48 + .../class/ident-name-method-def-extends.js | 48 + .../class/ident-name-method-def-finally-escaped.js | 48 + .../class/ident-name-method-def-for-escaped.js | 48 + .../ident-name-method-def-function-escaped.js | 48 + .../class/ident-name-method-def-if-escaped.js | 48 + .../ident-name-method-def-implements-escaped.js | 48 + .../class/ident-name-method-def-import-escaped.js | 48 + .../class/ident-name-method-def-in-escaped.js | 48 + .../ident-name-method-def-instanceof-escaped.js | 48 + .../ident-name-method-def-interface-escaped.js | 48 + .../class/ident-name-method-def-let-escaped.js | 48 + .../class/ident-name-method-def-new-escaped.js | 48 + .../class/ident-name-method-def-package-escaped.js | 48 + .../class/ident-name-method-def-private-escaped.js | 48 + .../ident-name-method-def-protected-escaped.js | 48 + .../class/ident-name-method-def-public-escaped.js | 48 + .../class/ident-name-method-def-return-escaped.js | 48 + .../class/ident-name-method-def-static-escaped.js | 48 + .../class/ident-name-method-def-super-escaped.js | 48 + .../class/ident-name-method-def-switch-escaped.js | 48 + .../class/ident-name-method-def-this-escaped.js | 48 + .../class/ident-name-method-def-throw-escaped.js | 48 + .../class/ident-name-method-def-try-escaped.js | 48 + .../class/ident-name-method-def-typeof-escaped.js | 48 + .../class/ident-name-method-def-var-escaped.js | 48 + .../class/ident-name-method-def-void-escaped.js | 48 + .../class/ident-name-method-def-while-escaped.js | 48 + .../class/ident-name-method-def-with-escaped.js | 48 + .../expressions/class/method-length-dflt.js | 69 + .../expressions/class/method-param-dflt-yield.js | 23 + .../array-destructuring-param-strict-body.js | 155 ++ .../expressions/class/method-static/browser.js | 0 .../class/method-static/dflt-params-abrupt.js | 85 + .../dflt-params-arg-val-not-undefined.js | 110 + .../method-static/dflt-params-arg-val-undefined.js | 93 + .../class/method-static/dflt-params-duplicates.js | 84 + .../class/method-static/dflt-params-ref-later.js | 86 + .../class/method-static/dflt-params-ref-prior.js | 90 + .../class/method-static/dflt-params-ref-self.js | 86 + .../class/method-static/dflt-params-rest.js | 88 + .../method-static/dflt-params-trailing-comma.js | 84 + .../method-static/forbidden-ext/b1/browser.js | 0 ...c-forbidden-ext-direct-access-prop-arguments.js | 37 + ...atic-forbidden-ext-direct-access-prop-caller.js | 37 + .../class/method-static/forbidden-ext/b1/shell.js | 0 .../method-static/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 64 + ...en-ext-indirect-access-own-prop-caller-value.js | 64 + ...ic-forbidden-ext-indirect-access-prop-caller.js | 64 + .../class/method-static/forbidden-ext/b2/shell.js | 0 .../class/method-static/forbidden-ext/browser.js | 0 .../class/method-static/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 155 ++ .../params-trailing-comma-multiple.js | 84 + .../method-static/params-trailing-comma-single.js | 83 + .../class/method-static/rest-param-strict-body.js | 155 ++ .../rest-params-trailing-comma-early-error.js | 80 + .../expressions/class/method-static/shell.js | 0 .../array-destructuring-param-strict-body.js | 155 ++ .../language/expressions/class/method/browser.js | 0 .../expressions/class/method/dflt-params-abrupt.js | 85 + .../method/dflt-params-arg-val-not-undefined.js | 110 + .../class/method/dflt-params-arg-val-undefined.js | 93 + .../class/method/dflt-params-duplicates.js | 84 + .../class/method/dflt-params-ref-later.js | 86 + .../class/method/dflt-params-ref-prior.js | 90 + .../class/method/dflt-params-ref-self.js | 86 + .../expressions/class/method/dflt-params-rest.js | 88 + .../class/method/dflt-params-trailing-comma.js | 84 + .../class/method/forbidden-ext/b1/browser.js | 0 ...h-forbidden-ext-direct-access-prop-arguments.js | 37 + ...meth-forbidden-ext-direct-access-prop-caller.js | 37 + .../class/method/forbidden-ext/b1/shell.js | 0 .../class/method/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 64 + ...en-ext-indirect-access-own-prop-caller-value.js | 64 + ...th-forbidden-ext-indirect-access-prop-caller.js | 64 + .../class/method/forbidden-ext/b2/shell.js | 0 .../class/method/forbidden-ext/browser.js | 0 .../class/method/forbidden-ext/shell.js | 0 .../object-destructuring-param-strict-body.js | 155 ++ .../class/method/params-trailing-comma-multiple.js | 84 + .../class/method/params-trailing-comma-single.js | 83 + .../class/method/rest-param-strict-body.js | 155 ++ .../rest-params-trailing-comma-early-error.js | 80 + .../language/expressions/class/method/shell.js | 0 .../test262/language/expressions/class/name.js | 56 + .../class/params-dflt-gen-meth-args-unmapped.js | 108 + .../class/params-dflt-gen-meth-ref-arguments.js | 87 + .../params-dflt-gen-meth-static-args-unmapped.js | 108 + .../params-dflt-gen-meth-static-ref-arguments.js | 87 + .../class/params-dflt-meth-args-unmapped.js | 105 + .../class/params-dflt-meth-ref-arguments.js | 84 + .../class/params-dflt-meth-static-args-unmapped.js | 105 + .../class/params-dflt-meth-static-ref-arguments.js | 84 + .../expressions/class/poisoned-underscore-proto.js | 30 + ...-multiple-evaluations-of-class-eval-indirect.js | 51 + ...and-check-multiple-evaluations-of-class-eval.js | 51 + ...-check-multiple-evaluations-of-class-factory.js | 49 + ...-multiple-evaluations-of-class-function-ctor.js | 52 + ...ple-evaluations-of-class-realm-function-ctor.js | 55 + ...nd-check-multiple-evaluations-of-class-realm.js | 56 + ...-multiple-evaluations-of-class-eval-indirect.js | 51 + ...and-check-multiple-evaluations-of-class-eval.js | 51 + ...-check-multiple-evaluations-of-class-factory.js | 48 + ...-multiple-evaluations-of-class-function-ctor.js | 52 + ...ple-evaluations-of-class-realm-function-ctor.js | 55 + ...nd-check-multiple-evaluations-of-class-realm.js | 56 + ...-multiple-evaluations-of-class-eval-indirect.js | 53 + ...and-check-multiple-evaluations-of-class-eval.js | 53 + ...-check-multiple-evaluations-of-class-factory.js | 50 + ...-multiple-evaluations-of-class-function-ctor.js | 54 + ...ple-evaluations-of-class-realm-function-ctor.js | 57 + ...nd-check-multiple-evaluations-of-class-realm.js | 58 + ...ld-multiple-evaluations-of-class-direct-eval.js | 70 + ...-multiple-evaluations-of-class-eval-indirect.js | 70 + ...-field-multiple-evaluations-of-class-factory.js | 65 + ...-multiple-evaluations-of-class-function-ctor.js | 70 + ...ic-field-multiple-evaluations-of-class-realm.js | 75 + ...er-multiple-evaluations-of-class-direct-eval.js | 56 + ...-multiple-evaluations-of-class-eval-indirect.js | 56 + ...getter-multiple-evaluations-of-class-factory.js | 51 + ...-multiple-evaluations-of-class-function-ctor.js | 56 + ...c-getter-multiple-evaluations-of-class-realm.js | 61 + ...ck-multiple-evaluations-of-class-direct-eval.js | 54 + ...-multiple-evaluations-of-class-eval-indirect.js | 54 + ...-check-multiple-evaluations-of-class-factory.js | 49 + ...-multiple-evaluations-of-class-function-ctor.js | 54 + ...nd-check-multiple-evaluations-of-class-realm.js | 59 + ...er-multiple-evaluations-of-class-direct-eval.js | 58 + ...-multiple-evaluations-of-class-eval-indirect.js | 58 + ...setter-multiple-evaluations-of-class-factory.js | 53 + ...-multiple-evaluations-of-class-function-ctor.js | 58 + ...c-setter-multiple-evaluations-of-class-realm.js | 63 + .../expressions/class/restricted-properties.js | 62 + .../class/scope-gen-meth-paramsbody-var-close.js | 40 + .../class/scope-gen-meth-paramsbody-var-open.js | 38 + .../class/scope-meth-paramsbody-var-close.js | 39 + .../class/scope-meth-paramsbody-var-open.js | 37 + .../expressions/class/scope-name-lex-close.js | 23 + .../class/scope-name-lex-open-heritage.js | 39 + .../class/scope-name-lex-open-no-heritage.js | 41 + .../class/scope-setter-paramsbody-var-close.js | 39 + .../class/scope-setter-paramsbody-var-open.js | 37 + .../scope-static-gen-meth-paramsbody-var-close.js | 40 + .../scope-static-gen-meth-paramsbody-var-open.js | 38 + .../scope-static-meth-paramsbody-var-close.js | 39 + .../class/scope-static-meth-paramsbody-var-open.js | 37 + .../scope-static-setter-paramsbody-var-close.js | 39 + .../scope-static-setter-paramsbody-var-open.js | 37 + .../expressions/class/setter-length-dflt.js | 43 + .../test262/language/expressions/class/shell.js | 0 .../class/static-gen-method-param-dflt-yield.js | 28 + .../expressions/class/static-init-await-binding.js | 24 + .../class/static-init-await-reference.js | 30 + .../expressions/class/static-method-length-dflt.js | 69 + .../class/static-method-param-dflt-yield.js | 23 + .../expressions/class/subclass-builtins/browser.js | 0 .../expressions/class/subclass-builtins/shell.js | 0 .../subclass-builtins/subclass-AggregateError.js | 17 + .../class/subclass-builtins/subclass-Array.js | 16 + .../subclass-builtins/subclass-ArrayBuffer.js | 17 + .../subclass-builtins/subclass-BigInt64Array.js | 17 + .../subclass-builtins/subclass-BigUint64Array.js | 17 + .../class/subclass-builtins/subclass-Boolean.js | 16 + .../class/subclass-builtins/subclass-DataView.js | 17 + .../class/subclass-builtins/subclass-Date.js | 16 + .../class/subclass-builtins/subclass-Error.js | 16 + .../class/subclass-builtins/subclass-EvalError.js | 16 + .../subclass-builtins/subclass-Float32Array.js | 17 + .../subclass-builtins/subclass-Float64Array.js | 17 + .../class/subclass-builtins/subclass-Function.js | 16 + .../class/subclass-builtins/subclass-Int16Array.js | 17 + .../class/subclass-builtins/subclass-Int32Array.js | 17 + .../class/subclass-builtins/subclass-Int8Array.js | 17 + .../class/subclass-builtins/subclass-Map.js | 17 + .../class/subclass-builtins/subclass-Number.js | 16 + .../class/subclass-builtins/subclass-Object.js | 16 + .../class/subclass-builtins/subclass-Promise.js | 17 + .../class/subclass-builtins/subclass-RangeError.js | 16 + .../subclass-builtins/subclass-ReferenceError.js | 16 + .../class/subclass-builtins/subclass-RegExp.js | 16 + .../class/subclass-builtins/subclass-Set.js | 17 + .../subclass-SharedArrayBuffer.js | 18 + .../class/subclass-builtins/subclass-String.js | 16 + .../subclass-builtins/subclass-SyntaxError.js | 16 + .../class/subclass-builtins/subclass-TypeError.js | 16 + .../class/subclass-builtins/subclass-URIError.js | 16 + .../subclass-builtins/subclass-Uint16Array.js | 17 + .../subclass-builtins/subclass-Uint32Array.js | 17 + .../class/subclass-builtins/subclass-Uint8Array.js | 17 + .../subclass-Uint8ClampedArray.js | 17 + .../class/subclass-builtins/subclass-WeakMap.js | 17 + .../class/subclass-builtins/subclass-WeakRef.js | 18 + .../class/subclass-builtins/subclass-WeakSet.js | 17 + .../coalesce/abrupt-is-a-short-circuit.js | 60 + .../language/expressions/coalesce/browser.js | 0 .../coalesce/cannot-chain-head-with-logical-and.js | 32 + .../coalesce/cannot-chain-head-with-logical-or.js | 32 + .../coalesce/cannot-chain-tail-with-logical-and.js | 33 + .../coalesce/cannot-chain-tail-with-logical-or.js | 33 + ...chainable-if-parenthesis-covered-logical-and.js | 55 + .../chainable-if-parenthesis-covered-logical-or.js | 63 + .../coalesce/chainable-with-bitwise-and.js | 51 + .../coalesce/chainable-with-bitwise-or.js | 51 + .../coalesce/chainable-with-bitwise-xor.js | 51 + .../language/expressions/coalesce/chainable.js | 52 + .../language/expressions/coalesce/follows-null.js | 51 + .../expressions/coalesce/follows-undefined.js | 51 + .../test262/language/expressions/coalesce/shell.js | 0 .../expressions/coalesce/short-circuit-number-0.js | 83 + .../coalesce/short-circuit-number-42.js | 83 + .../coalesce/short-circuit-number-empty-string.js | 84 + .../coalesce/short-circuit-number-false.js | 83 + .../coalesce/short-circuit-number-object.js | 91 + .../coalesce/short-circuit-number-string.js | 84 + .../coalesce/short-circuit-number-symbol.js | 84 + .../coalesce/short-circuit-number-true.js | 83 + .../coalesce/short-circuit-prevents-evaluation.js | 58 + .../expressions/coalesce/tco-pos-null-strict.js | 30 + .../coalesce/tco-pos-undefined-strict.js | 30 + .../language/expressions/comma/S11.14_A1.js | 63 + .../language/expressions/comma/S11.14_A2.1_T1.js | 53 + .../language/expressions/comma/S11.14_A2.1_T2.js | 21 + .../language/expressions/comma/S11.14_A2.1_T3.js | 21 + .../language/expressions/comma/S11.14_A3.js | 38 + .../test262/language/expressions/comma/browser.js | 0 .../test262/language/expressions/comma/shell.js | 0 .../language/expressions/comma/tco-final-strict.js | 23 + .../expressions/compound-assignment/11.13.2-1-s.js | 16 + .../compound-assignment/11.13.2-10-s.js | 16 + .../compound-assignment/11.13.2-11-s.js | 16 + .../compound-assignment/11.13.2-12-s.js | 16 + .../compound-assignment/11.13.2-13-s.js | 16 + .../compound-assignment/11.13.2-14-s.js | 16 + .../compound-assignment/11.13.2-15-s.js | 16 + .../compound-assignment/11.13.2-16-s.js | 16 + .../compound-assignment/11.13.2-17-s.js | 16 + .../compound-assignment/11.13.2-18-s.js | 16 + .../compound-assignment/11.13.2-19-s.js | 16 + .../expressions/compound-assignment/11.13.2-2-s.js | 16 + .../compound-assignment/11.13.2-20-s.js | 16 + .../compound-assignment/11.13.2-21-s.js | 16 + .../compound-assignment/11.13.2-22-s.js | 16 + .../compound-assignment/11.13.2-23-s-strict.js | 26 + .../compound-assignment/11.13.2-24-s-strict.js | 26 + .../compound-assignment/11.13.2-25-s-strict.js | 26 + .../compound-assignment/11.13.2-26-s-strict.js | 26 + .../compound-assignment/11.13.2-27-s-strict.js | 26 + .../compound-assignment/11.13.2-28-s-strict.js | 26 + .../compound-assignment/11.13.2-29-s-strict.js | 26 + .../compound-assignment/11.13.2-30-s-strict.js | 26 + .../compound-assignment/11.13.2-31-s-strict.js | 26 + .../compound-assignment/11.13.2-32-s-strict.js | 26 + .../compound-assignment/11.13.2-33-s-strict.js | 26 + .../compound-assignment/11.13.2-34-s-strict.js | 28 + .../compound-assignment/11.13.2-35-s-strict.js | 28 + .../compound-assignment/11.13.2-36-s-strict.js | 28 + .../compound-assignment/11.13.2-37-s-strict.js | 28 + .../compound-assignment/11.13.2-38-s-strict.js | 28 + .../compound-assignment/11.13.2-39-s-strict.js | 28 + .../expressions/compound-assignment/11.13.2-4-s.js | 17 + .../compound-assignment/11.13.2-40-s-strict.js | 28 + .../compound-assignment/11.13.2-41-s-strict.js | 28 + .../compound-assignment/11.13.2-42-s-strict.js | 28 + .../compound-assignment/11.13.2-43-s-strict.js | 28 + .../compound-assignment/11.13.2-44-s-strict.js | 28 + .../compound-assignment/11.13.2-45-s-strict.js | 21 + .../compound-assignment/11.13.2-46-s-strict.js | 21 + .../compound-assignment/11.13.2-47-s-strict.js | 21 + .../compound-assignment/11.13.2-48-s-strict.js | 21 + .../compound-assignment/11.13.2-49-s-strict.js | 21 + .../expressions/compound-assignment/11.13.2-5-s.js | 17 + .../compound-assignment/11.13.2-50-s-strict.js | 21 + .../compound-assignment/11.13.2-51-s-strict.js | 21 + .../compound-assignment/11.13.2-52-s-strict.js | 21 + .../compound-assignment/11.13.2-53-s-strict.js | 21 + .../compound-assignment/11.13.2-54-s-strict.js | 21 + .../compound-assignment/11.13.2-55-s-strict.js | 21 + .../compound-assignment/11.13.2-6-1gs-strict.js | 19 + .../expressions/compound-assignment/11.13.2-6-s.js | 17 + .../expressions/compound-assignment/11.13.2-8-s.js | 17 + .../expressions/compound-assignment/11.13.2-9-s.js | 17 + .../compound-assignment/S11.13.2_A2.1_T1.1.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.10.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.11.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.2.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.3.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.4.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.5.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.6.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.7.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.8.js | 27 + .../compound-assignment/S11.13.2_A2.1_T1.9.js | 27 + .../compound-assignment/S11.13.2_A2.1_T2.1.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.10.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.11.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.2.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.3.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.4.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.5.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.6.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.7.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.8.js | 24 + .../compound-assignment/S11.13.2_A2.1_T2.9.js | 24 + .../compound-assignment/S11.13.2_A2.1_T3.1.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.10.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.11.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.2.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.3.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.4.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.5.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.6.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.7.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.8.js | 23 + .../compound-assignment/S11.13.2_A2.1_T3.9.js | 23 + .../compound-assignment/S11.13.2_A3.1_T1.js | 25 + .../compound-assignment/S11.13.2_A3.1_T10.js | 25 + .../compound-assignment/S11.13.2_A3.1_T11.js | 25 + .../compound-assignment/S11.13.2_A3.1_T2.js | 25 + .../compound-assignment/S11.13.2_A3.1_T3.js | 25 + .../compound-assignment/S11.13.2_A3.1_T4.js | 25 + .../compound-assignment/S11.13.2_A3.1_T5.js | 25 + .../compound-assignment/S11.13.2_A3.1_T6.js | 25 + .../compound-assignment/S11.13.2_A3.1_T7.js | 25 + .../compound-assignment/S11.13.2_A3.1_T8.js | 25 + .../compound-assignment/S11.13.2_A3.1_T9.js | 25 + .../compound-assignment/S11.13.2_A3.2_T1.js | 26 + .../compound-assignment/S11.13.2_A3.2_T10.js | 26 + .../compound-assignment/S11.13.2_A3.2_T11.js | 26 + .../compound-assignment/S11.13.2_A3.2_T2.js | 26 + .../compound-assignment/S11.13.2_A3.2_T3.js | 26 + .../compound-assignment/S11.13.2_A3.2_T4.js | 26 + .../compound-assignment/S11.13.2_A3.2_T5.js | 26 + .../compound-assignment/S11.13.2_A3.2_T6.js | 26 + .../compound-assignment/S11.13.2_A3.2_T7.js | 26 + .../compound-assignment/S11.13.2_A3.2_T8.js | 26 + .../compound-assignment/S11.13.2_A3.2_T9.js | 26 + .../compound-assignment/S11.13.2_A4.10_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.10_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.10_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.10_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.10_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.10_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.10_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.10_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.10_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.10_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.10_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.10_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.10_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.11_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.11_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.11_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.11_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.11_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.11_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.11_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.11_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.11_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.11_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.11_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.11_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.11_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.1_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.1_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.1_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.1_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.1_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.1_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.1_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.1_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.1_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.1_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.1_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.1_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.1_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.2_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.2_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.2_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.2_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.2_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.2_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.2_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.2_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.2_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.2_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.2_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.2_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.2_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.3_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.3_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.3_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.3_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.3_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.3_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.3_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.3_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.3_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.3_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.3_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.3_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.3_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.4_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.4_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.4_T1.3.js | 40 + .../compound-assignment/S11.13.2_A4.4_T1.4.js | 52 + .../compound-assignment/S11.13.2_A4.4_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.4_T2.2.js | 42 + .../compound-assignment/S11.13.2_A4.4_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.4_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.4_T2.5.js | 42 + .../compound-assignment/S11.13.2_A4.4_T2.6.js | 82 + .../compound-assignment/S11.13.2_A4.4_T2.7.js | 70 + .../compound-assignment/S11.13.2_A4.4_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.4_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.5_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.5_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.5_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.5_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.5_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.5_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.5_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.5_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.5_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.5_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.5_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.5_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.5_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.6_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.6_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.6_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.6_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.6_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.6_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.6_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.6_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.6_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.6_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.6_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.6_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.6_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.7_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.7_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.7_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.7_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.7_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.7_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.7_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.7_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.7_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.7_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.7_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.7_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.7_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.8_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.8_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.8_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.8_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.8_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.8_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.8_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.8_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.8_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.8_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.8_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.8_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.8_T2.9.js | 42 + .../compound-assignment/S11.13.2_A4.9_T1.1.js | 42 + .../compound-assignment/S11.13.2_A4.9_T1.2.js | 40 + .../compound-assignment/S11.13.2_A4.9_T1.3.js | 54 + .../compound-assignment/S11.13.2_A4.9_T1.4.js | 40 + .../compound-assignment/S11.13.2_A4.9_T2.1.js | 70 + .../compound-assignment/S11.13.2_A4.9_T2.2.js | 84 + .../compound-assignment/S11.13.2_A4.9_T2.3.js | 42 + .../compound-assignment/S11.13.2_A4.9_T2.4.js | 42 + .../compound-assignment/S11.13.2_A4.9_T2.5.js | 70 + .../compound-assignment/S11.13.2_A4.9_T2.6.js | 42 + .../compound-assignment/S11.13.2_A4.9_T2.7.js | 42 + .../compound-assignment/S11.13.2_A4.9_T2.8.js | 42 + .../compound-assignment/S11.13.2_A4.9_T2.9.js | 42 + .../compound-assignment/S11.13.2_A5.10_T1.js | 39 + .../compound-assignment/S11.13.2_A5.10_T2.js | 36 + .../compound-assignment/S11.13.2_A5.10_T3.js | 40 + .../compound-assignment/S11.13.2_A5.11_T1.js | 39 + .../compound-assignment/S11.13.2_A5.11_T2.js | 36 + .../compound-assignment/S11.13.2_A5.11_T3.js | 40 + .../compound-assignment/S11.13.2_A5.1_T1.js | 39 + .../compound-assignment/S11.13.2_A5.1_T2.js | 36 + .../compound-assignment/S11.13.2_A5.1_T3.js | 40 + .../compound-assignment/S11.13.2_A5.2_T1.js | 39 + .../compound-assignment/S11.13.2_A5.2_T2.js | 36 + .../compound-assignment/S11.13.2_A5.2_T3.js | 40 + .../compound-assignment/S11.13.2_A5.3_T1.js | 39 + .../compound-assignment/S11.13.2_A5.3_T2.js | 36 + .../compound-assignment/S11.13.2_A5.3_T3.js | 40 + .../compound-assignment/S11.13.2_A5.4_T1.js | 39 + .../compound-assignment/S11.13.2_A5.4_T2.js | 36 + .../compound-assignment/S11.13.2_A5.4_T3.js | 40 + .../compound-assignment/S11.13.2_A5.5_T1.js | 39 + .../compound-assignment/S11.13.2_A5.5_T2.js | 36 + .../compound-assignment/S11.13.2_A5.5_T3.js | 40 + .../compound-assignment/S11.13.2_A5.6_T1.js | 39 + .../compound-assignment/S11.13.2_A5.6_T2.js | 36 + .../compound-assignment/S11.13.2_A5.6_T3.js | 40 + .../compound-assignment/S11.13.2_A5.7_T1.js | 39 + .../compound-assignment/S11.13.2_A5.7_T2.js | 36 + .../compound-assignment/S11.13.2_A5.7_T3.js | 40 + .../compound-assignment/S11.13.2_A5.8_T1.js | 39 + .../compound-assignment/S11.13.2_A5.8_T2.js | 36 + .../compound-assignment/S11.13.2_A5.8_T3.js | 40 + .../compound-assignment/S11.13.2_A5.9_T1.js | 39 + .../compound-assignment/S11.13.2_A5.9_T2.js | 36 + .../compound-assignment/S11.13.2_A5.9_T3.js | 40 + .../compound-assignment/S11.13.2_A6.10_T1.js | 32 + .../compound-assignment/S11.13.2_A6.11_T1.js | 32 + .../compound-assignment/S11.13.2_A6.1_T1.js | 32 + .../compound-assignment/S11.13.2_A6.2_T1.js | 32 + .../compound-assignment/S11.13.2_A6.3_T1.js | 32 + .../compound-assignment/S11.13.2_A6.4_T1.js | 32 + .../compound-assignment/S11.13.2_A6.5_T1.js | 32 + .../compound-assignment/S11.13.2_A6.6_T1.js | 32 + .../compound-assignment/S11.13.2_A6.7_T1.js | 32 + .../compound-assignment/S11.13.2_A6.8_T1.js | 32 + .../compound-assignment/S11.13.2_A6.9_T1.js | 32 + .../compound-assignment/S11.13.2_A7.10_T1.js | 41 + .../compound-assignment/S11.13.2_A7.10_T2.js | 41 + .../compound-assignment/S11.13.2_A7.10_T3.js | 29 + .../compound-assignment/S11.13.2_A7.10_T4.js | 28 + .../compound-assignment/S11.13.2_A7.11_T1.js | 41 + .../compound-assignment/S11.13.2_A7.11_T2.js | 41 + .../compound-assignment/S11.13.2_A7.11_T3.js | 29 + .../compound-assignment/S11.13.2_A7.11_T4.js | 28 + .../compound-assignment/S11.13.2_A7.1_T1.js | 41 + .../compound-assignment/S11.13.2_A7.1_T2.js | 41 + .../compound-assignment/S11.13.2_A7.1_T3.js | 29 + .../compound-assignment/S11.13.2_A7.1_T4.js | 28 + .../compound-assignment/S11.13.2_A7.2_T1.js | 41 + .../compound-assignment/S11.13.2_A7.2_T2.js | 41 + .../compound-assignment/S11.13.2_A7.2_T3.js | 29 + .../compound-assignment/S11.13.2_A7.2_T4.js | 28 + .../compound-assignment/S11.13.2_A7.3_T1.js | 41 + .../compound-assignment/S11.13.2_A7.3_T2.js | 41 + .../compound-assignment/S11.13.2_A7.3_T3.js | 29 + .../compound-assignment/S11.13.2_A7.3_T4.js | 28 + .../compound-assignment/S11.13.2_A7.4_T1.js | 41 + .../compound-assignment/S11.13.2_A7.4_T2.js | 41 + .../compound-assignment/S11.13.2_A7.4_T3.js | 29 + .../compound-assignment/S11.13.2_A7.4_T4.js | 28 + .../compound-assignment/S11.13.2_A7.5_T1.js | 41 + .../compound-assignment/S11.13.2_A7.5_T2.js | 41 + .../compound-assignment/S11.13.2_A7.5_T3.js | 29 + .../compound-assignment/S11.13.2_A7.5_T4.js | 28 + .../compound-assignment/S11.13.2_A7.6_T1.js | 41 + .../compound-assignment/S11.13.2_A7.6_T2.js | 41 + .../compound-assignment/S11.13.2_A7.6_T3.js | 29 + .../compound-assignment/S11.13.2_A7.6_T4.js | 28 + .../compound-assignment/S11.13.2_A7.7_T1.js | 41 + .../compound-assignment/S11.13.2_A7.7_T2.js | 41 + .../compound-assignment/S11.13.2_A7.7_T3.js | 29 + .../compound-assignment/S11.13.2_A7.7_T4.js | 28 + .../compound-assignment/S11.13.2_A7.8_T1.js | 41 + .../compound-assignment/S11.13.2_A7.8_T2.js | 41 + .../compound-assignment/S11.13.2_A7.8_T3.js | 29 + .../compound-assignment/S11.13.2_A7.8_T4.js | 28 + .../compound-assignment/S11.13.2_A7.9_T1.js | 41 + .../compound-assignment/S11.13.2_A7.9_T2.js | 41 + .../compound-assignment/S11.13.2_A7.9_T3.js | 29 + .../compound-assignment/S11.13.2_A7.9_T4.js | 28 + .../add-arguments-strict-strict.js | 21 + .../compound-assignment/add-eval-strict-strict.js | 20 + .../compound-assignment/add-non-simple.js | 18 + .../compound-assignment/add-whitespace.js | 59 + .../and-arguments-strict-strict.js | 21 + .../compound-assignment/and-eval-strict-strict.js | 20 + .../compound-assignment/and-whitespace.js | 59 + .../expressions/compound-assignment/browser.js | 0 .../compound-assignment/btws-and-non-simple.js | 18 + .../compound-assignment/btws-or-non-simple.js | 18 + .../compound-assignment/btws-xor-non-simple.js | 18 + ...ssignment-operator-calls-putvalue-lref--v--1.js | 42 + ...signment-operator-calls-putvalue-lref--v--10.js | 43 + ...signment-operator-calls-putvalue-lref--v--11.js | 42 + ...signment-operator-calls-putvalue-lref--v--12.js | 43 + ...signment-operator-calls-putvalue-lref--v--13.js | 41 + ...signment-operator-calls-putvalue-lref--v--14.js | 42 + ...signment-operator-calls-putvalue-lref--v--15.js | 41 + ...signment-operator-calls-putvalue-lref--v--16.js | 42 + ...signment-operator-calls-putvalue-lref--v--17.js | 41 + ...signment-operator-calls-putvalue-lref--v--18.js | 42 + ...signment-operator-calls-putvalue-lref--v--19.js | 41 + ...ssignment-operator-calls-putvalue-lref--v--2.js | 42 + ...signment-operator-calls-putvalue-lref--v--20.js | 42 + ...signment-operator-calls-putvalue-lref--v--21.js | 41 + ...ssignment-operator-calls-putvalue-lref--v--3.js | 41 + ...ssignment-operator-calls-putvalue-lref--v--4.js | 42 + ...ssignment-operator-calls-putvalue-lref--v--5.js | 41 + ...ssignment-operator-calls-putvalue-lref--v--6.js | 42 + ...ssignment-operator-calls-putvalue-lref--v--7.js | 41 + ...ssignment-operator-calls-putvalue-lref--v--8.js | 42 + ...ssignment-operator-calls-putvalue-lref--v--9.js | 41 + ...-assignment-operator-calls-putvalue-lref--v-.js | 42 + .../div-arguments-strict-strict.js | 21 + .../compound-assignment/div-eval-strict-strict.js | 20 + .../compound-assignment/div-non-simple.js | 18 + .../compound-assignment/div-whitespace.js | 59 + ...side-private-reference-accessor-property-add.js | 62 + ...e-private-reference-accessor-property-bitand.js | 62 + ...de-private-reference-accessor-property-bitor.js | 62 + ...e-private-reference-accessor-property-bitxor.js | 62 + ...side-private-reference-accessor-property-div.js | 62 + ...side-private-reference-accessor-property-exp.js | 62 + ...e-private-reference-accessor-property-lshift.js | 62 + ...side-private-reference-accessor-property-mod.js | 62 + ...ide-private-reference-accessor-property-mult.js | 62 + ...e-private-reference-accessor-property-rshift.js | 62 + ...-private-reference-accessor-property-srshift.js | 62 + ...side-private-reference-accessor-property-sub.js | 62 + ...and-side-private-reference-data-property-add.js | 54 + ...-side-private-reference-data-property-bitand.js | 54 + ...d-side-private-reference-data-property-bitor.js | 54 + ...-side-private-reference-data-property-bitxor.js | 54 + ...and-side-private-reference-data-property-div.js | 54 + ...and-side-private-reference-data-property-exp.js | 54 + ...-side-private-reference-data-property-lshift.js | 54 + ...and-side-private-reference-data-property-mod.js | 54 + ...nd-side-private-reference-data-property-mult.js | 54 + ...-side-private-reference-data-property-rshift.js | 54 + ...side-private-reference-data-property-srshift.js | 54 + ...and-side-private-reference-data-property-sub.js | 54 + .../left-hand-side-private-reference-method-add.js | 50 + ...ft-hand-side-private-reference-method-bitand.js | 50 + ...eft-hand-side-private-reference-method-bitor.js | 50 + ...ft-hand-side-private-reference-method-bitxor.js | 50 + .../left-hand-side-private-reference-method-div.js | 50 + .../left-hand-side-private-reference-method-exp.js | 50 + ...ft-hand-side-private-reference-method-lshift.js | 50 + .../left-hand-side-private-reference-method-mod.js | 50 + ...left-hand-side-private-reference-method-mult.js | 50 + ...ft-hand-side-private-reference-method-rshift.js | 50 + ...t-hand-side-private-reference-method-srshift.js | 50 + .../left-hand-side-private-reference-method-sub.js | 50 + ...ate-reference-readonly-accessor-property-add.js | 52 + ...-reference-readonly-accessor-property-bitand.js | 52 + ...e-reference-readonly-accessor-property-bitor.js | 52 + ...-reference-readonly-accessor-property-bitxor.js | 52 + ...ate-reference-readonly-accessor-property-div.js | 52 + ...ate-reference-readonly-accessor-property-exp.js | 52 + ...-reference-readonly-accessor-property-lshift.js | 52 + ...ate-reference-readonly-accessor-property-mod.js | 52 + ...te-reference-readonly-accessor-property-mult.js | 52 + ...-reference-readonly-accessor-property-rshift.js | 52 + ...reference-readonly-accessor-property-srshift.js | 52 + ...ate-reference-readonly-accessor-property-sub.js | 52 + .../compound-assignment/left-shift-non-simple.js | 18 + .../lshift-arguments-strict-strict.js | 21 + .../lshift-eval-strict-strict.js | 21 + .../compound-assignment/lshift-whitespace.js | 59 + .../mod-arguments-strict-strict.js | 21 + .../compound-assignment/mod-div-non-simple.js | 18 + .../compound-assignment/mod-eval-strict-strict.js | 20 + .../compound-assignment/mod-whitespace.js | 59 + .../mult-arguments-strict-strict.js | 21 + .../compound-assignment/mult-eval-strict-strict.js | 20 + .../compound-assignment/mult-non-simple.js | 18 + .../compound-assignment/mult-whitespace.js | 59 + .../or-arguments-strict-strict.js | 21 + .../compound-assignment/or-eval-strict-strict.js | 20 + .../compound-assignment/or-whitespace.js | 59 + .../compound-assignment/right-shift-non-simple.js | 18 + .../expressions/compound-assignment/shell.js | 0 .../srshift-arguments-strict-strict.js | 21 + .../srshift-eval-strict-strict.js | 21 + .../compound-assignment/srshift-whitespace.js | 59 + .../sub-arguments-strict-strict.js | 21 + .../compound-assignment/sub-eval-strict-strict.js | 20 + .../compound-assignment/sub-whitespace.js | 59 + .../compound-assignment/subtract-non-simple.js | 18 + .../u-right-shift-non-simple.js | 18 + .../urshift-arguments-strict-strict.js | 21 + .../urshift-eval-strict-strict.js | 21 + .../compound-assignment/urshift-whitespace.js | 59 + .../xor-arguments-strict-strict.js | 21 + .../compound-assignment/xor-eval-strict-strict.js | 20 + .../compound-assignment/xor-whitespace.js | 59 + .../expressions/concatenation/S9.8_A1_T2.js | 27 + .../expressions/concatenation/S9.8_A2_T2.js | 15 + .../expressions/concatenation/S9.8_A3_T2.js | 22 + .../expressions/concatenation/S9.8_A4_T2.js | 24 + .../expressions/concatenation/S9.8_A5_T2.js | 93 + .../language/expressions/concatenation/browser.js | 0 .../language/expressions/concatenation/shell.js | 0 .../language/expressions/conditional/S11.12_A1.js | 63 + .../expressions/conditional/S11.12_A2.1_T1.js | 49 + .../expressions/conditional/S11.12_A2.1_T2.js | 21 + .../expressions/conditional/S11.12_A2.1_T3.js | 23 + .../expressions/conditional/S11.12_A2.1_T4.js | 23 + .../expressions/conditional/S11.12_A2.1_T5.js | 16 + .../expressions/conditional/S11.12_A2.1_T6.js | 16 + .../expressions/conditional/S11.12_A3_T1.js | 21 + .../expressions/conditional/S11.12_A3_T2.js | 21 + .../expressions/conditional/S11.12_A3_T3.js | 21 + .../expressions/conditional/S11.12_A3_T4.js | 20 + .../expressions/conditional/S11.12_A4_T1.js | 27 + .../expressions/conditional/S11.12_A4_T2.js | 27 + .../expressions/conditional/S11.12_A4_T3.js | 27 + .../expressions/conditional/S11.12_A4_T4.js | 20 + .../language/expressions/conditional/browser.js | 0 .../conditional/coalesce-expr-ternary.js | 75 + .../expressions/conditional/in-branch-1.js | 30 + .../expressions/conditional/in-branch-2.js | 23 + .../expressions/conditional/in-condition.js | 23 + .../language/expressions/conditional/shell.js | 0 .../conditional/symbol-conditional-evaluation.js | 14 + .../expressions/conditional/tco-cond-strict.js | 23 + .../expressions/conditional/tco-pos-strict.js | 23 + .../language/expressions/delete/11.4.1-0-1.js | 20 + .../language/expressions/delete/11.4.1-2-2.js | 21 + .../language/expressions/delete/11.4.1-3-1.js | 14 + .../language/expressions/delete/11.4.1-3-2.js | 15 + .../language/expressions/delete/11.4.1-3-3.js | 14 + .../expressions/delete/11.4.1-4-a-1-s-strict.js | 23 + .../expressions/delete/11.4.1-4-a-2-s-strict.js | 25 + .../language/expressions/delete/11.4.1-4-a-3-s.js | 24 + .../language/expressions/delete/11.4.1-4-a-4-s.js | 26 + .../language/expressions/delete/11.4.1-4.a-1.js | 27 + .../language/expressions/delete/11.4.1-4.a-10.js | 19 + .../language/expressions/delete/11.4.1-4.a-11.js | 22 + .../language/expressions/delete/11.4.1-4.a-12.js | 20 + .../language/expressions/delete/11.4.1-4.a-13.js | 21 + .../language/expressions/delete/11.4.1-4.a-14.js | 19 + .../language/expressions/delete/11.4.1-4.a-15.js | 19 + .../language/expressions/delete/11.4.1-4.a-16.js | 18 + .../language/expressions/delete/11.4.1-4.a-17.js | 19 + .../language/expressions/delete/11.4.1-4.a-2.js | 32 + .../expressions/delete/11.4.1-4.a-3-s-strict.js | 27 + .../language/expressions/delete/11.4.1-4.a-3.js | 28 + .../language/expressions/delete/11.4.1-4.a-4.js | 20 + .../language/expressions/delete/11.4.1-4.a-5.js | 26 + .../language/expressions/delete/11.4.1-4.a-6.js | 23 + .../language/expressions/delete/11.4.1-4.a-7.js | 19 + .../expressions/delete/11.4.1-4.a-8-s-strict.js | 22 + .../language/expressions/delete/11.4.1-4.a-8.js | 17 + .../expressions/delete/11.4.1-4.a-9-s-strict.js | 20 + .../language/expressions/delete/11.4.1-4.a-9.js | 19 + .../language/expressions/delete/11.4.1-5-1.js | 20 + .../language/expressions/delete/11.4.1-5-2.js | 21 + .../language/expressions/delete/11.4.1-5-3.js | 20 + .../expressions/delete/11.4.1-5-a-27-s-strict.js | 25 + .../language/expressions/delete/11.4.1-5-a-28-s.js | 12 + .../expressions/delete/11.4.4-4.a-3-s-strict.js | 27 + .../language/expressions/delete/S11.4.1_A2.1.js | 20 + .../language/expressions/delete/S11.4.1_A2.2_T1.js | 16 + .../language/expressions/delete/S11.4.1_A2.2_T2.js | 25 + .../language/expressions/delete/S11.4.1_A2.2_T3.js | 15 + .../language/expressions/delete/S11.4.1_A3.1.js | 37 + .../language/expressions/delete/S11.4.1_A3.2_T1.js | 17 + .../language/expressions/delete/S11.4.1_A3.2_T2.js | 19 + .../language/expressions/delete/S11.4.1_A3.2_T3.js | 20 + .../language/expressions/delete/S11.4.1_A3.3_T1.js | 23 + .../language/expressions/delete/S11.4.1_A3.3_T2.js | 21 + .../language/expressions/delete/S11.4.1_A3.3_T3.js | 22 + .../language/expressions/delete/S11.4.1_A3.3_T4.js | 20 + .../language/expressions/delete/S11.4.1_A3.3_T5.js | 23 + .../language/expressions/delete/S11.4.1_A3.3_T6.js | 20 + .../language/expressions/delete/S11.4.1_A4.js | 24 + .../expressions/delete/S11.4.1_A5-strict.js | 36 + .../language/expressions/delete/S8.12.7_A1.js | 29 + .../language/expressions/delete/S8.12.7_A2_T1.js | 48 + .../language/expressions/delete/S8.12.7_A2_T2.js | 54 + .../language/expressions/delete/S8.12.7_A3.js | 66 + .../test262/language/expressions/delete/browser.js | 0 ...vable-base-object-reference-throws-typeerror.js | 14 + .../delete/identifier-strict-recursive-strict.js | 20 + .../expressions/delete/identifier-strict-strict.js | 19 + .../delete/member-computed-reference-null.js | 23 + .../delete/member-computed-reference-undefined.js | 23 + .../delete/member-identifier-reference-null.js | 23 + .../member-identifier-reference-undefined.js | 23 + .../delete/non-reference-return-true.js | 37 + .../test262/language/expressions/delete/shell.js | 0 .../expressions/delete/super-property-method.js | 27 + .../expressions/delete/super-property-null-base.js | 38 + .../language/expressions/delete/super-property.js | 24 + ...nator-between-delete-unaryexpression-allowed.js | 51 + .../language/expressions/division/S11.5.2_A1.js | 62 + .../expressions/division/S11.5.2_A2.1_T1.js | 43 + .../expressions/division/S11.5.2_A2.1_T2.js | 21 + .../expressions/division/S11.5.2_A2.1_T3.js | 21 + .../expressions/division/S11.5.2_A2.2_T1.js | 71 + .../expressions/division/S11.5.2_A2.3_T1.js | 28 + .../expressions/division/S11.5.2_A2.4_T1.js | 22 + .../expressions/division/S11.5.2_A2.4_T2.js | 26 + .../expressions/division/S11.5.2_A2.4_T3.js | 21 + .../expressions/division/S11.5.2_A2.4_T4.js | 16 + .../expressions/division/S11.5.2_A3_T1.1.js | 32 + .../expressions/division/S11.5.2_A3_T1.2.js | 30 + .../expressions/division/S11.5.2_A3_T1.3.js | 40 + .../expressions/division/S11.5.2_A3_T1.4.js | 30 + .../expressions/division/S11.5.2_A3_T1.5.js | 30 + .../expressions/division/S11.5.2_A3_T2.1.js | 52 + .../expressions/division/S11.5.2_A3_T2.2.js | 62 + .../expressions/division/S11.5.2_A3_T2.3.js | 32 + .../expressions/division/S11.5.2_A3_T2.4.js | 32 + .../expressions/division/S11.5.2_A3_T2.5.js | 52 + .../expressions/division/S11.5.2_A3_T2.6.js | 32 + .../expressions/division/S11.5.2_A3_T2.7.js | 32 + .../expressions/division/S11.5.2_A3_T2.8.js | 32 + .../expressions/division/S11.5.2_A3_T2.9.js | 32 + .../expressions/division/S11.5.2_A4_T1.1.js | 52 + .../expressions/division/S11.5.2_A4_T1.2.js | 52 + .../expressions/division/S11.5.2_A4_T10.js | 64 + .../language/expressions/division/S11.5.2_A4_T2.js | 34 + .../language/expressions/division/S11.5.2_A4_T3.js | 34 + .../language/expressions/division/S11.5.2_A4_T4.js | 32 + .../language/expressions/division/S11.5.2_A4_T5.js | 44 + .../language/expressions/division/S11.5.2_A4_T6.js | 50 + .../language/expressions/division/S11.5.2_A4_T7.js | 32 + .../language/expressions/division/S11.5.2_A4_T8.js | 68 + .../language/expressions/division/S11.5.2_A4_T9.js | 39 + .../expressions/division/bigint-and-number.js | 92 + .../expressions/division/bigint-arithmetic.js | 1072 ++++++++ .../division/bigint-complex-infinity.js | 37 + .../language/expressions/division/bigint-errors.js | 72 + .../expressions/division/bigint-toprimitive.js | 374 +++ .../expressions/division/bigint-wrapped-values.js | 47 + .../language/expressions/division/browser.js | 0 .../expressions/division/line-terminator.js | 29 + .../division/no-magic-asi-from-block-eval.js | 23 + .../language/expressions/division/no-magic-asi.js | 24 + .../expressions/division/order-of-evaluation.js | 140 ++ .../test262/language/expressions/division/shell.js | 0 .../expressions/does-not-equals/S11.9.2_A1.js | 62 + .../expressions/does-not-equals/S11.9.2_A2.1_T1.js | 43 + .../expressions/does-not-equals/S11.9.2_A2.1_T2.js | 21 + .../expressions/does-not-equals/S11.9.2_A2.1_T3.js | 21 + .../expressions/does-not-equals/S11.9.2_A2.4_T1.js | 22 + .../expressions/does-not-equals/S11.9.2_A2.4_T2.js | 26 + .../expressions/does-not-equals/S11.9.2_A2.4_T3.js | 21 + .../expressions/does-not-equals/S11.9.2_A2.4_T4.js | 16 + .../expressions/does-not-equals/S11.9.2_A3.1.js | 32 + .../expressions/does-not-equals/S11.9.2_A3.2.js | 32 + .../expressions/does-not-equals/S11.9.2_A3.3.js | 32 + .../expressions/does-not-equals/S11.9.2_A4.1_T1.js | 55 + .../expressions/does-not-equals/S11.9.2_A4.1_T2.js | 55 + .../expressions/does-not-equals/S11.9.2_A4.2.js | 20 + .../expressions/does-not-equals/S11.9.2_A4.3.js | 37 + .../expressions/does-not-equals/S11.9.2_A5.1.js | 47 + .../expressions/does-not-equals/S11.9.2_A5.2.js | 37 + .../expressions/does-not-equals/S11.9.2_A5.3.js | 32 + .../expressions/does-not-equals/S11.9.2_A6.1.js | 40 + .../expressions/does-not-equals/S11.9.2_A6.2_T1.js | 50 + .../expressions/does-not-equals/S11.9.2_A6.2_T2.js | 50 + .../expressions/does-not-equals/S11.9.2_A7.1.js | 57 + .../expressions/does-not-equals/S11.9.2_A7.2.js | 27 + .../expressions/does-not-equals/S11.9.2_A7.3.js | 27 + .../expressions/does-not-equals/S11.9.2_A7.4.js | 27 + .../expressions/does-not-equals/S11.9.2_A7.5.js | 27 + .../expressions/does-not-equals/S11.9.2_A7.6.js | 27 + .../expressions/does-not-equals/S11.9.2_A7.7.js | 27 + .../expressions/does-not-equals/S11.9.2_A7.8.js | 77 + .../expressions/does-not-equals/S11.9.2_A7.9.js | 77 + .../does-not-equals/bigint-and-bigint.js | 173 ++ .../does-not-equals/bigint-and-boolean.js | 33 + .../bigint-and-incomparable-primitive.js | 27 + .../does-not-equals/bigint-and-non-finite.js | 31 + .../does-not-equals/bigint-and-number-extremes.js | 53 + .../does-not-equals/bigint-and-number.js | 43 + .../does-not-equals/bigint-and-object.js | 136 + .../does-not-equals/bigint-and-string.js | 68 + .../expressions/does-not-equals/browser.js | 0 .../language/expressions/does-not-equals/shell.js | 0 .../dynamic-import/always-create-new-promise.js | 36 + .../assign-expr-get-value-abrupt-throws.js | 39 + .../assignment-expression/additive-expr.js | 42 + .../assignment-expression/array-literal.js | 40 + .../assignment-expression/arrow-function.js | 33 + .../assignment-expression/await-expr.js | 39 + .../assignment-expression/await-identifier.js | 35 + .../assignment-expression/browser.js | 0 .../assignment-expression/call-expr-arguments.js | 47 + .../assignment-expression/call-expr-expr.js | 46 + .../assignment-expression/call-expr-identifier.js | 49 + .../assignment-expression/cover-call-expr.js | 47 + .../cover-parenthesized-expr.js | 39 + .../assignment-expression/identifier.js | 39 + .../assignment-expression/import-meta.js | 37 + .../lhs-assign-operator-assign-expr.js | 42 + .../lhs-eq-assign-expr-nostrict.js | 38 + .../assignment-expression/lhs-eq-assign-expr.js | 43 + .../assignment-expression/logical-and-expr.js | 40 + .../assignment-expression/logical-or-expr.js | 39 + .../assignment-expression/member-expr.js | 43 + .../module-code-other_FIXTURE.js | 11 + .../assignment-expression/module-code_FIXTURE.js | 11 + .../assignment-expression/new-target.js | 37 + .../assignment-expression/object-literal.js | 40 + .../dynamic-import/assignment-expression/shell.js | 0 .../assignment-expression/tagged-function-call.js | 36 + .../assignment-expression/ternary.js | 39 + .../dynamic-import/assignment-expression/this.js | 33 + .../assignment-expression/unary-expr.js | 34 + .../assignment-expression/yield-assign-expr.js | 49 + .../assignment-expression/yield-expr.js | 49 + .../assignment-expression/yield-identifier.js | 33 + .../assignment-expression/yield-star.js | 26 + .../dynamic-import/await-import-evaluation.js | 25 + .../await-import-evaluation_FIXTURE.js | 15 + .../language/expressions/dynamic-import/browser.js | 0 .../expressions/dynamic-import/catch/browser.js | 0 .../catch/eval-rqstd-abrupt-err-type_FIXTURE.js | 5 + .../catch/eval-rqstd-abrupt-err-uri_FIXTURE.js | 5 + .../catch/instn-iee-err-ambiguous-1_FIXTURE.js | 5 + .../catch/instn-iee-err-ambiguous-2_FIXTURE.js | 5 + .../instn-iee-err-ambiguous-export_FIXTURE.js | 5 + .../catch/instn-iee-err-ambiguous_FIXTURE.js | 6 + .../catch/instn-iee-err-circular-1_FIXTURE.js | 5 + .../catch/instn-iee-err-circular-2_FIXTURE.js | 5 + ...row-import-catch-eval-rqstd-abrupt-typeerror.js | 41 + ...rrow-import-catch-eval-rqstd-abrupt-urierror.js | 41 + ...d-arrow-import-catch-eval-script-code-target.js | 43 + ...ested-arrow-import-catch-file-does-not-exist.js | 38 + ...-import-catch-instn-iee-err-ambiguous-import.js | 62 + ...ed-arrow-import-catch-instn-iee-err-circular.js | 51 + ...port-catch-specifier-tostring-abrupt-rejects.js | 56 + ...w-function-await-eval-rqstd-abrupt-typeerror.js | 41 + ...ow-function-await-eval-rqstd-abrupt-urierror.js | 41 + ...arrow-function-await-eval-script-code-target.js | 43 + ...ync-arrow-function-await-file-does-not-exist.js | 38 + ...unction-await-instn-iee-err-ambiguous-import.js | 62 + ...-arrow-function-await-instn-iee-err-circular.js | 51 + ...tion-await-specifier-tostring-abrupt-rejects.js | 56 + ...ion-return-await-eval-rqstd-abrupt-typeerror.js | 39 + ...tion-return-await-eval-rqstd-abrupt-urierror.js | 39 + ...unction-return-await-eval-script-code-target.js | 41 + ...ow-function-return-await-file-does-not-exist.js | 36 + ...-return-await-instn-iee-err-ambiguous-import.js | 60 + ...function-return-await-instn-iee-err-circular.js | 49 + ...turn-await-specifier-tostring-abrupt-rejects.js | 54 + ...c-function-await-eval-rqstd-abrupt-typeerror.js | 41 + ...nc-function-await-eval-rqstd-abrupt-urierror.js | 41 + ...async-function-await-eval-script-code-target.js | 43 + ...ted-async-function-await-file-does-not-exist.js | 38 + ...unction-await-instn-iee-err-ambiguous-import.js | 62 + ...-async-function-await-instn-iee-err-circular.js | 51 + ...tion-await-specifier-tostring-abrupt-rejects.js | 56 + ...d-async-function-eval-rqstd-abrupt-typeerror.js | 42 + ...ed-async-function-eval-rqstd-abrupt-urierror.js | 42 + ...ested-async-function-eval-script-code-target.js | 44 + .../nested-async-function-file-does-not-exist.js | 39 + ...sync-function-instn-iee-err-ambiguous-import.js | 63 + ...nested-async-function-instn-iee-err-circular.js | 52 + ...ion-return-await-eval-rqstd-abrupt-typeerror.js | 41 + ...tion-return-await-eval-rqstd-abrupt-urierror.js | 41 + ...unction-return-await-eval-script-code-target.js | 43 + ...nc-function-return-await-file-does-not-exist.js | 38 + ...-return-await-instn-iee-err-ambiguous-import.js | 62 + ...function-return-await-instn-iee-err-circular.js | 51 + ...turn-await-specifier-tostring-abrupt-rejects.js | 56 + ...c-function-specifier-tostring-abrupt-rejects.js | 57 + ...-async-gen-await-eval-rqstd-abrupt-typeerror.js | 41 + ...d-async-gen-await-eval-rqstd-abrupt-urierror.js | 41 + ...sted-async-gen-await-eval-script-code-target.js | 43 + .../nested-async-gen-await-file-does-not-exist.js | 38 + ...ync-gen-await-instn-iee-err-ambiguous-import.js | 62 + ...ested-async-gen-await-instn-iee-err-circular.js | 51 + ...-gen-await-specifier-tostring-abrupt-rejects.js | 56 + ...gen-return-await-eval-rqstd-abrupt-typeerror.js | 41 + ...-gen-return-await-eval-rqstd-abrupt-urierror.js | 41 + ...ync-gen-return-await-eval-script-code-target.js | 43 + ...d-async-gen-return-await-file-does-not-exist.js | 38 + ...-return-await-instn-iee-err-ambiguous-import.js | 62 + ...sync-gen-return-await-instn-iee-err-circular.js | 51 + ...turn-await-specifier-tostring-abrupt-rejects.js | 56 + ...ock-import-catch-eval-rqstd-abrupt-typeerror.js | 39 + ...lock-import-catch-eval-rqstd-abrupt-urierror.js | 39 + ...d-block-import-catch-eval-script-code-target.js | 41 + ...ested-block-import-catch-file-does-not-exist.js | 36 + ...-import-catch-instn-iee-err-ambiguous-import.js | 60 + ...ed-block-import-catch-instn-iee-err-circular.js | 49 + ...port-catch-specifier-tostring-abrupt-rejects.js | 54 + ...ed-block-labeled-eval-rqstd-abrupt-typeerror.js | 39 + ...ted-block-labeled-eval-rqstd-abrupt-urierror.js | 39 + ...nested-block-labeled-eval-script-code-target.js | 41 + .../nested-block-labeled-file-does-not-exist.js | 36 + ...block-labeled-instn-iee-err-ambiguous-import.js | 60 + .../nested-block-labeled-instn-iee-err-circular.js | 49 + ...ck-labeled-specifier-tostring-abrupt-rejects.js | 54 + .../nested-do-while-eval-rqstd-abrupt-typeerror.js | 39 + .../nested-do-while-eval-rqstd-abrupt-urierror.js | 39 + .../nested-do-while-eval-script-code-target.js | 41 + .../catch/nested-do-while-file-does-not-exist.js | 36 + ...sted-do-while-instn-iee-err-ambiguous-import.js | 60 + .../nested-do-while-instn-iee-err-circular.js | 49 + ...d-do-while-specifier-tostring-abrupt-rejects.js | 54 + ...lse-import-catch-eval-rqstd-abrupt-typeerror.js | 41 + ...else-import-catch-eval-rqstd-abrupt-urierror.js | 41 + ...ed-else-import-catch-eval-script-code-target.js | 43 + ...nested-else-import-catch-file-does-not-exist.js | 38 + ...-import-catch-instn-iee-err-ambiguous-import.js | 62 + ...ted-else-import-catch-instn-iee-err-circular.js | 51 + ...port-catch-specifier-tostring-abrupt-rejects.js | 56 + ...ion-import-catch-eval-rqstd-abrupt-typeerror.js | 40 + ...tion-import-catch-eval-rqstd-abrupt-urierror.js | 40 + ...unction-import-catch-eval-script-code-target.js | 42 + ...ed-function-import-catch-file-does-not-exist.js | 37 + ...-import-catch-instn-iee-err-ambiguous-import.js | 61 + ...function-import-catch-instn-iee-err-circular.js | 50 + ...port-catch-specifier-tostring-abrupt-rejects.js | 55 + ...-if-import-catch-eval-rqstd-abrupt-typeerror.js | 39 + ...d-if-import-catch-eval-rqstd-abrupt-urierror.js | 39 + ...sted-if-import-catch-eval-script-code-target.js | 41 + .../nested-if-import-catch-file-does-not-exist.js | 36 + ...-import-catch-instn-iee-err-ambiguous-import.js | 60 + ...ested-if-import-catch-instn-iee-err-circular.js | 49 + ...port-catch-specifier-tostring-abrupt-rejects.js | 54 + ...ile-import-catch-eval-rqstd-abrupt-typeerror.js | 41 + ...hile-import-catch-eval-rqstd-abrupt-urierror.js | 41 + ...d-while-import-catch-eval-script-code-target.js | 43 + ...ested-while-import-catch-file-does-not-exist.js | 38 + ...-import-catch-instn-iee-err-ambiguous-import.js | 62 + ...ed-while-import-catch-instn-iee-err-circular.js | 51 + ...port-catch-specifier-tostring-abrupt-rejects.js | 56 + .../dynamic-import/catch/script-code_FIXTURE.js | 8 + .../expressions/dynamic-import/catch/shell.js | 0 ...vel-import-catch-eval-rqstd-abrupt-typeerror.js | 37 + ...evel-import-catch-eval-rqstd-abrupt-urierror.js | 37 + ...p-level-import-catch-eval-script-code-target.js | 39 + .../top-level-import-catch-file-does-not-exist.js | 34 + ...-import-catch-instn-iee-err-ambiguous-import.js | 58 + ...op-level-import-catch-instn-iee-err-circular.js | 47 + ...port-catch-specifier-tostring-abrupt-rejects.js | 52 + .../expressions/dynamic-import/custom-primitive.js | 34 + .../dynamic-import/custom-tostring_FIXTURE.js | 7 + .../dynamic-import/custom-valueof_FIXTURE.js | 7 + .../dynamic-import-module_FIXTURE.js | 5 + .../expressions/dynamic-import/empty_FIXTURE.js | 3 + .../dynamic-import/escape-sequence-import.js | 36 + .../dynamic-import/eval-export-dflt-cls-anon.js | 37 + .../eval-export-dflt-cls-name-meth.js | 35 + .../dynamic-import/eval-export-dflt-cls-named.js | 37 + .../eval-export-dflt-expr-cls-anon.js | 35 + .../eval-export-dflt-expr-cls-name-meth.js | 36 + .../eval-export-dflt-expr-cls-named.js | 35 + .../eval-export-dflt-expr-fn-anon.js | 35 + .../eval-export-dflt-expr-fn-named.js | 35 + .../eval-export-dflt-expr-gen-anon.js | 36 + .../eval-export-dflt-expr-gen-named.js | 35 + .../dynamic-import/eval-export-dflt-expr-in.js | 29 + .../expressions/dynamic-import/eval-rqstd-once.js | 32 + .../dynamic-import/eval-rqstd-once_FIXTURE.js | 16 + .../dynamic-import/eval-self-once-module.js | 40 + .../dynamic-import/eval-self-once-script.js | 44 + .../for-await-resolution-and-error-a_FIXTURE.js | 5 + .../for-await-resolution-and-error-agen-yield.js | 71 + .../for-await-resolution-and-error-agen.js | 53 + .../for-await-resolution-and-error-b_FIXTURE.js | 5 + ...-await-resolution-and-error-poisoned_FIXTURE.js | 5 + .../for-await-resolution-and-error.js | 38 + .../2nd-param-assert-enumeration-abrupt.js | 44 + .../2nd-param-assert-enumeration-enumerable.js | 61 + .../2nd-param-assert-enumeration.js | 59 + .../2nd-param-assert-non-object.js | 48 + .../2nd-param-assert-undefined.js | 37 + .../2nd-param-assert-value-abrupt.js | 35 + .../2nd-param-assert-value-non-string.js | 48 + .../import-assertions/2nd-param-await-expr.js | 22 + .../import-assertions/2nd-param-await-ident.js | 22 + .../2nd-param-evaluation-abrupt-return.js | 33 + .../2nd-param-evaluation-abrupt-throw.js | 32 + .../2nd-param-evaluation-sequence.js | 28 + .../2nd-param-get-assert-error.js | 37 + .../import-assertions/2nd-param-in.js | 23 + .../import-assertions/2nd-param-non-object.js | 41 + .../2nd-param-trailing-comma-fulfill.js | 21 + .../2nd-param-trailing-comma-reject.js | 25 + .../import-assertions/2nd-param-yield-expr.js | 32 + .../2nd-param-yield-ident-invalid-strict.js | 21 + .../2nd-param-yield-ident-valid.js | 22 + .../import-assertions/2nd-param_FIXTURE.js | 4 + .../import-assertions/2nd-param_FIXTURE.json | 1 + .../dynamic-import/import-assertions/README.md | 2 + .../dynamic-import/import-assertions/browser.js | 0 .../dynamic-import/import-assertions/shell.js | 0 .../import-assertions/trailing-comma-fulfill.js | 21 + .../import-assertions/trailing-comma-reject.js | 25 + .../import-attributes/2nd-param-await-expr.js | 22 + .../import-attributes/2nd-param-await-ident.js | 22 + .../2nd-param-evaluation-abrupt-return.js | 33 + .../2nd-param-evaluation-abrupt-throw.js | 32 + .../2nd-param-evaluation-sequence.js | 28 + .../import-attributes/2nd-param-get-with-error.js | 37 + .../import-attributes/2nd-param-in.js | 23 + .../import-attributes/2nd-param-non-object.js | 41 + .../2nd-param-trailing-comma-fulfill.js | 21 + .../2nd-param-trailing-comma-reject.js | 25 + .../2nd-param-with-enumeration-abrupt.js | 44 + .../2nd-param-with-enumeration-enumerable.js | 61 + .../2nd-param-with-enumeration.js | 59 + .../import-attributes/2nd-param-with-non-object.js | 48 + .../import-attributes/2nd-param-with-undefined.js | 37 + .../2nd-param-with-value-abrupt.js | 35 + .../2nd-param-with-value-non-string.js | 48 + .../import-attributes/2nd-param-yield-expr.js | 32 + .../2nd-param-yield-ident-invalid-strict.js | 21 + .../2nd-param-yield-ident-valid.js | 22 + .../import-attributes/2nd-param_FIXTURE.js | 4 + .../import-attributes/2nd-param_FIXTURE.json | 1 + .../dynamic-import/import-attributes/README.md | 2 + .../dynamic-import/import-attributes/browser.js | 0 .../dynamic-import/import-attributes/shell.js | 0 .../import-attributes/trailing-comma-fulfill.js | 21 + .../import-attributes/trailing-comma-reject.js | 25 + .../dynamic-import/imported-self-update.js | 34 + .../indirect-resolution-1_FIXTURE.js | 5 + .../indirect-resolution-2_FIXTURE.js | 5 + .../dynamic-import/indirect-resolution.js | 32 + .../dynamic-import/module-code_FIXTURE.js | 11 + .../namespace/await-ns-Symbol-toStringTag.js | 99 + .../namespace/await-ns-define-own-property.js | 178 ++ .../await-ns-delete-exported-init-no-strict.js | 113 + .../await-ns-delete-exported-init-strict-strict.js | 122 + .../await-ns-delete-non-exported-no-strict.js | 105 + .../await-ns-delete-non-exported-strict-strict.js | 106 + .../namespace/await-ns-extensible.js | 81 + .../await-ns-get-nested-namespace-dflt-direct.js | 127 + .../await-ns-get-nested-namespace-dflt-indirect.js | 127 + .../await-ns-get-nested-namespace-props-nrml.js | 124 + .../await-ns-get-own-property-str-found-init.js | 125 + .../await-ns-get-own-property-str-not-found.js | 118 + .../namespace/await-ns-get-own-property-sym.js | 96 + .../namespace/await-ns-get-str-found.js | 89 + .../namespace/await-ns-get-str-not-found.js | 91 + .../namespace/await-ns-get-sym-found.js | 86 + .../namespace/await-ns-get-sym-not-found.js | 86 + .../await-ns-has-property-str-found-init.js | 96 + .../await-ns-has-property-str-not-found.js | 103 + .../namespace/await-ns-has-property-sym-found.js | 85 + .../await-ns-has-property-sym-not-found.js | 87 + .../namespace/await-ns-no-iterator.js | 81 + .../namespace/await-ns-own-property-keys-sort.js | 131 + .../await-ns-prevent-extensions-object.js | 84 + .../await-ns-prevent-extensions-reflect.js | 81 + .../namespace/await-ns-prop-descs.js | 111 + .../dynamic-import/namespace/await-ns-prototype.js | 82 + .../namespace/await-ns-set-no-strict.js | 109 + .../namespace/await-ns-set-prototype-of-null.js | 82 + .../namespace/await-ns-set-prototype-of.js | 87 + .../await-ns-set-same-values-no-strict.js | 101 + .../await-ns-set-same-values-strict-strict.js | 112 + .../namespace/await-ns-set-strict-strict.js | 124 + .../dynamic-import/namespace/browser.js | 0 .../namespace/default-property-not-set-own.js | 34 + .../namespace/define-own-property_FIXTURE.js | 8 + .../dynamic-import/namespace/empty_FIXTURE.js | 3 + ...nested-namespace-dflt-skip-named-end_FIXTURE.js | 7 + ...get-nested-namespace-dflt-skip-named_FIXTURE.js | 5 + ...-nested-namespace-dflt-skip-prod-end_FIXTURE.js | 6 + .../get-nested-namespace-dflt-skip-prod_FIXTURE.js | 5 + .../get-nested-namespace-props-nrml-1_FIXTURE.js | 5 + .../get-nested-namespace-props-nrml-2_FIXTURE.js | 24 + .../get-nested-namespace-props-nrml-3_FIXTURE.js | 6 + .../namespace/module-code_FIXTURE.js | 11 + .../namespace/own-keys-sort_FIXTURE.js | 21 + .../promise-then-ns-Symbol-toStringTag.js | 97 + .../promise-then-ns-define-own-property.js | 176 ++ ...omise-then-ns-delete-exported-init-no-strict.js | 111 + ...e-then-ns-delete-exported-init-strict-strict.js | 120 + ...romise-then-ns-delete-non-exported-no-strict.js | 103 + ...se-then-ns-delete-non-exported-strict-strict.js | 104 + .../namespace/promise-then-ns-extensible.js | 79 + ...ise-then-ns-get-nested-namespace-dflt-direct.js | 125 + ...e-then-ns-get-nested-namespace-dflt-indirect.js | 125 + ...mise-then-ns-get-nested-namespace-props-nrml.js | 122 + ...mise-then-ns-get-own-property-str-found-init.js | 123 + ...omise-then-ns-get-own-property-str-not-found.js | 116 + .../promise-then-ns-get-own-property-sym.js | 94 + .../namespace/promise-then-ns-get-str-found.js | 87 + .../namespace/promise-then-ns-get-str-not-found.js | 89 + .../namespace/promise-then-ns-get-sym-found.js | 84 + .../namespace/promise-then-ns-get-sym-not-found.js | 84 + .../promise-then-ns-has-property-str-found-init.js | 94 + .../promise-then-ns-has-property-str-not-found.js | 101 + .../promise-then-ns-has-property-sym-found.js | 83 + .../promise-then-ns-has-property-sym-not-found.js | 85 + .../namespace/promise-then-ns-no-iterator.js | 79 + .../promise-then-ns-own-property-keys-sort.js | 129 + .../promise-then-ns-prevent-extensions-object.js | 82 + .../promise-then-ns-prevent-extensions-reflect.js | 79 + .../namespace/promise-then-ns-prop-descs.js | 109 + .../namespace/promise-then-ns-prototype.js | 80 + .../namespace/promise-then-ns-set-no-strict.js | 107 + .../promise-then-ns-set-prototype-of-null.js | 80 + .../namespace/promise-then-ns-set-prototype-of.js | 85 + .../promise-then-ns-set-same-values-no-strict.js | 99 + ...romise-then-ns-set-same-values-strict-strict.js | 110 + .../namespace/promise-then-ns-set-strict-strict.js | 122 + .../expressions/dynamic-import/namespace/shell.js | 0 .../expressions/dynamic-import/returns-promise.js | 55 + .../reuse-namespace-object-from-import.js | 39 + .../reuse-namespace-object-from-script.js | 37 + .../dynamic-import/reuse-namespace-object.js | 35 + .../language/expressions/dynamic-import/shell.js | 127 + .../expressions/dynamic-import/syntax/browser.js | 0 .../dynamic-import/syntax/invalid/browser.js | 0 ...ttargettype-syntax-error-1-update-expression.js | 47 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...ttargettype-syntax-error-2-update-expression.js | 47 + ...ttargettype-syntax-error-3-update-expression.js | 47 + ...ttargettype-syntax-error-4-update-expression.js | 47 + ...tax-error-5-lhs-equals-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + ...hs-assignment-operator-assignment-expression.js | 49 + .../nested-arrow-assignment-expr-not-optional.js | 38 + ...ment-expression-assignment-expr-not-optional.js | 36 + ...assignment-expression-no-new-call-expression.js | 37 + ...ed-arrow-assignment-expression-no-rest-param.js | 42 + ...ow-assignment-expression-not-extensible-args.js | 39 + .../invalid/nested-arrow-no-new-call-expression.js | 39 + .../syntax/invalid/nested-arrow-no-rest-param.js | 44 + .../invalid/nested-arrow-not-extensible-args.js | 41 + ...-function-await-assignment-expr-not-optional.js | 38 + ...-arrow-function-await-no-new-call-expression.js | 39 + ...ted-async-arrow-function-await-no-rest-param.js | 44 + ...ync-arrow-function-await-not-extensible-args.js | 41 + ...on-return-await-assignment-expr-not-optional.js | 36 + ...function-return-await-no-new-call-expression.js | 37 + ...nc-arrow-function-return-await-no-rest-param.js | 42 + ...ow-function-return-await-not-extensible-args.js | 39 + ...-async-function-assignment-expr-not-optional.js | 39 + ...-function-await-assignment-expr-not-optional.js | 38 + ...-async-function-await-no-new-call-expression.js | 39 + .../nested-async-function-await-no-rest-param.js | 44 + ...ted-async-function-await-not-extensible-args.js | 41 + ...nested-async-function-no-new-call-expression.js | 40 + .../invalid/nested-async-function-no-rest-param.js | 45 + .../nested-async-function-not-extensible-args.js | 42 + ...on-return-await-assignment-expr-not-optional.js | 39 + ...function-return-await-no-new-call-expression.js | 40 + ...ed-async-function-return-await-no-rest-param.js | 45 + ...nc-function-return-await-not-extensible-args.js | 42 + ...async-gen-await-assignment-expr-not-optional.js | 38 + ...ested-async-gen-await-no-new-call-expression.js | 39 + .../nested-async-gen-await-no-rest-param.js | 44 + .../nested-async-gen-await-not-extensible-args.js | 41 + .../nested-block-assignment-expr-not-optional.js | 38 + ...d-block-labeled-assignment-expr-not-optional.js | 38 + .../nested-block-labeled-no-new-call-expression.js | 39 + .../invalid/nested-block-labeled-no-rest-param.js | 44 + .../nested-block-labeled-not-extensible-args.js | 41 + .../invalid/nested-block-no-new-call-expression.js | 39 + .../syntax/invalid/nested-block-no-rest-param.js | 44 + .../invalid/nested-block-not-extensible-args.js | 41 + ...nested-do-while-assignment-expr-not-optional.js | 38 + .../nested-do-while-no-new-call-expression.js | 39 + .../invalid/nested-do-while-no-rest-param.js | 44 + .../invalid/nested-do-while-not-extensible-args.js | 41 + .../nested-else-assignment-expr-not-optional.js | 40 + ...-else-braceless-assignment-expr-not-optional.js | 38 + ...nested-else-braceless-no-new-call-expression.js | 39 + .../invalid/nested-else-braceless-no-rest-param.js | 44 + .../nested-else-braceless-not-extensible-args.js | 41 + .../invalid/nested-else-no-new-call-expression.js | 41 + .../syntax/invalid/nested-else-no-rest-param.js | 46 + .../invalid/nested-else-not-extensible-args.js | 43 + ...nested-function-assignment-expr-not-optional.js | 38 + .../nested-function-no-new-call-expression.js | 39 + .../invalid/nested-function-no-rest-param.js | 44 + .../invalid/nested-function-not-extensible-args.js | 41 + ...function-return-assignment-expr-not-optional.js | 38 + ...ested-function-return-no-new-call-expression.js | 39 + .../nested-function-return-no-rest-param.js | 44 + .../nested-function-return-not-extensible-args.js | 41 + .../nested-if-assignment-expr-not-optional.js | 38 + ...ed-if-braceless-assignment-expr-not-optional.js | 36 + .../nested-if-braceless-no-new-call-expression.js | 37 + .../invalid/nested-if-braceless-no-rest-param.js | 42 + .../nested-if-braceless-not-extensible-args.js | 39 + .../invalid/nested-if-no-new-call-expression.js | 39 + .../syntax/invalid/nested-if-no-rest-param.js | 44 + .../invalid/nested-if-not-extensible-args.js | 41 + .../nested-while-assignment-expr-not-optional.js | 40 + .../invalid/nested-while-no-new-call-expression.js | 41 + .../syntax/invalid/nested-while-no-rest-param.js | 46 + .../invalid/nested-while-not-extensible-args.js | 43 + .../nested-with-assignment-expr-not-optional.js | 38 + ...with-expression-assignment-expr-not-optional.js | 36 + ...ested-with-expression-no-new-call-expression.js | 37 + .../nested-with-expression-no-rest-param.js | 42 + .../nested-with-expression-not-extensible-args.js | 39 + .../invalid/nested-with-no-new-call-expression.js | 39 + .../syntax/invalid/nested-with-no-rest-param.js | 44 + .../invalid/nested-with-not-extensible-args.js | 41 + .../dynamic-import/syntax/invalid/shell.js | 0 .../top-level-assignment-expr-not-optional.js | 26 + .../invalid/top-level-no-new-call-expression.js | 27 + .../syntax/invalid/top-level-no-rest-param.js | 32 + .../invalid/top-level-not-extensible-args.js | 29 + .../expressions/dynamic-import/syntax/shell.js | 0 .../dynamic-import/syntax/valid/browser.js | 0 .../syntax/valid/callexpression-arguments.js | 33 + .../syntax/valid/callexpression-templateliteral.js | 29 + .../dynamic-import/syntax/valid/empty_FIXTURE.js | 5 + ...nt-expression-empty-str-is-valid-assign-expr.js | 27 + ...ssion-import-assertions-trailing-comma-first.js | 33 + ...sion-import-assertions-trailing-comma-second.js | 33 + ...ssion-import-attributes-trailing-comma-first.js | 33 + ...sion-import-attributes-trailing-comma-second.js | 33 + ...d-arrow-assignment-expression-nested-imports.js | 27 + ...rrow-assignment-expression-script-code-valid.js | 31 + .../nested-arrow-empty-str-is-valid-assign-expr.js | 29 + ...arrow-import-assertions-trailing-comma-first.js | 35 + ...rrow-import-assertions-trailing-comma-second.js | 35 + ...arrow-import-attributes-trailing-comma-first.js | 35 + ...rrow-import-attributes-trailing-comma-second.js | 35 + .../syntax/valid/nested-arrow-nested-imports.js | 29 + .../syntax/valid/nested-arrow-script-code-valid.js | 33 + ...unction-await-empty-str-is-valid-assign-expr.js | 29 + ...await-import-assertions-trailing-comma-first.js | 35 + ...wait-import-assertions-trailing-comma-second.js | 35 + ...await-import-attributes-trailing-comma-first.js | 35 + ...wait-import-attributes-trailing-comma-second.js | 35 + ...ed-async-arrow-function-await-nested-imports.js | 29 + ...async-arrow-function-await-script-code-valid.js | 33 + ...-return-await-empty-str-is-valid-assign-expr.js | 27 + ...await-import-assertions-trailing-comma-first.js | 33 + ...wait-import-assertions-trailing-comma-second.js | 33 + ...await-import-attributes-trailing-comma-first.js | 33 + ...wait-import-attributes-trailing-comma-second.js | 33 + ...c-arrow-function-return-await-nested-imports.js | 27 + ...rrow-function-return-await-script-code-valid.js | 31 + ...unction-await-empty-str-is-valid-assign-expr.js | 29 + ...await-import-assertions-trailing-comma-first.js | 35 + ...wait-import-assertions-trailing-comma-second.js | 35 + ...await-import-attributes-trailing-comma-first.js | 35 + ...wait-import-attributes-trailing-comma-second.js | 35 + .../nested-async-function-await-nested-imports.js | 29 + ...ested-async-function-await-script-code-valid.js | 33 + ...sync-function-empty-str-is-valid-assign-expr.js | 30 + ...ction-import-assertions-trailing-comma-first.js | 36 + ...tion-import-assertions-trailing-comma-second.js | 36 + ...ction-import-attributes-trailing-comma-first.js | 36 + ...tion-import-attributes-trailing-comma-second.js | 36 + .../valid/nested-async-function-nested-imports.js | 30 + ...-return-await-empty-str-is-valid-assign-expr.js | 30 + ...await-import-assertions-trailing-comma-first.js | 36 + ...wait-import-assertions-trailing-comma-second.js | 36 + ...await-import-attributes-trailing-comma-first.js | 36 + ...wait-import-attributes-trailing-comma-second.js | 36 + ...d-async-function-return-await-nested-imports.js | 30 + ...sync-function-return-await-script-code-valid.js | 34 + .../nested-async-function-script-code-valid.js | 34 + ...ync-gen-await-empty-str-is-valid-assign-expr.js | 29 + ...await-import-assertions-trailing-comma-first.js | 35 + ...wait-import-assertions-trailing-comma-second.js | 35 + ...await-import-attributes-trailing-comma-first.js | 35 + ...wait-import-attributes-trailing-comma-second.js | 35 + .../valid/nested-async-gen-await-nested-imports.js | 29 + .../nested-async-gen-await-script-code-valid.js | 33 + .../nested-block-empty-str-is-valid-assign-expr.js | 29 + ...block-import-assertions-trailing-comma-first.js | 35 + ...lock-import-assertions-trailing-comma-second.js | 35 + ...block-import-attributes-trailing-comma-first.js | 35 + ...lock-import-attributes-trailing-comma-second.js | 35 + ...block-labeled-empty-str-is-valid-assign-expr.js | 29 + ...beled-import-assertions-trailing-comma-first.js | 35 + ...eled-import-assertions-trailing-comma-second.js | 35 + ...beled-import-attributes-trailing-comma-first.js | 35 + ...eled-import-attributes-trailing-comma-second.js | 35 + .../valid/nested-block-labeled-nested-imports.js | 29 + .../nested-block-labeled-script-code-valid.js | 33 + .../syntax/valid/nested-block-nested-imports.js | 29 + .../syntax/valid/nested-block-script-code-valid.js | 33 + ...sted-do-while-empty-str-is-valid-assign-expr.js | 29 + ...while-import-assertions-trailing-comma-first.js | 35 + ...hile-import-assertions-trailing-comma-second.js | 35 + ...while-import-attributes-trailing-comma-first.js | 35 + ...hile-import-attributes-trailing-comma-second.js | 35 + .../syntax/valid/nested-do-while-nested-imports.js | 29 + .../valid/nested-do-while-script-code-valid.js | 33 + ...lse-braceless-empty-str-is-valid-assign-expr.js | 29 + ...eless-import-assertions-trailing-comma-first.js | 35 + ...less-import-assertions-trailing-comma-second.js | 35 + ...eless-import-attributes-trailing-comma-first.js | 35 + ...less-import-attributes-trailing-comma-second.js | 35 + .../valid/nested-else-braceless-nested-imports.js | 29 + .../nested-else-braceless-script-code-valid.js | 33 + .../nested-else-empty-str-is-valid-assign-expr.js | 31 + ...-else-import-assertions-trailing-comma-first.js | 37 + ...else-import-assertions-trailing-comma-second.js | 37 + ...-else-import-attributes-trailing-comma-first.js | 37 + ...else-import-attributes-trailing-comma-second.js | 37 + .../syntax/valid/nested-else-nested-imports.js | 31 + .../syntax/valid/nested-else-script-code-valid.js | 35 + ...sted-function-empty-str-is-valid-assign-expr.js | 29 + ...ction-import-assertions-trailing-comma-first.js | 35 + ...tion-import-assertions-trailing-comma-second.js | 35 + ...ction-import-attributes-trailing-comma-first.js | 35 + ...tion-import-attributes-trailing-comma-second.js | 35 + .../syntax/valid/nested-function-nested-imports.js | 29 + ...nction-return-empty-str-is-valid-assign-expr.js | 29 + ...eturn-import-assertions-trailing-comma-first.js | 35 + ...turn-import-assertions-trailing-comma-second.js | 35 + ...eturn-import-attributes-trailing-comma-first.js | 35 + ...turn-import-attributes-trailing-comma-second.js | 35 + .../valid/nested-function-return-nested-imports.js | 29 + .../nested-function-return-script-code-valid.js | 33 + .../valid/nested-function-script-code-valid.js | 33 + ...-if-braceless-empty-str-is-valid-assign-expr.js | 27 + ...eless-import-assertions-trailing-comma-first.js | 33 + ...less-import-assertions-trailing-comma-second.js | 33 + ...eless-import-attributes-trailing-comma-first.js | 33 + ...less-import-attributes-trailing-comma-second.js | 33 + .../valid/nested-if-braceless-nested-imports.js | 27 + .../valid/nested-if-braceless-script-code-valid.js | 31 + .../nested-if-empty-str-is-valid-assign-expr.js | 29 + ...ed-if-import-assertions-trailing-comma-first.js | 35 + ...d-if-import-assertions-trailing-comma-second.js | 35 + ...ed-if-import-attributes-trailing-comma-first.js | 35 + ...d-if-import-attributes-trailing-comma-second.js | 35 + .../syntax/valid/nested-if-nested-imports.js | 29 + .../syntax/valid/nested-if-script-code-valid.js | 33 + .../nested-while-empty-str-is-valid-assign-expr.js | 31 + ...while-import-assertions-trailing-comma-first.js | 37 + ...hile-import-assertions-trailing-comma-second.js | 37 + ...while-import-attributes-trailing-comma-first.js | 37 + ...hile-import-attributes-trailing-comma-second.js | 37 + .../syntax/valid/nested-while-nested-imports.js | 31 + .../syntax/valid/nested-while-script-code-valid.js | 35 + .../nested-with-empty-str-is-valid-assign-expr.js | 29 + ...th-expression-empty-str-is-valid-assign-expr.js | 30 + ...ssion-import-assertions-trailing-comma-first.js | 36 + ...sion-import-assertions-trailing-comma-second.js | 36 + ...ssion-import-attributes-trailing-comma-first.js | 36 + ...sion-import-attributes-trailing-comma-second.js | 36 + .../valid/nested-with-expression-nested-imports.js | 30 + .../nested-with-expression-script-code-valid.js | 34 + ...-with-import-assertions-trailing-comma-first.js | 35 + ...with-import-assertions-trailing-comma-second.js | 35 + ...-with-import-attributes-trailing-comma-first.js | 35 + ...with-import-attributes-trailing-comma-second.js | 35 + .../syntax/valid/nested-with-nested-imports.js | 29 + .../syntax/valid/nested-with-script-code-valid.js | 33 + .../valid/new-covered-expression-is-valid.js | 41 + .../dynamic-import/syntax/valid/shell.js | 0 .../top-level-empty-str-is-valid-assign-expr.js | 17 + ...level-import-assertions-trailing-comma-first.js | 23 + ...evel-import-assertions-trailing-comma-second.js | 23 + ...level-import-attributes-trailing-comma-first.js | 23 + ...evel-import-attributes-trailing-comma-second.js | 23 + .../syntax/valid/top-level-nested-imports.js | 17 + .../syntax/valid/top-level-script-code-valid.js | 21 + .../update-to-dynamic-import-other_FIXTURE.js | 9 + .../dynamic-import/update-to-dynamic-import.js | 33 + .../update-to-dynamic-import_FIXTURE.js | 11 + .../expressions/dynamic-import/usage-from-eval.js | 37 + .../expressions/dynamic-import/usage/browser.js | 0 .../usage/dynamic-import-module_FIXTURE.js | 5 + .../eval-gtbndng-indirect-update-dflt_FIXTURE.js | 8 + .../usage/eval-gtbndng-indirect-update_FIXTURE.js | 10 + .../dynamic-import/usage/module-code_FIXTURE.js | 9 + ...expression-eval-gtbndng-indirect-update-dflt.js | 46 + ...ment-expression-eval-gtbndng-indirect-update.js | 54 + ...n-eval-script-code-host-resolves-module-code.js | 39 + ...xpression-is-call-expression-square-brackets.js | 35 + ...arrow-assignment-expression-returns-thenable.js | 33 + ...row-assignment-expression-specifier-tostring.js | 59 + ...mport-then-eval-gtbndng-indirect-update-dflt.js | 48 + ...row-import-then-eval-gtbndng-indirect-update.js | 56 + ...n-eval-script-code-host-resolves-module-code.js | 41 + ...port-then-is-call-expression-square-brackets.js | 37 + .../nested-arrow-import-then-returns-thenable.js | 35 + .../nested-arrow-import-then-specifier-tostring.js | 61 + ...tion-await-eval-gtbndng-indirect-update-dflt.js | 47 + ...-function-await-eval-gtbndng-indirect-update.js | 55 + ...t-eval-script-code-host-resolves-module-code.js | 40 + ...ion-await-is-call-expression-square-brackets.js | 36 + ...-async-arrow-function-await-returns-thenable.js | 34 + ...sync-arrow-function-await-specifier-tostring.js | 60 + ...turn-await-eval-gtbndng-indirect-update-dflt.js | 45 + ...on-return-await-eval-gtbndng-indirect-update.js | 53 + ...t-eval-script-code-host-resolves-module-code.js | 38 + ...urn-await-is-call-expression-square-brackets.js | 34 + ...arrow-function-return-await-returns-thenable.js | 32 + ...row-function-return-await-specifier-tostring.js | 58 + ...tion-await-eval-gtbndng-indirect-update-dflt.js | 47 + ...-function-await-eval-gtbndng-indirect-update.js | 55 + ...t-eval-script-code-host-resolves-module-code.js | 40 + ...ion-await-is-call-expression-square-brackets.js | 36 + ...nested-async-function-await-returns-thenable.js | 34 + ...sted-async-function-await-specifier-tostring.js | 60 + ...c-function-eval-gtbndng-indirect-update-dflt.js | 47 + ...-async-function-eval-gtbndng-indirect-update.js | 55 + ...n-eval-script-code-host-resolves-module-code.js | 40 + ...-function-is-call-expression-square-brackets.js | 36 + ...turn-await-eval-gtbndng-indirect-update-dflt.js | 47 + ...on-return-await-eval-gtbndng-indirect-update.js | 55 + ...t-eval-script-code-host-resolves-module-code.js | 40 + ...urn-await-is-call-expression-square-brackets.js | 36 + ...async-function-return-await-returns-thenable.js | 34 + ...ync-function-return-await-specifier-tostring.js | 60 + .../nested-async-function-returns-thenable.js | 34 + .../nested-async-function-specifier-tostring.js | 60 + ...-gen-await-eval-gtbndng-indirect-update-dflt.js | 52 + ...async-gen-await-eval-gtbndng-indirect-update.js | 60 + ...t-eval-script-code-host-resolves-module-code.js | 45 + ...gen-await-is-call-expression-square-brackets.js | 41 + .../nested-async-gen-await-returns-thenable.js | 39 + .../nested-async-gen-await-specifier-tostring.js | 65 + ...turn-await-eval-gtbndng-indirect-update-dflt.js | 47 + ...en-return-await-eval-gtbndng-indirect-update.js | 55 + ...t-eval-script-code-host-resolves-module-code.js | 40 + ...urn-await-is-call-expression-square-brackets.js | 36 + ...sted-async-gen-return-await-returns-thenable.js | 34 + ...ed-async-gen-return-await-specifier-tostring.js | 60 + ...mport-then-eval-gtbndng-indirect-update-dflt.js | 45 + ...ock-import-then-eval-gtbndng-indirect-update.js | 53 + ...n-eval-script-code-host-resolves-module-code.js | 38 + ...port-then-is-call-expression-square-brackets.js | 34 + .../nested-block-import-then-returns-thenable.js | 32 + .../nested-block-import-then-specifier-tostring.js | 58 + ...d-do-while-eval-gtbndng-indirect-update-dflt.js | 45 + ...nested-do-while-eval-gtbndng-indirect-update.js | 53 + ...e-eval-script-code-host-resolves-module-code.js | 38 + ...-do-while-is-call-expression-square-brackets.js | 34 + .../usage/nested-do-while-returns-thenable.js | 32 + .../usage/nested-do-while-specifier-tostring.js | 58 + ...mport-then-eval-gtbndng-indirect-update-dflt.js | 47 + ...lse-import-then-eval-gtbndng-indirect-update.js | 55 + ...n-eval-script-code-host-resolves-module-code.js | 40 + ...port-then-is-call-expression-square-brackets.js | 36 + .../nested-else-import-then-returns-thenable.js | 34 + .../nested-else-import-then-specifier-tostring.js | 60 + ...mport-then-eval-gtbndng-indirect-update-dflt.js | 46 + ...ion-import-then-eval-gtbndng-indirect-update.js | 54 + ...n-eval-script-code-host-resolves-module-code.js | 39 + ...port-then-is-call-expression-square-brackets.js | 35 + ...nested-function-import-then-returns-thenable.js | 33 + ...sted-function-import-then-specifier-tostring.js | 59 + ...-braceless-eval-gtbndng-indirect-update-dflt.js | 43 + ...ed-if-braceless-eval-gtbndng-indirect-update.js | 51 + ...s-eval-script-code-host-resolves-module-code.js | 36 + ...braceless-is-call-expression-square-brackets.js | 32 + .../usage/nested-if-braceless-returns-thenable.js | 30 + .../nested-if-braceless-specifier-tostring.js | 56 + ...mport-then-eval-gtbndng-indirect-update-dflt.js | 45 + ...-if-import-then-eval-gtbndng-indirect-update.js | 53 + ...n-eval-script-code-host-resolves-module-code.js | 38 + ...port-then-is-call-expression-square-brackets.js | 34 + .../nested-if-import-then-returns-thenable.js | 32 + .../nested-if-import-then-specifier-tostring.js | 58 + ...mport-then-eval-gtbndng-indirect-update-dflt.js | 47 + ...ile-import-then-eval-gtbndng-indirect-update.js | 55 + ...n-eval-script-code-host-resolves-module-code.js | 40 + ...port-then-is-call-expression-square-brackets.js | 36 + .../nested-while-import-then-returns-thenable.js | 34 + .../nested-while-import-then-specifier-tostring.js | 60 + .../expressions/dynamic-import/usage/shell.js | 0 ...ck-labeled-eval-gtbndng-indirect-update-dflt.js | 45 + ...d-block-labeled-eval-gtbndng-indirect-update.js | 53 + ...d-eval-script-code-host-resolves-module-code.js | 38 + ...k-labeled-is-call-expression-square-brackets.js | 34 + ...syntax-nested-block-labeled-returns-thenable.js | 32 + ...ntax-nested-block-labeled-specifier-tostring.js | 58 + ...mport-then-eval-gtbndng-indirect-update-dflt.js | 43 + ...vel-import-then-eval-gtbndng-indirect-update.js | 51 + ...n-eval-script-code-host-resolves-module-code.js | 36 + ...port-then-is-call-expression-square-brackets.js | 32 + .../top-level-import-then-returns-thenable.js | 30 + .../top-level-import-then-specifier-tostring.js | 56 + .../language/expressions/equals/S11.9.1_A1.js | 62 + .../language/expressions/equals/S11.9.1_A2.1_T1.js | 43 + .../language/expressions/equals/S11.9.1_A2.1_T2.js | 21 + .../language/expressions/equals/S11.9.1_A2.1_T3.js | 21 + .../language/expressions/equals/S11.9.1_A2.4_T1.js | 22 + .../language/expressions/equals/S11.9.1_A2.4_T2.js | 26 + .../language/expressions/equals/S11.9.1_A2.4_T3.js | 21 + .../language/expressions/equals/S11.9.1_A2.4_T4.js | 16 + .../language/expressions/equals/S11.9.1_A3.1.js | 32 + .../language/expressions/equals/S11.9.1_A3.2.js | 22 + .../language/expressions/equals/S11.9.1_A3.3.js | 22 + .../language/expressions/equals/S11.9.1_A4.1_T1.js | 55 + .../language/expressions/equals/S11.9.1_A4.1_T2.js | 55 + .../language/expressions/equals/S11.9.1_A4.2.js | 20 + .../language/expressions/equals/S11.9.1_A4.3.js | 37 + .../language/expressions/equals/S11.9.1_A5.1.js | 47 + .../language/expressions/equals/S11.9.1_A5.2.js | 37 + .../language/expressions/equals/S11.9.1_A5.3.js | 32 + .../language/expressions/equals/S11.9.1_A6.1.js | 40 + .../language/expressions/equals/S11.9.1_A6.2_T1.js | 50 + .../language/expressions/equals/S11.9.1_A6.2_T2.js | 50 + .../language/expressions/equals/S11.9.1_A7.1.js | 57 + .../language/expressions/equals/S11.9.1_A7.2.js | 27 + .../language/expressions/equals/S11.9.1_A7.3.js | 27 + .../language/expressions/equals/S11.9.1_A7.4.js | 27 + .../language/expressions/equals/S11.9.1_A7.5.js | 27 + .../language/expressions/equals/S11.9.1_A7.6.js | 27 + .../language/expressions/equals/S11.9.1_A7.7.js | 27 + .../language/expressions/equals/S11.9.1_A7.8.js | 77 + .../language/expressions/equals/S11.9.1_A7.9.js | 77 + .../language/expressions/equals/S9.1_A1_T3.js | 26 + .../expressions/equals/bigint-and-bigint.js | 173 ++ .../expressions/equals/bigint-and-boolean.js | 33 + .../equals/bigint-and-incomparable-primitive.js | 26 + .../expressions/equals/bigint-and-non-finite.js | 31 + .../equals/bigint-and-number-extremes.js | 63 + .../expressions/equals/bigint-and-number.js | 53 + .../expressions/equals/bigint-and-object.js | 136 + .../expressions/equals/bigint-and-string.js | 68 + .../test262/language/expressions/equals/browser.js | 0 .../equals/coerce-symbol-to-prim-err.js | 39 + .../equals/coerce-symbol-to-prim-invocation.js | 50 + .../equals/coerce-symbol-to-prim-return-obj.js | 53 + .../equals/coerce-symbol-to-prim-return-prim.js | 49 + .../expressions/equals/get-symbol-to-prim-err.js | 36 + .../test262/language/expressions/equals/shell.js | 0 .../equals/symbol-abstract-equality-comparison.js | 23 + .../equals/symbol-strict-equality-comparison.js | 22 + .../language/expressions/equals/to-prim-hint.js | 37 + .../exponentiation/applying-the-exp-operator_A1.js | 31 + .../applying-the-exp-operator_A10.js | 25 + .../applying-the-exp-operator_A11.js | 24 + .../applying-the-exp-operator_A12.js | 24 + .../applying-the-exp-operator_A13.js | 23 + .../applying-the-exp-operator_A14.js | 25 + .../applying-the-exp-operator_A15.js | 21 + .../applying-the-exp-operator_A16.js | 25 + .../applying-the-exp-operator_A17.js | 24 + .../applying-the-exp-operator_A18.js | 24 + .../applying-the-exp-operator_A19.js | 21 + .../exponentiation/applying-the-exp-operator_A2.js | 30 + .../applying-the-exp-operator_A20.js | 25 + .../applying-the-exp-operator_A21.js | 23 + .../applying-the-exp-operator_A22.js | 25 + .../applying-the-exp-operator_A23.js | 38 + .../exponentiation/applying-the-exp-operator_A3.js | 30 + .../exponentiation/applying-the-exp-operator_A4.js | 29 + .../exponentiation/applying-the-exp-operator_A5.js | 26 + .../exponentiation/applying-the-exp-operator_A6.js | 26 + .../exponentiation/applying-the-exp-operator_A7.js | 24 + .../exponentiation/applying-the-exp-operator_A8.js | 24 + .../exponentiation/applying-the-exp-operator_A9.js | 26 + .../exponentiation/bigint-and-number.js | 92 + .../exponentiation/bigint-arithmetic.js | 77 + .../expressions/exponentiation/bigint-errors.js | 72 + .../bigint-negative-exponent-throws.js | 34 + .../exponentiation/bigint-toprimitive.js | 374 +++ .../exponentiation/bigint-wrapped-values.js | 47 + .../bigint-zero-base-zero-exponent.js | 22 + .../language/expressions/exponentiation/browser.js | 0 .../exponentiation/exp-assignment-operator.js | 27 + .../exp-operator-evaluation-order.js | 35 + ...erator-precedence-unary-expression-semantics.js | 69 + ...rator-precedence-update-expression-semantics.js | 60 + ...or-syntax-error-bitnot-unary-expression-base.js | 26 + ...or-syntax-error-delete-unary-expression-base.js | 26 + ...ntax-error-logical-not-unary-expression-base.js | 26 + ...or-syntax-error-negate-unary-expression-base.js | 26 + ...ator-syntax-error-plus-unary-expression-base.js | 26 + ...or-syntax-error-typeof-unary-expression-base.js | 26 + ...ator-syntax-error-void-unary-expression-base.js | 26 + .../expressions/exponentiation/exp-operator.js | 23 + .../exponentiation/int32_min-exponent.js | 21 + .../exponentiation/order-of-evaluation.js | 140 ++ .../language/expressions/exponentiation/shell.js | 0 .../language/expressions/function/S10.1.1_A1_T2.js | 29 + .../function/arguments-with-arguments-fn.js | 32 + .../function/arguments-with-arguments-lex.js | 32 + .../array-destructuring-param-strict-body.js | 133 + .../language/expressions/function/browser.js | 0 .../expressions/function/dflt-params-abrupt.js | 64 + .../function/dflt-params-arg-val-not-undefined.js | 87 + .../function/dflt-params-arg-val-undefined.js | 70 + .../expressions/function/dflt-params-duplicates.js | 62 + .../expressions/function/dflt-params-ref-later.js | 65 + .../expressions/function/dflt-params-ref-prior.js | 67 + .../expressions/function/dflt-params-ref-self.js | 65 + .../expressions/function/dflt-params-rest.js | 66 + .../function/dflt-params-trailing-comma.js | 61 + .../function/dstr/ary-init-iter-close.js | 74 + .../dstr/ary-init-iter-get-err-array-prototype.js | 65 + .../function/dstr/ary-init-iter-get-err.js | 59 + .../function/dstr/ary-init-iter-no-close.js | 74 + .../expressions/function/dstr/ary-name-iter-val.js | 73 + .../function/dstr/ary-ptrn-elem-ary-elem-init.js | 65 + .../function/dstr/ary-ptrn-elem-ary-elem-iter.js | 66 + .../dstr/ary-ptrn-elem-ary-elision-init.js | 72 + .../dstr/ary-ptrn-elem-ary-elision-iter.js | 69 + .../function/dstr/ary-ptrn-elem-ary-empty-init.js | 68 + .../function/dstr/ary-ptrn-elem-ary-empty-iter.js | 65 + .../function/dstr/ary-ptrn-elem-ary-rest-init.js | 69 + .../function/dstr/ary-ptrn-elem-ary-rest-iter.js | 72 + .../function/dstr/ary-ptrn-elem-ary-val-null.js | 66 + .../dstr/ary-ptrn-elem-id-init-exhausted.js | 64 + .../dstr/ary-ptrn-elem-id-init-fn-name-arrow.js | 65 + .../dstr/ary-ptrn-elem-id-init-fn-name-class.js | 67 + .../dstr/ary-ptrn-elem-id-init-fn-name-cover.js | 66 + .../dstr/ary-ptrn-elem-id-init-fn-name-fn.js | 66 + .../dstr/ary-ptrn-elem-id-init-fn-name-gen.js | 67 + .../function/dstr/ary-ptrn-elem-id-init-hole.js | 60 + .../function/dstr/ary-ptrn-elem-id-init-skipped.js | 69 + .../function/dstr/ary-ptrn-elem-id-init-throws.js | 57 + .../function/dstr/ary-ptrn-elem-id-init-undef.js | 63 + .../dstr/ary-ptrn-elem-id-init-unresolvable.js | 64 + .../dstr/ary-ptrn-elem-id-iter-complete.js | 67 + .../function/dstr/ary-ptrn-elem-id-iter-done.js | 62 + .../dstr/ary-ptrn-elem-id-iter-step-err.js | 66 + .../ary-ptrn-elem-id-iter-val-array-prototype.js | 83 + .../function/dstr/ary-ptrn-elem-id-iter-val-err.js | 77 + .../function/dstr/ary-ptrn-elem-id-iter-val.js | 73 + .../function/dstr/ary-ptrn-elem-obj-id-init.js | 65 + .../function/dstr/ary-ptrn-elem-obj-id.js | 65 + .../dstr/ary-ptrn-elem-obj-prop-id-init.js | 75 + .../function/dstr/ary-ptrn-elem-obj-prop-id.js | 75 + .../function/dstr/ary-ptrn-elem-obj-val-null.js | 66 + .../function/dstr/ary-ptrn-elem-obj-val-undef.js | 66 + .../function/dstr/ary-ptrn-elision-exhausted.js | 70 + .../function/dstr/ary-ptrn-elision-step-err.js | 73 + .../expressions/function/dstr/ary-ptrn-elision.js | 79 + .../expressions/function/dstr/ary-ptrn-empty.js | 62 + .../function/dstr/ary-ptrn-rest-ary-elem.js | 86 + .../function/dstr/ary-ptrn-rest-ary-elision.js | 92 + .../function/dstr/ary-ptrn-rest-ary-empty.js | 75 + .../function/dstr/ary-ptrn-rest-ary-rest.js | 71 + .../function/dstr/ary-ptrn-rest-id-direct.js | 66 + .../dstr/ary-ptrn-rest-id-elision-next-err.js | 59 + .../function/dstr/ary-ptrn-rest-id-elision.js | 67 + .../function/dstr/ary-ptrn-rest-id-exhausted.js | 63 + .../dstr/ary-ptrn-rest-id-iter-step-err.js | 70 + .../function/dstr/ary-ptrn-rest-id-iter-val-err.js | 72 + .../expressions/function/dstr/ary-ptrn-rest-id.js | 64 + .../function/dstr/ary-ptrn-rest-init-ary.js | 60 + .../function/dstr/ary-ptrn-rest-init-id.js | 60 + .../function/dstr/ary-ptrn-rest-init-obj.js | 60 + .../function/dstr/ary-ptrn-rest-not-final-ary.js | 60 + .../function/dstr/ary-ptrn-rest-not-final-id.js | 60 + .../function/dstr/ary-ptrn-rest-not-final-obj.js | 60 + .../function/dstr/ary-ptrn-rest-obj-id.js | 64 + .../function/dstr/ary-ptrn-rest-obj-prop-id.js | 71 + .../language/expressions/function/dstr/browser.js | 0 .../function/dstr/dflt-ary-init-iter-close.js | 74 + .../dflt-ary-init-iter-get-err-array-prototype.js | 65 + .../function/dstr/dflt-ary-init-iter-get-err.js | 59 + .../function/dstr/dflt-ary-init-iter-no-close.js | 74 + .../function/dstr/dflt-ary-name-iter-val.js | 73 + .../dstr/dflt-ary-ptrn-elem-ary-elem-init.js | 65 + .../dstr/dflt-ary-ptrn-elem-ary-elem-iter.js | 66 + .../dstr/dflt-ary-ptrn-elem-ary-elision-init.js | 72 + .../dstr/dflt-ary-ptrn-elem-ary-elision-iter.js | 69 + .../dstr/dflt-ary-ptrn-elem-ary-empty-init.js | 68 + .../dstr/dflt-ary-ptrn-elem-ary-empty-iter.js | 65 + .../dstr/dflt-ary-ptrn-elem-ary-rest-init.js | 69 + .../dstr/dflt-ary-ptrn-elem-ary-rest-iter.js | 72 + .../dstr/dflt-ary-ptrn-elem-ary-val-null.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-init-exhausted.js | 64 + .../dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 65 + .../dflt-ary-ptrn-elem-id-init-fn-name-class.js | 67 + .../dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 67 + .../dstr/dflt-ary-ptrn-elem-id-init-hole.js | 60 + .../dstr/dflt-ary-ptrn-elem-id-init-skipped.js | 69 + .../dstr/dflt-ary-ptrn-elem-id-init-throws.js | 57 + .../dstr/dflt-ary-ptrn-elem-id-init-undef.js | 63 + .../dflt-ary-ptrn-elem-id-init-unresolvable.js | 64 + .../dstr/dflt-ary-ptrn-elem-id-iter-complete.js | 67 + .../dstr/dflt-ary-ptrn-elem-id-iter-done.js | 62 + .../dstr/dflt-ary-ptrn-elem-id-iter-step-err.js | 66 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 83 + .../dstr/dflt-ary-ptrn-elem-id-iter-val-err.js | 77 + .../dstr/dflt-ary-ptrn-elem-id-iter-val.js | 73 + .../dstr/dflt-ary-ptrn-elem-obj-id-init.js | 65 + .../function/dstr/dflt-ary-ptrn-elem-obj-id.js | 65 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js | 75 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id.js | 75 + .../dstr/dflt-ary-ptrn-elem-obj-val-null.js | 66 + .../dstr/dflt-ary-ptrn-elem-obj-val-undef.js | 66 + .../dstr/dflt-ary-ptrn-elision-exhausted.js | 70 + .../dstr/dflt-ary-ptrn-elision-step-err.js | 73 + .../function/dstr/dflt-ary-ptrn-elision.js | 79 + .../function/dstr/dflt-ary-ptrn-empty.js | 62 + .../function/dstr/dflt-ary-ptrn-rest-ary-elem.js | 86 + .../dstr/dflt-ary-ptrn-rest-ary-elision.js | 92 + .../function/dstr/dflt-ary-ptrn-rest-ary-empty.js | 75 + .../function/dstr/dflt-ary-ptrn-rest-ary-rest.js | 71 + .../function/dstr/dflt-ary-ptrn-rest-id-direct.js | 66 + .../dstr/dflt-ary-ptrn-rest-id-elision-next-err.js | 59 + .../function/dstr/dflt-ary-ptrn-rest-id-elision.js | 67 + .../dstr/dflt-ary-ptrn-rest-id-exhausted.js | 63 + .../dstr/dflt-ary-ptrn-rest-id-iter-step-err.js | 70 + .../dstr/dflt-ary-ptrn-rest-id-iter-val-err.js | 72 + .../function/dstr/dflt-ary-ptrn-rest-id.js | 64 + .../function/dstr/dflt-ary-ptrn-rest-init-ary.js | 60 + .../function/dstr/dflt-ary-ptrn-rest-init-id.js | 60 + .../function/dstr/dflt-ary-ptrn-rest-init-obj.js | 60 + .../dstr/dflt-ary-ptrn-rest-not-final-ary.js | 60 + .../dstr/dflt-ary-ptrn-rest-not-final-id.js | 60 + .../dstr/dflt-ary-ptrn-rest-not-final-obj.js | 60 + .../function/dstr/dflt-ary-ptrn-rest-obj-id.js | 64 + .../dstr/dflt-ary-ptrn-rest-obj-prop-id.js | 71 + .../function/dstr/dflt-obj-init-null.js | 53 + .../function/dstr/dflt-obj-init-undefined.js | 53 + .../function/dstr/dflt-obj-ptrn-empty.js | 63 + .../dstr/dflt-obj-ptrn-id-get-value-err.js | 60 + .../dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js | 64 + .../dstr/dflt-obj-ptrn-id-init-fn-name-class.js | 66 + .../dstr/dflt-obj-ptrn-id-init-fn-name-cover.js | 65 + .../dstr/dflt-obj-ptrn-id-init-fn-name-fn.js | 65 + .../dstr/dflt-obj-ptrn-id-init-fn-name-gen.js | 66 + .../function/dstr/dflt-obj-ptrn-id-init-skipped.js | 68 + .../function/dstr/dflt-obj-ptrn-id-init-throws.js | 60 + .../dstr/dflt-obj-ptrn-id-init-unresolvable.js | 64 + .../dstr/dflt-obj-ptrn-id-trailing-comma.js | 58 + .../function/dstr/dflt-obj-ptrn-list-err.js | 61 + .../function/dstr/dflt-obj-ptrn-prop-ary-init.js | 67 + .../dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js | 58 + .../dstr/dflt-obj-ptrn-prop-ary-value-null.js | 55 + .../function/dstr/dflt-obj-ptrn-prop-ary.js | 65 + .../function/dstr/dflt-obj-ptrn-prop-eval-err.js | 57 + .../dstr/dflt-obj-ptrn-prop-id-get-value-err.js | 62 + .../dstr/dflt-obj-ptrn-prop-id-init-skipped.js | 80 + .../dstr/dflt-obj-ptrn-prop-id-init-throws.js | 60 + .../dflt-obj-ptrn-prop-id-init-unresolvable.js | 64 + .../function/dstr/dflt-obj-ptrn-prop-id-init.js | 61 + .../dstr/dflt-obj-ptrn-prop-id-trailing-comma.js | 62 + .../function/dstr/dflt-obj-ptrn-prop-id.js | 61 + .../function/dstr/dflt-obj-ptrn-prop-obj-init.js | 67 + .../dstr/dflt-obj-ptrn-prop-obj-value-null.js | 55 + .../dstr/dflt-obj-ptrn-prop-obj-value-undef.js | 55 + .../function/dstr/dflt-obj-ptrn-prop-obj.js | 65 + .../function/dstr/dflt-obj-ptrn-rest-getter.js | 60 + .../dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js | 68 + .../function/dstr/dflt-obj-ptrn-rest-val-obj.js | 67 + .../expressions/function/dstr/obj-init-null.js | 53 + .../function/dstr/obj-init-undefined.js | 53 + .../expressions/function/dstr/obj-ptrn-empty.js | 63 + .../function/dstr/obj-ptrn-id-get-value-err.js | 60 + .../dstr/obj-ptrn-id-init-fn-name-arrow.js | 64 + .../dstr/obj-ptrn-id-init-fn-name-class.js | 66 + .../dstr/obj-ptrn-id-init-fn-name-cover.js | 65 + .../function/dstr/obj-ptrn-id-init-fn-name-fn.js | 65 + .../function/dstr/obj-ptrn-id-init-fn-name-gen.js | 66 + .../function/dstr/obj-ptrn-id-init-skipped.js | 68 + .../function/dstr/obj-ptrn-id-init-throws.js | 60 + .../function/dstr/obj-ptrn-id-init-unresolvable.js | 64 + .../function/dstr/obj-ptrn-id-trailing-comma.js | 58 + .../expressions/function/dstr/obj-ptrn-list-err.js | 61 + .../function/dstr/obj-ptrn-prop-ary-init.js | 67 + .../dstr/obj-ptrn-prop-ary-trailing-comma.js | 58 + .../function/dstr/obj-ptrn-prop-ary-value-null.js | 55 + .../expressions/function/dstr/obj-ptrn-prop-ary.js | 65 + .../function/dstr/obj-ptrn-prop-eval-err.js | 57 + .../dstr/obj-ptrn-prop-id-get-value-err.js | 62 + .../function/dstr/obj-ptrn-prop-id-init-skipped.js | 80 + .../function/dstr/obj-ptrn-prop-id-init-throws.js | 60 + .../dstr/obj-ptrn-prop-id-init-unresolvable.js | 64 + .../function/dstr/obj-ptrn-prop-id-init.js | 61 + .../dstr/obj-ptrn-prop-id-trailing-comma.js | 62 + .../expressions/function/dstr/obj-ptrn-prop-id.js | 61 + .../function/dstr/obj-ptrn-prop-obj-init.js | 67 + .../function/dstr/obj-ptrn-prop-obj-value-null.js | 55 + .../function/dstr/obj-ptrn-prop-obj-value-undef.js | 55 + .../expressions/function/dstr/obj-ptrn-prop-obj.js | 65 + .../function/dstr/obj-ptrn-rest-getter.js | 60 + .../dstr/obj-ptrn-rest-skip-non-enumerable.js | 68 + .../function/dstr/obj-ptrn-rest-val-obj.js | 67 + .../language/expressions/function/dstr/shell.js | 0 .../expressions/function/early-body-super-call.js | 19 + .../expressions/function/early-body-super-prop.js | 19 + .../expressions/function/early-errors/browser.js | 0 .../invalid-names-call-expression-bad-reference.js | 41 + .../invalid-names-call-expression-this.js | 41 + ...nvalid-names-member-expression-bad-reference.js | 41 + .../invalid-names-member-expression-this.js | 41 + .../expressions/function/early-errors/shell.js | 0 .../function/early-params-super-call.js | 17 + .../function/early-params-super-prop.js | 17 + .../function/eval-var-scope-syntax-err.js | 60 + .../function/forbidden-ext/b1/browser.js | 0 ...t-forbidden-ext-direct-access-prop-arguments.js | 35 + ...rict-forbidden-ext-direct-access-prop-caller.js | 35 + .../expressions/function/forbidden-ext/b1/shell.js | 0 .../function/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 61 + ...en-ext-indirect-access-own-prop-caller-value.js | 61 + ...pr-forbidden-ext-indirect-access-prop-caller.js | 61 + .../expressions/function/forbidden-ext/b2/shell.js | 0 .../expressions/function/forbidden-ext/browser.js | 0 .../expressions/function/forbidden-ext/shell.js | 0 .../language/expressions/function/length-dflt.js | 70 + .../function/name-arguments-non-strict.js | 14 + .../function/name-arguments-strict-body.js | 19 + .../function/name-arguments-strict-strict.js | 19 + .../expressions/function/name-eval-non-strict.js | 14 + .../expressions/function/name-eval-strict-body.js | 19 + .../function/name-eval-strict-strict.js | 19 + .../expressions/function/name-eval-stricteval.js | 17 + .../test262/language/expressions/function/name.js | 38 + ...-no-strict-reassign-fn-name-in-body-in-arrow.js | 26 + ...d-no-strict-reassign-fn-name-in-body-in-eval.js | 24 + .../named-no-strict-reassign-fn-name-in-body.js | 24 + ...ror-reassign-fn-name-in-body-in-arrow-strict.js | 29 + ...rror-reassign-fn-name-in-body-in-eval-strict.js | 27 + ...strict-error-reassign-fn-name-in-body-strict.js | 27 + .../object-destructuring-param-strict-body.js | 133 + .../function/param-arguments-non-strict.js | 14 + .../function/param-dflt-yield-non-strict.js | 29 + .../function/param-dflt-yield-strict-strict.js | 27 + .../function/param-duplicated-non-strict.js | 14 + .../function/param-duplicated-strict-1-strict.js | 24 + .../function/param-duplicated-strict-2-strict.js | 25 + .../function/param-duplicated-strict-3-strict.js | 24 + .../function/param-duplicated-strict-body-1.js | 23 + .../function/param-duplicated-strict-body-2.js | 24 + .../function/param-duplicated-strict-body-3.js | 22 + .../param-eval-non-strict-is-correct-value.js | 23 + .../expressions/function/param-eval-non-strict.js | 14 + .../expressions/function/param-eval-strict-body.js | 23 + .../expressions/function/param-eval-stricteval.js | 22 + .../function/params-dflt-args-unmapped.js | 84 + .../function/params-dflt-ref-arguments.js | 63 + .../function/params-trailing-comma-multiple.js | 61 + .../function/params-trailing-comma-single.js | 60 + .../expressions/function/rest-param-strict-body.js | 133 + .../rest-params-trailing-comma-early-error.js | 58 + .../function/scope-body-lex-distinct.js | 51 + .../expressions/function/scope-name-var-close.js | 30 + .../function/scope-name-var-open-non-strict.js | 52 + .../function/scope-name-var-open-strict-strict.js | 57 + .../function/scope-param-elem-var-close.js | 32 + .../function/scope-param-elem-var-open.js | 30 + .../function/scope-param-rest-elem-var-close.js | 30 + .../function/scope-param-rest-elem-var-open.js | 30 + .../function/scope-paramsbody-var-close.js | 36 + .../function/scope-paramsbody-var-open.js | 34 + .../test262/language/expressions/function/shell.js | 0 .../function/static-init-await-binding.js | 20 + .../function/static-init-await-reference.js | 28 + .../function/unscopables-with-in-nested-fn.js | 104 + .../expressions/function/unscopables-with.js | 98 + .../function/use-strict-with-non-simple-param.js | 22 + .../generators/arguments-with-arguments-fn.js | 33 + .../generators/arguments-with-arguments-lex.js | 33 + .../array-destructuring-param-strict-body.js | 134 + .../language/expressions/generators/browser.js | 0 .../expressions/generators/default-proto.js | 36 + .../expressions/generators/dflt-params-abrupt.js | 65 + .../dflt-params-arg-val-not-undefined.js | 88 + .../generators/dflt-params-arg-val-undefined.js | 71 + .../generators/dflt-params-duplicates.js | 63 + .../generators/dflt-params-ref-later.js | 66 + .../generators/dflt-params-ref-prior.js | 68 + .../expressions/generators/dflt-params-ref-self.js | 66 + .../expressions/generators/dflt-params-rest.js | 67 + .../generators/dflt-params-trailing-comma.js | 63 + .../generators/dstr/ary-init-iter-close.js | 74 + .../dstr/ary-init-iter-get-err-array-prototype.js | 65 + .../generators/dstr/ary-init-iter-get-err.js | 59 + .../generators/dstr/ary-init-iter-no-close.js | 74 + .../generators/dstr/ary-name-iter-val.js | 73 + .../generators/dstr/ary-ptrn-elem-ary-elem-init.js | 65 + .../generators/dstr/ary-ptrn-elem-ary-elem-iter.js | 66 + .../dstr/ary-ptrn-elem-ary-elision-init.js | 72 + .../dstr/ary-ptrn-elem-ary-elision-iter.js | 69 + .../dstr/ary-ptrn-elem-ary-empty-init.js | 68 + .../dstr/ary-ptrn-elem-ary-empty-iter.js | 65 + .../generators/dstr/ary-ptrn-elem-ary-rest-init.js | 69 + .../generators/dstr/ary-ptrn-elem-ary-rest-iter.js | 72 + .../generators/dstr/ary-ptrn-elem-ary-val-null.js | 66 + .../dstr/ary-ptrn-elem-id-init-exhausted.js | 64 + .../dstr/ary-ptrn-elem-id-init-fn-name-arrow.js | 65 + .../dstr/ary-ptrn-elem-id-init-fn-name-class.js | 67 + .../dstr/ary-ptrn-elem-id-init-fn-name-cover.js | 66 + .../dstr/ary-ptrn-elem-id-init-fn-name-fn.js | 66 + .../dstr/ary-ptrn-elem-id-init-fn-name-gen.js | 67 + .../generators/dstr/ary-ptrn-elem-id-init-hole.js | 60 + .../dstr/ary-ptrn-elem-id-init-skipped.js | 69 + .../dstr/ary-ptrn-elem-id-init-throws.js | 57 + .../generators/dstr/ary-ptrn-elem-id-init-undef.js | 63 + .../dstr/ary-ptrn-elem-id-init-unresolvable.js | 64 + .../dstr/ary-ptrn-elem-id-iter-complete.js | 67 + .../generators/dstr/ary-ptrn-elem-id-iter-done.js | 62 + .../dstr/ary-ptrn-elem-id-iter-step-err.js | 66 + .../ary-ptrn-elem-id-iter-val-array-prototype.js | 83 + .../dstr/ary-ptrn-elem-id-iter-val-err.js | 77 + .../generators/dstr/ary-ptrn-elem-id-iter-val.js | 73 + .../generators/dstr/ary-ptrn-elem-obj-id-init.js | 65 + .../generators/dstr/ary-ptrn-elem-obj-id.js | 65 + .../dstr/ary-ptrn-elem-obj-prop-id-init.js | 75 + .../generators/dstr/ary-ptrn-elem-obj-prop-id.js | 75 + .../generators/dstr/ary-ptrn-elem-obj-val-null.js | 66 + .../generators/dstr/ary-ptrn-elem-obj-val-undef.js | 66 + .../generators/dstr/ary-ptrn-elision-exhausted.js | 70 + .../generators/dstr/ary-ptrn-elision-step-err.js | 73 + .../generators/dstr/ary-ptrn-elision.js | 79 + .../expressions/generators/dstr/ary-ptrn-empty.js | 62 + .../generators/dstr/ary-ptrn-rest-ary-elem.js | 86 + .../generators/dstr/ary-ptrn-rest-ary-elision.js | 92 + .../generators/dstr/ary-ptrn-rest-ary-empty.js | 75 + .../generators/dstr/ary-ptrn-rest-ary-rest.js | 71 + .../generators/dstr/ary-ptrn-rest-id-direct.js | 66 + .../dstr/ary-ptrn-rest-id-elision-next-err.js | 59 + .../generators/dstr/ary-ptrn-rest-id-elision.js | 67 + .../generators/dstr/ary-ptrn-rest-id-exhausted.js | 63 + .../dstr/ary-ptrn-rest-id-iter-step-err.js | 70 + .../dstr/ary-ptrn-rest-id-iter-val-err.js | 72 + .../generators/dstr/ary-ptrn-rest-id.js | 64 + .../generators/dstr/ary-ptrn-rest-init-ary.js | 60 + .../generators/dstr/ary-ptrn-rest-init-id.js | 60 + .../generators/dstr/ary-ptrn-rest-init-obj.js | 60 + .../generators/dstr/ary-ptrn-rest-not-final-ary.js | 60 + .../generators/dstr/ary-ptrn-rest-not-final-id.js | 60 + .../generators/dstr/ary-ptrn-rest-not-final-obj.js | 60 + .../generators/dstr/ary-ptrn-rest-obj-id.js | 64 + .../generators/dstr/ary-ptrn-rest-obj-prop-id.js | 71 + .../expressions/generators/dstr/browser.js | 0 .../generators/dstr/dflt-ary-init-iter-close.js | 74 + .../dflt-ary-init-iter-get-err-array-prototype.js | 65 + .../generators/dstr/dflt-ary-init-iter-get-err.js | 59 + .../generators/dstr/dflt-ary-init-iter-no-close.js | 74 + .../generators/dstr/dflt-ary-name-iter-val.js | 73 + .../dstr/dflt-ary-ptrn-elem-ary-elem-init.js | 65 + .../dstr/dflt-ary-ptrn-elem-ary-elem-iter.js | 66 + .../dstr/dflt-ary-ptrn-elem-ary-elision-init.js | 72 + .../dstr/dflt-ary-ptrn-elem-ary-elision-iter.js | 69 + .../dstr/dflt-ary-ptrn-elem-ary-empty-init.js | 68 + .../dstr/dflt-ary-ptrn-elem-ary-empty-iter.js | 65 + .../dstr/dflt-ary-ptrn-elem-ary-rest-init.js | 69 + .../dstr/dflt-ary-ptrn-elem-ary-rest-iter.js | 72 + .../dstr/dflt-ary-ptrn-elem-ary-val-null.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-init-exhausted.js | 64 + .../dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 65 + .../dflt-ary-ptrn-elem-id-init-fn-name-class.js | 67 + .../dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 66 + .../dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 67 + .../dstr/dflt-ary-ptrn-elem-id-init-hole.js | 60 + .../dstr/dflt-ary-ptrn-elem-id-init-skipped.js | 69 + .../dstr/dflt-ary-ptrn-elem-id-init-throws.js | 57 + .../dstr/dflt-ary-ptrn-elem-id-init-undef.js | 63 + .../dflt-ary-ptrn-elem-id-init-unresolvable.js | 64 + .../dstr/dflt-ary-ptrn-elem-id-iter-complete.js | 67 + .../dstr/dflt-ary-ptrn-elem-id-iter-done.js | 62 + .../dstr/dflt-ary-ptrn-elem-id-iter-step-err.js | 66 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 83 + .../dstr/dflt-ary-ptrn-elem-id-iter-val-err.js | 77 + .../dstr/dflt-ary-ptrn-elem-id-iter-val.js | 73 + .../dstr/dflt-ary-ptrn-elem-obj-id-init.js | 65 + .../generators/dstr/dflt-ary-ptrn-elem-obj-id.js | 65 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js | 75 + .../dstr/dflt-ary-ptrn-elem-obj-prop-id.js | 75 + .../dstr/dflt-ary-ptrn-elem-obj-val-null.js | 66 + .../dstr/dflt-ary-ptrn-elem-obj-val-undef.js | 66 + .../dstr/dflt-ary-ptrn-elision-exhausted.js | 70 + .../dstr/dflt-ary-ptrn-elision-step-err.js | 73 + .../generators/dstr/dflt-ary-ptrn-elision.js | 79 + .../generators/dstr/dflt-ary-ptrn-empty.js | 62 + .../generators/dstr/dflt-ary-ptrn-rest-ary-elem.js | 86 + .../dstr/dflt-ary-ptrn-rest-ary-elision.js | 92 + .../dstr/dflt-ary-ptrn-rest-ary-empty.js | 75 + .../generators/dstr/dflt-ary-ptrn-rest-ary-rest.js | 71 + .../dstr/dflt-ary-ptrn-rest-id-direct.js | 66 + .../dstr/dflt-ary-ptrn-rest-id-elision-next-err.js | 59 + .../dstr/dflt-ary-ptrn-rest-id-elision.js | 67 + .../dstr/dflt-ary-ptrn-rest-id-exhausted.js | 63 + .../dstr/dflt-ary-ptrn-rest-id-iter-step-err.js | 70 + .../dstr/dflt-ary-ptrn-rest-id-iter-val-err.js | 72 + .../generators/dstr/dflt-ary-ptrn-rest-id.js | 64 + .../generators/dstr/dflt-ary-ptrn-rest-init-ary.js | 60 + .../generators/dstr/dflt-ary-ptrn-rest-init-id.js | 60 + .../generators/dstr/dflt-ary-ptrn-rest-init-obj.js | 60 + .../dstr/dflt-ary-ptrn-rest-not-final-ary.js | 60 + .../dstr/dflt-ary-ptrn-rest-not-final-id.js | 60 + .../dstr/dflt-ary-ptrn-rest-not-final-obj.js | 60 + .../generators/dstr/dflt-ary-ptrn-rest-obj-id.js | 64 + .../dstr/dflt-ary-ptrn-rest-obj-prop-id.js | 71 + .../generators/dstr/dflt-obj-init-null.js | 53 + .../generators/dstr/dflt-obj-init-undefined.js | 53 + .../generators/dstr/dflt-obj-ptrn-empty.js | 63 + .../dstr/dflt-obj-ptrn-id-get-value-err.js | 60 + .../dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js | 64 + .../dstr/dflt-obj-ptrn-id-init-fn-name-class.js | 66 + .../dstr/dflt-obj-ptrn-id-init-fn-name-cover.js | 65 + .../dstr/dflt-obj-ptrn-id-init-fn-name-fn.js | 65 + .../dstr/dflt-obj-ptrn-id-init-fn-name-gen.js | 66 + .../dstr/dflt-obj-ptrn-id-init-skipped.js | 68 + .../dstr/dflt-obj-ptrn-id-init-throws.js | 60 + .../dstr/dflt-obj-ptrn-id-init-unresolvable.js | 64 + .../dstr/dflt-obj-ptrn-id-trailing-comma.js | 58 + .../generators/dstr/dflt-obj-ptrn-list-err.js | 61 + .../generators/dstr/dflt-obj-ptrn-prop-ary-init.js | 67 + .../dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js | 58 + .../dstr/dflt-obj-ptrn-prop-ary-value-null.js | 55 + .../generators/dstr/dflt-obj-ptrn-prop-ary.js | 65 + .../generators/dstr/dflt-obj-ptrn-prop-eval-err.js | 57 + .../dstr/dflt-obj-ptrn-prop-id-get-value-err.js | 62 + .../dstr/dflt-obj-ptrn-prop-id-init-skipped.js | 80 + .../dstr/dflt-obj-ptrn-prop-id-init-throws.js | 60 + .../dflt-obj-ptrn-prop-id-init-unresolvable.js | 64 + .../generators/dstr/dflt-obj-ptrn-prop-id-init.js | 61 + .../dstr/dflt-obj-ptrn-prop-id-trailing-comma.js | 62 + .../generators/dstr/dflt-obj-ptrn-prop-id.js | 61 + .../generators/dstr/dflt-obj-ptrn-prop-obj-init.js | 67 + .../dstr/dflt-obj-ptrn-prop-obj-value-null.js | 55 + .../dstr/dflt-obj-ptrn-prop-obj-value-undef.js | 55 + .../generators/dstr/dflt-obj-ptrn-prop-obj.js | 65 + .../generators/dstr/dflt-obj-ptrn-rest-getter.js | 60 + .../dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js | 68 + .../generators/dstr/dflt-obj-ptrn-rest-val-obj.js | 67 + .../expressions/generators/dstr/obj-init-null.js | 53 + .../generators/dstr/obj-init-undefined.js | 53 + .../expressions/generators/dstr/obj-ptrn-empty.js | 63 + .../generators/dstr/obj-ptrn-id-get-value-err.js | 60 + .../dstr/obj-ptrn-id-init-fn-name-arrow.js | 64 + .../dstr/obj-ptrn-id-init-fn-name-class.js | 66 + .../dstr/obj-ptrn-id-init-fn-name-cover.js | 65 + .../generators/dstr/obj-ptrn-id-init-fn-name-fn.js | 65 + .../dstr/obj-ptrn-id-init-fn-name-gen.js | 66 + .../generators/dstr/obj-ptrn-id-init-skipped.js | 68 + .../generators/dstr/obj-ptrn-id-init-throws.js | 60 + .../dstr/obj-ptrn-id-init-unresolvable.js | 64 + .../generators/dstr/obj-ptrn-id-trailing-comma.js | 58 + .../generators/dstr/obj-ptrn-list-err.js | 61 + .../generators/dstr/obj-ptrn-prop-ary-init.js | 67 + .../dstr/obj-ptrn-prop-ary-trailing-comma.js | 58 + .../dstr/obj-ptrn-prop-ary-value-null.js | 55 + .../generators/dstr/obj-ptrn-prop-ary.js | 65 + .../generators/dstr/obj-ptrn-prop-eval-err.js | 57 + .../dstr/obj-ptrn-prop-id-get-value-err.js | 62 + .../dstr/obj-ptrn-prop-id-init-skipped.js | 80 + .../dstr/obj-ptrn-prop-id-init-throws.js | 60 + .../dstr/obj-ptrn-prop-id-init-unresolvable.js | 64 + .../generators/dstr/obj-ptrn-prop-id-init.js | 61 + .../dstr/obj-ptrn-prop-id-trailing-comma.js | 62 + .../generators/dstr/obj-ptrn-prop-id.js | 61 + .../generators/dstr/obj-ptrn-prop-obj-init.js | 67 + .../dstr/obj-ptrn-prop-obj-value-null.js | 55 + .../dstr/obj-ptrn-prop-obj-value-undef.js | 55 + .../generators/dstr/obj-ptrn-prop-obj.js | 65 + .../generators/dstr/obj-ptrn-rest-getter.js | 60 + .../dstr/obj-ptrn-rest-skip-non-enumerable.js | 68 + .../generators/dstr/obj-ptrn-rest-val-obj.js | 67 + .../language/expressions/generators/dstr/shell.js | 0 .../generators/eval-body-proto-realm.js | 34 + .../generators/eval-var-scope-syntax-err.js | 61 + .../generators/forbidden-ext/b1/browser.js | 0 ...r-forbidden-ext-direct-access-prop-arguments.js | 37 + ...expr-forbidden-ext-direct-access-prop-caller.js | 37 + .../generators/forbidden-ext/b1/shell.js | 0 .../generators/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 64 + ...en-ext-indirect-access-own-prop-caller-value.js | 64 + ...pr-forbidden-ext-indirect-access-prop-caller.js | 64 + .../generators/forbidden-ext/b2/shell.js | 0 .../generators/forbidden-ext/browser.js | 0 .../expressions/generators/forbidden-ext/shell.js | 0 .../generator-created-after-decl-inst.js | 26 + .../expressions/generators/has-instance.js | 15 + .../expressions/generators/implicit-name.js | 22 + .../generators/invoke-as-constructor.js | 17 + .../language/expressions/generators/length-dflt.js | 70 + .../generators/length-property-descriptor.js | 21 + .../language/expressions/generators/name.js | 39 + ...-no-strict-reassign-fn-name-in-body-in-arrow.js | 27 + ...d-no-strict-reassign-fn-name-in-body-in-eval.js | 25 + .../named-no-strict-reassign-fn-name-in-body.js | 25 + ...ror-reassign-fn-name-in-body-in-arrow-strict.js | 30 + ...rror-reassign-fn-name-in-body-in-eval-strict.js | 28 + ...strict-error-reassign-fn-name-in-body-strict.js | 28 + .../named-yield-as-binding-identifier-escaped.js | 30 + .../named-yield-as-binding-identifier.js | 30 + .../named-yield-as-identifier-reference-escaped.js | 30 + .../named-yield-as-identifier-reference.js | 30 + .../named-yield-as-label-identifier-escaped.js | 30 + .../generators/named-yield-as-label-identifier.js | 30 + .../named-yield-identifier-non-strict.js | 41 + .../named-yield-identifier-spread-non-strict.js | 63 + .../named-yield-identifier-spread-strict-strict.js | 46 + .../named-yield-identifier-strict-strict.js | 37 + .../generators/named-yield-spread-arr-multiple.js | 44 + .../generators/named-yield-spread-arr-single.js | 46 + .../generators/named-yield-spread-obj.js | 49 + .../language/expressions/generators/no-name.js | 23 + .../language/expressions/generators/no-yield.js | 20 + .../object-destructuring-param-strict-body.js | 134 + .../expressions/generators/param-dflt-yield.js | 26 + .../generators/params-dflt-args-unmapped.js | 84 + .../generators/params-dflt-ref-arguments.js | 63 + .../generators/params-trailing-comma-multiple.js | 63 + .../generators/params-trailing-comma-single.js | 62 + .../generators/prototype-own-properties.js | 14 + .../generators/prototype-property-descriptor.js | 20 + .../generators/prototype-relation-to-function.js | 20 + .../expressions/generators/prototype-typeof.js | 14 + .../expressions/generators/prototype-uniqueness.js | 16 + .../expressions/generators/prototype-value.js | 21 + .../generators/rest-param-strict-body.js | 134 + .../rest-params-trailing-comma-early-error.js | 60 + .../language/expressions/generators/return.js | 23 + .../generators/scope-body-lex-distinct.js | 56 + .../expressions/generators/scope-name-var-close.js | 31 + .../generators/scope-name-var-open-non-strict.js | 53 + .../scope-name-var-open-strict-strict.js | 58 + .../generators/scope-param-elem-var-close.js | 33 + .../generators/scope-param-elem-var-open.js | 31 + .../generators/scope-param-rest-elem-var-close.js | 31 + .../generators/scope-param-rest-elem-var-open.js | 31 + .../generators/scope-paramsbody-var-close.js | 37 + .../generators/scope-paramsbody-var-open.js | 35 + .../language/expressions/generators/shell.js | 0 .../generators/static-init-await-binding.js | 20 + .../generators/static-init-await-reference.js | 28 + .../generators/unscopables-with-in-nested-fn.js | 105 + .../expressions/generators/unscopables-with.js | 99 + .../generators/use-strict-with-non-simple-param.js | 23 + .../yield-as-binding-identifier-escaped.js | 30 + .../generators/yield-as-binding-identifier.js | 30 + ...ld-as-function-expression-binding-identifier.js | 23 + ...d-as-generator-expression-binding-identifier.js | 18 + .../yield-as-identifier-in-nested-function.js | 24 + .../yield-as-identifier-reference-escaped.js | 30 + .../generators/yield-as-identifier-reference.js | 30 + .../yield-as-label-identifier-escaped.js | 30 + .../generators/yield-as-label-identifier.js | 30 + .../generators/yield-as-literal-property-name.js | 21 + .../generators/yield-as-logical-or-expression.js | 20 + .../expressions/generators/yield-as-parameter.js | 18 + .../generators/yield-as-property-name.js | 21 + .../expressions/generators/yield-as-statement.js | 47 + .../generators/yield-as-yield-operand.js | 31 + .../generators/yield-identifier-non-strict.js | 41 + .../yield-identifier-spread-non-strict.js | 63 + .../yield-identifier-spread-strict-strict.js | 46 + .../generators/yield-identifier-strict-strict.js | 37 + .../expressions/generators/yield-newline.js | 27 + .../generators/yield-spread-arr-multiple.js | 44 + .../generators/yield-spread-arr-single.js | 46 + .../expressions/generators/yield-spread-obj.js | 49 + .../generators/yield-star-after-newline.js | 20 + .../generators/yield-star-before-newline.js | 22 + .../expressions/generators/yield-weak-binding.js | 17 + .../greater-than-or-equal/S11.8.4_A1.js | 62 + .../greater-than-or-equal/S11.8.4_A2.1_T1.js | 43 + .../greater-than-or-equal/S11.8.4_A2.1_T2.js | 21 + .../greater-than-or-equal/S11.8.4_A2.1_T3.js | 21 + .../greater-than-or-equal/S11.8.4_A2.2_T1.js | 71 + .../greater-than-or-equal/S11.8.4_A2.3_T1.js | 28 + .../greater-than-or-equal/S11.8.4_A2.4_T1.js | 22 + .../greater-than-or-equal/S11.8.4_A2.4_T2.js | 26 + .../greater-than-or-equal/S11.8.4_A2.4_T3.js | 21 + .../greater-than-or-equal/S11.8.4_A2.4_T4.js | 16 + .../greater-than-or-equal/S11.8.4_A3.1_T1.1.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T1.2.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T1.3.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T2.1.js | 55 + .../greater-than-or-equal/S11.8.4_A3.1_T2.2.js | 65 + .../greater-than-or-equal/S11.8.4_A3.1_T2.3.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T2.4.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T2.5.js | 55 + .../greater-than-or-equal/S11.8.4_A3.1_T2.6.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T2.7.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T2.8.js | 34 + .../greater-than-or-equal/S11.8.4_A3.1_T2.9.js | 34 + .../greater-than-or-equal/S11.8.4_A3.2_T1.1.js | 44 + .../greater-than-or-equal/S11.8.4_A3.2_T1.2.js | 34 + .../greater-than-or-equal/S11.8.4_A4.1.js | 50 + .../greater-than-or-equal/S11.8.4_A4.10.js | 41 + .../greater-than-or-equal/S11.8.4_A4.11.js | 51 + .../greater-than-or-equal/S11.8.4_A4.12_T1.js | 48 + .../greater-than-or-equal/S11.8.4_A4.12_T2.js | 48 + .../greater-than-or-equal/S11.8.4_A4.2.js | 50 + .../greater-than-or-equal/S11.8.4_A4.3.js | 45 + .../greater-than-or-equal/S11.8.4_A4.4.js | 30 + .../greater-than-or-equal/S11.8.4_A4.5.js | 40 + .../greater-than-or-equal/S11.8.4_A4.6.js | 40 + .../greater-than-or-equal/S11.8.4_A4.7.js | 40 + .../greater-than-or-equal/S11.8.4_A4.8.js | 40 + .../greater-than-or-equal/S11.8.4_A4.9.js | 52 + .../greater-than-or-equal/bigint-and-bigint.js | 166 ++ .../bigint-and-incomparable-string.js | 29 + .../greater-than-or-equal/bigint-and-non-finite.js | 31 + .../bigint-and-number-extremes.js | 55 + .../greater-than-or-equal/bigint-and-number.js | 57 + .../greater-than-or-equal/bigint-and-string.js | 53 + .../expressions/greater-than-or-equal/browser.js | 0 .../expressions/greater-than-or-equal/shell.js | 0 .../language/expressions/greater-than/11.8.2-1.js | 27 + .../language/expressions/greater-than/11.8.2-2.js | 27 + .../language/expressions/greater-than/11.8.2-3.js | 27 + .../language/expressions/greater-than/11.8.2-4.js | 27 + .../expressions/greater-than/S11.8.2_A1.js | 62 + .../expressions/greater-than/S11.8.2_A2.1_T1.js | 43 + .../expressions/greater-than/S11.8.2_A2.1_T2.js | 21 + .../expressions/greater-than/S11.8.2_A2.1_T3.js | 21 + .../expressions/greater-than/S11.8.2_A2.2_T1.js | 71 + .../expressions/greater-than/S11.8.2_A2.3_T1.js | 26 + .../expressions/greater-than/S11.8.2_A2.4_T1.js | 22 + .../expressions/greater-than/S11.8.2_A2.4_T2.js | 26 + .../expressions/greater-than/S11.8.2_A2.4_T3.js | 21 + .../expressions/greater-than/S11.8.2_A2.4_T4.js | 16 + .../expressions/greater-than/S11.8.2_A3.1_T1.1.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T1.2.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T1.3.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T2.1.js | 55 + .../expressions/greater-than/S11.8.2_A3.1_T2.2.js | 65 + .../expressions/greater-than/S11.8.2_A3.1_T2.3.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T2.4.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T2.5.js | 55 + .../expressions/greater-than/S11.8.2_A3.1_T2.6.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T2.7.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T2.8.js | 34 + .../expressions/greater-than/S11.8.2_A3.1_T2.9.js | 34 + .../expressions/greater-than/S11.8.2_A3.2_T1.1.js | 44 + .../expressions/greater-than/S11.8.2_A3.2_T1.2.js | 34 + .../expressions/greater-than/S11.8.2_A4.1.js | 50 + .../expressions/greater-than/S11.8.2_A4.10.js | 41 + .../expressions/greater-than/S11.8.2_A4.11.js | 51 + .../expressions/greater-than/S11.8.2_A4.12_T1.js | 48 + .../expressions/greater-than/S11.8.2_A4.12_T2.js | 48 + .../expressions/greater-than/S11.8.2_A4.2.js | 50 + .../expressions/greater-than/S11.8.2_A4.3.js | 45 + .../expressions/greater-than/S11.8.2_A4.4.js | 30 + .../expressions/greater-than/S11.8.2_A4.5.js | 40 + .../expressions/greater-than/S11.8.2_A4.6.js | 40 + .../expressions/greater-than/S11.8.2_A4.7.js | 40 + .../expressions/greater-than/S11.8.2_A4.8.js | 40 + .../expressions/greater-than/S11.8.2_A4.9.js | 52 + .../expressions/greater-than/bigint-and-bigint.js | 166 ++ .../expressions/greater-than/bigint-and-boolean.js | 23 + .../greater-than/bigint-and-incomparable-string.js | 29 + .../greater-than/bigint-and-non-finite.js | 31 + .../greater-than/bigint-and-number-extremes.js | 50 + .../expressions/greater-than/bigint-and-number.js | 48 + .../expressions/greater-than/bigint-and-string.js | 62 + .../expressions/greater-than/bigint-and-symbol.js | 16 + .../language/expressions/greater-than/browser.js | 0 .../language/expressions/greater-than/shell.js | 0 .../language/expressions/grouping/S11.1.6_A1.js | 62 + .../language/expressions/grouping/S11.1.6_A2_T1.js | 30 + .../language/expressions/grouping/S11.1.6_A2_T2.js | 19 + .../language/expressions/grouping/S11.1.6_A3_T1.js | 23 + .../language/expressions/grouping/S11.1.6_A3_T2.js | 23 + .../language/expressions/grouping/S11.1.6_A3_T3.js | 28 + .../language/expressions/grouping/S11.1.6_A3_T4.js | 27 + .../language/expressions/grouping/S11.1.6_A3_T6.js | 16 + .../language/expressions/grouping/S11.1.6_A3_T7.js | 15 + .../language/expressions/grouping/browser.js | 0 .../test262/language/expressions/grouping/shell.js | 0 .../language/expressions/import.meta/browser.js | 0 .../import.meta/distinct-for-each-module.js | 39 + .../distinct-for-each-module_FIXTURE.js | 9 + .../import-meta-is-an-ordinary-object.js | 80 + .../import.meta/not-accessible-from-direct-eval.js | 19 + .../import.meta/same-object-returned.js | 37 + .../language/expressions/import.meta/shell.js | 0 .../expressions/import.meta/syntax/browser.js | 0 .../import.meta/syntax/escape-sequence-import.js | 35 + .../import.meta/syntax/escape-sequence-meta.js | 35 + .../syntax/goal-async-function-params-or-body.js | 23 + .../syntax/goal-async-generator-params-or-body.js | 23 + .../syntax/goal-function-params-or-body.js | 21 + .../syntax/goal-generator-params-or-body.js | 23 + .../syntax/goal-module-nested-function.js | 19 + .../expressions/import.meta/syntax/goal-module.js | 17 + .../expressions/import.meta/syntax/goal-script.js | 19 + ...d-assignment-target-array-destructuring-expr.js | 32 + ...ignment-target-array-rest-destructuring-expr.js | 32 + .../invalid-assignment-target-assignment-expr.js | 32 + .../invalid-assignment-target-for-await-of-loop.js | 33 + .../invalid-assignment-target-for-in-loop.js | 31 + .../invalid-assignment-target-for-of-loop.js | 31 + ...-assignment-target-object-destructuring-expr.js | 32 + ...gnment-target-object-rest-destructuring-expr.js | 32 + .../invalid-assignment-target-update-expr.js | 33 + .../expressions/import.meta/syntax/shell.js | 0 .../test262/language/expressions/in/S11.8.7_A1.js | 62 + .../language/expressions/in/S11.8.7_A2.1_T1.js | 34 + .../language/expressions/in/S11.8.7_A2.1_T2.js | 21 + .../language/expressions/in/S11.8.7_A2.1_T3.js | 21 + .../language/expressions/in/S11.8.7_A2.4_T1.js | 22 + .../language/expressions/in/S11.8.7_A2.4_T2.js | 26 + .../language/expressions/in/S11.8.7_A2.4_T3.js | 21 + .../language/expressions/in/S11.8.7_A2.4_T4.js | 16 + .../test262/language/expressions/in/S11.8.7_A3.js | 65 + .../test262/language/expressions/in/S11.8.7_A4.js | 38 + .../test262/language/expressions/in/S8.12.6_A1.js | 22 + .../language/expressions/in/S8.12.6_A2_T1.js | 22 + .../language/expressions/in/S8.12.6_A2_T2.js | 46 + .../test262/language/expressions/in/S8.12.6_A3.js | 46 + .../test262/language/expressions/in/browser.js | 0 .../expressions/in/private-field-in-nested.js | 28 + .../language/expressions/in/private-field-in.js | 27 + .../private-field-invalid-assignment-reference.js | 26 + .../in/private-field-invalid-assignment-target.js | 32 + .../in/private-field-invalid-identifier-complex.js | 32 + .../in/private-field-invalid-identifier-simple.js | 26 + .../expressions/in/private-field-invalid-rhs.js | 27 + .../in/private-field-presence-accessor-shadowed.js | 49 + .../in/private-field-presence-accessor.js | 35 + .../in/private-field-presence-field-shadowed.js | 38 + .../expressions/in/private-field-presence-field.js | 28 + .../in/private-field-presence-method-shadowed.js | 48 + .../in/private-field-presence-method.js | 35 + .../in/private-field-rhs-await-absent.js | 41 + .../in/private-field-rhs-await-present.js | 40 + .../expressions/in/private-field-rhs-non-object.js | 53 + .../in/private-field-rhs-unresolvable.js | 32 + .../in/private-field-rhs-yield-absent.js | 34 + .../in/private-field-rhs-yield-present.js | 38 + .../expressions/in/rhs-yield-absent-non-strict.js | 32 + .../in/rhs-yield-absent-strict-strict.js | 22 + .../language/expressions/in/rhs-yield-present.js | 35 + .../tests/test262/language/expressions/in/shell.js | 0 .../language/expressions/instanceof/S11.8.6_A1.js | 62 + .../expressions/instanceof/S11.8.6_A2.1_T1.js | 34 + .../expressions/instanceof/S11.8.6_A2.1_T2.js | 21 + .../expressions/instanceof/S11.8.6_A2.1_T3.js | 21 + .../expressions/instanceof/S11.8.6_A2.4_T1.js | 22 + .../expressions/instanceof/S11.8.6_A2.4_T2.js | 26 + .../expressions/instanceof/S11.8.6_A2.4_T3.js | 21 + .../expressions/instanceof/S11.8.6_A2.4_T4.js | 16 + .../language/expressions/instanceof/S11.8.6_A3.js | 65 + .../expressions/instanceof/S11.8.6_A4_T1.js | 25 + .../expressions/instanceof/S11.8.6_A4_T2.js | 25 + .../expressions/instanceof/S11.8.6_A4_T3.js | 25 + .../expressions/instanceof/S11.8.6_A5_T1.js | 46 + .../expressions/instanceof/S11.8.6_A5_T2.js | 35 + .../expressions/instanceof/S11.8.6_A6_T1.js | 23 + .../expressions/instanceof/S11.8.6_A6_T2.js | 23 + .../expressions/instanceof/S11.8.6_A6_T3.js | 29 + .../expressions/instanceof/S11.8.6_A6_T4.js | 42 + .../expressions/instanceof/S11.8.6_A7_T1.js | 24 + .../expressions/instanceof/S11.8.6_A7_T2.js | 24 + .../expressions/instanceof/S11.8.6_A7_T3.js | 24 + .../expressions/instanceof/S15.3.5.3_A1_T1.js | 21 + .../expressions/instanceof/S15.3.5.3_A1_T2.js | 21 + .../expressions/instanceof/S15.3.5.3_A1_T3.js | 21 + .../expressions/instanceof/S15.3.5.3_A1_T4.js | 21 + .../expressions/instanceof/S15.3.5.3_A1_T5.js | 21 + .../expressions/instanceof/S15.3.5.3_A1_T6.js | 21 + .../expressions/instanceof/S15.3.5.3_A1_T7.js | 21 + .../expressions/instanceof/S15.3.5.3_A1_T8.js | 23 + .../expressions/instanceof/S15.3.5.3_A2_T2.js | 32 + .../expressions/instanceof/S15.3.5.3_A2_T5.js | 40 + .../expressions/instanceof/S15.3.5.3_A2_T6.js | 31 + .../expressions/instanceof/S15.3.5.3_A3_T1.js | 30 + .../expressions/instanceof/S15.3.5.3_A3_T2.js | 35 + .../language/expressions/instanceof/browser.js | 0 .../instanceof/primitive-prototype-with-object.js | 34 + .../primitive-prototype-with-primitive.js | 31 + .../prototype-getter-with-object-throws.js | 44 + .../instanceof/prototype-getter-with-object.js | 49 + .../instanceof/prototype-getter-with-primitive.js | 36 + .../language/expressions/instanceof/shell.js | 0 .../instanceof/symbol-hasinstance-get-err.js | 26 + .../instanceof/symbol-hasinstance-invocation.js | 34 + .../instanceof/symbol-hasinstance-not-callable.js | 26 + .../instanceof/symbol-hasinstance-to-boolean.js | 46 + .../language/expressions/left-shift/S11.7.1_A1.js | 62 + .../expressions/left-shift/S11.7.1_A2.1_T1.js | 43 + .../expressions/left-shift/S11.7.1_A2.1_T2.js | 21 + .../expressions/left-shift/S11.7.1_A2.1_T3.js | 21 + .../expressions/left-shift/S11.7.1_A2.2_T1.js | 71 + .../expressions/left-shift/S11.7.1_A2.3_T1.js | 28 + .../expressions/left-shift/S11.7.1_A2.4_T1.js | 22 + .../expressions/left-shift/S11.7.1_A2.4_T2.js | 26 + .../expressions/left-shift/S11.7.1_A2.4_T3.js | 21 + .../expressions/left-shift/S11.7.1_A2.4_T4.js | 16 + .../expressions/left-shift/S11.7.1_A3_T1.1.js | 32 + .../expressions/left-shift/S11.7.1_A3_T1.2.js | 30 + .../expressions/left-shift/S11.7.1_A3_T1.3.js | 40 + .../expressions/left-shift/S11.7.1_A3_T1.4.js | 30 + .../expressions/left-shift/S11.7.1_A3_T1.5.js | 30 + .../expressions/left-shift/S11.7.1_A3_T2.1.js | 52 + .../expressions/left-shift/S11.7.1_A3_T2.2.js | 62 + .../expressions/left-shift/S11.7.1_A3_T2.3.js | 32 + .../expressions/left-shift/S11.7.1_A3_T2.4.js | 32 + .../expressions/left-shift/S11.7.1_A3_T2.5.js | 52 + .../expressions/left-shift/S11.7.1_A3_T2.6.js | 32 + .../expressions/left-shift/S11.7.1_A3_T2.7.js | 32 + .../expressions/left-shift/S11.7.1_A3_T2.8.js | 32 + .../expressions/left-shift/S11.7.1_A3_T2.9.js | 32 + .../expressions/left-shift/S11.7.1_A4_T1.js | 2571 +++++++++++++++++++ .../expressions/left-shift/S11.7.1_A4_T2.js | 2571 +++++++++++++++++++ .../expressions/left-shift/S11.7.1_A4_T3.js | 2571 +++++++++++++++++++ .../expressions/left-shift/S11.7.1_A4_T4.js | 2571 +++++++++++++++++++ .../expressions/left-shift/S11.7.1_A5.1_T1.js | 60 + .../expressions/left-shift/S11.7.1_A5.2_T1.js | 330 +++ .../language/expressions/left-shift/S9.5_A1_T1.js | 52 + .../expressions/left-shift/S9.5_A2.1_T1.js | 52 + .../expressions/left-shift/S9.5_A2.2_T1.js | 70 + .../expressions/left-shift/S9.5_A2.3_T1.js | 40 + .../expressions/left-shift/S9.5_A3.1_T1.js | 20 + .../expressions/left-shift/S9.5_A3.1_T2.js | 20 + .../expressions/left-shift/S9.5_A3.1_T3.js | 20 + .../expressions/left-shift/S9.5_A3.2_T1.js | 20 + .../expressions/left-shift/bigint-and-number.js | 92 + .../expressions/left-shift/bigint-errors.js | 72 + .../expressions/left-shift/bigint-non-primitive.js | 89 + .../expressions/left-shift/bigint-toprimitive.js | 374 +++ .../left-shift/bigint-wrapped-values.js | 47 + .../language/expressions/left-shift/bigint.js | 110 + .../language/expressions/left-shift/browser.js | 0 .../expressions/left-shift/order-of-evaluation.js | 140 ++ .../language/expressions/left-shift/shell.js | 0 .../expressions/less-than-or-equal/11.8.3-1.js | 27 + .../expressions/less-than-or-equal/11.8.3-2.js | 28 + .../expressions/less-than-or-equal/11.8.3-3.js | 28 + .../expressions/less-than-or-equal/11.8.3-4.js | 28 + .../expressions/less-than-or-equal/S11.8.3_A1.js | 62 + .../less-than-or-equal/S11.8.3_A2.1_T1.js | 43 + .../less-than-or-equal/S11.8.3_A2.1_T2.js | 21 + .../less-than-or-equal/S11.8.3_A2.1_T3.js | 21 + .../less-than-or-equal/S11.8.3_A2.2_T1.js | 71 + .../less-than-or-equal/S11.8.3_A2.3_T1.js | 26 + .../less-than-or-equal/S11.8.3_A2.4_T1.js | 22 + .../less-than-or-equal/S11.8.3_A2.4_T2.js | 26 + .../less-than-or-equal/S11.8.3_A2.4_T3.js | 21 + .../less-than-or-equal/S11.8.3_A2.4_T4.js | 16 + .../less-than-or-equal/S11.8.3_A3.1_T1.1.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T1.2.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T1.3.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T2.1.js | 55 + .../less-than-or-equal/S11.8.3_A3.1_T2.2.js | 65 + .../less-than-or-equal/S11.8.3_A3.1_T2.3.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T2.4.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T2.5.js | 55 + .../less-than-or-equal/S11.8.3_A3.1_T2.6.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T2.7.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T2.8.js | 34 + .../less-than-or-equal/S11.8.3_A3.1_T2.9.js | 34 + .../less-than-or-equal/S11.8.3_A3.2_T1.1.js | 44 + .../less-than-or-equal/S11.8.3_A3.2_T1.2.js | 34 + .../expressions/less-than-or-equal/S11.8.3_A4.1.js | 50 + .../less-than-or-equal/S11.8.3_A4.10.js | 41 + .../less-than-or-equal/S11.8.3_A4.11.js | 51 + .../less-than-or-equal/S11.8.3_A4.12_T1.js | 48 + .../less-than-or-equal/S11.8.3_A4.12_T2.js | 48 + .../expressions/less-than-or-equal/S11.8.3_A4.2.js | 50 + .../expressions/less-than-or-equal/S11.8.3_A4.3.js | 45 + .../expressions/less-than-or-equal/S11.8.3_A4.4.js | 30 + .../expressions/less-than-or-equal/S11.8.3_A4.5.js | 40 + .../expressions/less-than-or-equal/S11.8.3_A4.6.js | 40 + .../expressions/less-than-or-equal/S11.8.3_A4.7.js | 40 + .../expressions/less-than-or-equal/S11.8.3_A4.8.js | 40 + .../expressions/less-than-or-equal/S11.8.3_A4.9.js | 52 + .../less-than-or-equal/bigint-and-bigint.js | 166 ++ .../bigint-and-incomparable-string.js | 29 + .../less-than-or-equal/bigint-and-non-finite.js | 31 + .../bigint-and-number-extremes.js | 56 + .../less-than-or-equal/bigint-and-number.js | 58 + .../less-than-or-equal/bigint-and-string.js | 53 + .../expressions/less-than-or-equal/browser.js | 0 .../expressions/less-than-or-equal/shell.js | 0 .../language/expressions/less-than/S11.8.1_A1.js | 62 + .../expressions/less-than/S11.8.1_A2.1_T1.js | 43 + .../expressions/less-than/S11.8.1_A2.1_T2.js | 21 + .../expressions/less-than/S11.8.1_A2.1_T3.js | 21 + .../expressions/less-than/S11.8.1_A2.2_T1.js | 71 + .../expressions/less-than/S11.8.1_A2.3_T1.js | 28 + .../expressions/less-than/S11.8.1_A2.4_T1.js | 22 + .../expressions/less-than/S11.8.1_A2.4_T2.js | 26 + .../expressions/less-than/S11.8.1_A2.4_T3.js | 21 + .../expressions/less-than/S11.8.1_A2.4_T4.js | 16 + .../expressions/less-than/S11.8.1_A3.1_T1.1.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T1.2.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T1.3.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T2.1.js | 55 + .../expressions/less-than/S11.8.1_A3.1_T2.2.js | 65 + .../expressions/less-than/S11.8.1_A3.1_T2.3.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T2.4.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T2.5.js | 55 + .../expressions/less-than/S11.8.1_A3.1_T2.6.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T2.7.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T2.8.js | 34 + .../expressions/less-than/S11.8.1_A3.1_T2.9.js | 34 + .../expressions/less-than/S11.8.1_A3.2_T1.1.js | 44 + .../expressions/less-than/S11.8.1_A3.2_T1.2.js | 34 + .../language/expressions/less-than/S11.8.1_A4.1.js | 50 + .../expressions/less-than/S11.8.1_A4.10.js | 41 + .../expressions/less-than/S11.8.1_A4.11.js | 51 + .../expressions/less-than/S11.8.1_A4.12_T1.js | 48 + .../expressions/less-than/S11.8.1_A4.12_T2.js | 48 + .../language/expressions/less-than/S11.8.1_A4.2.js | 50 + .../language/expressions/less-than/S11.8.1_A4.3.js | 45 + .../language/expressions/less-than/S11.8.1_A4.4.js | 30 + .../language/expressions/less-than/S11.8.1_A4.5.js | 40 + .../language/expressions/less-than/S11.8.1_A4.6.js | 40 + .../language/expressions/less-than/S11.8.1_A4.7.js | 40 + .../language/expressions/less-than/S11.8.1_A4.8.js | 40 + .../language/expressions/less-than/S11.8.1_A4.9.js | 52 + .../expressions/less-than/bigint-and-bigint.js | 166 ++ .../expressions/less-than/bigint-and-boolean.js | 23 + .../less-than/bigint-and-incomparable-string.js | 29 + .../expressions/less-than/bigint-and-non-finite.js | 31 + .../less-than/bigint-and-number-extremes.js | 50 + .../expressions/less-than/bigint-and-number.js | 47 + .../expressions/less-than/bigint-and-string.js | 62 + .../expressions/less-than/bigint-and-symbol.js | 16 + .../language/expressions/less-than/browser.js | 0 .../language/expressions/less-than/shell.js | 0 .../expressions/logical-and/S11.11.1_A1.js | 63 + .../expressions/logical-and/S11.11.1_A2.1_T1.js | 64 + .../expressions/logical-and/S11.11.1_A2.1_T2.js | 21 + .../expressions/logical-and/S11.11.1_A2.1_T3.js | 23 + .../expressions/logical-and/S11.11.1_A2.1_T4.js | 15 + .../expressions/logical-and/S11.11.1_A2.4_T1.js | 22 + .../expressions/logical-and/S11.11.1_A2.4_T2.js | 26 + .../expressions/logical-and/S11.11.1_A2.4_T3.js | 27 + .../expressions/logical-and/S11.11.1_A3_T1.js | 32 + .../expressions/logical-and/S11.11.1_A3_T2.js | 33 + .../expressions/logical-and/S11.11.1_A3_T3.js | 20 + .../expressions/logical-and/S11.11.1_A3_T4.js | 20 + .../expressions/logical-and/S11.11.1_A4_T1.js | 46 + .../expressions/logical-and/S11.11.1_A4_T2.js | 51 + .../expressions/logical-and/S11.11.1_A4_T3.js | 44 + .../expressions/logical-and/S11.11.1_A4_T4.js | 20 + .../language/expressions/logical-and/browser.js | 0 .../language/expressions/logical-and/shell.js | 0 .../logical-and/symbol-logical-and-evaluation.js | 14 + .../expressions/logical-and/tco-right-strict.js | 23 + .../expressions/logical-assignment/browser.js | 0 ...side-private-reference-accessor-property-and.js | 63 + ...-private-reference-accessor-property-nullish.js | 62 + ...-side-private-reference-accessor-property-or.js | 63 + ...eference-accessor-property-short-circuit-and.js | 64 + ...ence-accessor-property-short-circuit-nullish.js | 63 + ...reference-accessor-property-short-circuit-or.js | 64 + ...and-side-private-reference-data-property-and.js | 55 + ...side-private-reference-data-property-nullish.js | 54 + ...hand-side-private-reference-data-property-or.js | 55 + ...te-reference-data-property-short-circuit-and.js | 58 + ...eference-data-property-short-circuit-nullish.js | 57 + ...ate-reference-data-property-short-circuit-or.js | 58 + .../left-hand-side-private-reference-method-and.js | 51 + ...ivate-reference-method-short-circuit-nullish.js | 57 + ...de-private-reference-method-short-circuit-or.js | 58 + ...ate-reference-readonly-accessor-property-and.js | 53 + ...reference-readonly-accessor-property-nullish.js | 52 + ...vate-reference-readonly-accessor-property-or.js | 53 + ...readonly-accessor-property-short-circuit-and.js | 57 + ...only-accessor-property-short-circuit-nullish.js | 56 + ...-readonly-accessor-property-short-circuit-or.js | 57 + .../lgcl-and-arguments-strict-strict.js | 20 + .../lgcl-and-assignment-operator-bigint.js | 29 + .../lgcl-and-assignment-operator-lhs-before-rhs.js | 55 + ...ment-operator-namedevaluation-arrow-function.js | 22 + ...nt-operator-namedevaluation-class-expression.js | 22 + ...assignment-operator-namedevaluation-function.js | 22 + ...cl-and-assignment-operator-no-set-put-strict.js | 31 + .../lgcl-and-assignment-operator-no-set-strict.js | 28 + ...nd-assignment-operator-non-extensible-strict.js | 22 + .../lgcl-and-assignment-operator-non-simple-lhs.js | 20 + ...assignment-operator-non-writeable-put-strict.js | 29 + ...and-assignment-operator-non-writeable-strict.js | 26 + ...nd-assignment-operator-unresolved-lhs-strict.js | 19 + ...l-and-assignment-operator-unresolved-rhs-put.js | 21 + .../lgcl-and-assignment-operator-unresolved-rhs.js | 18 + .../lgcl-and-assignment-operator.js | 63 + .../lgcl-and-eval-strict-strict.js | 19 + .../logical-assignment/lgcl-and-non-simple.js | 18 + .../logical-assignment/lgcl-and-whitespace.js | 60 + .../lgcl-nullish-arguments-strict-strict.js | 20 + .../lgcl-nullish-assignment-operator-bigint.js | 28 + ...l-nullish-assignment-operator-lhs-before-rhs.js | 55 + ...ment-operator-namedevaluation-arrow-function.js | 22 + ...nt-operator-namedevaluation-class-expression.js | 22 + ...assignment-operator-namedevaluation-function.js | 22 + ...ullish-assignment-operator-no-set-put-strict.js | 31 + ...cl-nullish-assignment-operator-no-set-strict.js | 28 + ...sh-assignment-operator-non-extensible-strict.js | 24 + ...l-nullish-assignment-operator-non-simple-lhs.js | 20 + ...assignment-operator-non-writeable-put-strict.js | 29 + ...ish-assignment-operator-non-writeable-strict.js | 26 + ...sh-assignment-operator-unresolved-lhs-strict.js | 19 + ...llish-assignment-operator-unresolved-rhs-put.js | 21 + ...l-nullish-assignment-operator-unresolved-rhs.js | 18 + .../lgcl-nullish-assignment-operator.js | 62 + .../lgcl-nullish-eval-strict-strict.js | 19 + .../logical-assignment/lgcl-nullish-non-simple.js | 18 + .../logical-assignment/lgcl-nullish-whitespace.js | 60 + .../lgcl-or-arguments-strict-strict.js | 20 + .../lgcl-or-assignment-operator-bigint.js | 29 + .../lgcl-or-assignment-operator-lhs-before-rhs.js | 55 + ...ment-operator-namedevaluation-arrow-function.js | 22 + ...nt-operator-namedevaluation-class-expression.js | 22 + ...assignment-operator-namedevaluation-function.js | 22 + ...gcl-or-assignment-operator-no-set-put-strict.js | 31 + .../lgcl-or-assignment-operator-no-set-strict.js | 28 + ...or-assignment-operator-non-extensible-strict.js | 24 + .../lgcl-or-assignment-operator-non-simple-lhs.js | 20 + ...assignment-operator-non-writeable-put-strict.js | 29 + ...-or-assignment-operator-non-writeable-strict.js | 26 + ...or-assignment-operator-unresolved-lhs-strict.js | 19 + ...cl-or-assignment-operator-unresolved-rhs-put.js | 21 + .../lgcl-or-assignment-operator-unresolved-rhs.js | 18 + .../lgcl-or-assignment-operator.js | 63 + .../lgcl-or-eval-strict-strict.js | 19 + .../logical-assignment/lgcl-or-non-simple.js | 18 + .../logical-assignment/lgcl-or-whitespace.js | 60 + .../expressions/logical-assignment/shell.js | 0 .../language/expressions/logical-not/S11.4.9_A1.js | 62 + .../expressions/logical-not/S11.4.9_A2.1_T1.js | 39 + .../expressions/logical-not/S11.4.9_A2.1_T2.js | 21 + .../expressions/logical-not/S11.4.9_A2.2_T1.js | 58 + .../expressions/logical-not/S11.4.9_A3_T1.js | 25 + .../expressions/logical-not/S11.4.9_A3_T2.js | 45 + .../expressions/logical-not/S11.4.9_A3_T3.js | 35 + .../expressions/logical-not/S11.4.9_A3_T4.js | 20 + .../expressions/logical-not/S11.4.9_A3_T5.js | 20 + .../language/expressions/logical-not/S9.2_A1_T2.js | 27 + .../language/expressions/logical-not/S9.2_A2_T2.js | 15 + .../language/expressions/logical-not/S9.2_A3_T2.js | 20 + .../language/expressions/logical-not/S9.2_A4_T2.js | 27 + .../language/expressions/logical-not/S9.2_A4_T4.js | 55 + .../language/expressions/logical-not/S9.2_A5_T2.js | 17 + .../language/expressions/logical-not/S9.2_A5_T4.js | 22 + .../language/expressions/logical-not/S9.2_A6_T2.js | 105 + .../language/expressions/logical-not/bigint.js | 25 + .../language/expressions/logical-not/browser.js | 0 .../language/expressions/logical-not/shell.js | 0 .../logical-not/symbol-logical-not-evaluation.js | 22 + .../language/expressions/logical-or/S11.11.2_A1.js | 63 + .../expressions/logical-or/S11.11.2_A2.1_T1.js | 64 + .../expressions/logical-or/S11.11.2_A2.1_T2.js | 21 + .../expressions/logical-or/S11.11.2_A2.1_T3.js | 23 + .../expressions/logical-or/S11.11.2_A2.1_T4.js | 15 + .../expressions/logical-or/S11.11.2_A2.4_T1.js | 22 + .../expressions/logical-or/S11.11.2_A2.4_T2.js | 26 + .../expressions/logical-or/S11.11.2_A2.4_T3.js | 27 + .../expressions/logical-or/S11.11.2_A3_T1.js | 34 + .../expressions/logical-or/S11.11.2_A3_T2.js | 40 + .../expressions/logical-or/S11.11.2_A3_T3.js | 21 + .../expressions/logical-or/S11.11.2_A3_T4.js | 20 + .../expressions/logical-or/S11.11.2_A4_T1.js | 46 + .../expressions/logical-or/S11.11.2_A4_T2.js | 43 + .../expressions/logical-or/S11.11.2_A4_T3.js | 44 + .../expressions/logical-or/S11.11.2_A4_T4.js | 20 + .../language/expressions/logical-or/browser.js | 0 .../language/expressions/logical-or/shell.js | 0 .../logical-or/symbol-logical-or-evaluation.js | 14 + .../expressions/logical-or/tco-right-strict.js | 23 + .../language/expressions/modulus/S11.5.3_A1.js | 62 + .../expressions/modulus/S11.5.3_A2.1_T1.js | 43 + .../expressions/modulus/S11.5.3_A2.1_T2.js | 21 + .../expressions/modulus/S11.5.3_A2.1_T3.js | 21 + .../expressions/modulus/S11.5.3_A2.2_T1.js | 71 + .../expressions/modulus/S11.5.3_A2.3_T1.js | 28 + .../expressions/modulus/S11.5.3_A2.4_T1.js | 22 + .../expressions/modulus/S11.5.3_A2.4_T2.js | 26 + .../expressions/modulus/S11.5.3_A2.4_T3.js | 21 + .../expressions/modulus/S11.5.3_A2.4_T4.js | 16 + .../expressions/modulus/S11.5.3_A3_T1.1.js | 32 + .../expressions/modulus/S11.5.3_A3_T1.2.js | 30 + .../expressions/modulus/S11.5.3_A3_T1.3.js | 40 + .../expressions/modulus/S11.5.3_A3_T1.4.js | 30 + .../expressions/modulus/S11.5.3_A3_T1.5.js | 30 + .../expressions/modulus/S11.5.3_A3_T2.1.js | 52 + .../expressions/modulus/S11.5.3_A3_T2.2.js | 62 + .../expressions/modulus/S11.5.3_A3_T2.3.js | 32 + .../expressions/modulus/S11.5.3_A3_T2.4.js | 32 + .../expressions/modulus/S11.5.3_A3_T2.5.js | 52 + .../expressions/modulus/S11.5.3_A3_T2.6.js | 32 + .../expressions/modulus/S11.5.3_A3_T2.7.js | 32 + .../expressions/modulus/S11.5.3_A3_T2.8.js | 32 + .../expressions/modulus/S11.5.3_A3_T2.9.js | 32 + .../expressions/modulus/S11.5.3_A4_T1.1.js | 52 + .../expressions/modulus/S11.5.3_A4_T1.2.js | 52 + .../language/expressions/modulus/S11.5.3_A4_T2.js | 70 + .../language/expressions/modulus/S11.5.3_A4_T3.js | 72 + .../language/expressions/modulus/S11.5.3_A4_T4.js | 92 + .../language/expressions/modulus/S11.5.3_A4_T5.js | 108 + .../language/expressions/modulus/S11.5.3_A4_T6.js | 86 + .../language/expressions/modulus/S11.5.3_A4_T7.js | 80 + .../expressions/modulus/bigint-and-number.js | 92 + .../expressions/modulus/bigint-arithmetic.js | 986 ++++++++ .../language/expressions/modulus/bigint-errors.js | 72 + .../expressions/modulus/bigint-modulo-zero.js | 37 + .../expressions/modulus/bigint-toprimitive.js | 374 +++ .../expressions/modulus/bigint-wrapped-values.js | 47 + .../language/expressions/modulus/browser.js | 0 .../expressions/modulus/line-terminator.js | 29 + .../expressions/modulus/order-of-evaluation.js | 140 ++ .../test262/language/expressions/modulus/shell.js | 0 .../expressions/multiplication/S11.5.1_A1.js | 62 + .../expressions/multiplication/S11.5.1_A2.1_T1.js | 43 + .../expressions/multiplication/S11.5.1_A2.1_T2.js | 21 + .../expressions/multiplication/S11.5.1_A2.1_T3.js | 21 + .../expressions/multiplication/S11.5.1_A2.2_T1.js | 71 + .../expressions/multiplication/S11.5.1_A2.3_T1.js | 28 + .../expressions/multiplication/S11.5.1_A2.4_T1.js | 22 + .../expressions/multiplication/S11.5.1_A2.4_T2.js | 26 + .../expressions/multiplication/S11.5.1_A2.4_T3.js | 21 + .../expressions/multiplication/S11.5.1_A2.4_T4.js | 16 + .../expressions/multiplication/S11.5.1_A3_T1.1.js | 32 + .../expressions/multiplication/S11.5.1_A3_T1.2.js | 30 + .../expressions/multiplication/S11.5.1_A3_T1.3.js | 40 + .../expressions/multiplication/S11.5.1_A3_T1.4.js | 30 + .../expressions/multiplication/S11.5.1_A3_T1.5.js | 30 + .../expressions/multiplication/S11.5.1_A3_T2.1.js | 52 + .../expressions/multiplication/S11.5.1_A3_T2.2.js | 62 + .../expressions/multiplication/S11.5.1_A3_T2.3.js | 32 + .../expressions/multiplication/S11.5.1_A3_T2.4.js | 32 + .../expressions/multiplication/S11.5.1_A3_T2.5.js | 52 + .../expressions/multiplication/S11.5.1_A3_T2.6.js | 32 + .../expressions/multiplication/S11.5.1_A3_T2.7.js | 32 + .../expressions/multiplication/S11.5.1_A3_T2.8.js | 32 + .../expressions/multiplication/S11.5.1_A3_T2.9.js | 32 + .../expressions/multiplication/S11.5.1_A4_T1.1.js | 52 + .../expressions/multiplication/S11.5.1_A4_T1.2.js | 52 + .../expressions/multiplication/S11.5.1_A4_T2.js | 70 + .../expressions/multiplication/S11.5.1_A4_T3.js | 52 + .../expressions/multiplication/S11.5.1_A4_T4.js | 34 + .../expressions/multiplication/S11.5.1_A4_T5.js | 54 + .../expressions/multiplication/S11.5.1_A4_T6.js | 34 + .../expressions/multiplication/S11.5.1_A4_T7.js | 62 + .../expressions/multiplication/S11.5.1_A4_T8.js | 24 + .../multiplication/bigint-and-number.js | 92 + .../multiplication/bigint-arithmetic.js | 701 ++++++ .../expressions/multiplication/bigint-errors.js | 72 + .../multiplication/bigint-toprimitive.js | 374 +++ .../multiplication/bigint-wrapped-values.js | 47 + .../language/expressions/multiplication/browser.js | 0 .../expressions/multiplication/line-terminator.js | 29 + .../multiplication/order-of-evaluation.js | 140 ++ .../language/expressions/multiplication/shell.js | 0 .../test262/language/expressions/new.target/asi.js | 69 + .../language/expressions/new.target/browser.js | 0 .../language/expressions/new.target/escaped-new.js | 26 + .../expressions/new.target/escaped-target.js | 26 + .../language/expressions/new.target/shell.js | 113 + .../language/expressions/new.target/unary-expr.js | 33 + .../expressions/new.target/value-via-call.js | 25 + .../expressions/new.target/value-via-fpapply.js | 23 + .../expressions/new.target/value-via-fpcall.js | 23 + .../expressions/new.target/value-via-member.js | 36 + .../expressions/new.target/value-via-new.js | 42 + .../new.target/value-via-reflect-apply.js | 23 + .../new.target/value-via-reflect-construct.js | 30 + .../expressions/new.target/value-via-super-call.js | 43 + .../new.target/value-via-super-property.js | 36 + .../new.target/value-via-tagged-template.js | 25 + .../language/expressions/new/S11.2.2_A1.1.js | 62 + .../language/expressions/new/S11.2.2_A1.2.js | 62 + .../test262/language/expressions/new/S11.2.2_A2.js | 34 + .../language/expressions/new/S11.2.2_A3_T1.js | 47 + .../language/expressions/new/S11.2.2_A3_T2.js | 47 + .../language/expressions/new/S11.2.2_A3_T3.js | 47 + .../language/expressions/new/S11.2.2_A3_T4.js | 47 + .../language/expressions/new/S11.2.2_A3_T5.js | 47 + .../language/expressions/new/S11.2.2_A4_T1.js | 47 + .../language/expressions/new/S11.2.2_A4_T2.js | 47 + .../language/expressions/new/S11.2.2_A4_T3.js | 47 + .../language/expressions/new/S11.2.2_A4_T4.js | 34 + .../language/expressions/new/S11.2.2_A4_T5.js | 46 + .../test262/language/expressions/new/browser.js | 0 .../ctorExpr-fn-ref-before-args-eval-fn-wrapup.js | 39 + .../new/ctorExpr-fn-ref-before-args-eval.js | 34 + .../ctorExpr-isCtor-after-args-eval-fn-wrapup.js | 38 + .../new/ctorExpr-isCtor-after-args-eval.js | 32 + .../language/expressions/new/non-ctor-err-realm.js | 34 + .../test262/language/expressions/new/shell.js | 0 .../new/spread-err-mult-err-expr-throws.js | 36 + .../new/spread-err-mult-err-iter-get-value.js | 47 + .../new/spread-err-mult-err-itr-get-call.js | 45 + .../new/spread-err-mult-err-itr-get-get.js | 46 + .../new/spread-err-mult-err-itr-step.js | 55 + .../new/spread-err-mult-err-itr-value.js | 58 + .../new/spread-err-mult-err-obj-unresolvable.js | 37 + .../new/spread-err-mult-err-unresolvable.js | 41 + .../new/spread-err-sngl-err-expr-throws.js | 36 + .../new/spread-err-sngl-err-itr-get-call.js | 46 + .../new/spread-err-sngl-err-itr-get-get.js | 47 + .../new/spread-err-sngl-err-itr-get-value.js | 46 + .../new/spread-err-sngl-err-itr-step.js | 59 + .../new/spread-err-sngl-err-itr-value.js | 65 + .../new/spread-err-sngl-err-obj-unresolvable.js | 37 + .../new/spread-err-sngl-err-unresolvable.js | 42 + .../language/expressions/new/spread-mult-empty.js | 46 + .../language/expressions/new/spread-mult-expr.js | 51 + .../language/expressions/new/spread-mult-iter.js | 63 + .../expressions/new/spread-mult-literal.js | 48 + .../expressions/new/spread-mult-obj-ident.js | 73 + .../expressions/new/spread-mult-obj-null.js | 44 + .../expressions/new/spread-mult-obj-undefined.js | 44 + .../new/spread-obj-getter-descriptor.js | 58 + .../expressions/new/spread-obj-getter-init.js | 38 + .../spread-obj-manipulate-outter-obj-in-getter.js | 52 + .../new/spread-obj-mult-spread-getter.js | 52 + .../expressions/new/spread-obj-mult-spread.js | 50 + .../language/expressions/new/spread-obj-null.js | 42 + .../new/spread-obj-override-immutable.js | 51 + .../new/spread-obj-overrides-prev-properties.js | 48 + .../new/spread-obj-skip-non-enumerable.js | 36 + .../expressions/new/spread-obj-spread-order.js | 49 + .../expressions/new/spread-obj-symbol-property.js | 50 + .../expressions/new/spread-obj-undefined.js | 42 + .../expressions/new/spread-obj-with-overrides.js | 54 + .../language/expressions/new/spread-sngl-empty.js | 45 + .../language/expressions/new/spread-sngl-expr.js | 53 + .../language/expressions/new/spread-sngl-iter.js | 60 + .../expressions/new/spread-sngl-literal.js | 50 + .../expressions/new/spread-sngl-obj-ident.js | 59 + .../language/expressions/object/11.1.5-0-1.js | 24 + .../language/expressions/object/11.1.5-0-2.js | 29 + .../expressions/object/11.1.5-1gs-strict.js | 20 + .../language/expressions/object/11.1.5-2gs.js | 13 + .../language/expressions/object/11.1.5_3-3-1.js | 27 + .../language/expressions/object/11.1.5_4-4-a-3.js | 21 + .../language/expressions/object/11.1.5_4-4-b-1.js | 13 + .../language/expressions/object/11.1.5_4-5-1.js | 27 + .../language/expressions/object/11.1.5_5-4-1.js | 22 + .../language/expressions/object/11.1.5_6-3-1.js | 21 + .../language/expressions/object/11.1.5_6-3-2.js | 22 + .../language/expressions/object/11.1.5_7-3-1.js | 21 + .../language/expressions/object/11.1.5_7-3-2.js | 22 + .../language/expressions/object/S11.1.5_A1.1.js | 34 + .../language/expressions/object/S11.1.5_A1.2.js | 41 + .../language/expressions/object/S11.1.5_A1.3.js | 41 + .../language/expressions/object/S11.1.5_A1.4.js | 41 + .../language/expressions/object/S11.1.5_A2.js | 96 + .../language/expressions/object/S11.1.5_A3.js | 29 + .../language/expressions/object/S11.1.5_A4.1.js | 13 + .../language/expressions/object/S11.1.5_A4.2.js | 13 + .../language/expressions/object/S11.1.5_A4.3.js | 36 + .../object/__proto__-duplicate-computed.js | 56 + .../expressions/object/__proto__-duplicate.js | 24 + .../expressions/object/__proto__-fn-name.js | 28 + .../object/__proto__-permitted-dup-shorthand.js | 27 + .../expressions/object/__proto__-permitted-dup.js | 39 + .../object/__proto__-poisoned-object-prototype.js | 34 + .../object/__proto__-value-non-object.js | 92 + .../expressions/object/__proto__-value-null.js | 26 + .../expressions/object/__proto__-value-obj.js | 31 + .../accessor-name-computed-err-evaluation.js | 41 + .../accessor-name-computed-err-to-prop-key.js | 57 + .../accessor-name-computed-err-unresolvable.js | 39 + .../object/accessor-name-computed-in.js | 37 + .../object/accessor-name-computed-yield-expr.js | 41 + .../object/accessor-name-computed-yield-id.js | 34 + .../expressions/object/accessor-name-computed.js | 41 + .../object/accessor-name-literal-numeric-binary.js | 39 + .../accessor-name-literal-numeric-exponent.js | 39 + .../object/accessor-name-literal-numeric-hex.js | 39 + ...ccessor-name-literal-numeric-leading-decimal.js | 39 + .../accessor-name-literal-numeric-non-canonical.js | 39 + .../object/accessor-name-literal-numeric-octal.js | 39 + .../object/accessor-name-literal-numeric-zero.js | 39 + .../accessor-name-literal-string-char-escape.js | 39 + ...ssor-name-literal-string-default-escaped-ext.js | 39 + ...accessor-name-literal-string-default-escaped.js | 39 + .../object/accessor-name-literal-string-default.js | 39 + .../accessor-name-literal-string-double-quote.js | 39 + .../object/accessor-name-literal-string-empty.js | 39 + .../accessor-name-literal-string-hex-escape.js | 39 + ...cessor-name-literal-string-line-continuation.js | 41 + .../accessor-name-literal-string-single-quote.js | 39 + .../accessor-name-literal-string-unicode-escape.js | 39 + .../test262/language/expressions/object/browser.js | 0 .../expressions/object/computed-__proto__.js | 180 ++ .../object/computed-property-evaluation-order.js | 28 + .../expressions/object/concise-generator.js | 29 + .../expressions/object/cover-initialized-name.js | 33 + ...d-ident-name-prop-name-literal-break-escaped.js | 41 + ...ed-ident-name-prop-name-literal-case-escaped.js | 41 + ...d-ident-name-prop-name-literal-catch-escaped.js | 41 + ...d-ident-name-prop-name-literal-class-escaped.js | 41 + ...d-ident-name-prop-name-literal-const-escaped.js | 41 + ...dent-name-prop-name-literal-continue-escaped.js | 41 + ...dent-name-prop-name-literal-debugger-escaped.js | 41 + ...t-name-prop-name-literal-default-escaped-ext.js | 41 + ...ident-name-prop-name-literal-default-escaped.js | 41 + ...covered-ident-name-prop-name-literal-default.js | 41 + ...-ident-name-prop-name-literal-delete-escaped.js | 41 + ...ered-ident-name-prop-name-literal-do-escaped.js | 41 + ...ed-ident-name-prop-name-literal-else-escaped.js | 41 + ...ed-ident-name-prop-name-literal-enum-escaped.js | 41 + ...-ident-name-prop-name-literal-export-escaped.js | 41 + ...t-name-prop-name-literal-extends-escaped-ext.js | 41 + ...ident-name-prop-name-literal-extends-escaped.js | 41 + ...covered-ident-name-prop-name-literal-extends.js | 41 + ...ident-name-prop-name-literal-finally-escaped.js | 41 + ...red-ident-name-prop-name-literal-for-escaped.js | 41 + ...dent-name-prop-name-literal-function-escaped.js | 41 + ...ered-ident-name-prop-name-literal-if-escaped.js | 41 + ...nt-name-prop-name-literal-implements-escaped.js | 41 + ...-ident-name-prop-name-literal-import-escaped.js | 41 + ...ered-ident-name-prop-name-literal-in-escaped.js | 41 + ...nt-name-prop-name-literal-instanceof-escaped.js | 41 + ...ent-name-prop-name-literal-interface-escaped.js | 41 + ...red-ident-name-prop-name-literal-let-escaped.js | 41 + ...red-ident-name-prop-name-literal-new-escaped.js | 41 + ...ident-name-prop-name-literal-package-escaped.js | 41 + ...ident-name-prop-name-literal-private-escaped.js | 41 + ...ent-name-prop-name-literal-protected-escaped.js | 41 + ...-ident-name-prop-name-literal-public-escaped.js | 41 + ...-ident-name-prop-name-literal-return-escaped.js | 41 + ...-ident-name-prop-name-literal-static-escaped.js | 41 + ...d-ident-name-prop-name-literal-super-escaped.js | 41 + ...-ident-name-prop-name-literal-switch-escaped.js | 41 + ...ed-ident-name-prop-name-literal-this-escaped.js | 41 + ...d-ident-name-prop-name-literal-throw-escaped.js | 41 + ...red-ident-name-prop-name-literal-try-escaped.js | 41 + ...-ident-name-prop-name-literal-typeof-escaped.js | 41 + ...red-ident-name-prop-name-literal-var-escaped.js | 41 + ...ed-ident-name-prop-name-literal-void-escaped.js | 41 + ...d-ident-name-prop-name-literal-while-escaped.js | 41 + ...ed-ident-name-prop-name-literal-with-escaped.js | 41 + ...d-property-name-from-additive-expression-add.js | 40 + ...perty-name-from-additive-expression-subtract.js | 40 + ...property-name-from-arrow-function-expression.js | 40 + ...y-name-from-assignment-expression-assignment.js | 43 + ...y-name-from-assignment-expression-bitwise-or.js | 43 + ...rty-name-from-assignment-expression-coalesce.js | 43 + ...-name-from-assignment-expression-logical-and.js | 43 + ...y-name-from-assignment-expression-logical-or.js | 43 + ...ty-name-from-async-arrow-function-expression.js | 40 + ...computed-property-name-from-await-expression.js | 45 + ...roperty-name-from-condition-expression-false.js | 40 + ...property-name-from-condition-expression-true.js | 40 + ...perty-name-from-decimal-e-notational-literal.js | 40 + ...-computed-property-name-from-decimal-literal.js | 40 + ...-property-name-from-exponetiation-expression.js | 40 + ...puted-property-name-from-expression-coalesce.js | 43 + ...ed-property-name-from-expression-logical-and.js | 43 + ...ted-property-name-from-expression-logical-or.js | 43 + ...uted-property-name-from-function-declaration.js | 41 + ...puted-property-name-from-function-expression.js | 40 + ...rty-name-from-generator-function-declaration.js | 41 + ...j-lit-computed-property-name-from-identifier.js | 42 + ...perty-name-from-integer-e-notational-literal.js | 40 + ...mputed-property-name-from-integer-separators.js | 40 + ...cpn-obj-lit-computed-property-name-from-math.js | 40 + ...erty-name-from-multiplicative-expression-div.js | 40 + ...rty-name-from-multiplicative-expression-mult.js | 40 + ...cpn-obj-lit-computed-property-name-from-null.js | 40 + ...-computed-property-name-from-numeric-literal.js | 40 + ...t-computed-property-name-from-string-literal.js | 40 + ...computed-property-name-from-yield-expression.js | 45 + .../dstr/async-gen-meth-ary-init-iter-close.js | 60 + ...n-meth-ary-init-iter-get-err-array-prototype.js | 53 + .../dstr/async-gen-meth-ary-init-iter-get-err.js | 47 + .../dstr/async-gen-meth-ary-init-iter-no-close.js | 60 + .../dstr/async-gen-meth-ary-name-iter-val.js | 59 + .../async-gen-meth-ary-ptrn-elem-ary-elem-init.js | 51 + .../async-gen-meth-ary-ptrn-elem-ary-elem-iter.js | 52 + ...sync-gen-meth-ary-ptrn-elem-ary-elision-init.js | 58 + ...sync-gen-meth-ary-ptrn-elem-ary-elision-iter.js | 55 + .../async-gen-meth-ary-ptrn-elem-ary-empty-init.js | 54 + .../async-gen-meth-ary-ptrn-elem-ary-empty-iter.js | 51 + .../async-gen-meth-ary-ptrn-elem-ary-rest-init.js | 55 + .../async-gen-meth-ary-ptrn-elem-ary-rest-iter.js | 58 + .../async-gen-meth-ary-ptrn-elem-ary-val-null.js | 54 + ...ync-gen-meth-ary-ptrn-elem-id-init-exhausted.js | 50 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 51 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-class.js | 53 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js | 52 + ...nc-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js | 52 + ...c-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js | 53 + .../async-gen-meth-ary-ptrn-elem-id-init-hole.js | 46 + ...async-gen-meth-ary-ptrn-elem-id-init-skipped.js | 55 + .../async-gen-meth-ary-ptrn-elem-id-init-throws.js | 45 + .../async-gen-meth-ary-ptrn-elem-id-init-undef.js | 49 + ...-gen-meth-ary-ptrn-elem-id-init-unresolvable.js | 52 + ...sync-gen-meth-ary-ptrn-elem-id-iter-complete.js | 53 + .../async-gen-meth-ary-ptrn-elem-id-iter-done.js | 48 + ...sync-gen-meth-ary-ptrn-elem-id-iter-step-err.js | 54 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 69 + ...async-gen-meth-ary-ptrn-elem-id-iter-val-err.js | 65 + .../async-gen-meth-ary-ptrn-elem-id-iter-val.js | 59 + .../async-gen-meth-ary-ptrn-elem-obj-id-init.js | 51 + .../dstr/async-gen-meth-ary-ptrn-elem-obj-id.js | 51 + ...sync-gen-meth-ary-ptrn-elem-obj-prop-id-init.js | 61 + .../async-gen-meth-ary-ptrn-elem-obj-prop-id.js | 61 + .../async-gen-meth-ary-ptrn-elem-obj-val-null.js | 54 + .../async-gen-meth-ary-ptrn-elem-obj-val-undef.js | 54 + .../async-gen-meth-ary-ptrn-elision-exhausted.js | 56 + .../async-gen-meth-ary-ptrn-elision-step-err.js | 61 + .../object/dstr/async-gen-meth-ary-ptrn-elision.js | 65 + .../object/dstr/async-gen-meth-ary-ptrn-empty.js | 48 + .../dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js | 72 + .../async-gen-meth-ary-ptrn-rest-ary-elision.js | 78 + .../dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js | 61 + .../dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js | 57 + .../dstr/async-gen-meth-ary-ptrn-rest-id-direct.js | 52 + ...c-gen-meth-ary-ptrn-rest-id-elision-next-err.js | 47 + .../async-gen-meth-ary-ptrn-rest-id-elision.js | 53 + .../async-gen-meth-ary-ptrn-rest-id-exhausted.js | 49 + ...sync-gen-meth-ary-ptrn-rest-id-iter-step-err.js | 58 + ...async-gen-meth-ary-ptrn-rest-id-iter-val-err.js | 60 + .../object/dstr/async-gen-meth-ary-ptrn-rest-id.js | 50 + .../dstr/async-gen-meth-ary-ptrn-rest-init-ary.js | 47 + .../dstr/async-gen-meth-ary-ptrn-rest-init-id.js | 47 + .../dstr/async-gen-meth-ary-ptrn-rest-init-obj.js | 47 + .../async-gen-meth-ary-ptrn-rest-not-final-ary.js | 47 + .../async-gen-meth-ary-ptrn-rest-not-final-id.js | 47 + .../async-gen-meth-ary-ptrn-rest-not-final-obj.js | 47 + .../dstr/async-gen-meth-ary-ptrn-rest-obj-id.js | 50 + .../async-gen-meth-ary-ptrn-rest-obj-prop-id.js | 57 + .../async-gen-meth-dflt-ary-init-iter-close.js | 60 + ...h-dflt-ary-init-iter-get-err-array-prototype.js | 53 + .../async-gen-meth-dflt-ary-init-iter-get-err.js | 47 + .../async-gen-meth-dflt-ary-init-iter-no-close.js | 60 + .../dstr/async-gen-meth-dflt-ary-name-iter-val.js | 59 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js | 51 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 52 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js | 58 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 55 + ...c-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js | 54 + ...c-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 51 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js | 55 + ...nc-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 58 + ...ync-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js | 54 + ...en-meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 50 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 51 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 53 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 52 + ...n-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 52 + ...-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 53 + ...ync-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js | 46 + ...-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js | 55 + ...c-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js | 45 + ...nc-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js | 49 + ...meth-dflt-ary-ptrn-elem-id-init-unresolvable.js | 52 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js | 53 + ...ync-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js | 48 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js | 54 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 69 + ...-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js | 65 + ...sync-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js | 59 + ...sync-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js | 51 + .../async-gen-meth-dflt-ary-ptrn-elem-obj-id.js | 51 + ...gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 61 + ...sync-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js | 61 + ...ync-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js | 54 + ...nc-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js | 54 + ...ync-gen-meth-dflt-ary-ptrn-elision-exhausted.js | 56 + ...sync-gen-meth-dflt-ary-ptrn-elision-step-err.js | 61 + .../dstr/async-gen-meth-dflt-ary-ptrn-elision.js | 65 + .../dstr/async-gen-meth-dflt-ary-ptrn-empty.js | 48 + .../async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js | 72 + ...sync-gen-meth-dflt-ary-ptrn-rest-ary-elision.js | 78 + .../async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js | 61 + .../async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js | 57 + .../async-gen-meth-dflt-ary-ptrn-rest-id-direct.js | 52 + ...-meth-dflt-ary-ptrn-rest-id-elision-next-err.js | 47 + ...async-gen-meth-dflt-ary-ptrn-rest-id-elision.js | 53 + ...ync-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js | 49 + ...gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js | 58 + ...-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js | 60 + .../dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js | 50 + .../async-gen-meth-dflt-ary-ptrn-rest-init-ary.js | 47 + .../async-gen-meth-dflt-ary-ptrn-rest-init-id.js | 47 + .../async-gen-meth-dflt-ary-ptrn-rest-init-obj.js | 47 + ...nc-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js | 47 + ...ync-gen-meth-dflt-ary-ptrn-rest-not-final-id.js | 47 + ...nc-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js | 47 + .../async-gen-meth-dflt-ary-ptrn-rest-obj-id.js | 50 + ...sync-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js | 57 + .../dstr/async-gen-meth-dflt-obj-init-null.js | 41 + .../dstr/async-gen-meth-dflt-obj-init-undefined.js | 41 + .../dstr/async-gen-meth-dflt-obj-ptrn-empty.js | 49 + ...sync-gen-meth-dflt-obj-ptrn-id-get-value-err.js | 48 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 50 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js | 52 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 51 + ...nc-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 51 + ...c-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 52 + ...async-gen-meth-dflt-obj-ptrn-id-init-skipped.js | 54 + .../async-gen-meth-dflt-obj-ptrn-id-init-throws.js | 48 + ...-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js | 52 + ...ync-gen-meth-dflt-obj-ptrn-id-trailing-comma.js | 44 + .../dstr/async-gen-meth-dflt-obj-ptrn-list-err.js | 49 + .../async-gen-meth-dflt-obj-ptrn-prop-ary-init.js | 53 + ...n-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 44 + ...c-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js | 43 + .../dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js | 51 + .../async-gen-meth-dflt-obj-ptrn-prop-eval-err.js | 45 + ...gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js | 50 + ...-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js | 66 + ...c-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js | 48 + ...meth-dflt-obj-ptrn-prop-id-init-unresolvable.js | 52 + .../async-gen-meth-dflt-obj-ptrn-prop-id-init.js | 47 + ...en-meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 48 + .../dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js | 47 + .../async-gen-meth-dflt-obj-ptrn-prop-obj-init.js | 53 + ...c-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js | 43 + ...-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js | 43 + .../dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js | 51 + .../async-gen-meth-dflt-obj-ptrn-rest-getter.js | 46 + ...-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 54 + .../async-gen-meth-dflt-obj-ptrn-rest-val-obj.js | 53 + .../object/dstr/async-gen-meth-obj-init-null.js | 41 + .../dstr/async-gen-meth-obj-init-undefined.js | 41 + .../object/dstr/async-gen-meth-obj-ptrn-empty.js | 49 + .../async-gen-meth-obj-ptrn-id-get-value-err.js | 48 + ...sync-gen-meth-obj-ptrn-id-init-fn-name-arrow.js | 50 + ...sync-gen-meth-obj-ptrn-id-init-fn-name-class.js | 52 + ...sync-gen-meth-obj-ptrn-id-init-fn-name-cover.js | 51 + .../async-gen-meth-obj-ptrn-id-init-fn-name-fn.js | 51 + .../async-gen-meth-obj-ptrn-id-init-fn-name-gen.js | 52 + .../async-gen-meth-obj-ptrn-id-init-skipped.js | 54 + .../dstr/async-gen-meth-obj-ptrn-id-init-throws.js | 48 + ...async-gen-meth-obj-ptrn-id-init-unresolvable.js | 52 + .../async-gen-meth-obj-ptrn-id-trailing-comma.js | 44 + .../dstr/async-gen-meth-obj-ptrn-list-err.js | 49 + .../dstr/async-gen-meth-obj-ptrn-prop-ary-init.js | 53 + ...nc-gen-meth-obj-ptrn-prop-ary-trailing-comma.js | 44 + .../async-gen-meth-obj-ptrn-prop-ary-value-null.js | 43 + .../dstr/async-gen-meth-obj-ptrn-prop-ary.js | 51 + .../dstr/async-gen-meth-obj-ptrn-prop-eval-err.js | 45 + ...sync-gen-meth-obj-ptrn-prop-id-get-value-err.js | 50 + ...async-gen-meth-obj-ptrn-prop-id-init-skipped.js | 66 + .../async-gen-meth-obj-ptrn-prop-id-init-throws.js | 48 + ...-gen-meth-obj-ptrn-prop-id-init-unresolvable.js | 52 + .../dstr/async-gen-meth-obj-ptrn-prop-id-init.js | 47 + ...ync-gen-meth-obj-ptrn-prop-id-trailing-comma.js | 48 + .../object/dstr/async-gen-meth-obj-ptrn-prop-id.js | 47 + .../dstr/async-gen-meth-obj-ptrn-prop-obj-init.js | 53 + .../async-gen-meth-obj-ptrn-prop-obj-value-null.js | 43 + ...async-gen-meth-obj-ptrn-prop-obj-value-undef.js | 43 + .../dstr/async-gen-meth-obj-ptrn-prop-obj.js | 51 + .../dstr/async-gen-meth-obj-ptrn-rest-getter.js | 46 + ...c-gen-meth-obj-ptrn-rest-skip-non-enumerable.js | 54 + .../dstr/async-gen-meth-obj-ptrn-rest-val-obj.js | 53 + .../language/expressions/object/dstr/browser.js | 0 .../object/dstr/gen-meth-ary-init-iter-close.js | 80 + ...n-meth-ary-init-iter-get-err-array-prototype.js | 72 + .../object/dstr/gen-meth-ary-init-iter-get-err.js | 66 + .../object/dstr/gen-meth-ary-init-iter-no-close.js | 80 + .../object/dstr/gen-meth-ary-name-iter-val.js | 79 + .../dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js | 71 + .../dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js | 72 + .../gen-meth-ary-ptrn-elem-ary-elision-init.js | 78 + .../gen-meth-ary-ptrn-elem-ary-elision-iter.js | 75 + .../dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js | 74 + .../dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js | 71 + .../dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js | 75 + .../dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js | 78 + .../dstr/gen-meth-ary-ptrn-elem-ary-val-null.js | 73 + .../gen-meth-ary-ptrn-elem-id-init-exhausted.js | 70 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 71 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-class.js | 73 + ...gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js | 72 + .../gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js | 72 + .../gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js | 73 + .../dstr/gen-meth-ary-ptrn-elem-id-init-hole.js | 66 + .../dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js | 75 + .../dstr/gen-meth-ary-ptrn-elem-id-init-throws.js | 64 + .../dstr/gen-meth-ary-ptrn-elem-id-init-undef.js | 69 + .../gen-meth-ary-ptrn-elem-id-init-unresolvable.js | 71 + .../gen-meth-ary-ptrn-elem-id-iter-complete.js | 73 + .../dstr/gen-meth-ary-ptrn-elem-id-iter-done.js | 68 + .../gen-meth-ary-ptrn-elem-id-iter-step-err.js | 73 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 89 + .../dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js | 84 + .../dstr/gen-meth-ary-ptrn-elem-id-iter-val.js | 79 + .../dstr/gen-meth-ary-ptrn-elem-obj-id-init.js | 71 + .../object/dstr/gen-meth-ary-ptrn-elem-obj-id.js | 71 + .../gen-meth-ary-ptrn-elem-obj-prop-id-init.js | 81 + .../dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js | 81 + .../dstr/gen-meth-ary-ptrn-elem-obj-val-null.js | 73 + .../dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js | 73 + .../dstr/gen-meth-ary-ptrn-elision-exhausted.js | 76 + .../dstr/gen-meth-ary-ptrn-elision-step-err.js | 80 + .../object/dstr/gen-meth-ary-ptrn-elision.js | 85 + .../object/dstr/gen-meth-ary-ptrn-empty.js | 68 + .../object/dstr/gen-meth-ary-ptrn-rest-ary-elem.js | 92 + .../dstr/gen-meth-ary-ptrn-rest-ary-elision.js | 98 + .../dstr/gen-meth-ary-ptrn-rest-ary-empty.js | 81 + .../object/dstr/gen-meth-ary-ptrn-rest-ary-rest.js | 77 + .../dstr/gen-meth-ary-ptrn-rest-id-direct.js | 72 + .../gen-meth-ary-ptrn-rest-id-elision-next-err.js | 66 + .../dstr/gen-meth-ary-ptrn-rest-id-elision.js | 73 + .../dstr/gen-meth-ary-ptrn-rest-id-exhausted.js | 69 + .../gen-meth-ary-ptrn-rest-id-iter-step-err.js | 77 + .../dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js | 79 + .../object/dstr/gen-meth-ary-ptrn-rest-id.js | 70 + .../object/dstr/gen-meth-ary-ptrn-rest-init-ary.js | 66 + .../object/dstr/gen-meth-ary-ptrn-rest-init-id.js | 66 + .../object/dstr/gen-meth-ary-ptrn-rest-init-obj.js | 66 + .../dstr/gen-meth-ary-ptrn-rest-not-final-ary.js | 66 + .../dstr/gen-meth-ary-ptrn-rest-not-final-id.js | 66 + .../dstr/gen-meth-ary-ptrn-rest-not-final-obj.js | 66 + .../object/dstr/gen-meth-ary-ptrn-rest-obj-id.js | 70 + .../dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js | 77 + .../dstr/gen-meth-dflt-ary-init-iter-close.js | 80 + ...h-dflt-ary-init-iter-get-err-array-prototype.js | 72 + .../dstr/gen-meth-dflt-ary-init-iter-get-err.js | 66 + .../dstr/gen-meth-dflt-ary-init-iter-no-close.js | 80 + .../object/dstr/gen-meth-dflt-ary-name-iter-val.js | 79 + .../gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js | 71 + .../gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 72 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js | 78 + ...gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 75 + .../gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js | 74 + .../gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 71 + .../gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js | 75 + .../gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 78 + .../gen-meth-dflt-ary-ptrn-elem-ary-val-null.js | 73 + ...en-meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 70 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 71 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 73 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 72 + ...n-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 72 + ...-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 73 + .../gen-meth-dflt-ary-ptrn-elem-id-init-hole.js | 66 + .../gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js | 75 + .../gen-meth-dflt-ary-ptrn-elem-id-init-throws.js | 64 + .../gen-meth-dflt-ary-ptrn-elem-id-init-undef.js | 69 + ...meth-dflt-ary-ptrn-elem-id-init-unresolvable.js | 71 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js | 73 + .../gen-meth-dflt-ary-ptrn-elem-id-iter-done.js | 68 + ...gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js | 73 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 89 + .../gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js | 84 + .../gen-meth-dflt-ary-ptrn-elem-id-iter-val.js | 79 + .../gen-meth-dflt-ary-ptrn-elem-obj-id-init.js | 71 + .../dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js | 71 + ...gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 81 + .../gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js | 81 + .../gen-meth-dflt-ary-ptrn-elem-obj-val-null.js | 73 + .../gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js | 73 + .../gen-meth-dflt-ary-ptrn-elision-exhausted.js | 76 + .../gen-meth-dflt-ary-ptrn-elision-step-err.js | 80 + .../object/dstr/gen-meth-dflt-ary-ptrn-elision.js | 85 + .../object/dstr/gen-meth-dflt-ary-ptrn-empty.js | 68 + .../dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js | 92 + .../gen-meth-dflt-ary-ptrn-rest-ary-elision.js | 98 + .../dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js | 81 + .../dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js | 77 + .../dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js | 72 + ...-meth-dflt-ary-ptrn-rest-id-elision-next-err.js | 66 + .../dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js | 73 + .../gen-meth-dflt-ary-ptrn-rest-id-exhausted.js | 69 + ...gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js | 77 + .../gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js | 79 + .../object/dstr/gen-meth-dflt-ary-ptrn-rest-id.js | 70 + .../dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js | 66 + .../dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js | 66 + .../dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js | 66 + .../gen-meth-dflt-ary-ptrn-rest-not-final-ary.js | 66 + .../gen-meth-dflt-ary-ptrn-rest-not-final-id.js | 66 + .../gen-meth-dflt-ary-ptrn-rest-not-final-obj.js | 66 + .../dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js | 70 + .../gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js | 77 + .../object/dstr/gen-meth-dflt-obj-init-null.js | 60 + .../dstr/gen-meth-dflt-obj-init-undefined.js | 60 + .../object/dstr/gen-meth-dflt-obj-ptrn-empty.js | 69 + .../gen-meth-dflt-obj-ptrn-id-get-value-err.js | 67 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 70 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js | 72 + ...gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 71 + .../gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 71 + .../gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 72 + .../dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js | 74 + .../dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js | 67 + .../gen-meth-dflt-obj-ptrn-id-init-unresolvable.js | 71 + .../gen-meth-dflt-obj-ptrn-id-trailing-comma.js | 64 + .../object/dstr/gen-meth-dflt-obj-ptrn-list-err.js | 68 + .../dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js | 73 + ...n-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 64 + .../gen-meth-dflt-obj-ptrn-prop-ary-value-null.js | 62 + .../object/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js | 71 + .../dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js | 64 + ...gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js | 69 + .../gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js | 86 + .../gen-meth-dflt-obj-ptrn-prop-id-init-throws.js | 67 + ...meth-dflt-obj-ptrn-prop-id-init-unresolvable.js | 71 + .../dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js | 67 + ...en-meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 68 + .../object/dstr/gen-meth-dflt-obj-ptrn-prop-id.js | 67 + .../dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js | 73 + .../gen-meth-dflt-obj-ptrn-prop-obj-value-null.js | 62 + .../gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js | 62 + .../object/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js | 71 + .../dstr/gen-meth-dflt-obj-ptrn-rest-getter.js | 66 + ...-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 74 + .../dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js | 73 + .../object/dstr/gen-meth-obj-init-null.js | 60 + .../object/dstr/gen-meth-obj-init-undefined.js | 60 + .../object/dstr/gen-meth-obj-ptrn-empty.js | 69 + .../dstr/gen-meth-obj-ptrn-id-get-value-err.js | 67 + .../gen-meth-obj-ptrn-id-init-fn-name-arrow.js | 70 + .../gen-meth-obj-ptrn-id-init-fn-name-class.js | 72 + .../gen-meth-obj-ptrn-id-init-fn-name-cover.js | 71 + .../dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js | 71 + .../dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js | 72 + .../dstr/gen-meth-obj-ptrn-id-init-skipped.js | 74 + .../dstr/gen-meth-obj-ptrn-id-init-throws.js | 67 + .../dstr/gen-meth-obj-ptrn-id-init-unresolvable.js | 71 + .../dstr/gen-meth-obj-ptrn-id-trailing-comma.js | 64 + .../object/dstr/gen-meth-obj-ptrn-list-err.js | 68 + .../object/dstr/gen-meth-obj-ptrn-prop-ary-init.js | 73 + .../gen-meth-obj-ptrn-prop-ary-trailing-comma.js | 64 + .../dstr/gen-meth-obj-ptrn-prop-ary-value-null.js | 62 + .../object/dstr/gen-meth-obj-ptrn-prop-ary.js | 71 + .../object/dstr/gen-meth-obj-ptrn-prop-eval-err.js | 64 + .../gen-meth-obj-ptrn-prop-id-get-value-err.js | 69 + .../dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js | 86 + .../dstr/gen-meth-obj-ptrn-prop-id-init-throws.js | 67 + .../gen-meth-obj-ptrn-prop-id-init-unresolvable.js | 71 + .../object/dstr/gen-meth-obj-ptrn-prop-id-init.js | 67 + .../gen-meth-obj-ptrn-prop-id-trailing-comma.js | 68 + .../object/dstr/gen-meth-obj-ptrn-prop-id.js | 67 + .../object/dstr/gen-meth-obj-ptrn-prop-obj-init.js | 73 + .../dstr/gen-meth-obj-ptrn-prop-obj-value-null.js | 62 + .../dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js | 62 + .../object/dstr/gen-meth-obj-ptrn-prop-obj.js | 71 + .../object/dstr/gen-meth-obj-ptrn-rest-getter.js | 66 + .../gen-meth-obj-ptrn-rest-skip-non-enumerable.js | 74 + .../object/dstr/gen-meth-obj-ptrn-rest-val-obj.js | 73 + .../object/dstr/meth-ary-init-iter-close.js | 77 + .../meth-ary-init-iter-get-err-array-prototype.js | 69 + .../object/dstr/meth-ary-init-iter-get-err.js | 63 + .../object/dstr/meth-ary-init-iter-no-close.js | 77 + .../object/dstr/meth-ary-name-iter-val.js | 76 + .../dstr/meth-ary-ptrn-elem-ary-elem-init.js | 68 + .../dstr/meth-ary-ptrn-elem-ary-elem-iter.js | 69 + .../dstr/meth-ary-ptrn-elem-ary-elision-init.js | 75 + .../dstr/meth-ary-ptrn-elem-ary-elision-iter.js | 72 + .../dstr/meth-ary-ptrn-elem-ary-empty-init.js | 71 + .../dstr/meth-ary-ptrn-elem-ary-empty-iter.js | 68 + .../dstr/meth-ary-ptrn-elem-ary-rest-init.js | 72 + .../dstr/meth-ary-ptrn-elem-ary-rest-iter.js | 75 + .../object/dstr/meth-ary-ptrn-elem-ary-val-null.js | 70 + .../dstr/meth-ary-ptrn-elem-id-init-exhausted.js | 67 + .../meth-ary-ptrn-elem-id-init-fn-name-arrow.js | 68 + .../meth-ary-ptrn-elem-id-init-fn-name-class.js | 70 + .../meth-ary-ptrn-elem-id-init-fn-name-cover.js | 69 + .../dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js | 69 + .../dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js | 70 + .../object/dstr/meth-ary-ptrn-elem-id-init-hole.js | 63 + .../dstr/meth-ary-ptrn-elem-id-init-skipped.js | 72 + .../dstr/meth-ary-ptrn-elem-id-init-throws.js | 61 + .../dstr/meth-ary-ptrn-elem-id-init-undef.js | 66 + .../meth-ary-ptrn-elem-id-init-unresolvable.js | 68 + .../dstr/meth-ary-ptrn-elem-id-iter-complete.js | 70 + .../object/dstr/meth-ary-ptrn-elem-id-iter-done.js | 65 + .../dstr/meth-ary-ptrn-elem-id-iter-step-err.js | 70 + ...th-ary-ptrn-elem-id-iter-val-array-prototype.js | 86 + .../dstr/meth-ary-ptrn-elem-id-iter-val-err.js | 81 + .../object/dstr/meth-ary-ptrn-elem-id-iter-val.js | 76 + .../object/dstr/meth-ary-ptrn-elem-obj-id-init.js | 68 + .../object/dstr/meth-ary-ptrn-elem-obj-id.js | 68 + .../dstr/meth-ary-ptrn-elem-obj-prop-id-init.js | 78 + .../object/dstr/meth-ary-ptrn-elem-obj-prop-id.js | 78 + .../object/dstr/meth-ary-ptrn-elem-obj-val-null.js | 70 + .../dstr/meth-ary-ptrn-elem-obj-val-undef.js | 70 + .../object/dstr/meth-ary-ptrn-elision-exhausted.js | 73 + .../object/dstr/meth-ary-ptrn-elision-step-err.js | 77 + .../object/dstr/meth-ary-ptrn-elision.js | 82 + .../expressions/object/dstr/meth-ary-ptrn-empty.js | 65 + .../object/dstr/meth-ary-ptrn-rest-ary-elem.js | 89 + .../object/dstr/meth-ary-ptrn-rest-ary-elision.js | 95 + .../object/dstr/meth-ary-ptrn-rest-ary-empty.js | 78 + .../object/dstr/meth-ary-ptrn-rest-ary-rest.js | 74 + .../object/dstr/meth-ary-ptrn-rest-id-direct.js | 69 + .../dstr/meth-ary-ptrn-rest-id-elision-next-err.js | 63 + .../object/dstr/meth-ary-ptrn-rest-id-elision.js | 70 + .../object/dstr/meth-ary-ptrn-rest-id-exhausted.js | 66 + .../dstr/meth-ary-ptrn-rest-id-iter-step-err.js | 74 + .../dstr/meth-ary-ptrn-rest-id-iter-val-err.js | 76 + .../object/dstr/meth-ary-ptrn-rest-id.js | 67 + .../object/dstr/meth-ary-ptrn-rest-init-ary.js | 63 + .../object/dstr/meth-ary-ptrn-rest-init-id.js | 63 + .../object/dstr/meth-ary-ptrn-rest-init-obj.js | 63 + .../dstr/meth-ary-ptrn-rest-not-final-ary.js | 63 + .../object/dstr/meth-ary-ptrn-rest-not-final-id.js | 63 + .../dstr/meth-ary-ptrn-rest-not-final-obj.js | 63 + .../object/dstr/meth-ary-ptrn-rest-obj-id.js | 67 + .../object/dstr/meth-ary-ptrn-rest-obj-prop-id.js | 74 + .../object/dstr/meth-dflt-ary-init-iter-close.js | 77 + ...h-dflt-ary-init-iter-get-err-array-prototype.js | 69 + .../object/dstr/meth-dflt-ary-init-iter-get-err.js | 63 + .../dstr/meth-dflt-ary-init-iter-no-close.js | 77 + .../object/dstr/meth-dflt-ary-name-iter-val.js | 76 + .../dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js | 68 + .../dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js | 69 + .../meth-dflt-ary-ptrn-elem-ary-elision-init.js | 75 + .../meth-dflt-ary-ptrn-elem-ary-elision-iter.js | 72 + .../dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js | 71 + .../dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js | 68 + .../dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js | 72 + .../dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js | 75 + .../dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js | 70 + .../meth-dflt-ary-ptrn-elem-id-init-exhausted.js | 67 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js | 68 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-class.js | 70 + ...eth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js | 69 + .../meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js | 69 + .../meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js | 70 + .../dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js | 63 + .../meth-dflt-ary-ptrn-elem-id-init-skipped.js | 72 + .../dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js | 61 + .../dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js | 66 + ...meth-dflt-ary-ptrn-elem-id-init-unresolvable.js | 68 + .../meth-dflt-ary-ptrn-elem-id-iter-complete.js | 70 + .../dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js | 65 + .../meth-dflt-ary-ptrn-elem-id-iter-step-err.js | 70 + ...lt-ary-ptrn-elem-id-iter-val-array-prototype.js | 86 + .../meth-dflt-ary-ptrn-elem-id-iter-val-err.js | 81 + .../dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js | 76 + .../dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js | 68 + .../object/dstr/meth-dflt-ary-ptrn-elem-obj-id.js | 68 + .../meth-dflt-ary-ptrn-elem-obj-prop-id-init.js | 78 + .../dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js | 78 + .../dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js | 70 + .../dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js | 70 + .../dstr/meth-dflt-ary-ptrn-elision-exhausted.js | 73 + .../dstr/meth-dflt-ary-ptrn-elision-step-err.js | 77 + .../object/dstr/meth-dflt-ary-ptrn-elision.js | 82 + .../object/dstr/meth-dflt-ary-ptrn-empty.js | 65 + .../dstr/meth-dflt-ary-ptrn-rest-ary-elem.js | 89 + .../dstr/meth-dflt-ary-ptrn-rest-ary-elision.js | 95 + .../dstr/meth-dflt-ary-ptrn-rest-ary-empty.js | 78 + .../dstr/meth-dflt-ary-ptrn-rest-ary-rest.js | 74 + .../dstr/meth-dflt-ary-ptrn-rest-id-direct.js | 69 + .../meth-dflt-ary-ptrn-rest-id-elision-next-err.js | 63 + .../dstr/meth-dflt-ary-ptrn-rest-id-elision.js | 70 + .../dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js | 66 + .../meth-dflt-ary-ptrn-rest-id-iter-step-err.js | 74 + .../meth-dflt-ary-ptrn-rest-id-iter-val-err.js | 76 + .../object/dstr/meth-dflt-ary-ptrn-rest-id.js | 67 + .../dstr/meth-dflt-ary-ptrn-rest-init-ary.js | 63 + .../object/dstr/meth-dflt-ary-ptrn-rest-init-id.js | 63 + .../dstr/meth-dflt-ary-ptrn-rest-init-obj.js | 63 + .../dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js | 63 + .../dstr/meth-dflt-ary-ptrn-rest-not-final-id.js | 63 + .../dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js | 63 + .../object/dstr/meth-dflt-ary-ptrn-rest-obj-id.js | 67 + .../dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js | 74 + .../object/dstr/meth-dflt-obj-init-null.js | 57 + .../object/dstr/meth-dflt-obj-init-undefined.js | 57 + .../object/dstr/meth-dflt-obj-ptrn-empty.js | 66 + .../dstr/meth-dflt-obj-ptrn-id-get-value-err.js | 64 + .../meth-dflt-obj-ptrn-id-init-fn-name-arrow.js | 67 + .../meth-dflt-obj-ptrn-id-init-fn-name-class.js | 69 + .../meth-dflt-obj-ptrn-id-init-fn-name-cover.js | 68 + .../dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js | 68 + .../dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js | 69 + .../dstr/meth-dflt-obj-ptrn-id-init-skipped.js | 71 + .../dstr/meth-dflt-obj-ptrn-id-init-throws.js | 64 + .../meth-dflt-obj-ptrn-id-init-unresolvable.js | 68 + .../dstr/meth-dflt-obj-ptrn-id-trailing-comma.js | 61 + .../object/dstr/meth-dflt-obj-ptrn-list-err.js | 65 + .../dstr/meth-dflt-obj-ptrn-prop-ary-init.js | 70 + .../meth-dflt-obj-ptrn-prop-ary-trailing-comma.js | 61 + .../dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js | 59 + .../object/dstr/meth-dflt-obj-ptrn-prop-ary.js | 68 + .../dstr/meth-dflt-obj-ptrn-prop-eval-err.js | 61 + .../meth-dflt-obj-ptrn-prop-id-get-value-err.js | 66 + .../meth-dflt-obj-ptrn-prop-id-init-skipped.js | 83 + .../dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js | 64 + ...meth-dflt-obj-ptrn-prop-id-init-unresolvable.js | 68 + .../object/dstr/meth-dflt-obj-ptrn-prop-id-init.js | 64 + .../meth-dflt-obj-ptrn-prop-id-trailing-comma.js | 65 + .../object/dstr/meth-dflt-obj-ptrn-prop-id.js | 64 + .../dstr/meth-dflt-obj-ptrn-prop-obj-init.js | 70 + .../dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js | 59 + .../meth-dflt-obj-ptrn-prop-obj-value-undef.js | 59 + .../object/dstr/meth-dflt-obj-ptrn-prop-obj.js | 68 + .../object/dstr/meth-dflt-obj-ptrn-rest-getter.js | 63 + .../meth-dflt-obj-ptrn-rest-skip-non-enumerable.js | 71 + .../object/dstr/meth-dflt-obj-ptrn-rest-val-obj.js | 70 + .../expressions/object/dstr/meth-obj-init-null.js | 57 + .../object/dstr/meth-obj-init-undefined.js | 57 + .../expressions/object/dstr/meth-obj-ptrn-empty.js | 66 + .../object/dstr/meth-obj-ptrn-id-get-value-err.js | 64 + .../dstr/meth-obj-ptrn-id-init-fn-name-arrow.js | 67 + .../dstr/meth-obj-ptrn-id-init-fn-name-class.js | 69 + .../dstr/meth-obj-ptrn-id-init-fn-name-cover.js | 68 + .../dstr/meth-obj-ptrn-id-init-fn-name-fn.js | 68 + .../dstr/meth-obj-ptrn-id-init-fn-name-gen.js | 69 + .../object/dstr/meth-obj-ptrn-id-init-skipped.js | 71 + .../object/dstr/meth-obj-ptrn-id-init-throws.js | 64 + .../dstr/meth-obj-ptrn-id-init-unresolvable.js | 68 + .../object/dstr/meth-obj-ptrn-id-trailing-comma.js | 61 + .../object/dstr/meth-obj-ptrn-list-err.js | 65 + .../object/dstr/meth-obj-ptrn-prop-ary-init.js | 70 + .../dstr/meth-obj-ptrn-prop-ary-trailing-comma.js | 61 + .../dstr/meth-obj-ptrn-prop-ary-value-null.js | 59 + .../object/dstr/meth-obj-ptrn-prop-ary.js | 68 + .../object/dstr/meth-obj-ptrn-prop-eval-err.js | 61 + .../dstr/meth-obj-ptrn-prop-id-get-value-err.js | 66 + .../dstr/meth-obj-ptrn-prop-id-init-skipped.js | 83 + .../dstr/meth-obj-ptrn-prop-id-init-throws.js | 64 + .../meth-obj-ptrn-prop-id-init-unresolvable.js | 68 + .../object/dstr/meth-obj-ptrn-prop-id-init.js | 64 + .../dstr/meth-obj-ptrn-prop-id-trailing-comma.js | 65 + .../object/dstr/meth-obj-ptrn-prop-id.js | 64 + .../object/dstr/meth-obj-ptrn-prop-obj-init.js | 70 + .../dstr/meth-obj-ptrn-prop-obj-value-null.js | 59 + .../dstr/meth-obj-ptrn-prop-obj-value-undef.js | 59 + .../object/dstr/meth-obj-ptrn-prop-obj.js | 68 + .../object/dstr/meth-obj-ptrn-rest-getter.js | 63 + .../dstr/meth-obj-ptrn-rest-skip-non-enumerable.js | 71 + .../object/dstr/meth-obj-ptrn-rest-val-obj.js | 70 + ...t-rest-proxy-get-not-called-on-dontenum-keys.js | 71 + ...-rest-proxy-gopd-not-called-on-excluded-keys.js | 55 + ...bject-rest-proxy-ownkeys-returned-keys-order.js | 47 + .../language/expressions/object/dstr/shell.js | 0 .../expressions/object/fn-name-accessor-get.js | 50 + .../expressions/object/fn-name-accessor-set.js | 51 + .../language/expressions/object/fn-name-arrow.js | 48 + .../language/expressions/object/fn-name-class.js | 51 + .../language/expressions/object/fn-name-cover.js | 52 + .../language/expressions/object/fn-name-fn.js | 51 + .../language/expressions/object/fn-name-gen.js | 52 + .../object/getter-body-strict-inside.js | 23 + .../object/getter-body-strict-outside-strict.js | 22 + .../expressions/object/getter-param-dflt.js | 24 + .../expressions/object/getter-prop-desc.js | 42 + .../expressions/object/getter-super-prop.js | 31 + .../object/ident-name-method-def-break-escaped.js | 44 + .../object/ident-name-method-def-case-escaped.js | 44 + .../object/ident-name-method-def-catch-escaped.js | 44 + .../object/ident-name-method-def-class-escaped.js | 44 + .../object/ident-name-method-def-const-escaped.js | 44 + .../ident-name-method-def-continue-escaped.js | 44 + .../ident-name-method-def-debugger-escaped.js | 44 + .../ident-name-method-def-default-escaped-ext.js | 44 + .../ident-name-method-def-default-escaped.js | 44 + .../object/ident-name-method-def-default.js | 44 + .../object/ident-name-method-def-delete-escaped.js | 44 + .../object/ident-name-method-def-do-escaped.js | 44 + .../object/ident-name-method-def-else-escaped.js | 44 + .../object/ident-name-method-def-enum-escaped.js | 44 + .../object/ident-name-method-def-export-escaped.js | 44 + .../ident-name-method-def-extends-escaped-ext.js | 44 + .../ident-name-method-def-extends-escaped.js | 44 + .../object/ident-name-method-def-extends.js | 44 + .../ident-name-method-def-finally-escaped.js | 44 + .../object/ident-name-method-def-for-escaped.js | 44 + .../ident-name-method-def-function-escaped.js | 44 + .../object/ident-name-method-def-if-escaped.js | 44 + .../ident-name-method-def-implements-escaped.js | 44 + .../object/ident-name-method-def-import-escaped.js | 44 + .../object/ident-name-method-def-in-escaped.js | 44 + .../ident-name-method-def-instanceof-escaped.js | 44 + .../ident-name-method-def-interface-escaped.js | 44 + .../object/ident-name-method-def-let-escaped.js | 44 + .../object/ident-name-method-def-new-escaped.js | 44 + .../ident-name-method-def-package-escaped.js | 44 + .../ident-name-method-def-private-escaped.js | 44 + .../ident-name-method-def-protected-escaped.js | 44 + .../object/ident-name-method-def-public-escaped.js | 44 + .../object/ident-name-method-def-return-escaped.js | 44 + .../object/ident-name-method-def-static-escaped.js | 44 + .../object/ident-name-method-def-super-escaped.js | 44 + .../object/ident-name-method-def-switch-escaped.js | 44 + .../object/ident-name-method-def-this-escaped.js | 44 + .../object/ident-name-method-def-throw-escaped.js | 44 + .../object/ident-name-method-def-try-escaped.js | 44 + .../object/ident-name-method-def-typeof-escaped.js | 44 + .../object/ident-name-method-def-var-escaped.js | 44 + .../object/ident-name-method-def-void-escaped.js | 44 + .../object/ident-name-method-def-while-escaped.js | 44 + .../object/ident-name-method-def-with-escaped.js | 44 + ...ent-name-prop-name-literal-await-static-init.js | 24 + .../ident-name-prop-name-literal-break-escaped.js | 43 + .../ident-name-prop-name-literal-case-escaped.js | 43 + .../ident-name-prop-name-literal-catch-escaped.js | 43 + .../ident-name-prop-name-literal-class-escaped.js | 43 + .../ident-name-prop-name-literal-const-escaped.js | 43 + ...dent-name-prop-name-literal-continue-escaped.js | 43 + ...dent-name-prop-name-literal-debugger-escaped.js | 43 + ...t-name-prop-name-literal-default-escaped-ext.js | 43 + ...ident-name-prop-name-literal-default-escaped.js | 43 + .../object/ident-name-prop-name-literal-default.js | 43 + .../ident-name-prop-name-literal-delete-escaped.js | 43 + .../ident-name-prop-name-literal-do-escaped.js | 43 + .../ident-name-prop-name-literal-else-escaped.js | 43 + .../ident-name-prop-name-literal-enum-escaped.js | 43 + .../ident-name-prop-name-literal-export-escaped.js | 43 + ...t-name-prop-name-literal-extends-escaped-ext.js | 43 + ...ident-name-prop-name-literal-extends-escaped.js | 43 + .../object/ident-name-prop-name-literal-extends.js | 43 + ...ident-name-prop-name-literal-finally-escaped.js | 43 + .../ident-name-prop-name-literal-for-escaped.js | 43 + ...dent-name-prop-name-literal-function-escaped.js | 43 + .../ident-name-prop-name-literal-if-escaped.js | 43 + ...nt-name-prop-name-literal-implements-escaped.js | 43 + .../ident-name-prop-name-literal-import-escaped.js | 43 + .../ident-name-prop-name-literal-in-escaped.js | 43 + ...nt-name-prop-name-literal-instanceof-escaped.js | 43 + ...ent-name-prop-name-literal-interface-escaped.js | 43 + .../ident-name-prop-name-literal-let-escaped.js | 43 + .../ident-name-prop-name-literal-new-escaped.js | 43 + ...ident-name-prop-name-literal-package-escaped.js | 43 + ...ident-name-prop-name-literal-private-escaped.js | 43 + ...ent-name-prop-name-literal-protected-escaped.js | 43 + .../ident-name-prop-name-literal-public-escaped.js | 43 + .../ident-name-prop-name-literal-return-escaped.js | 43 + .../ident-name-prop-name-literal-static-escaped.js | 43 + .../ident-name-prop-name-literal-super-escaped.js | 43 + .../ident-name-prop-name-literal-switch-escaped.js | 43 + .../ident-name-prop-name-literal-this-escaped.js | 43 + .../ident-name-prop-name-literal-throw-escaped.js | 43 + .../ident-name-prop-name-literal-try-escaped.js | 43 + .../ident-name-prop-name-literal-typeof-escaped.js | 43 + .../ident-name-prop-name-literal-var-escaped.js | 43 + .../ident-name-prop-name-literal-void-escaped.js | 43 + .../ident-name-prop-name-literal-while-escaped.js | 43 + .../ident-name-prop-name-literal-with-escaped.js | 43 + .../identifier-shorthand-await-strict-mode.js | 27 + ...ier-shorthand-implements-invalid-strict-mode.js | 34 + ...fier-shorthand-interface-invalid-strict-mode.js | 34 + .../identifier-shorthand-invalid-computed-name.js | 30 + .../object/identifier-shorthand-invalid-zero.js | 23 + ...identifier-shorthand-let-invalid-strict-mode.js | 34 + ...tifier-shorthand-package-invalid-strict-mode.js | 34 + ...tifier-shorthand-private-invalid-strict-mode.js | 34 + ...fier-shorthand-protected-invalid-strict-mode.js | 34 + ...ntifier-shorthand-public-invalid-strict-mode.js | 34 + ...entifier-shorthand-static-init-await-invalid.js | 27 + ...identifier-shorthand-static-init-await-valid.js | 20 + ...ntifier-shorthand-static-invalid-strict-mode.js | 34 + ...entifier-shorthand-yield-invalid-strict-mode.js | 34 + .../expressions/object/let-non-strict-access.js | 14 + .../expressions/object/let-non-strict-syntax.js | 12 + .../object/literal-property-name-bigint.js | 56 + .../async-await-as-binding-identifier-escaped.js | 33 + .../async-await-as-binding-identifier.js | 33 + .../async-await-as-identifier-reference-escaped.js | 33 + .../async-await-as-identifier-reference.js | 33 + .../async-await-as-label-identifier-escaped.js | 33 + .../async-await-as-label-identifier.js | 33 + ...sync-gen-await-as-binding-identifier-escaped.js | 32 + .../async-gen-await-as-binding-identifier.js | 32 + ...nc-gen-await-as-identifier-reference-escaped.js | 32 + .../async-gen-await-as-identifier-reference.js | 32 + .../async-gen-await-as-label-identifier-escaped.js | 32 + .../async-gen-await-as-label-identifier.js | 32 + ...n-meth-array-destructuring-param-strict-body.js | 119 + .../async-gen-meth-dflt-params-abrupt.js | 49 + ...c-gen-meth-dflt-params-arg-val-not-undefined.js | 73 + ...async-gen-meth-dflt-params-arg-val-undefined.js | 56 + .../async-gen-meth-dflt-params-duplicates.js | 48 + .../async-gen-meth-dflt-params-ref-later.js | 50 + .../async-gen-meth-dflt-params-ref-prior.js | 53 + .../async-gen-meth-dflt-params-ref-self.js | 50 + .../async-gen-meth-dflt-params-rest.js | 52 + .../async-gen-meth-dflt-params-trailing-comma.js | 48 + .../async-gen-meth-escaped-async.js | 27 + .../async-gen-meth-eval-var-scope-syntax-err.js | 45 + ...-meth-object-destructuring-param-strict-body.js | 119 + ...sync-gen-meth-params-trailing-comma-multiple.js | 48 + .../async-gen-meth-params-trailing-comma-single.js | 47 + .../async-gen-meth-rest-param-strict-body.js | 119 + ...-meth-rest-params-trailing-comma-early-error.js | 45 + ...sync-gen-yield-as-binding-identifier-escaped.js | 32 + .../async-gen-yield-as-binding-identifier.js | 32 + ...nc-gen-yield-as-identifier-reference-escaped.js | 32 + .../async-gen-yield-as-identifier-reference.js | 32 + .../async-gen-yield-as-label-identifier-escaped.js | 32 + .../async-gen-yield-as-label-identifier.js | 32 + .../async-gen-yield-identifier-non-strict.js | 47 + ...async-gen-yield-identifier-spread-non-strict.js | 65 + ...nc-gen-yield-identifier-spread-strict-strict.js | 48 + .../async-gen-yield-identifier-strict-strict.js | 39 + .../async-gen-yield-promise-reject-next-catch.js | 44 + ...mise-reject-next-for-await-of-async-iterator.js | 50 + ...omise-reject-next-for-await-of-sync-iterator.js | 49 + ...romise-reject-next-yield-star-async-iterator.js | 48 + ...promise-reject-next-yield-star-sync-iterator.js | 47 + .../async-gen-yield-promise-reject-next.js | 44 + .../async-gen-yield-spread-arr-multiple.js | 50 + .../async-gen-yield-spread-arr-single.js | 49 + .../async-gen-yield-spread-obj.js | 52 + .../async-gen-yield-star-async-next.js | 219 ++ .../async-gen-yield-star-async-return.js | 235 ++ .../async-gen-yield-star-async-throw.js | 243 ++ .../async-gen-yield-star-expr-abrupt.js | 54 + ...sync-gen-yield-star-getiter-async-get-abrupt.js | 74 + ...tar-getiter-async-not-callable-boolean-throw.js | 73 + ...star-getiter-async-not-callable-number-throw.js | 73 + ...star-getiter-async-not-callable-object-throw.js | 73 + ...star-getiter-async-not-callable-string-throw.js | 73 + ...star-getiter-async-not-callable-symbol-throw.js | 73 + ...ield-star-getiter-async-null-sync-get-abrupt.js | 79 + ...-gen-yield-star-getiter-async-returns-abrupt.js | 70 + ...eld-star-getiter-async-returns-boolean-throw.js | 70 + ...-yield-star-getiter-async-returns-null-throw.js | 70 + ...ield-star-getiter-async-returns-number-throw.js | 70 + ...ield-star-getiter-async-returns-string-throw.js | 70 + ...ield-star-getiter-async-returns-symbol-throw.js | 70 + ...d-star-getiter-async-returns-undefined-throw.js | 70 + ...star-getiter-async-undefined-sync-get-abrupt.js | 79 + ...async-gen-yield-star-getiter-sync-get-abrupt.js | 73 + ...star-getiter-sync-not-callable-boolean-throw.js | 72 + ...-star-getiter-sync-not-callable-number-throw.js | 72 + ...-star-getiter-sync-not-callable-object-throw.js | 72 + ...-star-getiter-sync-not-callable-string-throw.js | 72 + ...-star-getiter-sync-not-callable-symbol-throw.js | 72 + ...c-gen-yield-star-getiter-sync-returns-abrupt.js | 67 + ...ield-star-getiter-sync-returns-boolean-throw.js | 72 + ...n-yield-star-getiter-sync-returns-null-throw.js | 72 + ...yield-star-getiter-sync-returns-number-throw.js | 72 + ...yield-star-getiter-sync-returns-string-throw.js | 72 + ...yield-star-getiter-sync-returns-symbol-throw.js | 72 + ...ld-star-getiter-sync-returns-undefined-throw.js | 72 + ...ync-gen-yield-star-next-call-done-get-abrupt.js | 73 + ...sync-gen-yield-star-next-call-returns-abrupt.js | 65 + ...nc-gen-yield-star-next-call-value-get-abrupt.js | 75 + .../async-gen-yield-star-next-get-abrupt.js | 65 + ...-gen-yield-star-next-non-object-ignores-then.js | 85 + ...n-yield-star-next-not-callable-boolean-throw.js | 62 + ...-gen-yield-star-next-not-callable-null-throw.js | 62 + ...en-yield-star-next-not-callable-number-throw.js | 62 + ...en-yield-star-next-not-callable-object-throw.js | 62 + ...en-yield-star-next-not-callable-string-throw.js | 62 + ...en-yield-star-next-not-callable-symbol-throw.js | 62 + ...yield-star-next-not-callable-undefined-throw.js | 62 + .../async-gen-yield-star-next-then-get-abrupt.js | 89 + ...ext-then-non-callable-boolean-fulfillpromise.js | 83 + ...r-next-then-non-callable-null-fulfillpromise.js | 83 + ...next-then-non-callable-number-fulfillpromise.js | 83 + ...next-then-non-callable-object-fulfillpromise.js | 83 + ...next-then-non-callable-string-fulfillpromise.js | 83 + ...next-then-non-callable-symbol-fulfillpromise.js | 83 + ...t-then-non-callable-undefined-fulfillpromise.js | 83 + ...sync-gen-yield-star-next-then-returns-abrupt.js | 89 + .../async-gen-yield-star-sync-next.js | 222 ++ .../async-gen-yield-star-sync-return.js | 197 ++ .../async-gen-yield-star-sync-throw.js | 203 ++ ...c-meth-array-destructuring-param-strict-body.js | 112 + .../async-meth-dflt-params-abrupt.js | 46 + ...async-meth-dflt-params-arg-val-not-undefined.js | 66 + .../async-meth-dflt-params-arg-val-undefined.js | 49 + .../async-meth-dflt-params-duplicates.js | 41 + .../async-meth-dflt-params-ref-later.js | 47 + .../async-meth-dflt-params-ref-prior.js | 46 + .../async-meth-dflt-params-ref-self.js | 47 + .../async-meth-dflt-params-rest.js | 45 + .../async-meth-dflt-params-trailing-comma.js | 41 + .../method-definition/async-meth-escaped-async.js | 27 + .../async-meth-eval-var-scope-syntax-err.js | 42 + ...-meth-object-destructuring-param-strict-body.js | 112 + .../async-meth-params-trailing-comma-multiple.js | 41 + .../async-meth-params-trailing-comma-single.js | 40 + .../async-meth-rest-param-strict-body.js | 112 + ...-meth-rest-params-trailing-comma-early-error.js | 38 + ...arrow-returns-arguments-from-parent-function.js | 35 + .../async-returns-async-arrow-returns-newtarget.js | 34 + .../method-definition/async-returns-async-arrow.js | 34 + ...function-returns-arguments-from-own-function.js | 35 + ...ync-returns-async-function-returns-newtarget.js | 34 + .../async-returns-async-function.js | 34 + .../method-definition/async-super-call-body.js | 28 + .../method-definition/async-super-call-param.js | 29 + .../object/method-definition/browser.js | 0 .../computed-property-name-yield-expression.js | 40 + ...ors-object-async-method-duplicate-parameters.js | 29 + .../early-errors-object-method-NSPL-with-USD.js | 18 + ...method-arguments-in-formal-parameters-strict.js | 20 + ...ly-errors-object-method-async-lineterminator.js | 23 + ...rrors-object-method-await-in-formals-default.js | 19 + .../early-errors-object-method-await-in-formals.js | 18 + ...rrors-object-method-body-contains-super-call.js | 18 + ...ly-errors-object-method-duplicate-parameters.js | 28 + ...ject-method-eval-in-formal-parameters-strict.js | 20 + ...-errors-object-method-formals-body-duplicate.js | 19 + ...rs-object-method-formals-contains-super-call.js | 17 + .../object/method-definition/escaped-get-e.js | 26 + .../object/method-definition/escaped-get-g.js | 26 + .../object/method-definition/escaped-get-t.js | 26 + .../object/method-definition/escaped-get.js | 26 + .../object/method-definition/escaped-set-e.js | 26 + .../object/method-definition/escaped-set-s.js | 26 + .../object/method-definition/escaped-set-t.js | 26 + .../object/method-definition/escaped-set.js | 26 + .../object/method-definition/fn-name-fn.js | 48 + .../object/method-definition/fn-name-gen.js | 49 + ...h-forbidden-ext-direct-access-prop-arguments.js | 40 + ...meth-forbidden-ext-direct-access-prop-caller.js | 40 + ...h-forbidden-ext-direct-access-prop-arguments.js | 41 + ...meth-forbidden-ext-direct-access-prop-caller.js | 41 + .../method-definition/forbidden-ext/b1/browser.js | 0 ...h-forbidden-ext-direct-access-prop-arguments.js | 38 + ...meth-forbidden-ext-direct-access-prop-caller.js | 38 + ...h-forbidden-ext-direct-access-prop-arguments.js | 35 + ...meth-forbidden-ext-direct-access-prop-caller.js | 35 + .../method-definition/forbidden-ext/b1/shell.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 66 + ...en-ext-indirect-access-own-prop-caller-value.js | 66 + ...th-forbidden-ext-indirect-access-prop-caller.js | 66 + ...dden-ext-indirect-access-own-prop-caller-get.js | 67 + ...en-ext-indirect-access-own-prop-caller-value.js | 67 + ...th-forbidden-ext-indirect-access-prop-caller.js | 67 + .../method-definition/forbidden-ext/b2/browser.js | 0 ...dden-ext-indirect-access-own-prop-caller-get.js | 64 + ...en-ext-indirect-access-own-prop-caller-value.js | 64 + ...th-forbidden-ext-indirect-access-prop-caller.js | 64 + ...dden-ext-indirect-access-own-prop-caller-get.js | 62 + ...en-ext-indirect-access-own-prop-caller-value.js | 62 + ...th-forbidden-ext-indirect-access-prop-caller.js | 62 + .../method-definition/forbidden-ext/b2/shell.js | 0 .../method-definition/forbidden-ext/browser.js | 0 .../method-definition/forbidden-ext/shell.js | 0 ...n-meth-array-destructuring-param-strict-body.js | 141 ++ .../gen-meth-dflt-params-abrupt.js | 71 + .../gen-meth-dflt-params-arg-val-not-undefined.js | 96 + .../gen-meth-dflt-params-arg-val-undefined.js | 79 + .../gen-meth-dflt-params-duplicates.js | 70 + .../gen-meth-dflt-params-ref-later.js | 72 + .../gen-meth-dflt-params-ref-prior.js | 76 + .../gen-meth-dflt-params-ref-self.js | 72 + .../method-definition/gen-meth-dflt-params-rest.js | 74 + .../gen-meth-dflt-params-trailing-comma.js | 71 + .../gen-meth-eval-var-scope-syntax-err.js | 67 + ...-meth-object-destructuring-param-strict-body.js | 141 ++ .../gen-meth-params-trailing-comma-multiple.js | 71 + .../gen-meth-params-trailing-comma-single.js | 70 + .../gen-meth-rest-param-strict-body.js | 141 ++ ...-meth-rest-params-trailing-comma-early-error.js | 67 + .../gen-yield-as-binding-identifier-escaped.js | 32 + .../gen-yield-as-binding-identifier.js | 32 + .../gen-yield-as-identifier-reference-escaped.js | 32 + .../gen-yield-as-identifier-reference.js | 32 + .../gen-yield-as-label-identifier-escaped.js | 32 + .../gen-yield-as-label-identifier.js | 32 + .../gen-yield-identifier-non-strict.js | 43 + .../gen-yield-identifier-spread-non-strict.js | 65 + .../gen-yield-identifier-spread-strict-strict.js | 48 + .../gen-yield-identifier-strict-strict.js | 39 + .../gen-yield-spread-arr-multiple.js | 46 + .../gen-yield-spread-arr-single.js | 48 + .../method-definition/gen-yield-spread-obj.js | 51 + .../method-definition/generator-invoke-ctor.js | 17 + .../generator-invoke-fn-no-strict.js | 25 + .../generator-invoke-fn-strict.js | 25 + .../method-definition/generator-length-dflt.js | 70 + .../object/method-definition/generator-length.js | 22 + .../generator-name-prop-string.js | 22 + .../generator-name-prop-symbol.js | 23 + .../object/method-definition/generator-no-yield.js | 22 + .../method-definition/generator-param-id-yield.js | 21 + .../generator-param-init-yield.js | 23 + .../generator-param-redecl-const.js | 24 + .../generator-param-redecl-let.js | 24 + .../object/method-definition/generator-params.js | 30 + .../generator-prop-name-eval-error.js | 17 + .../generator-prop-name-yield-expr.js | 37 + .../generator-prop-name-yield-id.js | 24 + .../method-definition/generator-property-desc.js | 21 + .../method-definition/generator-prototype-prop.js | 26 + .../method-definition/generator-prototype.js | 18 + .../object/method-definition/generator-return.js | 25 + .../method-definition/generator-super-call-body.js | 24 + .../generator-super-call-param.js | 23 + .../method-definition/generator-super-prop-body.js | 25 + .../generator-super-prop-param.js | 23 + .../generator-use-strict-with-non-simple-param.js | 25 + .../meth-array-destructuring-param-strict-body.js | 137 + .../method-definition/meth-dflt-params-abrupt.js | 67 + .../meth-dflt-params-arg-val-not-undefined.js | 92 + .../meth-dflt-params-arg-val-undefined.js | 75 + .../meth-dflt-params-duplicates.js | 66 + .../meth-dflt-params-ref-later.js | 68 + .../meth-dflt-params-ref-prior.js | 72 + .../method-definition/meth-dflt-params-ref-self.js | 68 + .../method-definition/meth-dflt-params-rest.js | 70 + .../meth-dflt-params-trailing-comma.js | 66 + .../meth-eval-var-scope-syntax-err.js | 63 + .../meth-object-destructuring-param-strict-body.js | 137 + .../meth-params-trailing-comma-multiple.js | 66 + .../meth-params-trailing-comma-single.js | 65 + .../meth-rest-param-strict-body.js | 137 + .../meth-rest-params-trailing-comma-early-error.js | 62 + .../object/method-definition/name-invoke-ctor.js | 15 + .../method-definition/name-invoke-fn-no-strict.js | 24 + .../method-definition/name-invoke-fn-strict.js | 24 + .../object/method-definition/name-length-dflt.js | 70 + .../object/method-definition/name-length.js | 21 + .../method-definition/name-name-prop-string.js | 21 + .../method-definition/name-name-prop-symbol.js | 23 + .../method-definition/name-param-id-yield.js | 21 + .../method-definition/name-param-init-yield.js | 23 + .../object/method-definition/name-param-redecl.js | 22 + .../object/method-definition/name-params.js | 28 + .../method-definition/name-prop-name-eval-error.js | 16 + .../method-definition/name-prop-name-yield-expr.js | 37 + .../method-definition/name-prop-name-yield-id.js | 23 + .../object/method-definition/name-property-desc.js | 20 + .../method-definition/name-prototype-prop.js | 17 + .../object/method-definition/name-prototype.js | 13 + .../method-definition/name-super-call-body.js | 20 + .../method-definition/name-super-call-param.js | 18 + .../method-definition/name-super-prop-body.js | 21 + .../method-definition/name-super-prop-param.js | 21 + .../object-method-returns-promise.js | 18 + .../params-dflt-gen-meth-args-unmapped.js | 90 + .../params-dflt-gen-meth-ref-arguments.js | 69 + .../params-dflt-meth-args-unmapped.js | 87 + .../params-dflt-meth-ref-arguments.js | 66 + ...ivate-name-early-error-async-fn-inside-class.js | 27 + .../private-name-early-error-async-fn.js | 25 + ...vate-name-early-error-async-gen-inside-class.js | 27 + .../private-name-early-error-async-gen.js | 25 + .../private-name-early-error-gen-inside-class.js | 27 + .../private-name-early-error-gen.js | 25 + ...ate-name-early-error-get-method-inside-class.js | 27 + .../private-name-early-error-get-method.js | 25 + ...private-name-early-error-method-inside-class.js | 27 + .../private-name-early-error-method.js | 25 + ...ate-name-early-error-set-method-inside-class.js | 27 + .../private-name-early-error-set-method.js | 25 + .../setter-use-strict-with-non-simple-param.js | 24 + .../expressions/object/method-definition/shell.js | 0 .../static-init-await-binding-accessor.js | 20 + .../static-init-await-binding-generator.js | 20 + .../static-init-await-binding-normal.js | 20 + .../static-init-await-reference-accessor.js | 30 + .../static-init-await-reference-generator.js | 30 + .../static-init-await-reference-normal.js | 30 + .../use-strict-with-non-simple-param.js | 24 + .../yield-as-expression-with-rhs.js | 120 + .../yield-as-expression-without-rhs.js | 130 + ...ld-as-function-expression-binding-identifier.js | 25 + ...yield-as-generator-method-binding-identifier.js | 30 + .../yield-as-identifier-in-nested-function.js | 26 + .../yield-as-literal-property-name.js | 23 + .../yield-as-logical-or-expression.js | 21 + .../object/method-definition/yield-as-parameter.js | 20 + .../method-definition/yield-as-property-name.js | 23 + .../object/method-definition/yield-as-statement.js | 49 + .../method-definition/yield-as-yield-operand.js | 33 + .../object/method-definition/yield-newline.js | 29 + .../object/method-definition/yield-return.js | 22 + .../method-definition/yield-star-after-newline.js | 22 + .../method-definition/yield-star-before-newline.js | 24 + .../object/method-definition/yield-weak-binding.js | 19 + .../test262/language/expressions/object/method.js | 30 + .../language/expressions/object/not-defined.js | 13 + ...spread-proxy-get-not-called-on-dontenum-keys.js | 73 + .../object/object-spread-proxy-no-excluded-keys.js | 49 + ...ect-spread-proxy-ownkeys-returned-keys-order.js | 48 + .../expressions/object/prop-def-id-eval-error-2.js | 24 + .../expressions/object/prop-def-id-eval-error.js | 23 + .../expressions/object/prop-def-id-get-error.js | 14 + .../expressions/object/prop-def-id-valid.js | 25 + .../object/prop-def-invalid-async-prefix.js | 36 + .../object/prop-def-invalid-star-prefix.js | 22 + .../expressions/object/prop-dup-data-data.js | 22 + .../expressions/object/prop-dup-data-set.js | 16 + .../expressions/object/prop-dup-get-data.js | 16 + .../expressions/object/prop-dup-get-get.js | 14 + .../expressions/object/prop-dup-get-set-get.js | 17 + .../expressions/object/prop-dup-set-data.js | 16 + .../expressions/object/prop-dup-set-get-set.js | 17 + .../expressions/object/prop-dup-set-set.js | 14 + .../object/properties-names-eval-arguments.js | 20 + .../expressions/object/property-name-yield.js | 12 + .../object/scope-gen-meth-body-lex-distinct.js | 58 + .../object/scope-gen-meth-param-elem-var-close.js | 35 + .../object/scope-gen-meth-param-elem-var-open.js | 32 + .../scope-gen-meth-param-rest-elem-var-close.js | 33 + .../scope-gen-meth-param-rest-elem-var-open.js | 32 + .../object/scope-gen-meth-paramsbody-var-close.js | 39 + .../object/scope-gen-meth-paramsbody-var-open.js | 37 + .../object/scope-getter-body-lex-distinc.js | 57 + .../object/scope-meth-body-lex-distinct.js | 55 + .../object/scope-meth-param-elem-var-close.js | 34 + .../object/scope-meth-param-elem-var-open.js | 31 + .../object/scope-meth-param-rest-elem-var-close.js | 32 + .../object/scope-meth-param-rest-elem-var-open.js | 31 + .../object/scope-meth-paramsbody-var-close.js | 38 + .../object/scope-meth-paramsbody-var-open.js | 36 + .../object/scope-setter-body-lex-distinc.js | 57 + .../object/scope-setter-paramsbody-var-close.js | 38 + .../object/scope-setter-paramsbody-var-open.js | 36 + .../object/setter-body-strict-inside.js | 23 + .../object/setter-body-strict-outside-strict.js | 22 + .../expressions/object/setter-length-dflt.js | 43 + .../object/setter-param-arguments-strict-inside.js | 22 + ...setter-param-arguments-strict-outside-strict.js | 21 + .../object/setter-param-eval-strict-inside.js | 22 + .../setter-param-eval-strict-outside-strict.js | 21 + .../expressions/object/setter-prop-desc.js | 42 + .../expressions/object/setter-super-prop.js | 31 + .../test262/language/expressions/object/shell.js | 0 .../expressions/object/yield-non-strict-access.js | 14 + .../expressions/object/yield-non-strict-syntax.js | 12 + .../expressions/optional-chaining/browser.js | 0 .../call-expression-super-no-base.js | 24 + .../optional-chaining/call-expression.js | 77 + ...rs-tail-position-null-op-template-string-esi.js | 26 + ...errors-tail-position-null-op-template-string.js | 23 + ...l-position-null-optchain-template-string-esi.js | 26 + ...-tail-position-null-optchain-template-string.js | 23 + ...-errors-tail-position-op-template-string-esi.js | 28 + ...arly-errors-tail-position-op-template-string.js | 25 + ...s-tail-position-optchain-template-string-esi.js | 28 + ...rrors-tail-position-optchain-template-string.js | 25 + .../optional-chaining/eval-optional-call.js | 41 + .../optional-chaining/iteration-statement-do.js | 20 + .../iteration-statement-for-await-of.js | 37 + .../iteration-statement-for-in.js | 24 + .../iteration-statement-for-of-type-error.js | 30 + .../optional-chaining/iteration-statement-for.js | 45 + .../optional-chaining/iteration-statement-while.js | 20 + .../member-expression-async-identifier.js | 34 + .../member-expression-async-literal.js | 21 + .../member-expression-async-this.js | 21 + .../optional-chaining/member-expression.js | 106 + .../optional-chaining/new-target-optional-call.js | 32 + .../optional-call-preserves-this.js | 29 + ...l-chain-async-optional-chain-square-brackets.js | 30 + .../optional-chain-async-square-brackets.js | 26 + ...ptional-chain-expression-optional-expression.js | 22 + .../optional-chain-prod-arguments.js | 21 + .../optional-chain-prod-expression.js | 44 + .../optional-chain-prod-identifiername.js | 40 + .../optional-chaining/optional-chain.js | 52 + .../optional-chaining/optional-expression.js | 29 + .../punctuator-decimal-lookahead.js | 17 + .../runtime-semantics-evaluation.js | 20 + .../expressions/optional-chaining/shell.js | 113 + .../optional-chaining/short-circuiting.js | 24 + .../static-semantics-simple-assignment.js | 24 + .../super-property-optional-call.js | 32 + .../optional-chaining/update-expression-postfix.js | 24 + .../optional-chaining/update-expression-prefix.js | 24 + .../expressions/postfix-decrement/11.3.2-2-3-s.js | 18 + .../postfix-decrement/S11.3.2_A2.1_T1.js | 41 + .../postfix-decrement/S11.3.2_A2.1_T2.js | 21 + .../postfix-decrement/S11.3.2_A2.2_T1.js | 110 + .../expressions/postfix-decrement/S11.3.2_A3_T1.js | 24 + .../expressions/postfix-decrement/S11.3.2_A3_T2.js | 24 + .../expressions/postfix-decrement/S11.3.2_A3_T3.js | 31 + .../expressions/postfix-decrement/S11.3.2_A3_T4.js | 24 + .../expressions/postfix-decrement/S11.3.2_A3_T5.js | 24 + .../expressions/postfix-decrement/S11.3.2_A4_T1.js | 24 + .../expressions/postfix-decrement/S11.3.2_A4_T2.js | 24 + .../expressions/postfix-decrement/S11.3.2_A4_T3.js | 31 + .../expressions/postfix-decrement/S11.3.2_A4_T4.js | 24 + .../expressions/postfix-decrement/S11.3.2_A4_T5.js | 24 + .../expressions/postfix-decrement/S11.3.2_A5_T1.js | 38 + .../expressions/postfix-decrement/S11.3.2_A5_T2.js | 35 + .../expressions/postfix-decrement/S11.3.2_A5_T3.js | 39 + .../expressions/postfix-decrement/S11.3.2_A6_T1.js | 33 + .../expressions/postfix-decrement/S11.3.2_A6_T2.js | 33 + .../expressions/postfix-decrement/S11.3.2_A6_T3.js | 24 + .../postfix-decrement/arguments-nostrict.js | 27 + .../postfix-decrement/arguments-strict.js | 28 + .../expressions/postfix-decrement/bigint.js | 64 + .../expressions/postfix-decrement/browser.js | 0 .../expressions/postfix-decrement/eval-nostrict.js | 25 + .../expressions/postfix-decrement/eval-strict.js | 28 + .../line-terminator-carriage-return.js | 19 + .../postfix-decrement/line-terminator-line-feed.js | 18 + .../line-terminator-line-separator.js | 18 + .../line-terminator-paragraph-separator.js | 19 + ...fix-decrement-calls-putvalue-lhs-newvalue--1.js | 41 + ...stfix-decrement-calls-putvalue-lhs-newvalue-.js | 42 + .../expressions/postfix-decrement/shell.js | 0 .../postfix-decrement/target-cover-id.js | 33 + .../postfix-decrement/target-cover-newtarget.js | 32 + .../postfix-decrement/target-cover-yieldexpr.js | 35 + .../postfix-decrement/target-newtarget.js | 32 + .../language/expressions/postfix-decrement/this.js | 28 + .../expressions/postfix-decrement/whitespace.js | 30 + .../postfix-increment/11.3.1-2-1gs-strict.js | 19 + .../expressions/postfix-increment/11.3.1-2-3.js | 18 + .../postfix-increment/S11.3.1_A2.1_T1.js | 44 + .../postfix-increment/S11.3.1_A2.1_T2.js | 21 + .../postfix-increment/S11.3.1_A2.2_T1.js | 110 + .../expressions/postfix-increment/S11.3.1_A3_T1.js | 24 + .../expressions/postfix-increment/S11.3.1_A3_T2.js | 24 + .../expressions/postfix-increment/S11.3.1_A3_T3.js | 31 + .../expressions/postfix-increment/S11.3.1_A3_T4.js | 24 + .../expressions/postfix-increment/S11.3.1_A3_T5.js | 24 + .../expressions/postfix-increment/S11.3.1_A4_T1.js | 24 + .../expressions/postfix-increment/S11.3.1_A4_T2.js | 24 + .../expressions/postfix-increment/S11.3.1_A4_T3.js | 31 + .../expressions/postfix-increment/S11.3.1_A4_T4.js | 24 + .../expressions/postfix-increment/S11.3.1_A4_T5.js | 24 + .../expressions/postfix-increment/S11.3.1_A5_T1.js | 38 + .../expressions/postfix-increment/S11.3.1_A5_T2.js | 35 + .../expressions/postfix-increment/S11.3.1_A5_T3.js | 39 + .../expressions/postfix-increment/S11.3.1_A6_T1.js | 33 + .../expressions/postfix-increment/S11.3.1_A6_T2.js | 33 + .../expressions/postfix-increment/S11.3.1_A6_T3.js | 24 + .../postfix-increment/arguments-nostrict.js | 27 + .../postfix-increment/arguments-strict.js | 24 + .../expressions/postfix-increment/bigint.js | 64 + .../expressions/postfix-increment/browser.js | 0 .../expressions/postfix-increment/eval-nostrict.js | 25 + .../expressions/postfix-increment/eval-strict.js | 24 + .../line-terminator-carriage-return.js | 19 + .../postfix-increment/line-terminator-line-feed.js | 18 + .../line-terminator-line-separator.js | 18 + .../line-terminator-paragraph-separator.js | 19 + ...fix-increment-calls-putvalue-lhs-newvalue--1.js | 41 + ...stfix-increment-calls-putvalue-lhs-newvalue-.js | 42 + .../expressions/postfix-increment/shell.js | 0 .../postfix-increment/target-cover-id.js | 33 + .../postfix-increment/target-cover-newtarget.js | 32 + .../postfix-increment/target-cover-yieldexpr.js | 35 + .../postfix-increment/target-newtarget.js | 32 + .../language/expressions/postfix-increment/this.js | 28 + .../expressions/postfix-increment/whitespace.js | 30 + .../prefix-decrement/11.4.5-2-2gs-strict.js | 19 + .../expressions/prefix-decrement/11.4.5-2-3-s.js | 16 + .../prefix-decrement/S11.4.5_A2.1_T1.js | 41 + .../prefix-decrement/S11.4.5_A2.1_T2.js | 21 + .../prefix-decrement/S11.4.5_A2.2_T1.js | 104 + .../expressions/prefix-decrement/S11.4.5_A3_T1.js | 24 + .../expressions/prefix-decrement/S11.4.5_A3_T2.js | 24 + .../expressions/prefix-decrement/S11.4.5_A3_T3.js | 31 + .../expressions/prefix-decrement/S11.4.5_A3_T4.js | 24 + .../expressions/prefix-decrement/S11.4.5_A3_T5.js | 24 + .../expressions/prefix-decrement/S11.4.5_A4_T1.js | 22 + .../expressions/prefix-decrement/S11.4.5_A4_T2.js | 22 + .../expressions/prefix-decrement/S11.4.5_A4_T3.js | 28 + .../expressions/prefix-decrement/S11.4.5_A4_T4.js | 22 + .../expressions/prefix-decrement/S11.4.5_A4_T5.js | 22 + .../expressions/prefix-decrement/S11.4.5_A5_T1.js | 38 + .../expressions/prefix-decrement/S11.4.5_A5_T2.js | 35 + .../expressions/prefix-decrement/S11.4.5_A5_T3.js | 39 + .../expressions/prefix-decrement/S11.4.5_A6_T1.js | 33 + .../expressions/prefix-decrement/S11.4.5_A6_T2.js | 33 + .../expressions/prefix-decrement/S11.4.5_A6_T3.js | 24 + .../prefix-decrement/arguments-nostrict.js | 27 + .../prefix-decrement/arguments-strict.js | 28 + .../expressions/prefix-decrement/bigint.js | 64 + .../expressions/prefix-decrement/browser.js | 0 .../expressions/prefix-decrement/eval-nostrict.js | 25 + .../expressions/prefix-decrement/eval-strict.js | 28 + ...x-decrement-x-calls-putvalue-lhs-newvalue--1.js | 41 + ...fix-decrement-x-calls-putvalue-lhs-newvalue-.js | 42 + .../language/expressions/prefix-decrement/shell.js | 0 .../prefix-decrement/target-cover-id.js | 31 + .../prefix-decrement/target-cover-newtarget.js | 32 + .../prefix-decrement/target-cover-yieldexpr.js | 35 + .../prefix-decrement/target-newtarget.js | 32 + .../language/expressions/prefix-decrement/this.js | 28 + .../expressions/prefix-decrement/whitespace.js | 52 + .../expressions/prefix-increment/11.4.4-2-3-s.js | 16 + .../prefix-increment/S11.4.4_A2.1_T1.js | 41 + .../prefix-increment/S11.4.4_A2.1_T2.js | 21 + .../prefix-increment/S11.4.4_A2.2_T1.js | 104 + .../expressions/prefix-increment/S11.4.4_A3_T1.js | 24 + .../expressions/prefix-increment/S11.4.4_A3_T2.js | 24 + .../expressions/prefix-increment/S11.4.4_A3_T3.js | 31 + .../expressions/prefix-increment/S11.4.4_A3_T4.js | 24 + .../expressions/prefix-increment/S11.4.4_A3_T5.js | 24 + .../expressions/prefix-increment/S11.4.4_A4_T1.js | 22 + .../expressions/prefix-increment/S11.4.4_A4_T2.js | 22 + .../expressions/prefix-increment/S11.4.4_A4_T3.js | 28 + .../expressions/prefix-increment/S11.4.4_A4_T4.js | 22 + .../expressions/prefix-increment/S11.4.4_A4_T5.js | 22 + .../expressions/prefix-increment/S11.4.4_A5_T1.js | 38 + .../expressions/prefix-increment/S11.4.4_A5_T2.js | 35 + .../expressions/prefix-increment/S11.4.4_A5_T3.js | 39 + .../expressions/prefix-increment/S11.4.4_A6_T1.js | 33 + .../expressions/prefix-increment/S11.4.4_A6_T2.js | 33 + .../expressions/prefix-increment/S11.4.4_A6_T3.js | 24 + .../prefix-increment/arguments-nostrict.js | 27 + .../prefix-increment/arguments-strict.js | 28 + .../expressions/prefix-increment/bigint.js | 64 + .../expressions/prefix-increment/browser.js | 0 .../expressions/prefix-increment/eval-nostrict.js | 25 + .../expressions/prefix-increment/eval-strict.js | 29 + ...x-increment-x-calls-putvalue-lhs-newvalue--1.js | 41 + ...fix-increment-x-calls-putvalue-lhs-newvalue-.js | 42 + .../language/expressions/prefix-increment/shell.js | 0 .../prefix-increment/target-cover-id.js | 31 + .../prefix-increment/target-cover-newtarget.js | 32 + .../prefix-increment/target-cover-yieldexpr.js | 35 + .../prefix-increment/target-newtarget.js | 32 + .../language/expressions/prefix-increment/this.js | 28 + .../expressions/prefix-increment/whitespace.js | 52 + .../expressions/property-accessors/S11.2.1_A1.1.js | 62 + .../expressions/property-accessors/S11.2.1_A1.2.js | 62 + .../expressions/property-accessors/S11.2.1_A2.js | 34 + .../property-accessors/S11.2.1_A3_T1.js | 33 + .../property-accessors/S11.2.1_A3_T2.js | 43 + .../property-accessors/S11.2.1_A3_T3.js | 43 + .../property-accessors/S11.2.1_A3_T4.js | 35 + .../property-accessors/S11.2.1_A3_T5.js | 35 + .../property-accessors/S11.2.1_A4_T1.js | 40 + .../property-accessors/S11.2.1_A4_T2.js | 20 + .../property-accessors/S11.2.1_A4_T3.js | 20 + .../property-accessors/S11.2.1_A4_T4.js | 26 + .../property-accessors/S11.2.1_A4_T5.js | 40 + .../property-accessors/S11.2.1_A4_T6.js | 20 + .../property-accessors/S11.2.1_A4_T7.js | 28 + .../property-accessors/S11.2.1_A4_T8.js | 64 + .../property-accessors/S11.2.1_A4_T9.js | 92 + .../expressions/property-accessors/S8.12.3_A1.js | 36 + .../expressions/property-accessors/S8.12.3_A2.js | 32 + .../expressions/property-accessors/S8.12.3_A3.js | 62 + .../expressions/property-accessors/browser.js | 0 .../property-accessors/non-identifier-name.js | 21 + .../expressions/property-accessors/shell.js | 0 .../language/expressions/relational/S9.1_A1_T4.js | 26 + .../language/expressions/relational/browser.js | 0 .../language/expressions/relational/shell.js | 0 .../language/expressions/right-shift/S11.7.2_A1.js | 62 + .../expressions/right-shift/S11.7.2_A2.1_T1.js | 43 + .../expressions/right-shift/S11.7.2_A2.1_T2.js | 21 + .../expressions/right-shift/S11.7.2_A2.1_T3.js | 21 + .../expressions/right-shift/S11.7.2_A2.2_T1.js | 71 + .../expressions/right-shift/S11.7.2_A2.3_T1.js | 28 + .../expressions/right-shift/S11.7.2_A2.4_T1.js | 22 + .../expressions/right-shift/S11.7.2_A2.4_T2.js | 26 + .../expressions/right-shift/S11.7.2_A2.4_T3.js | 21 + .../expressions/right-shift/S11.7.2_A2.4_T4.js | 16 + .../expressions/right-shift/S11.7.2_A3_T1.1.js | 32 + .../expressions/right-shift/S11.7.2_A3_T1.2.js | 30 + .../expressions/right-shift/S11.7.2_A3_T1.3.js | 40 + .../expressions/right-shift/S11.7.2_A3_T1.4.js | 30 + .../expressions/right-shift/S11.7.2_A3_T1.5.js | 30 + .../expressions/right-shift/S11.7.2_A3_T2.1.js | 52 + .../expressions/right-shift/S11.7.2_A3_T2.2.js | 62 + .../expressions/right-shift/S11.7.2_A3_T2.3.js | 32 + .../expressions/right-shift/S11.7.2_A3_T2.4.js | 32 + .../expressions/right-shift/S11.7.2_A3_T2.5.js | 52 + .../expressions/right-shift/S11.7.2_A3_T2.6.js | 32 + .../expressions/right-shift/S11.7.2_A3_T2.7.js | 32 + .../expressions/right-shift/S11.7.2_A3_T2.8.js | 32 + .../expressions/right-shift/S11.7.2_A3_T2.9.js | 32 + .../expressions/right-shift/S11.7.2_A4_T1.js | 2571 +++++++++++++++++++ .../expressions/right-shift/S11.7.2_A4_T2.js | 2571 +++++++++++++++++++ .../expressions/right-shift/S11.7.2_A4_T3.js | 2571 +++++++++++++++++++ .../expressions/right-shift/S11.7.2_A4_T4.js | 2566 +++++++++++++++++++ .../expressions/right-shift/S11.7.2_A5.1_T1.js | 60 + .../expressions/right-shift/S11.7.2_A5.2_T1.js | 330 +++ .../expressions/right-shift/bigint-and-number.js | 92 + .../expressions/right-shift/bigint-errors.js | 72 + .../right-shift/bigint-non-primitive.js | 89 + .../expressions/right-shift/bigint-toprimitive.js | 374 +++ .../right-shift/bigint-wrapped-values.js | 47 + .../language/expressions/right-shift/bigint.js | 117 + .../language/expressions/right-shift/browser.js | 0 .../expressions/right-shift/order-of-evaluation.js | 140 ++ .../language/expressions/right-shift/shell.js | 0 js/src/tests/test262/language/expressions/shell.js | 16 + .../strict-does-not-equals/S11.9.5_A1.js | 62 + .../strict-does-not-equals/S11.9.5_A2.1_T1.js | 43 + .../strict-does-not-equals/S11.9.5_A2.1_T2.js | 21 + .../strict-does-not-equals/S11.9.5_A2.1_T3.js | 21 + .../strict-does-not-equals/S11.9.5_A2.4_T1.js | 22 + .../strict-does-not-equals/S11.9.5_A2.4_T2.js | 26 + .../strict-does-not-equals/S11.9.5_A2.4_T3.js | 21 + .../strict-does-not-equals/S11.9.5_A2.4_T4.js | 16 + .../strict-does-not-equals/S11.9.5_A3.js | 32 + .../strict-does-not-equals/S11.9.5_A4.1_T1.js | 55 + .../strict-does-not-equals/S11.9.5_A4.1_T2.js | 55 + .../strict-does-not-equals/S11.9.5_A4.2.js | 20 + .../strict-does-not-equals/S11.9.5_A4.3.js | 57 + .../strict-does-not-equals/S11.9.5_A5.js | 37 + .../strict-does-not-equals/S11.9.5_A6.1.js | 25 + .../strict-does-not-equals/S11.9.5_A6.2.js | 15 + .../strict-does-not-equals/S11.9.5_A7.js | 57 + .../strict-does-not-equals/S11.9.5_A8_T1.js | 65 + .../strict-does-not-equals/S11.9.5_A8_T2.js | 65 + .../strict-does-not-equals/S11.9.5_A8_T3.js | 65 + .../strict-does-not-equals/S11.9.5_A8_T4.js | 80 + .../strict-does-not-equals/S11.9.5_A8_T5.js | 30 + .../strict-does-not-equals/bigint-and-bigint.js | 174 ++ .../strict-does-not-equals/bigint-and-boolean.js | 28 + .../bigint-and-incomparable-primitive.js | 24 + .../bigint-and-non-finite.js | 30 + .../bigint-and-number-extremes.js | 62 + .../strict-does-not-equals/bigint-and-number.js | 52 + .../strict-does-not-equals/bigint-and-object.js | 124 + .../strict-does-not-equals/bigint-and-string.js | 68 + .../expressions/strict-does-not-equals/browser.js | 0 .../expressions/strict-does-not-equals/shell.js | 0 .../expressions/strict-equals/S11.9.4_A1.js | 62 + .../expressions/strict-equals/S11.9.4_A2.1_T1.js | 43 + .../expressions/strict-equals/S11.9.4_A2.1_T2.js | 21 + .../expressions/strict-equals/S11.9.4_A2.1_T3.js | 21 + .../expressions/strict-equals/S11.9.4_A2.4_T1.js | 22 + .../expressions/strict-equals/S11.9.4_A2.4_T2.js | 26 + .../expressions/strict-equals/S11.9.4_A2.4_T3.js | 21 + .../expressions/strict-equals/S11.9.4_A2.4_T4.js | 16 + .../expressions/strict-equals/S11.9.4_A3.js | 32 + .../expressions/strict-equals/S11.9.4_A4.1_T1.js | 55 + .../expressions/strict-equals/S11.9.4_A4.1_T2.js | 55 + .../expressions/strict-equals/S11.9.4_A4.2.js | 20 + .../expressions/strict-equals/S11.9.4_A4.3.js | 57 + .../expressions/strict-equals/S11.9.4_A5.js | 37 + .../expressions/strict-equals/S11.9.4_A6.1.js | 25 + .../expressions/strict-equals/S11.9.4_A6.2.js | 15 + .../expressions/strict-equals/S11.9.4_A7.js | 57 + .../expressions/strict-equals/S11.9.4_A8_T1.js | 65 + .../expressions/strict-equals/S11.9.4_A8_T2.js | 65 + .../expressions/strict-equals/S11.9.4_A8_T3.js | 65 + .../expressions/strict-equals/S11.9.4_A8_T4.js | 80 + .../expressions/strict-equals/S11.9.4_A8_T5.js | 30 + .../expressions/strict-equals/bigint-and-bigint.js | 174 ++ .../strict-equals/bigint-and-boolean.js | 28 + .../bigint-and-incomparable-primitive.js | 24 + .../strict-equals/bigint-and-non-finite.js | 30 + .../strict-equals/bigint-and-number-extremes.js | 71 + .../expressions/strict-equals/bigint-and-number.js | 62 + .../expressions/strict-equals/bigint-and-object.js | 124 + .../expressions/strict-equals/bigint-and-string.js | 68 + .../language/expressions/strict-equals/browser.js | 0 .../language/expressions/strict-equals/shell.js | 0 .../language/expressions/subtraction/S11.6.2_A1.js | 62 + .../expressions/subtraction/S11.6.2_A2.1_T1.js | 43 + .../expressions/subtraction/S11.6.2_A2.1_T2.js | 21 + .../expressions/subtraction/S11.6.2_A2.1_T3.js | 21 + .../expressions/subtraction/S11.6.2_A2.2_T1.js | 71 + .../expressions/subtraction/S11.6.2_A2.3_T1.js | 28 + .../expressions/subtraction/S11.6.2_A2.4_T1.js | 22 + .../expressions/subtraction/S11.6.2_A2.4_T2.js | 26 + .../expressions/subtraction/S11.6.2_A2.4_T3.js | 21 + .../expressions/subtraction/S11.6.2_A2.4_T4.js | 16 + .../expressions/subtraction/S11.6.2_A3_T1.1.js | 32 + .../expressions/subtraction/S11.6.2_A3_T1.2.js | 30 + .../expressions/subtraction/S11.6.2_A3_T1.3.js | 40 + .../expressions/subtraction/S11.6.2_A3_T1.4.js | 30 + .../expressions/subtraction/S11.6.2_A3_T1.5.js | 30 + .../expressions/subtraction/S11.6.2_A3_T2.1.js | 52 + .../expressions/subtraction/S11.6.2_A3_T2.2.js | 62 + .../expressions/subtraction/S11.6.2_A3_T2.3.js | 32 + .../expressions/subtraction/S11.6.2_A3_T2.4.js | 32 + .../expressions/subtraction/S11.6.2_A3_T2.5.js | 52 + .../expressions/subtraction/S11.6.2_A3_T2.6.js | 32 + .../expressions/subtraction/S11.6.2_A3_T2.7.js | 32 + .../expressions/subtraction/S11.6.2_A3_T2.8.js | 32 + .../expressions/subtraction/S11.6.2_A3_T2.9.js | 32 + .../expressions/subtraction/S11.6.2_A4_T1.js | 40 + .../expressions/subtraction/S11.6.2_A4_T2.js | 22 + .../expressions/subtraction/S11.6.2_A4_T3.js | 20 + .../expressions/subtraction/S11.6.2_A4_T4.js | 52 + .../expressions/subtraction/S11.6.2_A4_T5.js | 48 + .../expressions/subtraction/S11.6.2_A4_T6.js | 52 + .../expressions/subtraction/S11.6.2_A4_T7.js | 39 + .../expressions/subtraction/S11.6.2_A4_T8.js | 32 + .../expressions/subtraction/bigint-and-number.js | 92 + .../expressions/subtraction/bigint-arithmetic.js | 1346 ++++++++++ .../expressions/subtraction/bigint-errors.js | 72 + .../expressions/subtraction/bigint-toprimitive.js | 374 +++ .../subtraction/bigint-wrapped-values.js | 47 + .../language/expressions/subtraction/browser.js | 0 .../expressions/subtraction/order-of-evaluation.js | 140 ++ .../language/expressions/subtraction/shell.js | 0 .../test262/language/expressions/super/browser.js | 0 .../expressions/super/call-arg-evaluation-err.js | 39 + .../super/call-bind-this-value-twice.js | 42 + .../expressions/super/call-bind-this-value.js | 32 + .../expressions/super/call-construct-error.js | 40 + .../expressions/super/call-construct-invocation.js | 37 + .../language/expressions/super/call-expr-value.js | 31 + .../super/call-poisoned-underscore-proto.js | 25 + .../expressions/super/call-proto-not-ctor.js | 43 + .../super/call-spread-err-mult-err-expr-throws.js | 44 + .../call-spread-err-mult-err-iter-get-value.js | 55 + .../super/call-spread-err-mult-err-itr-get-call.js | 53 + .../super/call-spread-err-mult-err-itr-get-get.js | 54 + .../super/call-spread-err-mult-err-itr-step.js | 63 + .../super/call-spread-err-mult-err-itr-value.js | 66 + .../call-spread-err-mult-err-obj-unresolvable.js | 45 + .../super/call-spread-err-mult-err-unresolvable.js | 49 + .../super/call-spread-err-sngl-err-expr-throws.js | 44 + .../super/call-spread-err-sngl-err-itr-get-call.js | 54 + .../super/call-spread-err-sngl-err-itr-get-get.js | 55 + .../call-spread-err-sngl-err-itr-get-value.js | 54 + .../super/call-spread-err-sngl-err-itr-step.js | 67 + .../super/call-spread-err-sngl-err-itr-value.js | 73 + .../call-spread-err-sngl-err-obj-unresolvable.js | 45 + .../super/call-spread-err-sngl-err-unresolvable.js | 50 + .../expressions/super/call-spread-mult-empty.js | 53 + .../expressions/super/call-spread-mult-expr.js | 58 + .../expressions/super/call-spread-mult-iter.js | 70 + .../expressions/super/call-spread-mult-literal.js | 55 + .../super/call-spread-mult-obj-ident.js | 80 + .../expressions/super/call-spread-mult-obj-null.js | 51 + .../super/call-spread-mult-obj-undefined.js | 51 + .../super/call-spread-obj-getter-descriptor.js | 65 + .../super/call-spread-obj-getter-init.js | 45 + ...l-spread-obj-manipulate-outter-obj-in-getter.js | 59 + .../super/call-spread-obj-mult-spread-getter.js | 59 + .../super/call-spread-obj-mult-spread.js | 57 + .../expressions/super/call-spread-obj-null.js | 49 + .../super/call-spread-obj-override-immutable.js | 58 + .../call-spread-obj-overrides-prev-properties.js | 55 + .../super/call-spread-obj-skip-non-enumerable.js | 43 + .../super/call-spread-obj-spread-order.js | 56 + .../super/call-spread-obj-symbol-property.js | 57 + .../expressions/super/call-spread-obj-undefined.js | 49 + .../super/call-spread-obj-with-overrides.js | 61 + .../expressions/super/call-spread-sngl-empty.js | 52 + .../expressions/super/call-spread-sngl-expr.js | 60 + .../expressions/super/call-spread-sngl-iter.js | 67 + .../expressions/super/call-spread-sngl-literal.js | 57 + .../super/call-spread-sngl-obj-ident.js | 66 + .../expressions/super/prop-dot-cls-null-proto.js | 41 + .../expressions/super/prop-dot-cls-ref-strict.js | 58 + .../expressions/super/prop-dot-cls-ref-this.js | 60 + .../expressions/super/prop-dot-cls-this-uninit.js | 52 + .../super/prop-dot-cls-val-from-arrow.js | 48 + .../super/prop-dot-cls-val-from-eval.js | 49 + .../language/expressions/super/prop-dot-cls-val.js | 48 + .../expressions/super/prop-dot-obj-null-proto.js | 41 + .../super/prop-dot-obj-ref-non-strict.js | 60 + .../super/prop-dot-obj-ref-strict-strict.js | 59 + .../expressions/super/prop-dot-obj-ref-this.js | 61 + .../super/prop-dot-obj-val-from-arrow.js | 48 + .../super/prop-dot-obj-val-from-eval.js | 47 + .../language/expressions/super/prop-dot-obj-val.js | 47 + .../expressions/super/prop-expr-cls-err.js | 36 + .../expressions/super/prop-expr-cls-key-err.js | 39 + .../expressions/super/prop-expr-cls-null-proto.js | 41 + .../expressions/super/prop-expr-cls-ref-strict.js | 58 + .../expressions/super/prop-expr-cls-ref-this.js | 60 + .../expressions/super/prop-expr-cls-this-uninit.js | 52 + .../super/prop-expr-cls-unresolvable.js | 36 + .../super/prop-expr-cls-val-from-arrow.js | 48 + .../super/prop-expr-cls-val-from-eval.js | 48 + .../expressions/super/prop-expr-cls-val.js | 48 + .../expressions/super/prop-expr-obj-err.js | 35 + .../expressions/super/prop-expr-obj-key-err.js | 38 + .../expressions/super/prop-expr-obj-null-proto.js | 41 + .../super/prop-expr-obj-ref-non-strict.js | 60 + .../super/prop-expr-obj-ref-strict-strict.js | 59 + .../expressions/super/prop-expr-obj-ref-this.js | 61 + .../super/prop-expr-obj-unresolvable.js | 35 + .../super/prop-expr-obj-val-from-arrow.js | 48 + .../super/prop-expr-obj-val-from-eval.js | 47 + .../expressions/super/prop-expr-obj-val.js | 47 + .../super/prop-poisoned-underscore-proto.js | 37 + .../test262/language/expressions/super/realm.js | 39 + .../test262/language/expressions/super/shell.js | 0 .../super/super-reference-resolution.js | 25 + .../expressions/tagged-template/browser.js | 0 .../cache-different-functions-same-site.js | 40 + .../cache-differing-expressions-eval.js | 27 + .../cache-differing-expressions-new-function.js | 31 + .../tagged-template/cache-differing-expressions.js | 27 + .../tagged-template/cache-differing-raw-strings.js | 28 + .../cache-differing-string-count.js | 28 + .../tagged-template/cache-eval-inner-function.js | 37 + .../tagged-template/cache-identical-source-eval.js | 26 + .../cache-identical-source-new-function.js | 26 + .../tagged-template/cache-identical-source.js | 30 + .../expressions/tagged-template/cache-realm.js | 41 + .../tagged-template/cache-same-site-top-level.js | 33 + .../expressions/tagged-template/cache-same-site.js | 38 + .../call-expression-argument-list-evaluation.js | 44 + .../call-expression-context-no-strict.js | 33 + .../call-expression-context-strict-strict.js | 34 + .../tagged-template/chained-application.js | 22 + .../tagged-template/constructor-invocation.js | 29 + .../tagged-template/invalid-escape-sequences.js | 82 + .../member-expression-argument-list-evaluation.js | 40 + .../tagged-template/member-expression-context.js | 23 + .../language/expressions/tagged-template/shell.js | 0 .../expressions/tagged-template/tco-call-strict.js | 29 + .../tagged-template/tco-member-strict.js | 26 + .../template-object-frozen-non-strict.js | 34 + .../template-object-frozen-strict-strict.js | 33 + .../template-object-template-map.js | 41 + .../expressions/tagged-template/template-object.js | 53 + .../test262/language/expressions/tco-pos-strict.js | 23 + .../expressions/template-literal/browser.js | 0 .../template-literal/evaluation-order.js | 26 + ...ecimal-character-escape-sequence-truncated-1.js | 14 + ...ecimal-character-escape-sequence-truncated-2.js | 14 + ...ecimal-character-escape-sequence-truncated-3.js | 14 + .../invalid-legacy-octal-escape-sequence-8.js | 28 + .../invalid-legacy-octal-escape-sequence-9.js | 28 + .../invalid-legacy-octal-escape-sequence.js | 27 + .../invalid-unicode-escape-sequence-1.js | 14 + .../invalid-unicode-escape-sequence-2.js | 14 + .../invalid-unicode-escape-sequence-3.js | 14 + .../invalid-unicode-escape-sequence-4.js | 14 + .../invalid-unicode-escape-sequence-5.js | 14 + .../invalid-unicode-escape-sequence-6.js | 14 + .../invalid-unicode-escape-sequence-7.js | 14 + .../invalid-unicode-escape-sequence-8.js | 14 + .../template-literal/literal-expr-abrupt.js | 19 + .../template-literal/literal-expr-function.js | 18 + .../template-literal/literal-expr-member-expr.js | 36 + .../template-literal/literal-expr-method.js | 19 + .../template-literal/literal-expr-obj.js | 31 + .../template-literal/literal-expr-primitive.js | 17 + .../template-literal/literal-expr-template.js | 16 + .../template-literal/literal-expr-tostr-error.js | 25 + .../middle-list-many-expr-abrupt.js | 21 + .../middle-list-many-expr-function.js | 20 + .../middle-list-many-expr-member-expr.js | 40 + .../middle-list-many-expr-method.js | 21 + .../template-literal/middle-list-many-expr-obj.js | 33 + .../middle-list-many-expr-primitive.js | 19 + .../middle-list-many-expr-template.js | 18 + .../middle-list-many-expr-tostr-error.js | 27 + .../middle-list-one-expr-abrupt.js | 19 + .../middle-list-one-expr-function.js | 18 + .../middle-list-one-expr-member-expr.js | 37 + .../middle-list-one-expr-method.js | 20 + .../template-literal/middle-list-one-expr-obj.js | 32 + .../middle-list-one-expr-primitive.js | 17 + .../middle-list-one-expr-template.js | 16 + .../middle-list-one-expr-tostr-error.js | 25 + .../mongolian-vowel-separator-eval.js | 24 + .../template-literal/mongolian-vowel-separator.js | 25 + .../expressions/template-literal/no-sub.js | 16 + .../language/expressions/template-literal/shell.js | 0 .../tv-character-escape-sequence.js | 119 + .../template-literal/tv-hex-escape-sequence.js | 26 + .../template-literal/tv-line-continuation.js | 44 + .../tv-line-terminator-sequence.js | 46 + .../template-literal/tv-no-substitution.js | 33 + .../tv-null-character-escape-sequence.js | Bin 0 -> 561 bytes .../template-literal/tv-template-character.js | 40 + .../template-literal/tv-template-characters.js | 25 + .../template-literal/tv-template-head.js | 32 + .../template-literal/tv-template-middle.js | 30 + .../template-literal/tv-template-tail.js | 32 + .../template-literal/tv-utf16-escape-sequence.js | 52 + .../expressions/template-literal/tv-zwnbsp.js | 35 + .../template-literal/unicode-escape-nls-err.js | 56 + .../template-literal/unicode-escape-no-hex-err.js | 51 + .../test262/language/expressions/this/11.1.1-1.js | 11 + .../language/expressions/this/S11.1.1_A1.js | 16 + .../language/expressions/this/S11.1.1_A3.1.js | 25 + .../language/expressions/this/S11.1.1_A3.2.js | 24 + .../language/expressions/this/S11.1.1_A4.1.js | 24 + .../language/expressions/this/S11.1.1_A4.2.js | 28 + .../test262/language/expressions/this/browser.js | 0 .../test262/language/expressions/this/shell.js | 0 .../test262/language/expressions/typeof/bigint.js | 54 + .../test262/language/expressions/typeof/boolean.js | 34 + .../test262/language/expressions/typeof/browser.js | 0 .../typeof/built-in-exotic-objects-no-call.js | 77 + .../expressions/typeof/built-in-functions.js | 38 + .../typeof/built-in-ordinary-objects-no-call.js | 33 + .../expressions/typeof/get-value-ref-err.js | 27 + .../language/expressions/typeof/get-value.js | 46 + .../language/expressions/typeof/native-call.js | 78 + .../test262/language/expressions/typeof/null.js | 33 + .../test262/language/expressions/typeof/number.js | 51 + .../test262/language/expressions/typeof/proxy.js | 43 + .../test262/language/expressions/typeof/shell.js | 0 .../test262/language/expressions/typeof/string.js | 57 + .../test262/language/expressions/typeof/symbol.js | 47 + .../test262/language/expressions/typeof/syntax.js | 79 + .../language/expressions/typeof/undefined.js | 32 + .../expressions/typeof/unresolvable-reference.js | 25 + .../language/expressions/unary-minus/11.4.7-4-1.js | 11 + .../language/expressions/unary-minus/S11.4.7_A1.js | 62 + .../expressions/unary-minus/S11.4.7_A2.1_T1.js | 39 + .../expressions/unary-minus/S11.4.7_A2.1_T2.js | 21 + .../expressions/unary-minus/S11.4.7_A2.2_T1.js | 79 + .../expressions/unary-minus/S11.4.7_A3_T1.js | 20 + .../expressions/unary-minus/S11.4.7_A3_T2.js | 20 + .../expressions/unary-minus/S11.4.7_A3_T3.js | 25 + .../expressions/unary-minus/S11.4.7_A3_T4.js | 20 + .../expressions/unary-minus/S11.4.7_A3_T5.js | 20 + .../expressions/unary-minus/S11.4.7_A4.1.js | 21 + .../expressions/unary-minus/S11.4.7_A4.2.js | 32 + .../unary-minus/bigint-non-primitive.js | 54 + .../language/expressions/unary-minus/bigint.js | 36 + .../language/expressions/unary-minus/browser.js | 0 .../language/expressions/unary-minus/shell.js | 0 .../language/expressions/unary-plus/11.4.6-2-1.js | 11 + .../language/expressions/unary-plus/S11.4.6_A1.js | 62 + .../expressions/unary-plus/S11.4.6_A2.1_T1.js | 39 + .../expressions/unary-plus/S11.4.6_A2.1_T2.js | 21 + .../expressions/unary-plus/S11.4.6_A2.2_T1.js | 79 + .../expressions/unary-plus/S11.4.6_A3_T1.js | 20 + .../expressions/unary-plus/S11.4.6_A3_T2.js | 20 + .../expressions/unary-plus/S11.4.6_A3_T3.js | 35 + .../expressions/unary-plus/S11.4.6_A3_T4.js | 20 + .../expressions/unary-plus/S11.4.6_A3_T5.js | 20 + .../language/expressions/unary-plus/S9.3_A1_T2.js | 25 + .../language/expressions/unary-plus/S9.3_A2_T2.js | 19 + .../language/expressions/unary-plus/S9.3_A3_T2.js | 26 + .../expressions/unary-plus/S9.3_A4.1_T2.js | 34 + .../expressions/unary-plus/S9.3_A4.2_T2.js | 58 + .../language/expressions/unary-plus/S9.3_A5_T2.js | 129 + .../expressions/unary-plus/bigint-throws.js | 33 + .../language/expressions/unary-plus/browser.js | 0 .../language/expressions/unary-plus/shell.js | 0 .../expressions/unsigned-right-shift/S11.7.3_A1.js | 62 + .../unsigned-right-shift/S11.7.3_A2.1_T1.js | 43 + .../unsigned-right-shift/S11.7.3_A2.1_T2.js | 21 + .../unsigned-right-shift/S11.7.3_A2.1_T3.js | 21 + .../unsigned-right-shift/S11.7.3_A2.2_T1.js | 71 + .../unsigned-right-shift/S11.7.3_A2.3_T1.js | 28 + .../unsigned-right-shift/S11.7.3_A2.4_T1.js | 22 + .../unsigned-right-shift/S11.7.3_A2.4_T2.js | 26 + .../unsigned-right-shift/S11.7.3_A2.4_T3.js | 21 + .../unsigned-right-shift/S11.7.3_A2.4_T4.js | 16 + .../unsigned-right-shift/S11.7.3_A3_T1.1.js | 32 + .../unsigned-right-shift/S11.7.3_A3_T1.2.js | 30 + .../unsigned-right-shift/S11.7.3_A3_T1.3.js | 40 + .../unsigned-right-shift/S11.7.3_A3_T1.4.js | 30 + .../unsigned-right-shift/S11.7.3_A3_T1.5.js | 30 + .../unsigned-right-shift/S11.7.3_A3_T2.1.js | 52 + .../unsigned-right-shift/S11.7.3_A3_T2.2.js | 62 + .../unsigned-right-shift/S11.7.3_A3_T2.3.js | 32 + .../unsigned-right-shift/S11.7.3_A3_T2.4.js | 32 + .../unsigned-right-shift/S11.7.3_A3_T2.5.js | 52 + .../unsigned-right-shift/S11.7.3_A3_T2.6.js | 32 + .../unsigned-right-shift/S11.7.3_A3_T2.7.js | 32 + .../unsigned-right-shift/S11.7.3_A3_T2.8.js | 32 + .../unsigned-right-shift/S11.7.3_A3_T2.9.js | 32 + .../unsigned-right-shift/S11.7.3_A4_T1.js | 2571 +++++++++++++++++++ .../unsigned-right-shift/S11.7.3_A4_T2.js | 2571 +++++++++++++++++++ .../unsigned-right-shift/S11.7.3_A4_T3.js | 2651 ++++++++++++++++++++ .../unsigned-right-shift/S11.7.3_A4_T4.js | 2651 ++++++++++++++++++++ .../unsigned-right-shift/S11.7.3_A5.1_T1.js | 60 + .../unsigned-right-shift/S11.7.3_A5.2_T1.js | 330 +++ .../expressions/unsigned-right-shift/S9.6_A1.js | 52 + .../expressions/unsigned-right-shift/S9.6_A2.1.js | 42 + .../expressions/unsigned-right-shift/S9.6_A2.2.js | 70 + .../unsigned-right-shift/S9.6_A3.1_T1.js | 20 + .../unsigned-right-shift/S9.6_A3.1_T2.js | 20 + .../unsigned-right-shift/S9.6_A3.1_T3.js | 20 + .../unsigned-right-shift/S9.6_A3.1_T4.js | 79 + .../unsigned-right-shift/S9.6_A3.2_T1.js | 20 + .../unsigned-right-shift/bigint-and-number.js | 92 + .../unsigned-right-shift/bigint-errors.js | 73 + .../unsigned-right-shift/bigint-non-primitive.js | 105 + .../unsigned-right-shift/bigint-toprimitive.js | 415 +++ .../unsigned-right-shift/bigint-wrapped-values.js | 65 + .../expressions/unsigned-right-shift/bigint.js | 66 + .../expressions/unsigned-right-shift/browser.js | 0 .../unsigned-right-shift/order-of-evaluation.js | 140 ++ .../expressions/unsigned-right-shift/shell.js | 0 .../language/expressions/void/S11.4.2_A1.js | 62 + .../language/expressions/void/S11.4.2_A2_T1.js | 27 + .../language/expressions/void/S11.4.2_A2_T2.js | 14 + .../language/expressions/void/S11.4.2_A4_T1.js | 22 + .../language/expressions/void/S11.4.2_A4_T2.js | 22 + .../language/expressions/void/S11.4.2_A4_T3.js | 28 + .../language/expressions/void/S11.4.2_A4_T4.js | 22 + .../language/expressions/void/S11.4.2_A4_T5.js | 22 + .../language/expressions/void/S11.4.2_A4_T6.js | 20 + .../test262/language/expressions/void/browser.js | 0 .../test262/language/expressions/void/shell.js | 0 .../yield/arguments-object-attributes.js | 43 + .../test262/language/expressions/yield/browser.js | 0 .../expressions/yield/captured-free-vars.js | 38 + ...mal-parameters-after-reassignment-non-strict.js | 47 + ...-parameters-after-reassignment-strict-strict.js | 48 + .../expressions/yield/formal-parameters.js | 43 + .../language/expressions/yield/from-catch.js | 29 + .../test262/language/expressions/yield/from-try.js | 29 + .../language/expressions/yield/from-with.js | 42 + .../expressions/yield/in-iteration-stmt.js | 24 + .../language/expressions/yield/in-rltn-expr.js | 50 + .../expressions/yield/invalid-left-hand-side.js | 29 + .../expressions/yield/iter-value-specified.js | 31 + .../expressions/yield/iter-value-unspecified.js | 26 + .../test262/language/expressions/yield/rhs-iter.js | 41 + .../language/expressions/yield/rhs-omitted.js | 128 + .../language/expressions/yield/rhs-primitive.js | 118 + .../language/expressions/yield/rhs-regexp.js | 45 + .../expressions/yield/rhs-template-middle.js | 40 + .../language/expressions/yield/rhs-unresolvable.js | 33 + .../language/expressions/yield/rhs-yield.js | 28 + .../test262/language/expressions/yield/shell.js | 0 .../language/expressions/yield/star-array.js | 33 + .../expressions/yield/star-in-iteration-stmt.js | 24 + .../expressions/yield/star-in-rltn-expr.js | 50 + .../language/expressions/yield/star-iterable.js | 42 + .../expressions/yield/star-return-is-null.js | 57 + .../yield/star-rhs-iter-get-call-err.js | 45 + .../yield/star-rhs-iter-get-call-non-obj.js | 44 + .../expressions/yield/star-rhs-iter-get-get-err.js | 45 + .../yield/star-rhs-iter-nrml-next-call-err.js | 52 + .../yield/star-rhs-iter-nrml-next-call-non-obj.js | 53 + .../yield/star-rhs-iter-nrml-next-get-err.js | 53 + .../yield/star-rhs-iter-nrml-next-invoke.js | 54 + .../yield/star-rhs-iter-nrml-res-done-err.js | 55 + .../yield/star-rhs-iter-nrml-res-done-no-value.js | 62 + .../yield/star-rhs-iter-nrml-res-value-err.js | 58 + .../yield/star-rhs-iter-nrml-res-value-final.js | 64 + .../yield/star-rhs-iter-rtrn-no-rtrn.js | 78 + .../yield/star-rhs-iter-rtrn-res-done-err.js | 69 + .../yield/star-rhs-iter-rtrn-res-done-no-value.js | 93 + .../yield/star-rhs-iter-rtrn-res-value-err.js | 72 + .../yield/star-rhs-iter-rtrn-res-value-final.js | 73 + .../yield/star-rhs-iter-rtrn-rtrn-call-err.js | 57 + .../yield/star-rhs-iter-rtrn-rtrn-call-non-obj.js | 60 + .../yield/star-rhs-iter-rtrn-rtrn-get-err.js | 67 + .../yield/star-rhs-iter-rtrn-rtrn-invoke.js | 59 + .../yield/star-rhs-iter-thrw-res-done-err.js | 68 + .../yield/star-rhs-iter-thrw-res-done-no-value.js | 78 + .../yield/star-rhs-iter-thrw-res-value-err.js | 71 + .../yield/star-rhs-iter-thrw-res-value-final.js | 56 + .../yield/star-rhs-iter-thrw-thrw-call-err.js | 54 + .../yield/star-rhs-iter-thrw-thrw-call-non-obj.js | 59 + .../yield/star-rhs-iter-thrw-thrw-get-err.js | 57 + .../yield/star-rhs-iter-thrw-thrw-invoke.js | 56 + .../yield/star-rhs-iter-thrw-violation-no-rtrn.js | 82 + .../star-rhs-iter-thrw-violation-rtrn-call-err.js | 73 + ...ar-rhs-iter-thrw-violation-rtrn-call-non-obj.js | 70 + .../star-rhs-iter-thrw-violation-rtrn-get-err.js | 75 + .../star-rhs-iter-thrw-violation-rtrn-invoke.js | 91 + .../expressions/yield/star-rhs-unresolvable.js | 33 + .../language/expressions/yield/star-string.js | 33 + .../expressions/yield/star-throw-is-null.js | 73 + .../language/expressions/yield/then-return.js | 24 + .../language/expressions/yield/within-for.js | 34 + 11085 files changed, 673016 insertions(+) create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T3.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T6.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T7.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T8.js create mode 100644 js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T9.js create mode 100644 js/src/tests/test262/language/expressions/addition/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/addition/bigint-arithmetic.js create mode 100644 js/src/tests/test262/language/expressions/addition/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/addition/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/addition/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/addition/browser.js create mode 100644 js/src/tests/test262/language/expressions/addition/coerce-bigint-to-string.js create mode 100644 js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-err.js create mode 100644 js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-invocation.js create mode 100644 js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-obj.js create mode 100644 js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-prim.js create mode 100644 js/src/tests/test262/language/expressions/addition/get-symbol-to-prim-err.js create mode 100644 js/src/tests/test262/language/expressions/addition/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/addition/shell.js create mode 100644 js/src/tests/test262/language/expressions/addition/symbol-to-string.js create mode 100644 js/src/tests/test262/language/expressions/array/11.1.4-0.js create mode 100644 js/src/tests/test262/language/expressions/array/11.1.4_4-5-1.js create mode 100644 js/src/tests/test262/language/expressions/array/11.1.4_5-6-1.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A1.1.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A1.2.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A1.3.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A1.4.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A1.5.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A1.6.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A1.7.js create mode 100644 js/src/tests/test262/language/expressions/array/S11.1.4_A2.js create mode 100644 js/src/tests/test262/language/expressions/array/browser.js create mode 100644 js/src/tests/test262/language/expressions/array/shell.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-iter-get-value.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-mult-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-value.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-err-sngl-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-mult-empty.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-mult-expr.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-mult-iter.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-mult-literal.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-mult-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-mult-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-mult-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-getter-descriptor.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-getter-init.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-manipulate-outter-obj-in-getter.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-mult-spread-getter.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-mult-spread.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-override-immutable.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-overrides-prev-properties.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-spread-order.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-symbol-property.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-obj-with-overrides.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-sngl-empty.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-sngl-expr.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-sngl-iter.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-sngl-literal.js create mode 100644 js/src/tests/test262/language/expressions/array/spread-sngl-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/ArrowFunction_restricted-properties.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-1.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-2.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-3.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-1.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-2.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/arrow/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/cannot-override-this-with-thisArg.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-implements-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-interface-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-let-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-package-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-private-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-protected-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-public-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-static-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/empty-function-body-returns-undefined.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/expression-body-implicit-return.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/extensibility.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-arguments.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-bindings-overriden-by-formal-parameters-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-new.target-closure-returned.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-new.target.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-super-call-from-within-constructor.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-super-property-from-within-constructor.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-super-property.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-supercall-from-immediately-invoked-arrow.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/lexical-this.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/low-precedence-expression-body-no-parens.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/name.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/non-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/object-literal-return-requires-body-parens.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/params-duplicate.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/prototype-rules.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/scope-body-lex-distinct.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly-missing.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/static-init-await-binding.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/static-init-await-reference.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-arguments.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-assignmentexpression.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-functionbody.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-eval.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-assignmentexpression.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-functionbody.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-yield.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-assignmentexpression.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-functionbody.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-arguments.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-eval.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-yield.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-includes-rest-concisebody-functionbody.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-1.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-2.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-assignmentexpression.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-functionbody.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-concisebody-functionbody.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-lineterminator-concisebody-functionbody.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-futurereservedword.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-strict-futurereservedword-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-yield-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-rest.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-1.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-2.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-3.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-1.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-2.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-3.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-4.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-5.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-6.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-rest.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-yield-strict.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters-expression-body.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/browser.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/use-strict-with-non-simple-param.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/shell.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/syntax/variations.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/throw-new.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/arrow-function/unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-1-6-s.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-1-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-2-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-3-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-4-1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-4-14-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-4-27-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-4-28gs-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-4-29gs-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-4-3-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/11.13.1-4-6-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_2.js create mode 100644 js/src/tests/test262/language/expressions/assignment/8.12.5-5-b_1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_2-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.2.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T3.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T2.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T3.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T3.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T4.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S8.12.4_A1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S8.12.5_A1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/S8.12.5_A2.js create mode 100644 js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js create mode 100644 js/src/tests/test262/language/expressions/assignment/browser.js create mode 100644 js/src/tests/test262/language/expressions/assignment/destructuring/browser.js create mode 100644 js/src/tests/test262/language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order.js create mode 100644 js/src/tests/test262/language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order.js create mode 100644 js/src/tests/test262/language/expressions/assignment/destructuring/obj-prop-__proto__dup.js create mode 100644 js/src/tests/test262/language/expressions/assignment/destructuring/shell.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-assignment.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-in.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-let.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-order.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-simple-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-hole.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-own.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-hole.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-own.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-const.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-let.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init-active.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-no-get.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-user-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-identifier.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-abpt.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-abpt.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-array.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-bool.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-num.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-string.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-symbol.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-array.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-bool.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-num.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-string.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-symbol.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-iteration.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-element.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-elision.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-element.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-elision.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-rest.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-iter-abpt.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-nrml-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iteration.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-iter-thrw-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-hole.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-own.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-hole.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-own.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-const.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-let.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-no-get.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/browser.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-implements-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-interface-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-let-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-package-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-private-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-protected-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-public-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-static-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-bool.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-num.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-obj.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-string.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-symbol.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-undef.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-first.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-last.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-lone.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-middle.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-trlng.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-missing.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-truthy.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-undef.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-in.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-let.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-order.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-const.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-let.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-missing.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-truthy.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-undef.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-in.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-let.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-first.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-last.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-lone.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-middle.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-trlng.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation-error.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined-own.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined-own.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-const.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-let.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-order.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-no-get.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-user-err.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-descriptors.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-empty-obj.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter-abrupt-get-error.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot0.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1e0.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1e0.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-string-1.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-not-last-element-invalid.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-number.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-order.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-put-const.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-same-name.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-str-val.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-symbol-val.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property-with-setter.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-valid-object.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/shell.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-implements-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-interface-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-let-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-package-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-private-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-protected-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-public-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-static-escaped-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/assignment/fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/assignment/fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/assignment/fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/assignment/fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/assignment/fn-name-lhs-cover.js create mode 100644 js/src/tests/test262/language/expressions/assignment/fn-name-lhs-member.js create mode 100644 js/src/tests/test262/language/expressions/assignment/id-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/id-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignment/line-terminator.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-implements-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-interface-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-let-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-package-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-private-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-protected-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-public-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-static-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/assignment/non-simple-target.js create mode 100644 js/src/tests/test262/language/expressions/assignment/shell.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-assignment-inside-function.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-assignment.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-boolean.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-cover-id.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-cover-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-cover-yieldexpr.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-undefined.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-number.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-string.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-super-computed-reference-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/target-super-identifier-reference-null.js create mode 100644 js/src/tests/test262/language/expressions/assignment/white-space.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/browser.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-3.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-4.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-5.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-6.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-3.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-4.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-5.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-6.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-arguments.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-templateliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-import.meta.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-importcall.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-minus-minus.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-plus-plus.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-memberexpression-templateliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-minus-minus-unaryexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-memberexpression-arguments.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-newexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-optionalexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-plus-plus-unaryexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncfunctionexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncgeneratorexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-classexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-functionexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-generatorexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-boolean.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-null.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-numeric.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-string.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-objectliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-regularexpressionliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-templateliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-this.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-delete-unaryexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-3.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-4.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-5.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-6.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-3.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-4.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-5.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-6.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-arguments.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-templateliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-import.meta.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-importcall.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-minus-minus.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-plus-plus.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-memberexpression-templateliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-minus-minus-unaryexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-memberexpression-arguments.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-newexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-optionalexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-plus-plus-unaryexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncfunctionexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncgeneratorexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-classexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-functionexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-generatorexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-boolean.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-null.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-numeric.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-string.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-objectliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-regularexpressionliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-templateliteral.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-this.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-delete-unaryexpression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-2.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-0.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-1.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/shell.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-arguments.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-eval.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-yield.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression-expression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression.identifiername.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression-expression.js create mode 100644 js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression.identifiername.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/name.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-function/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-NSPL-with-USD.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-body-duplicate.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-property.js create mode 100644 js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.js create mode 100644 js/src/tests/test262/language/expressions/async-function/escaped-async.js create mode 100644 js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-function/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-function/name.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-arguments-from-own-function.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-returns-async-function.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-function/named-unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/async-function/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-reject-finally-reject.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-reject-finally-return.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-reject-finally-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-return-finally-reject.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-return-finally-return.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-return-finally-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-throw-finally-reject.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-throw-finally-return.js create mode 100644 js/src/tests/test262/language/expressions/async-function/try-throw-finally-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/default-proto.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/dstr/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-NSPL-with-USD.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-arguments-in-formal-parameters-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-await-as-function-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-property.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-eval-in-formal-parameters-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-const.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-let.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-await.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-yield.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-not-simple-assignment-target.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-as-function-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-star-after-newline.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/escaped-async.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/eval-body-proto-realm.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/expression-await-as-yield-operand.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/expression-await-promise-as-yield-operand.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/expression-await-thenable-as-yield-operand.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/expression-yield-as-operand.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/expression-yield-as-statement.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/expression-yield-newline.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/expression-yield-star-before-newline.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/generator-created-after-decl-inst.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/name.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-arrow.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-eval.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-catch.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-next.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-return.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-null-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-undefined-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-done-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-value-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-non-object-ignores-then.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-boolean-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-null-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-number-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-object-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-string-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-symbol-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-undefined-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-next.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-return.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/shell.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-identifier-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-catch.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-async-next.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-async-return.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-async-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-return-method-is-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-throw-method-is-null.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-done-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-value-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-non-object-ignores-then.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-sync-next.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-sync-return.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-star-sync-throw.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-reject.js create mode 100644 js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-resolve.js create mode 100644 js/src/tests/test262/language/expressions/await/async-await-interleaved.js create mode 100644 js/src/tests/test262/language/expressions/await/async-generator-interleaved.js create mode 100644 js/src/tests/test262/language/expressions/await/await-BindingIdentifier-in-global.js create mode 100644 js/src/tests/test262/language/expressions/await/await-BindingIdentifier-nested.js create mode 100644 js/src/tests/test262/language/expressions/await/await-awaits-thenable-not-callable.js create mode 100644 js/src/tests/test262/language/expressions/await/await-awaits-thenables-that-throw.js create mode 100644 js/src/tests/test262/language/expressions/await/await-awaits-thenables.js create mode 100644 js/src/tests/test262/language/expressions/await/await-in-function.js create mode 100644 js/src/tests/test262/language/expressions/await/await-in-generator.js create mode 100644 js/src/tests/test262/language/expressions/await/await-in-global.js create mode 100644 js/src/tests/test262/language/expressions/await/await-in-nested-function.js create mode 100644 js/src/tests/test262/language/expressions/await/await-in-nested-generator.js create mode 100644 js/src/tests/test262/language/expressions/await/await-monkey-patched-promise.js create mode 100644 js/src/tests/test262/language/expressions/await/await-non-promise-thenable.js create mode 100644 js/src/tests/test262/language/expressions/await/await-non-promise.js create mode 100644 js/src/tests/test262/language/expressions/await/await-throws-rejections.js create mode 100644 js/src/tests/test262/language/expressions/await/browser.js create mode 100644 js/src/tests/test262/language/expressions/await/early-errors-await-not-simple-assignment-target.js create mode 100644 js/src/tests/test262/language/expressions/await/for-await-of-interleaved.js create mode 100644 js/src/tests/test262/language/expressions/await/no-operand.js create mode 100644 js/src/tests/test262/language/expressions/await/shell.js create mode 100644 js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js create mode 100644 js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/bigint.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/browser.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-and/shell.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.1_T4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/bigint.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/browser.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-not/shell.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/bigint.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/browser.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-or/shell.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/bigint.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/browser.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/bitwise-xor/shell.js create mode 100644 js/src/tests/test262/language/expressions/browser.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_1.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_2.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_3.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_4.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_5.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_6.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_7.js create mode 100644 js/src/tests/test262/language/expressions/call/11.2.3-3_8.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A1.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A2.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.3_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/call/browser.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-err-args.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-first-arg.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-no-args.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-realm-indirect.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-spread-empty-leading.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-spread-empty-trailing.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-spread-empty.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-spread.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-strictness-inherit-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/call/eval-strictness-inherit-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/call/scope-lex-close.js create mode 100644 js/src/tests/test262/language/expressions/call/scope-lex-open.js create mode 100644 js/src/tests/test262/language/expressions/call/scope-var-close.js create mode 100644 js/src/tests/test262/language/expressions/call/scope-var-open.js create mode 100644 js/src/tests/test262/language/expressions/call/shell.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-iter-get-value.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-mult-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-value.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-err-sngl-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-mult-empty.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-mult-expr.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-mult-iter.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-mult-literal.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-mult-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-mult-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-mult-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-getter-descriptor.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-getter-init.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-manipulate-outter-obj-in-getter.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-mult-spread-getter.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-mult-spread.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-override-immutable.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-overrides-prev-properties.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-spread-order.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-symbol-property.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-obj-with-overrides.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-sngl-empty.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-sngl-expr.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-sngl-iter.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-sngl-literal.js create mode 100644 js/src/tests/test262/language/expressions/call/spread-sngl-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/call/tco-call-args-strict.js create mode 100644 js/src/tests/test262/language/expressions/call/tco-member-args-strict.js create mode 100644 js/src/tests/test262/language/expressions/call/tco-non-eval-function-dynamic.js create mode 100644 js/src/tests/test262/language/expressions/call/tco-non-eval-function.js create mode 100644 js/src/tests/test262/language/expressions/call/tco-non-eval-global.js create mode 100644 js/src/tests/test262/language/expressions/call/tco-non-eval-with.js create mode 100644 js/src/tests/test262/language/expressions/call/trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/call/with-base-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-in.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-to-prop-key.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/computed.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-binary.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-exponent.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-hex.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-leading-decimal.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-non-canonical.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-octal.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-zero.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-char-escape.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-double-quote.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-hex-escape.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-line-continuation.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-single-quote.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-unicode-escape.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-inst/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static-computed-in.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static-computed-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-to-prop-key.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/computed.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-binary.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-exponent.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-hex.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-leading-decimal.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-non-canonical.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-octal.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-zero.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-char-escape.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-double-quote.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-hex-escape.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-line-continuation.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-single-quote.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-unicode-escape.js create mode 100644 js/src/tests/test262/language/expressions/class/accessor-name-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-catch.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-next.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-return.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-next.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-return.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-catch.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-next.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-return.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-done-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-value-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-non-object-ignores-then.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-next.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-return.js create mode 100644 js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-throw.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function-returns-arguments-from-own-function.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/returns-async-function-returns-arguments-from-own-function.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/returns-async-function-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/returns-async-function.js create mode 100644 js/src/tests/test262/language/expressions/class/async-method/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped-module.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-await-module.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-await.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-let-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-let.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-static-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-static.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-yield-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/class-name-ident-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/constructor-this-tdz-during-initializers.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-add.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-subtract.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-assignment.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-bitwise-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-async-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-await-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-false.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-true.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-exponetiation-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-generator-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-separators.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-math.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-div.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-mult.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-null.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-numeric-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-string-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-yield-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-add.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-subtract.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-assignment.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-bitwise-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-async-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-await-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-false.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-true.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-exponetiation-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-generator-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-separators.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-math.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-div.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-mult.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-null.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-numeric-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-string-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-yield-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-add.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-subtract.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-assignment.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-bitwise-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-async-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-await-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-false.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-true.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-exponetiation-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-generator-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-separators.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-math.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-div.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-mult.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-null.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-numeric-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-string-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-yield-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-add.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-subtract.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-assignment.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-async-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-await-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-false.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-true.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-exponetiation-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-generator-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-separators.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-math.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-div.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-mult.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-null.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-numeric-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-string-literal.js create mode 100644 js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-yield-expression.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/decorator/syntax/valid/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/dstr/shell.js 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/field-definition-accessor-no-line-terminator.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/super-access-from-arrow-func-on-field.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-accessor.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 create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-param-dflt-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/class/gen-method/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/class/getter-param-dflt.js create mode 100644 js/src/tests/test262/language/expressions/class/heritage-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/heritage-async-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-default.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-extends.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-implements-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-interface-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-let-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-package-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-private-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-protected-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-public-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-static-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/ident-name-method-def-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/class/method-length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/class/method-param-dflt-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/method-static/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/method/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/method/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/class/method/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/method/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/method/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/method/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/class/method/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/class/method/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/class/method/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/class/method/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/name.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-meth-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-meth-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-meth-static-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/class/params-dflt-meth-static-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/class/poisoned-underscore-proto.js create mode 100644 js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval-indirect.js create mode 100644 js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval.js create mode 100644 js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-factory.js create mode 100644 js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm.js create mode 100644 js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval-indirect.js create mode 100644 js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval.js create mode 100644 js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-factory.js create mode 100644 js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm.js create mode 100644 js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval-indirect.js create mode 100644 js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval.js create mode 100644 js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-factory.js create mode 100644 js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-direct-eval.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-eval-indirect.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-factory.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-realm.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-direct-eval.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-eval-indirect.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-factory.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-realm.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-direct-eval.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-eval-indirect.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-factory.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-realm.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-direct-eval.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-eval-indirect.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-factory.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-function-ctor.js create mode 100644 js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-realm.js create mode 100644 js/src/tests/test262/language/expressions/class/restricted-properties.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-name-lex-close.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-name-lex-open-heritage.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-name-lex-open-no-heritage.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/class/setter-length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/class/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/static-gen-method-param-dflt-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/static-init-await-binding.js create mode 100644 js/src/tests/test262/language/expressions/class/static-init-await-reference.js create mode 100644 js/src/tests/test262/language/expressions/class/static-method-length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/class/static-method-param-dflt-yield.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/browser.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/shell.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-AggregateError.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ArrayBuffer.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigInt64Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigUint64Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Boolean.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-DataView.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Date.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Error.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-EvalError.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float32Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float64Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Function.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int16Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int32Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int8Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Map.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Number.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Object.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Promise.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RangeError.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ReferenceError.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RegExp.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Set.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SharedArrayBuffer.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-String.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SyntaxError.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-TypeError.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-URIError.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint16Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint32Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8Array.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8ClampedArray.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakMap.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakRef.js create mode 100644 js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakSet.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/abrupt-is-a-short-circuit.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/browser.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-and.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-or.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-xor.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/chainable.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/follows-null.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/follows-undefined.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/shell.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-0.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-42.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-empty-string.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-false.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-object.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-string.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-symbol.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-number-true.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/short-circuit-prevents-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/tco-pos-null-strict.js create mode 100644 js/src/tests/test262/language/expressions/coalesce/tco-pos-undefined-strict.js create mode 100644 js/src/tests/test262/language/expressions/comma/S11.14_A1.js create mode 100644 js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/comma/S11.14_A3.js create mode 100644 js/src/tests/test262/language/expressions/comma/browser.js create mode 100644 js/src/tests/test262/language/expressions/comma/shell.js create mode 100644 js/src/tests/test262/language/expressions/comma/tco-final-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-1-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-10-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-11-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-12-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-13-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-14-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-15-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-16-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-17-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-18-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-19-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-2-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-20-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-21-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-22-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-23-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-24-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-25-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-26-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-27-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-28-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-29-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-30-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-31-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-33-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-34-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-35-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-36-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-37-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-38-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-39-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-4-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-40-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-41-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-42-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-43-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-44-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-45-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-46-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-47-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-48-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-49-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-5-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-50-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-51-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-52-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-53-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-54-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-55-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-1gs-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-8-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/11.13.2-9-s.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.10.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.11.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.10.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.11.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.10.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.11.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T10.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T11.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T10.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T11.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.5_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.6_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.7_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.8_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/add-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/add-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/add-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/add-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/and-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/and-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/and-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/browser.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/btws-and-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/btws-or-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/btws-xor-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/div-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/div-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/div-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/div-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/left-shift-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/lshift-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/lshift-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/lshift-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mod-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mod-div-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mod-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mod-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mult-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mult-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mult-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/mult-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/or-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/or-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/or-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/right-shift-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/shell.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/srshift-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/srshift-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/srshift-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/sub-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/sub-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/sub-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/subtract-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/u-right-shift-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/urshift-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/urshift-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/urshift-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/xor-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/xor-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/compound-assignment/xor-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/concatenation/S9.8_A1_T2.js create mode 100644 js/src/tests/test262/language/expressions/concatenation/S9.8_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/concatenation/S9.8_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/concatenation/browser.js create mode 100644 js/src/tests/test262/language/expressions/concatenation/shell.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A1.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T4.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T5.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T6.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/conditional/S11.12_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/conditional/browser.js create mode 100644 js/src/tests/test262/language/expressions/conditional/coalesce-expr-ternary.js create mode 100644 js/src/tests/test262/language/expressions/conditional/in-branch-1.js create mode 100644 js/src/tests/test262/language/expressions/conditional/in-branch-2.js create mode 100644 js/src/tests/test262/language/expressions/conditional/in-condition.js create mode 100644 js/src/tests/test262/language/expressions/conditional/shell.js create mode 100644 js/src/tests/test262/language/expressions/conditional/symbol-conditional-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/conditional/tco-cond-strict.js create mode 100644 js/src/tests/test262/language/expressions/conditional/tco-pos-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-0-1.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-2-2.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-3-1.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-3-2.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-3-3.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4-a-1-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4-a-2-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4-a-3-s.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4-a-4-s.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-1.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-10.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-11.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-12.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-13.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-14.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-15.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-16.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-17.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-2.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-4.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-5.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-6.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-7.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-5-1.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-5-2.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-5-3.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-5-a-27-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.1-5-a-28-s.js create mode 100644 js/src/tests/test262/language/expressions/delete/11.4.4-4.a-3-s-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A2.1.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T3.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.1.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T3.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T2.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T3.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T4.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T5.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T6.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A4.js create mode 100644 js/src/tests/test262/language/expressions/delete/S11.4.1_A5-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/S8.12.7_A1.js create mode 100644 js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T1.js create mode 100644 js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/delete/S8.12.7_A3.js create mode 100644 js/src/tests/test262/language/expressions/delete/browser.js create mode 100644 js/src/tests/test262/language/expressions/delete/delete-unresolvable-base-object-reference-throws-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/delete/identifier-strict-recursive-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/delete/member-computed-reference-null.js create mode 100644 js/src/tests/test262/language/expressions/delete/member-computed-reference-undefined.js create mode 100644 js/src/tests/test262/language/expressions/delete/member-identifier-reference-null.js create mode 100644 js/src/tests/test262/language/expressions/delete/member-identifier-reference-undefined.js create mode 100644 js/src/tests/test262/language/expressions/delete/non-reference-return-true.js create mode 100644 js/src/tests/test262/language/expressions/delete/shell.js create mode 100644 js/src/tests/test262/language/expressions/delete/super-property-method.js create mode 100644 js/src/tests/test262/language/expressions/delete/super-property-null-base.js create mode 100644 js/src/tests/test262/language/expressions/delete/super-property.js create mode 100644 js/src/tests/test262/language/expressions/delete/white-space-line-terminator-between-delete-unaryexpression-allowed.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T10.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T6.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T7.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T8.js create mode 100644 js/src/tests/test262/language/expressions/division/S11.5.2_A4_T9.js create mode 100644 js/src/tests/test262/language/expressions/division/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/division/bigint-arithmetic.js create mode 100644 js/src/tests/test262/language/expressions/division/bigint-complex-infinity.js create mode 100644 js/src/tests/test262/language/expressions/division/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/division/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/division/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/division/browser.js create mode 100644 js/src/tests/test262/language/expressions/division/line-terminator.js create mode 100644 js/src/tests/test262/language/expressions/division/no-magic-asi-from-block-eval.js create mode 100644 js/src/tests/test262/language/expressions/division/no-magic-asi.js create mode 100644 js/src/tests/test262/language/expressions/division/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/division/shell.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.3.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.3.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.1.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.2.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.3.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.4.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.5.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.6.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.7.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.8.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.9.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-boolean.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-object.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/browser.js create mode 100644 js/src/tests/test262/language/expressions/does-not-equals/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/always-create-new-promise.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assign-expr-get-value-abrupt-throws.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/additive-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/array-literal.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-identifier.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/identifier.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/import-meta.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/member-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code-other_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/new-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/object-literal.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/ternary.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/this.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/unary-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-identifier.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-star.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-type_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-uri_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-1_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-2_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-export_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-1_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-2_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/script-code_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-script-code-target.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-file-does-not-exist.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-specifier-tostring-abrupt-rejects.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/custom-primitive.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/custom-tostring_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/custom-valueof_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/dynamic-import-module_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/empty_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/escape-sequence-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-name-meth.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-named.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-anon.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-named.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-anon.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-named.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-anon.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-named.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-in.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-module.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-script.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-a_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-b_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-poisoned_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-non-object.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-undefined.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-non-string.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-ident.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-return.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-throw.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-sequence.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-get-assert-error.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-in.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-non-object.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-fulfill.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-reject.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/README.md create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-fulfill.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-reject.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-ident.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-return.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-throw.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-sequence.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-get-with-error.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-in.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-non-object.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-fulfill.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-reject.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-non-object.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-undefined.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-non-string.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-invalid-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.json create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/README.md create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-fulfill.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-reject.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/imported-self-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-1_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-2_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/module-code_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-Symbol-toStringTag.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-define-own-property.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-extensible.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-direct.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-indirect.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-props-nrml.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-found-init.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-sym.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-found-init.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-no-iterator.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-object.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-reflect.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prop-descs.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prototype.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of-null.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/default-property-not-set-own.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/define-own-property_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/empty_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named-end_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-1_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-2_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-3_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/module-code_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/own-keys-sort_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-Symbol-toStringTag.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-define-own-property.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-extensible.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-direct.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-indirect.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-props-nrml.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-found-init.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-sym.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-found-init.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-not-found.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-no-iterator.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-object.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-reflect.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prop-descs.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prototype.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of-null.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/namespace/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/returns-promise.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-script.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-1-update-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-10-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-11-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-12-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-13-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-14-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-15-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-16-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-17-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-2-update-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-3-update-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-4-update-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-5-lhs-equals-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-6-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-7-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-8-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-9-lhs-assignment-operator-assignment-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-new-call-expression.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-rest-param.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-args.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-arguments.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-templateliteral.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/empty_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/new-covered-expression-is-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-first.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-second.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-nested-imports.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-script-code-valid.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import-other_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage-from-eval.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/browser.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/dynamic-import-module_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update-dflt_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/module-code_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/shell.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-script-code-host-resolves-module-code.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-returns-thenable.js create mode 100644 js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-specifier-tostring.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A3.1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A3.2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A3.3.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A5.1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A5.2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A5.3.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A6.1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.1.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.2.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.3.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.4.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.5.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.6.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.7.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.8.js create mode 100644 js/src/tests/test262/language/expressions/equals/S11.9.1_A7.9.js create mode 100644 js/src/tests/test262/language/expressions/equals/S9.1_A1_T3.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-boolean.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-incomparable-primitive.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-object.js create mode 100644 js/src/tests/test262/language/expressions/equals/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/equals/browser.js create mode 100644 js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-err.js create mode 100644 js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-invocation.js create mode 100644 js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-obj.js create mode 100644 js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-prim.js create mode 100644 js/src/tests/test262/language/expressions/equals/get-symbol-to-prim-err.js create mode 100644 js/src/tests/test262/language/expressions/equals/shell.js create mode 100644 js/src/tests/test262/language/expressions/equals/symbol-abstract-equality-comparison.js create mode 100644 js/src/tests/test262/language/expressions/equals/symbol-strict-equality-comparison.js create mode 100644 js/src/tests/test262/language/expressions/equals/to-prim-hint.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A1.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A10.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A11.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A12.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A13.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A14.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A15.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A16.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A17.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A18.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A19.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A2.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A20.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A21.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A22.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A23.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A3.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A4.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A5.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A6.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A7.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A8.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A9.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/bigint-arithmetic.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/bigint-negative-exponent-throws.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/browser.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-assignment-operator.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-evaluation-order.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/exp-operator.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/int32_min-exponent.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/exponentiation/shell.js create mode 100644 js/src/tests/test262/language/expressions/function/S10.1.1_A1_T2.js create mode 100644 js/src/tests/test262/language/expressions/function/arguments-with-arguments-fn.js create mode 100644 js/src/tests/test262/language/expressions/function/arguments-with-arguments-lex.js create mode 100644 js/src/tests/test262/language/expressions/function/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/function/browser.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/function/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/browser.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/function/dstr/shell.js create mode 100644 js/src/tests/test262/language/expressions/function/early-body-super-call.js create mode 100644 js/src/tests/test262/language/expressions/function/early-body-super-prop.js create mode 100644 js/src/tests/test262/language/expressions/function/early-errors/browser.js create mode 100644 js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js create mode 100644 js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-this.js create mode 100644 js/src/tests/test262/language/expressions/function/early-errors/shell.js create mode 100644 js/src/tests/test262/language/expressions/function/early-params-super-call.js create mode 100644 js/src/tests/test262/language/expressions/function/early-params-super-prop.js create mode 100644 js/src/tests/test262/language/expressions/function/eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/function/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/function/length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/function/name-arguments-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/name-arguments-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/function/name-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/name-eval-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/name-eval-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/function/name-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/name-eval-stricteval.js create mode 100644 js/src/tests/test262/language/expressions/function/name.js create mode 100644 js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-arrow.js create mode 100644 js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-eval.js create mode 100644 js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body.js create mode 100644 js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/function/param-arguments-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-dflt-yield-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-dflt-yield-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-duplicated-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-duplicated-strict-1-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-duplicated-strict-2-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-duplicated-strict-3-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-1.js create mode 100644 js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-2.js create mode 100644 js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-3.js create mode 100644 js/src/tests/test262/language/expressions/function/param-eval-non-strict-is-correct-value.js create mode 100644 js/src/tests/test262/language/expressions/function/param-eval-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/param-eval-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/function/param-eval-stricteval.js create mode 100644 js/src/tests/test262/language/expressions/function/params-dflt-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/function/params-dflt-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/function/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/function/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/function/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/function/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-body-lex-distinct.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-name-var-close.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-name-var-open-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-name-var-open-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-param-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-param-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/function/scope-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/function/shell.js create mode 100644 js/src/tests/test262/language/expressions/function/static-init-await-binding.js create mode 100644 js/src/tests/test262/language/expressions/function/static-init-await-reference.js create mode 100644 js/src/tests/test262/language/expressions/function/unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/function/unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/function/use-strict-with-non-simple-param.js create mode 100644 js/src/tests/test262/language/expressions/generators/arguments-with-arguments-fn.js create mode 100644 js/src/tests/test262/language/expressions/generators/arguments-with-arguments-lex.js create mode 100644 js/src/tests/test262/language/expressions/generators/array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/generators/browser.js create mode 100644 js/src/tests/test262/language/expressions/generators/default-proto.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/generators/dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/browser.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/dstr/shell.js create mode 100644 js/src/tests/test262/language/expressions/generators/eval-body-proto-realm.js create mode 100644 js/src/tests/test262/language/expressions/generators/eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/generators/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/generators/generator-created-after-decl-inst.js create mode 100644 js/src/tests/test262/language/expressions/generators/has-instance.js create mode 100644 js/src/tests/test262/language/expressions/generators/implicit-name.js create mode 100644 js/src/tests/test262/language/expressions/generators/invoke-as-constructor.js create mode 100644 js/src/tests/test262/language/expressions/generators/length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/generators/length-property-descriptor.js create mode 100644 js/src/tests/test262/language/expressions/generators/name.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-arrow.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-eval.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-identifier-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/generators/named-yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/no-name.js create mode 100644 js/src/tests/test262/language/expressions/generators/no-yield.js create mode 100644 js/src/tests/test262/language/expressions/generators/object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/generators/param-dflt-yield.js create mode 100644 js/src/tests/test262/language/expressions/generators/params-dflt-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/generators/params-dflt-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/generators/params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/generators/params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/generators/prototype-own-properties.js create mode 100644 js/src/tests/test262/language/expressions/generators/prototype-property-descriptor.js create mode 100644 js/src/tests/test262/language/expressions/generators/prototype-relation-to-function.js create mode 100644 js/src/tests/test262/language/expressions/generators/prototype-typeof.js create mode 100644 js/src/tests/test262/language/expressions/generators/prototype-uniqueness.js create mode 100644 js/src/tests/test262/language/expressions/generators/prototype-value.js create mode 100644 js/src/tests/test262/language/expressions/generators/rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/generators/rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/generators/return.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-body-lex-distinct.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-name-var-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-name-var-open-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-name-var-open-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-param-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-param-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/generators/shell.js create mode 100644 js/src/tests/test262/language/expressions/generators/static-init-await-binding.js create mode 100644 js/src/tests/test262/language/expressions/generators/static-init-await-reference.js create mode 100644 js/src/tests/test262/language/expressions/generators/unscopables-with-in-nested-fn.js create mode 100644 js/src/tests/test262/language/expressions/generators/unscopables-with.js create mode 100644 js/src/tests/test262/language/expressions/generators/use-strict-with-non-simple-param.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-function-expression-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-generator-expression-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-identifier-in-nested-function.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-literal-property-name.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-logical-or-expression.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-parameter.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-property-name.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-statement.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-as-yield-operand.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-identifier-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-identifier-spread-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-newline.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-star-after-newline.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-star-before-newline.js create mode 100644 js/src/tests/test262/language/expressions/generators/yield-weak-binding.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.10.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.11.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.4.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.5.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.6.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.7.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.8.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.9.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/browser.js create mode 100644 js/src/tests/test262/language/expressions/greater-than-or-equal/shell.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/11.8.2-1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/11.8.2-2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/11.8.2-3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/11.8.2-4.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.10.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.11.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.4.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.5.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.6.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.7.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.8.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.9.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-boolean.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-incomparable-string.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/bigint-and-symbol.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/browser.js create mode 100644 js/src/tests/test262/language/expressions/greater-than/shell.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A1.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T1.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T6.js create mode 100644 js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T7.js create mode 100644 js/src/tests/test262/language/expressions/grouping/browser.js create mode 100644 js/src/tests/test262/language/expressions/grouping/shell.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/browser.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/same-object-returned.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/shell.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/browser.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js create mode 100644 js/src/tests/test262/language/expressions/import.meta/syntax/shell.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A1.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A3.js create mode 100644 js/src/tests/test262/language/expressions/in/S11.8.7_A4.js create mode 100644 js/src/tests/test262/language/expressions/in/S8.12.6_A1.js create mode 100644 js/src/tests/test262/language/expressions/in/S8.12.6_A2_T1.js create mode 100644 js/src/tests/test262/language/expressions/in/S8.12.6_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/in/S8.12.6_A3.js create mode 100644 js/src/tests/test262/language/expressions/in/browser.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-in-nested.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-in.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-reference.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-target.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-complex.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-simple.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-invalid-rhs.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-presence-accessor-shadowed.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-presence-accessor.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-presence-field-shadowed.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-presence-field.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-presence-method-shadowed.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-presence-method.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-rhs-await-absent.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-rhs-await-present.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-rhs-non-object.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-rhs-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-rhs-yield-absent.js create mode 100644 js/src/tests/test262/language/expressions/in/private-field-rhs-yield-present.js create mode 100644 js/src/tests/test262/language/expressions/in/rhs-yield-absent-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/in/rhs-yield-absent-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/in/rhs-yield-present.js create mode 100644 js/src/tests/test262/language/expressions/in/shell.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/browser.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/shell.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js create mode 100644 js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A1_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/S9.5_A3.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/bigint.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/browser.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/left-shift/shell.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-3.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-4.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.10.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.11.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.4.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.5.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.6.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.7.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.8.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.9.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/browser.js create mode 100644 js/src/tests/test262/language/expressions/less-than-or-equal/shell.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.10.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.11.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T1.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T2.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.4.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.5.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.6.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.7.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.8.js create mode 100644 js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.9.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-boolean.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-incomparable-string.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/less-than/bigint-and-symbol.js create mode 100644 js/src/tests/test262/language/expressions/less-than/browser.js create mode 100644 js/src/tests/test262/language/expressions/less-than/shell.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/browser.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/shell.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/symbol-logical-and-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/logical-and/tco-right-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/browser.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-and.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-nullish.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-or.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-nullish.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-or.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-and.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-nullish.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-or.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-and.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-nullish.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-or.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-and.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-nullish.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-or.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-and.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-nullish.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-or.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-bigint.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-lhs-before-rhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-class-expression.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-function.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-put-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-extensible-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-simple-lhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-put-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-lhs-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs-put.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-bigint.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-lhs-before-rhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-class-expression.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-function.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-put-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-extensible-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-simple-lhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-put-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-lhs-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs-put.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-arguments-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-bigint.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-lhs-before-rhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-arrow-function.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-class-expression.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-function.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-put-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-extensible-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-simple-lhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-put-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-lhs-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs-put.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-eval-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-non-simple.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-whitespace.js create mode 100644 js/src/tests/test262/language/expressions/logical-assignment/shell.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A1.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A1_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/S9.2_A6_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/bigint.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/browser.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/shell.js create mode 100644 js/src/tests/test262/language/expressions/logical-not/symbol-logical-not-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/browser.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/shell.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/symbol-logical-or-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/logical-or/tco-right-strict.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T6.js create mode 100644 js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T7.js create mode 100644 js/src/tests/test262/language/expressions/modulus/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/modulus/bigint-arithmetic.js create mode 100644 js/src/tests/test262/language/expressions/modulus/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/modulus/bigint-modulo-zero.js create mode 100644 js/src/tests/test262/language/expressions/modulus/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/modulus/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/modulus/browser.js create mode 100644 js/src/tests/test262/language/expressions/modulus/line-terminator.js create mode 100644 js/src/tests/test262/language/expressions/modulus/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/modulus/shell.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T6.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T7.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T8.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/bigint-arithmetic.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/browser.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/line-terminator.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/multiplication/shell.js create mode 100644 js/src/tests/test262/language/expressions/new.target/asi.js create mode 100644 js/src/tests/test262/language/expressions/new.target/browser.js create mode 100644 js/src/tests/test262/language/expressions/new.target/escaped-new.js create mode 100644 js/src/tests/test262/language/expressions/new.target/escaped-target.js create mode 100644 js/src/tests/test262/language/expressions/new.target/shell.js create mode 100644 js/src/tests/test262/language/expressions/new.target/unary-expr.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-call.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-fpapply.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-fpcall.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-member.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-new.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-reflect-apply.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-reflect-construct.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-super-call.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-super-property.js create mode 100644 js/src/tests/test262/language/expressions/new.target/value-via-tagged-template.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A2.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/new/browser.js create mode 100644 js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js create mode 100644 js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js create mode 100644 js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js create mode 100644 js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js create mode 100644 js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js create mode 100644 js/src/tests/test262/language/expressions/new/shell.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-mult-empty.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-mult-expr.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-mult-iter.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-mult-literal.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-sngl-empty.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-sngl-expr.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-sngl-iter.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-sngl-literal.js create mode 100644 js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5-0-1.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5-0-2.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5-1gs-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5-2gs.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_3-3-1.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_4-4-a-3.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_4-4-b-1.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_4-5-1.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_5-4-1.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_6-3-1.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_6-3-2.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_7-3-1.js create mode 100644 js/src/tests/test262/language/expressions/object/11.1.5_7-3-2.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A1.1.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A1.2.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A1.3.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A1.4.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A2.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A3.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A4.1.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/object/S11.1.5_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-duplicate-computed.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-duplicate.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-fn-name.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-permitted-dup-shorthand.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-permitted-dup.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-poisoned-object-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-value-non-object.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/__proto__-value-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-computed-err-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-computed-err-to-prop-key.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-computed-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-computed-in.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-id.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-computed.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-binary.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-exponent.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-hex.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-non-canonical.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-octal.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-zero.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-char-escape.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-double-quote.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-hex-escape.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-line-continuation.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-single-quote.js create mode 100644 js/src/tests/test262/language/expressions/object/accessor-name-literal-string-unicode-escape.js create mode 100644 js/src/tests/test262/language/expressions/object/browser.js create mode 100644 js/src/tests/test262/language/expressions/object/computed-__proto__.js create mode 100644 js/src/tests/test262/language/expressions/object/computed-property-evaluation-order.js create mode 100644 js/src/tests/test262/language/expressions/object/concise-generator.js create mode 100644 js/src/tests/test262/language/expressions/object/cover-initialized-name.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-implements-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-interface-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-let-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-package-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-private-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-protected-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-public-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-static-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-add.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-subtract.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-assignment.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-bitwise-or.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-async-arrow-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-false.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-true.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-literal.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-exponetiation-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-coalesce.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-and.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-or.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-generator-function-declaration.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-e-notational-literal.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-math.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-div.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-mult.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-null.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-numeric-literal.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-string-literal.js create mode 100644 js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-yield-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/browser.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-no-close.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-name-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-direct.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-empty.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-list-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-eval-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-get-value-err.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-skipped.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-throws.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-init.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-null.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-undef.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-getter.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-val-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-get-not-called-on-dontenum-keys.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-gopd-not-called-on-excluded-keys.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-ownkeys-returned-keys-order.js create mode 100644 js/src/tests/test262/language/expressions/object/dstr/shell.js create mode 100644 js/src/tests/test262/language/expressions/object/fn-name-accessor-get.js create mode 100644 js/src/tests/test262/language/expressions/object/fn-name-accessor-set.js create mode 100644 js/src/tests/test262/language/expressions/object/fn-name-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/fn-name-class.js create mode 100644 js/src/tests/test262/language/expressions/object/fn-name-cover.js create mode 100644 js/src/tests/test262/language/expressions/object/fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/getter-body-strict-inside.js create mode 100644 js/src/tests/test262/language/expressions/object/getter-body-strict-outside-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/getter-param-dflt.js create mode 100644 js/src/tests/test262/language/expressions/object/getter-prop-desc.js create mode 100644 js/src/tests/test262/language/expressions/object/getter-super-prop.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-default.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-extends.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-implements-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-interface-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-let-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-package-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-private-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-protected-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-public-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-static-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-method-def-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-await-static-init.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-break-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-case-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-catch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-class-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-const-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-continue-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-debugger-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-delete-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-do-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-else-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-enum-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-export-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped-ext.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-finally-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-for-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-function-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-if-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-implements-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-import-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-in-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-instanceof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-interface-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-let-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-new-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-package-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-private-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-protected-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-public-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-return-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-static-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-super-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-switch-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-this-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-throw-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-try-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-typeof-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-var-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-void-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-while-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-with-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-await-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-implements-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-interface-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-computed-name.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-zero.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-let-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-package-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-private-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-protected-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-public-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-invalid.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-valid.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-static-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/identifier-shorthand-yield-invalid-strict-mode.js create mode 100644 js/src/tests/test262/language/expressions/object/let-non-strict-access.js create mode 100644 js/src/tests/test262/language/expressions/object/let-non-strict-syntax.js create mode 100644 js/src/tests/test262/language/expressions/object/literal-property-name-bigint.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-escaped-async.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-catch.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-async-iterator.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-sync-iterator.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-next.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-return.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-null-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-undefined-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-done-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-value-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-non-object-ignores-then.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-boolean-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-null-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-number-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-object-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-string-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-symbol-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-undefined-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-get-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-boolean-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-null-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-number-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-object-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-string-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-symbol-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-undefined-fulfillpromise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-returns-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-next.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-return.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-throw.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-escaped-async.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow-returns-arguments-from-parent-function.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function-returns-arguments-from-own-function.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function-returns-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-super-call-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/async-super-call-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/browser.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/computed-property-name-yield-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-async-method-duplicate-parameters.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-NSPL-with-USD.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-arguments-in-formal-parameters-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-async-lineterminator.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals-default.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-body-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-eval-in-formal-parameters-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-body-duplicate.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-contains-super-call.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-get-e.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-get-g.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-get-t.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-get.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-set-e.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-set-s.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-set-t.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/escaped-set.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/fn-name-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/fn-name-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/browser.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-arguments.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/shell.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/browser.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-get.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-value.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-prop-caller.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/shell.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/browser.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/shell.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier-escaped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-single.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-obj.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-ctor.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-length.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-string.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-symbol.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-no-yield.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-param-id-yield.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-param-init-yield.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-const.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-let.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-params.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-eval-error.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-id.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-property-desc.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-prototype-prop.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-return.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-array-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-not-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-undefined.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-duplicates.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-later.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-prior.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-self.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-rest.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-trailing-comma.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-eval-var-scope-syntax-err.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-object-destructuring-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-multiple.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-single.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-rest-param-strict-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/meth-rest-params-trailing-comma-early-error.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-invoke-ctor.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-length.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-string.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-symbol.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-param-id-yield.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-param-init-yield.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-param-redecl.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-params.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-eval-error.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-expr.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-id.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-property-desc.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-prototype-prop.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-prototype.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-super-call-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-super-call-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-body.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/object-method-returns-promise.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-args-unmapped.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-ref-arguments.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn-inside-class.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method-inside-class.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method-inside-class.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method-inside-class.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/setter-use-strict-with-non-simple-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/shell.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-accessor.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-generator.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-normal.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-accessor.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-generator.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-normal.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/use-strict-with-non-simple-param.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-with-rhs.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-without-rhs.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-identifier-in-nested-function.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-literal-property-name.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-logical-or-expression.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-parameter.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-property-name.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-statement.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-as-yield-operand.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-newline.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-return.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-star-after-newline.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-star-before-newline.js create mode 100644 js/src/tests/test262/language/expressions/object/method-definition/yield-weak-binding.js create mode 100644 js/src/tests/test262/language/expressions/object/method.js create mode 100644 js/src/tests/test262/language/expressions/object/not-defined.js create mode 100644 js/src/tests/test262/language/expressions/object/object-spread-proxy-get-not-called-on-dontenum-keys.js create mode 100644 js/src/tests/test262/language/expressions/object/object-spread-proxy-no-excluded-keys.js create mode 100644 js/src/tests/test262/language/expressions/object/object-spread-proxy-ownkeys-returned-keys-order.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-def-id-eval-error-2.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-def-id-eval-error.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-def-id-get-error.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-def-id-valid.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-def-invalid-async-prefix.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-def-invalid-star-prefix.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-data-data.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-data-set.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-get-data.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-get-get.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-get-set-get.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-set-data.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-set-get-set.js create mode 100644 js/src/tests/test262/language/expressions/object/prop-dup-set-set.js create mode 100644 js/src/tests/test262/language/expressions/object/properties-names-eval-arguments.js create mode 100644 js/src/tests/test262/language/expressions/object/property-name-yield.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-gen-meth-body-lex-distinct.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-getter-body-lex-distinc.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-meth-body-lex-distinct.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-close.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-open.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-setter-body-lex-distinc.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-close.js create mode 100644 js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-open.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-body-strict-inside.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-body-strict-outside-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-length-dflt.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-inside.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-outside-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-param-eval-strict-inside.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-param-eval-strict-outside-strict.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-prop-desc.js create mode 100644 js/src/tests/test262/language/expressions/object/setter-super-prop.js create mode 100644 js/src/tests/test262/language/expressions/object/shell.js create mode 100644 js/src/tests/test262/language/expressions/object/yield-non-strict-access.js create mode 100644 js/src/tests/test262/language/expressions/object/yield-non-strict-syntax.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/browser.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/call-expression-super-no-base.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/call-expression.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string-esi.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string-esi.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string-esi.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string-esi.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/eval-optional-call.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-do.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-await-of.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-in.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-of-type-error.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-while.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-identifier.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-literal.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-this.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/member-expression.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/new-target-optional-call.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-call-preserves-this.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-square-brackets.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-chain-expression-optional-expression.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-arguments.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-expression.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-identifiername.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-chain.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/optional-expression.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/punctuator-decimal-lookahead.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/runtime-semantics-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/shell.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/short-circuiting.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/static-semantics-simple-assignment.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/super-property-optional-call.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/update-expression-postfix.js create mode 100644 js/src/tests/test262/language/expressions/optional-chaining/update-expression-prefix.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/11.3.2-2-3-s.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/arguments-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/bigint.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/browser.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/eval-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-carriage-return.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-feed.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-separator.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-paragraph-separator.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/shell.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/target-cover-id.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/target-cover-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/target-cover-yieldexpr.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/target-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/this.js create mode 100644 js/src/tests/test262/language/expressions/postfix-decrement/whitespace.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-1gs-strict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T2.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T3.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/arguments-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/bigint.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/browser.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/eval-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/line-terminator-carriage-return.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-feed.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-separator.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/line-terminator-paragraph-separator.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/shell.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/target-cover-id.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/target-cover-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/target-cover-yieldexpr.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/target-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/this.js create mode 100644 js/src/tests/test262/language/expressions/postfix-increment/whitespace.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-2gs-strict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-3-s.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/arguments-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/bigint.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/browser.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/eval-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/shell.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/target-cover-id.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/target-cover-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/target-cover-yieldexpr.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/target-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/this.js create mode 100644 js/src/tests/test262/language/expressions/prefix-decrement/whitespace.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/11.4.4-2-3-s.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T2.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T3.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/arguments-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/arguments-strict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/bigint.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/browser.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/eval-nostrict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/eval-strict.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/shell.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/target-cover-id.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/target-cover-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/target-cover-yieldexpr.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/target-newtarget.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/this.js create mode 100644 js/src/tests/test262/language/expressions/prefix-increment/whitespace.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.1.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.2.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A2.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T6.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T7.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T8.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T9.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A1.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A2.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A3.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/browser.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/non-identifier-name.js create mode 100644 js/src/tests/test262/language/expressions/property-accessors/shell.js create mode 100644 js/src/tests/test262/language/expressions/relational/S9.1_A1_T4.js create mode 100644 js/src/tests/test262/language/expressions/relational/browser.js create mode 100644 js/src/tests/test262/language/expressions/relational/shell.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/bigint.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/browser.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/right-shift/shell.js create mode 100644 js/src/tests/test262/language/expressions/shell.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A1.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A3.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A5.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.1.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.2.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A7.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T3.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T4.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T5.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-boolean.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-object.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/browser.js create mode 100644 js/src/tests/test262/language/expressions/strict-does-not-equals/shell.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A1.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A3.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.3.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A5.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.1.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.2.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A7.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T1.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T2.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T3.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T4.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T5.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-bigint.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-boolean.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-incomparable-primitive.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-non-finite.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-number-extremes.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-object.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/bigint-and-string.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/browser.js create mode 100644 js/src/tests/test262/language/expressions/strict-equals/shell.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T6.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T7.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T8.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/bigint-arithmetic.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/browser.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/subtraction/shell.js create mode 100644 js/src/tests/test262/language/expressions/super/browser.js create mode 100644 js/src/tests/test262/language/expressions/super/call-arg-evaluation-err.js create mode 100644 js/src/tests/test262/language/expressions/super/call-bind-this-value-twice.js create mode 100644 js/src/tests/test262/language/expressions/super/call-bind-this-value.js create mode 100644 js/src/tests/test262/language/expressions/super/call-construct-error.js create mode 100644 js/src/tests/test262/language/expressions/super/call-construct-invocation.js create mode 100644 js/src/tests/test262/language/expressions/super/call-expr-value.js create mode 100644 js/src/tests/test262/language/expressions/super/call-poisoned-underscore-proto.js create mode 100644 js/src/tests/test262/language/expressions/super/call-proto-not-ctor.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-iter-get-value.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-expr-throws.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-call.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-get.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-value.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-step.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-value.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-mult-empty.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-mult-expr.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-mult-iter.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-mult-literal.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-mult-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-mult-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-mult-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-getter-descriptor.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-getter-init.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-manipulate-outter-obj-in-getter.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread-getter.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-null.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-override-immutable.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-overrides-prev-properties.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-skip-non-enumerable.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-spread-order.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-symbol-property.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-undefined.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-obj-with-overrides.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-sngl-empty.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-sngl-expr.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-sngl-iter.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-sngl-literal.js create mode 100644 js/src/tests/test262/language/expressions/super/call-spread-sngl-obj-ident.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-cls-null-proto.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-strict.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-this.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-cls-this-uninit.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-arrow.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-eval.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-cls-val.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-obj-null-proto.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-this.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-arrow.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-eval.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-dot-obj-val.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-err.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-key-err.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-null-proto.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-strict.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-this.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-this-uninit.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-arrow.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-eval.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-cls-val.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-err.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-key-err.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-null-proto.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-this.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-arrow.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-eval.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-expr-obj-val.js create mode 100644 js/src/tests/test262/language/expressions/super/prop-poisoned-underscore-proto.js create mode 100644 js/src/tests/test262/language/expressions/super/realm.js create mode 100644 js/src/tests/test262/language/expressions/super/shell.js create mode 100644 js/src/tests/test262/language/expressions/super/super-reference-resolution.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/browser.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-different-functions-same-site.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-eval.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-new-function.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-differing-raw-strings.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-differing-string-count.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-eval-inner-function.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-eval.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-new-function.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-identical-source.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-realm.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-same-site-top-level.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/cache-same-site.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/call-expression-argument-list-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/call-expression-context-no-strict.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/call-expression-context-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/chained-application.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/constructor-invocation.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/invalid-escape-sequences.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/member-expression-argument-list-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/member-expression-context.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/shell.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/tco-call-strict.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/tco-member-strict.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/template-object-template-map.js create mode 100644 js/src/tests/test262/language/expressions/tagged-template/template-object.js create mode 100644 js/src/tests/test262/language/expressions/tco-pos-strict.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/browser.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/evaluation-order.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-1.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-2.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-3.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-8.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-9.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-1.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-2.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-3.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-4.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-5.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-6.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-7.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-8.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-function.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-member-expr.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-method.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-obj.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-primitive.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-template.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/literal-expr-tostr-error.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-function.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-member-expr.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-method.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-obj.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-primitive.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-template.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-tostr-error.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-abrupt.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-function.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-member-expr.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-method.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-obj.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-primitive.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-template.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-tostr-error.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator-eval.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/no-sub.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/shell.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-character-escape-sequence.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-hex-escape-sequence.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-line-continuation.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-line-terminator-sequence.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-no-substitution.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-null-character-escape-sequence.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-template-character.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-template-characters.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-template-head.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-template-middle.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-template-tail.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-utf16-escape-sequence.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/tv-zwnbsp.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/unicode-escape-nls-err.js create mode 100644 js/src/tests/test262/language/expressions/template-literal/unicode-escape-no-hex-err.js create mode 100644 js/src/tests/test262/language/expressions/this/11.1.1-1.js create mode 100644 js/src/tests/test262/language/expressions/this/S11.1.1_A1.js create mode 100644 js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.js create mode 100644 js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.js create mode 100644 js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.js create mode 100644 js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/this/browser.js create mode 100644 js/src/tests/test262/language/expressions/this/shell.js create mode 100644 js/src/tests/test262/language/expressions/typeof/bigint.js create mode 100644 js/src/tests/test262/language/expressions/typeof/boolean.js create mode 100644 js/src/tests/test262/language/expressions/typeof/browser.js create mode 100644 js/src/tests/test262/language/expressions/typeof/built-in-exotic-objects-no-call.js create mode 100644 js/src/tests/test262/language/expressions/typeof/built-in-functions.js create mode 100644 js/src/tests/test262/language/expressions/typeof/built-in-ordinary-objects-no-call.js create mode 100644 js/src/tests/test262/language/expressions/typeof/get-value-ref-err.js create mode 100644 js/src/tests/test262/language/expressions/typeof/get-value.js create mode 100644 js/src/tests/test262/language/expressions/typeof/native-call.js create mode 100644 js/src/tests/test262/language/expressions/typeof/null.js create mode 100644 js/src/tests/test262/language/expressions/typeof/number.js create mode 100644 js/src/tests/test262/language/expressions/typeof/proxy.js create mode 100644 js/src/tests/test262/language/expressions/typeof/shell.js create mode 100644 js/src/tests/test262/language/expressions/typeof/string.js create mode 100644 js/src/tests/test262/language/expressions/typeof/symbol.js create mode 100644 js/src/tests/test262/language/expressions/typeof/syntax.js create mode 100644 js/src/tests/test262/language/expressions/typeof/undefined.js create mode 100644 js/src/tests/test262/language/expressions/typeof/unresolvable-reference.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/11.4.7-4-1.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A1.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.1.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.2.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/bigint.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/browser.js create mode 100644 js/src/tests/test262/language/expressions/unary-minus/shell.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A1.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T1.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T3.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T4.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T5.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/browser.js create mode 100644 js/src/tests/test262/language/expressions/unary-plus/shell.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.3_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T2.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T3.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T4.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.2.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.3.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.4.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.5.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.2.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.3.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.4.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.5.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.6.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.7.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.8.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.9.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.2.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T2.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T3.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T4.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.2_T1.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-and-number.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-errors.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-non-primitive.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-toprimitive.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-wrapped-values.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/bigint.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/browser.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/order-of-evaluation.js create mode 100644 js/src/tests/test262/language/expressions/unsigned-right-shift/shell.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A1.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A2_T1.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A2_T2.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A4_T1.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A4_T2.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A4_T3.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A4_T4.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A4_T5.js create mode 100644 js/src/tests/test262/language/expressions/void/S11.4.2_A4_T6.js create mode 100644 js/src/tests/test262/language/expressions/void/browser.js create mode 100644 js/src/tests/test262/language/expressions/void/shell.js create mode 100644 js/src/tests/test262/language/expressions/yield/arguments-object-attributes.js create mode 100644 js/src/tests/test262/language/expressions/yield/browser.js create mode 100644 js/src/tests/test262/language/expressions/yield/captured-free-vars.js create mode 100644 js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-non-strict.js create mode 100644 js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-strict-strict.js create mode 100644 js/src/tests/test262/language/expressions/yield/formal-parameters.js create mode 100644 js/src/tests/test262/language/expressions/yield/from-catch.js create mode 100644 js/src/tests/test262/language/expressions/yield/from-try.js create mode 100644 js/src/tests/test262/language/expressions/yield/from-with.js create mode 100644 js/src/tests/test262/language/expressions/yield/in-iteration-stmt.js create mode 100644 js/src/tests/test262/language/expressions/yield/in-rltn-expr.js create mode 100644 js/src/tests/test262/language/expressions/yield/invalid-left-hand-side.js create mode 100644 js/src/tests/test262/language/expressions/yield/iter-value-specified.js create mode 100644 js/src/tests/test262/language/expressions/yield/iter-value-unspecified.js create mode 100644 js/src/tests/test262/language/expressions/yield/rhs-iter.js create mode 100644 js/src/tests/test262/language/expressions/yield/rhs-omitted.js create mode 100644 js/src/tests/test262/language/expressions/yield/rhs-primitive.js create mode 100644 js/src/tests/test262/language/expressions/yield/rhs-regexp.js create mode 100644 js/src/tests/test262/language/expressions/yield/rhs-template-middle.js create mode 100644 js/src/tests/test262/language/expressions/yield/rhs-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/yield/rhs-yield.js create mode 100644 js/src/tests/test262/language/expressions/yield/shell.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-array.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-in-iteration-stmt.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-in-rltn-expr.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-iterable.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-return-is-null.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-non-obj.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-get-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-non-obj.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-get-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-invoke.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-no-value.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-final.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-no-rtrn.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-no-value.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-final.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-non-obj.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-get-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-invoke.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-no-value.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-final.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-non-obj.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-get-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-invoke.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-no-rtrn.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-non-obj.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-get-err.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-invoke.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-rhs-unresolvable.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-string.js create mode 100644 js/src/tests/test262/language/expressions/yield/star-throw-is-null.js create mode 100644 js/src/tests/test262/language/expressions/yield/then-return.js create mode 100644 js/src/tests/test262/language/expressions/yield/within-for.js (limited to 'js/src/tests/test262/language/expressions') diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A1.js new file mode 100644 index 0000000000..434f41be29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between AdditiveExpression and "+" or + between "+" and MultiplicativeExpression are allowed +es5id: 11.6.1_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009+\u00091") !== 2) { + throw new Test262Error('#1: 1\\u0009+\\u00091 === 2'); +} + +//CHECK#2 +if (eval("1\u000B+\u000B1") !== 2) { + throw new Test262Error('#2: 1\\u000B+\\u000B1 === 2'); +} + +//CHECK#3 +if (eval("1\u000C+\u000C1") !== 2) { + throw new Test262Error('#3: 1\\u000C+\\u000C1 === 2'); +} + +//CHECK#4 +if (eval("1\u0020+\u00201") !== 2) { + throw new Test262Error('#4: 1\\u0020+\\u00201 === 2'); +} + +//CHECK#5 +if (eval("1\u00A0+\u00A01") !== 2) { + throw new Test262Error('#5: 1\\u00A0+\\u00A01 === 2'); +} + +//CHECK#6 +if (eval("1\u000A+\u000A1") !== 2) { + throw new Test262Error('#6: 1\\u000A+\\u000A1 === 2'); +} + +//CHECK#7 +if (eval("1\u000D+\u000D1") !== 2) { + throw new Test262Error('#7: 1\\u000D+\\u000D1 === 2'); +} + +//CHECK#8 +if (eval("1\u2028+\u20281") !== 2) { + throw new Test262Error('#8: 1\\u2028+\\u20281 === 2'); +} + +//CHECK#9 +if (eval("1\u2029+\u20291") !== 2) { + throw new Test262Error('#9: 1\\u2029+\\u20291 === 2'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029+\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 2) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029+\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 2'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T1.js new file mode 100644 index 0000000000..098c37fd14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x + y uses GetValue +es5id: 11.6.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 + 1 !== 2) { + throw new Test262Error('#1: 1 + 1 === 2. Actual: ' + (1 + 1)); +} + +//CHECK#2 +var x = 1; +if (x + 1 !== 2) { + throw new Test262Error('#2: var x = 1; x + 1 === 2. Actual: ' + (x + 1)); +} + +//CHECK#3 +var y = 1; +if (1 + y !== 2) { + throw new Test262Error('#3: var y = 1; 1 + y === 2. Actual: ' + (1 + y)); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x + y !== 2) { + throw new Test262Error('#4: var x = 1; var y = 1; x + y === 2. Actual: ' + (x + y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop + objecty.prop !== 2) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop + objecty.prop === 2. Actual: ' + (objectx.prop + objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T2.js new file mode 100644 index 0000000000..8a7eb762b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x + y uses GetValue +es5id: 11.6.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x + 1; + throw new Test262Error('#1.1: x + 1 throw ReferenceError. Actual: ' + (x + 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x + 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T3.js new file mode 100644 index 0000000000..4bbd1ae88c --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x + y uses GetValue +es5id: 11.6.1_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 + y; + throw new Test262Error('#1.1: 1 + y throw ReferenceError. Actual: ' + (1 + y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 + y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T1.js new file mode 100644 index 0000000000..2620c3d966 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x + y uses [[Default Value]] +es5id: 11.6.1_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 1}} + 1 !== 2) { + throw new Test262Error('#1: {valueOf: function() {return 1}} + 1 === 2. Actual: ' + ({valueOf: function() {return 1}} + 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} + 1 !== 2) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} + 1 === 2. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} + 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} + 1 !== 2) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} + 1 === 2. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} + 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} + 1 !== 2) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} + 1 === 2. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} + 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} + 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} + 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 + {toString: function() {return 1}} !== 2) { + throw new Test262Error('#5: 1 + {toString: function() {return 1}} === 2. Actual: ' + (1 + {toString: function() {return 1}})); +} + +//CHECK#6 +if (1 + {valueOf: function() {return {}}, toString: function() {return 1}} !== 2) { + throw new Test262Error('#6: 1 + {valueOf: function() {return {}}, toString: function() {return 1}} === 2. Actual: ' + (1 + {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + 1 + {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 1 + {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 + {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 + {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 + {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 + {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 + {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 + {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T2.js new file mode 100644 index 0000000000..b8f533bf95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x + y uses [[Default Value]] +es5id: 11.6.1_A2.2_T2 +description: If Type(value) is Date object, evaluate ToPrimitive(value, String) +---*/ + +//CHECK#1 +var date = new Date(); +if (date + date !== date.toString() + date.toString()) { + throw new Test262Error('#1: var date = new Date(); date + date === date.toString() + date.toString(). Actual: ' + (date + date)); +} + +//CHECK#2 +var date = new Date(); +if (date + 0 !== date.toString() + "0") { + throw new Test262Error('#2: var date = new Date(); date + 0 === date.toString() + "0". Actual: ' + (date + 0)); +} + +//CHECK#3 +var date = new Date(); +if (date + true !== date.toString() + "true") { + throw new Test262Error('#3: var date = new Date(); date + true === date.toString() + "true". Actual: ' + (date + true)); +} + +//CHECK#4 +var date = new Date(); +if (date + new Object() !== date.toString() + "[object Object]") { + throw new Test262Error('#4: var date = new Date(); date + new Object() === date.toString() + "[object Object]". Actual: ' + (date + new Object())); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T3.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T3.js new file mode 100644 index 0000000000..4d60b6dd11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.2_T3.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x + y uses [[Default Value]] +es5id: 11.6.1_A2.2_T3 +description: If Type(value) is Function, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +function f1(){ + return 0; +} +if (f1 + 1 !== f1.toString() + 1) { + throw new Test262Error('#1: function f1() {return 0;}; f1 + 1 === f1.toString() + 1'); +} + +//CHECK#2 +function f2(){ + return 0; +} +f2.valueOf = function() {return 1;}; +if (1 + f2 !== 1 + 1) { + throw new Test262Error('#2: f1unction f2() {return 0;} f2.valueOf = function() {return 1;}; 1 + f2 === 1 + 1. Actual: ' + (1 + f2)); +} + +//CHECK#3 +function f3(){ + return 0; +} +f3.toString = function() {return 1;}; +if (1 + f3 !== 1 + 1) { + throw new Test262Error('#3: f1unction f3() {return 0;} f3.toString() = function() {return 1;}; 1 + f3 === 1 + 1. Actual: ' + (1 + f3)); +} + +//CHECK#4 +function f4(){ + return 0; +} +f4.valueOf = function() {return -1;}; +f4.toString = function() {return 1;}; +if (f4 + 1 !== 1 - 1) { + throw new Test262Error('#4: f1unction f4() {return 0;}; f2.valueOf = function() {return -1;}; f4.toString() = function() {return 1;}; f4 + 1 === 1 - 1. Actual: ' + (f4 + 1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.3_T1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.3_T1.js new file mode 100644 index 0000000000..9989784ab5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.6.1_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x + y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x + y throw "x". Actual: ' + (x + y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x + y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T1.js new file mode 100644 index 0000000000..19c4bfc42e --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) + x !== 2) { + throw new Test262Error('#1: var x = 0; (x = 1) + x === 2. Actual: ' + ((x = 1) + x)); +} + +//CHECK#2 +var x = 0; +if (x + (x = 1) !== 1) { + throw new Test262Error('#2: var x = 0; x + (x = 1) === 1. Actual: ' + (x + (x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T2.js new file mode 100644 index 0000000000..6e4c31e23c --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() + y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() + y() throw "x". Actual: ' + (x() + y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() + y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T3.js new file mode 100644 index 0000000000..8b7167a47a --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.1_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x + (x = 1); + throw new Test262Error('#1.1: x + (x = 1) throw ReferenceError. Actual: ' + (x + (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x + (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T4.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T4.js new file mode 100644 index 0000000000..e8476ea39f --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.1_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) + y !== 2) { + throw new Test262Error('#1: (y = 1) + y === 2. Actual: ' + ((y = 1) + y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.1.js new file mode 100644 index 0000000000..74cb81c855 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + boolean and Boolean object +---*/ + +//CHECK#1 +if (true + true !== 2) { + throw new Test262Error('#1: true + true === 2. Actual: ' + (true + true)); +} + +//CHECK#2 +if (new Boolean(true) + true !== 2) { + throw new Test262Error('#2: new Boolean(true) + true === 2. Actual: ' + (new Boolean(true) + true)); +} + +//CHECK#3 +if (true + new Boolean(true) !== 2) { + throw new Test262Error('#3: true + new Boolean(true) === 2. Actual: ' + (true + new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) + new Boolean(true) !== 2) { + throw new Test262Error('#4: new Boolean(true) + new Boolean(true) === 2. Actual: ' + (new Boolean(true) + new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.2.js new file mode 100644 index 0000000000..7c6e0191c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + number and Number object +---*/ + +//CHECK#1 +if (1 + 1 !== 2) { + throw new Test262Error('#1: 1 + 1 === 2. Actual: ' + (1 + 1)); +} + +//CHECK#2 +if (new Number(1) + 1 !== 2) { + throw new Test262Error('#2: new Number(1) + 1 === 2. Actual: ' + (new Number(1) + 1)); +} + +//CHECK#3 +if (1 + new Number(1) !== 2) { + throw new Test262Error('#3: 1 + new Number(1) === 2. Actual: ' + (1 + new Number(1))); +} + +//CHECK#4 +if (new Number(1) + new Number(1) !== 2) { + throw new Test262Error('#4: new Number(1) + new Number(1) === 2. Actual: ' + (new Number(1) + new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.3.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.3.js new file mode 100644 index 0000000000..1868103d15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T1.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T1.3 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Null and + Undefined +---*/ + +//CHECK#1 +if (isNaN(null + undefined) !== true) { + throw new Test262Error('#1: null + undefined === Not-a-Number. Actual: ' + (null + undefined)); +} + +//CHECK#2 +if (isNaN(undefined + null) !== true) { + throw new Test262Error('#2: undefined + null === Not-a-Number. Actual: ' + (undefined + null)); +} + +//CHECK#3 +if (isNaN(undefined + undefined) !== true) { + throw new Test262Error('#3: undefined + undefined === Not-a-Number. Actual: ' + (undefined + undefined)); +} + +//CHECK#4 +if (null + null !== 0) { + throw new Test262Error('#4: null + null === 0. Actual: ' + (null + null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.1.js new file mode 100644 index 0000000000..1c745745d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T2.1 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) or Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true + 1 !== 2) { + throw new Test262Error('#1: true + 1 === 2. Actual: ' + (true + 1)); +} + +//CHECK#2 +if (1 + true !== 2) { + throw new Test262Error('#2: 1 + true === 2. Actual: ' + (1 + true)); +} + +//CHECK#3 +if (new Boolean(true) + 1 !== 2) { + throw new Test262Error('#3: new Boolean(true) + 1 === 2. Actual: ' + (new Boolean(true) + 1)); +} + +//CHECK#4 +if (1 + new Boolean(true) !== 2) { + throw new Test262Error('#4: 1 + new Boolean(true) === 2. Actual: ' + (1 + new Boolean(true))); +} + +//CHECK#5 +if (true + new Number(1) !== 2) { + throw new Test262Error('#5: true + new Number(1) === 2. Actual: ' + (true + new Number(1))); +} + +//CHECK#6 +if (new Number(1) + true !== 2) { + throw new Test262Error('#6: new Number(1) + true === 2. Actual: ' + (new Number(1) + true)); +} + +//CHECK#7 +if (new Boolean(true) + new Number(1) !== 2) { + throw new Test262Error('#7: new Boolean(true) + new Number(1) === 2. Actual: ' + (new Boolean(true) + new Number(1))); +} + +//CHECK#8 +if (new Number(1) + new Boolean(true) !== 2) { + throw new Test262Error('#8: new Number(1) + new Boolean(true) === 2. Actual: ' + (new Number(1) + new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.2.js new file mode 100644 index 0000000000..6704fc2752 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T2.2 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 + null !== 1) { + throw new Test262Error('#1: 1 + null === 1. Actual: ' + (1 + null)); +} + +//CHECK#2 +if (null + 1 !== 1) { + throw new Test262Error('#2: null + 1 === 1. Actual: ' + (null + 1)); +} + +//CHECK#3 +if (new Number(1) + null !== 1) { + throw new Test262Error('#3: new Number(1) + null === 1. Actual: ' + (new Number(1) + null)); +} + +//CHECK#4 +if (null + new Number(1) !== 1) { + throw new Test262Error('#4: null + new Number(1) === 1. Actual: ' + (null + new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.3.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.3.js new file mode 100644 index 0000000000..2e28d0e87d --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T2.3 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(1 + undefined) !== true) { + throw new Test262Error('#1: 1 + undefined === Not-a-Number. Actual: ' + (1 + undefined)); +} + +//CHECK#2 +if (isNaN(undefined + 1) !== true) { + throw new Test262Error('#2: undefined + 1 === Not-a-Number. Actual: ' + (undefined + 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) + undefined) !== true) { + throw new Test262Error('#3: new Number(1) + undefined === Not-a-Number. Actual: ' + (new Number(1) + undefined)); +} + +//CHECK#4 +if (isNaN(undefined + new Number(1)) !== true) { + throw new Test262Error('#4: undefined + new Number(1) === Not-a-Number. Actual: ' + (undefined + new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.4.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.4.js new file mode 100644 index 0000000000..b3a2f92c9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T2.4 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(true + undefined) !== true) { + throw new Test262Error('#1: true + undefined === Not-a-Number. Actual: ' + (true + undefined)); +} + +//CHECK#2 +if (isNaN(undefined + true) !== true) { + throw new Test262Error('#2: undefined + true === Not-a-Number. Actual: ' + (undefined + true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) + undefined) !== true) { + throw new Test262Error('#3: new Boolean(true) + undefined === Not-a-Number. Actual: ' + (new Boolean(true) + undefined)); +} + +//CHECK#4 +if (isNaN(undefined + new Boolean(true)) !== true) { + throw new Test262Error('#4: undefined + new Boolean(true) === Not-a-Number. Actual: ' + (undefined + new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.5.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.5.js new file mode 100644 index 0000000000..4ef1638be9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.1_T2.5.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String and Type(Primitive(y)) is not String, + then operator x + y returns ToNumber(x) + ToNumber(y) +es5id: 11.6.1_A3.1_T2.5 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true + null !== 1) { + throw new Test262Error('#1: true + null === 1. Actual: ' + (true + null)); +} + +//CHECK#2 +if (null + true !== 1) { + throw new Test262Error('#2: null + true === 1. Actual: ' + (null + true)); +} + +//CHECK#3 +if (new Boolean(true) + null !== 1) { + throw new Test262Error('#3: new Boolean(true) + null === 1. Actual: ' + (new Boolean(true) + null)); +} + +//CHECK#4 +if (null + new Boolean(true) !== 1) { + throw new Test262Error('#4: null + new Boolean(true) === 1. Actual: ' + (null + new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.1.js new file mode 100644 index 0000000000..9300686afb --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String or Type(Primitive(y)) is String, then + operator x + y returns the result of concatenating ToString(x) followed + by ToString(y) +es5id: 11.6.1_A3.2_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + string and String object +---*/ + +//CHECK#1 +if ("1" + "1" !== "11") { + throw new Test262Error('#1: "1" + "1" === "11". Actual: ' + ("1" + "1")); +} + +//CHECK#2 +if (new String("1") + "1" !== "11") { + throw new Test262Error('#2: new String("1") + "1" === "11". Actual: ' + (new String("1") + "1")); +} + +//CHECK#3 +if ("1" + new String("1") !== "11") { + throw new Test262Error('#3: "1" + new String("1") === "11". Actual: ' + ("1" + new String("1"))); +} + +//CHECK#4 +if (new String("1") + new String("1") !== "11") { + throw new Test262Error('#4: new String("1") + new String("1") === "11". Actual: ' + (new String("1") + new String("1"))); +} + +//CHECK#5 +if ("x" + "1" !=="x1") { + throw new Test262Error('#5: "x" + "1" === "x1". Actual: ' + ("x" + "1")); +} + +//CHECK#6 +if ("1" + "x" !== "1x") { + throw new Test262Error('#6: "1" + "x" === "1x". Actual: ' + ("1" + "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.2.js new file mode 100644 index 0000000000..cd218b0019 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T1.2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String or Type(Primitive(y)) is String, then + operator x + y returns the result of concatenating ToString(x) followed + by ToString(y) +es5id: 11.6.1_A3.2_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Object + object and Function object +---*/ + +//CHECK#1 +if (({} + function(){return 1}) !== ({}.toString() + function(){return 1}.toString())) { + throw new Test262Error('#1: ({} + function(){return 1}) === ({}.toString() + function(){return 1}.toString()). Actual: ' + (({} + function(){return 1}))); +} + +//CHECK#2 +if ((function(){return 1} + {}) !== (function(){return 1}.toString() + {}.toString())) { + throw new Test262Error('#2: (function(){return 1} + {}) === (function(){return 1}.toString() + {}.toString()). Actual: ' + ((function(){return 1} + {}))); +} + +//CHECK#3 +if ((function(){return 1} + function(){return 1}) !== (function(){return 1}.toString() + function(){return 1}.toString())) { + throw new Test262Error('#3: (function(){return 1} + function(){return 1}) === (function(){return 1}.toString() + function(){return 1}.toString()). Actual: ' + ((function(){return 1} + function(){return 1}))); +} + +//CHECK#4 +if (({} + {}) !== ({}.toString() + {}.toString())) { + throw new Test262Error('#4: ({} + {}) === ({}.toString() + {}.toString()). Actual: ' + (({} + {}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.1.js new file mode 100644 index 0000000000..dc166795dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.1.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String or Type(Primitive(y)) is String, then + operator x + y returns the result of concatenating ToString(x) followed + by ToString(y) +es5id: 11.6.1_A3.2_T2.1 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and String + (primitive and object) +---*/ + +//CHECK#1 +if ("1" + 1 !== "11") { + throw new Test262Error('#1: "1" + 1 === "11". Actual: ' + ("1" + 1)); +} + +//CHECK#2 +if (1 + "1" !== "11") { + throw new Test262Error('#2: 1 + "1" === "11". Actual: ' + (1 + "1")); +} + +//CHECK#3 +if (new String("1") + 1 !== "11") { + throw new Test262Error('#3: new String("1") + 1 === "11". Actual: ' + (new String("1") + 1)); +} + +//CHECK#4 +if (1 + new String("1") !== "11") { + throw new Test262Error('#4: 1 + new String("1") === "11". Actual: ' + (1 + new String("1"))); +} + +//CHECK#5 +if ("1" + new Number(1) !== "11") { + throw new Test262Error('#5: "1" + new Number(1) === "11". Actual: ' + ("1" + new Number(1))); +} + +//CHECK#6 +if (new Number(1) + "1" !== "11") { + throw new Test262Error('#6: new Number(1) + "1" === "11". Actual: ' + (new Number(1) + "1")); +} + +//CHECK#7 +if (new String("1") + new Number(1) !== "11") { + throw new Test262Error('#7: new String("1") + new Number(1) === "11". Actual: ' + (new String("1") + new Number(1))); +} + +//CHECK#8 +if (new Number(1) + new String("1") !== "11") { + throw new Test262Error('#8: new Number(1) + new String("1") === "11". Actual: ' + (new Number(1) + new String("1"))); +} + +//CHECK#9 +if ("x" + 1 !=="x1") { + throw new Test262Error('#9: "x" + 1 === "x1". Actual: ' + ("x" + 1)); +} + +//CHECK#10 +if (1 + "x" !== "1x") { + throw new Test262Error('#10: 1 + "x" === "1x". Actual: ' + (1 + "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.2.js new file mode 100644 index 0000000000..c58913d6dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.2.js @@ -0,0 +1,56 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String or Type(Primitive(y)) is String, then + operator x + y returns the result of concatenating ToString(x) followed + by ToString(y) +es5id: 11.6.1_A3.2_T2.2 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true + "1" !== "true1") { + throw new Test262Error('#1: true + "1" === "true1". Actual: ' + (true + "1")); +} + +//CHECK#2 +if ("1" + true !== "1true") { + throw new Test262Error('#2: "1" + true === "1true". Actual: ' + ("1" + true)); +} + +//CHECK#3 +if (new Boolean(true) + "1" !== "true1") { + throw new Test262Error('#3: new Boolean(true) + "1" === "true1". Actual: ' + (new Boolean(true) + "1")); +} + +//CHECK#4 +if ("1" + new Boolean(true) !== "1true") { + throw new Test262Error('#4: "1" + new Boolean(true) === "1true". Actual: ' + ("1" + new Boolean(true))); +} + +//CHECK#5 +if (true + new String("1") !== "true1") { + throw new Test262Error('#5: true + new String("1") === "true1". Actual: ' + (true + new String("1"))); +} + +//CHECK#6 +if (new String("1") + true !== "1true") { + throw new Test262Error('#6: new String("1") + true === "1true". Actual: ' + (new String("1") + true)); +} + +//CHECK#7 +if (new Boolean(true) + new String("1") !== "true1") { + throw new Test262Error('#7: new Boolean(true) + new String("1") === "true1". Actual: ' + (new Boolean(true) + new String("1"))); +} + +//CHECK#8 +if (new String("1") + new Boolean(true) !== "1true") { + throw new Test262Error('#8: new String("1") + new Boolean(true) === "1true". Actual: ' + (new String("1") + new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.3.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.3.js new file mode 100644 index 0000000000..08eb8292db --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.3.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String or Type(Primitive(y)) is String, then + operator x + y returns the result of concatenating ToString(x) followed + by ToString(y) +es5id: 11.6.1_A3.2_T2.3 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" + undefined !== "1undefined") { + throw new Test262Error('#1: "1" + undefined === "1undefined". Actual: ' + ("1" + undefined)); +} + +//CHECK#2 +if (undefined + "1" !== "undefined1") { + throw new Test262Error('#2: undefined + "1" === "undefined1". Actual: ' + (undefined + "1")); +} + +//CHECK#3 +if (new String("1") + undefined !== "1undefined") { + throw new Test262Error('#3: new String("1") + undefined === "1undefined". Actual: ' + (new String("1") + undefined)); +} + +//CHECK#4 +if (undefined + new String("1") !== "undefined1") { + throw new Test262Error('#4: undefined + new String("1") === "undefined1". Actual: ' + (undefined + new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.4.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.4.js new file mode 100644 index 0000000000..4ebf1e3f29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A3.2_T2.4.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String or Type(Primitive(y)) is String, then + operator x + y returns the result of concatenating ToString(x) followed + by ToString(y) +es5id: 11.6.1_A3.2_T2.4 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" + null !== "1null") { + throw new Test262Error('#1: "1" + null === "1null". Actual: ' + ("1" + null)); +} + +//CHECK#2 +if (null + "1" !== "null1") { + throw new Test262Error('#2: null + "1" === "null1". Actual: ' + (null + "1")); +} + +//CHECK#3 +if (new String("1") + null !== "1null") { + throw new Test262Error('#3: new String("1") + null === "1null". Actual: ' + (new String("1") + null)); +} + +//CHECK#4 +if (null + new String("1") !== "null1") { + throw new Test262Error('#4: null + new String("1") === "null1". Actual: ' + (null + new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T1.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T1.js new file mode 100644 index 0000000000..65bbdfc0dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T1 +description: If either operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN + 1) !== true ) { + throw new Test262Error('#1: NaN + 1 === Not-a-Number. Actual: ' + (NaN + 1)); +} + +//CHECK#2 +if (isNaN(1 + Number.NaN) !== true ) { + throw new Test262Error('#2: 1 + NaN === Not-a-Number. Actual: ' + (1 + NaN)); +} + +//CHECK#3 +if (isNaN(Number.NaN + Number.POSITIVE_INFINITY) !== true ) { + throw new Test262Error('#3: NaN + Infinity === Not-a-Number. Actual: ' + (NaN + Infinity)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY + Number.NaN) !== true ) { + throw new Test262Error('#4: Infinity + NaN === Not-a-Number. Actual: ' + (Infinity + NaN)); +} + +//CHECK#5 +if (isNaN(Number.NaN + Number.NEGATIVE_INFINITY) !== true ) { + throw new Test262Error('#5: NaN + Infinity === Not-a-Number. Actual: ' + (NaN + Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NEGATIVE_INFINITY + Number.NaN) !== true ) { + throw new Test262Error('#6: Infinity + NaN === Not-a-Number. Actual: ' + (Infinity + NaN)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T2.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T2.js new file mode 100644 index 0000000000..9e37b275b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T2 +description: The sum of two infinities of opposite sign is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY) !== true ) { + throw new Test262Error('#1: Infinity + -Infinity === Not-a-Number. Actual: ' + (Infinity + -Infinity)); +} + +//CHECK#2 +if (isNaN(Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY) !== true ) { + throw new Test262Error('#2: -Infinity + Infinity === Not-a-Number. Actual: ' + (-Infinity + Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T3.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T3.js new file mode 100644 index 0000000000..a6c1cf485b --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T3 +description: > + The sum of two infinities of the same sign is the infinity of that + sign +---*/ + +//CHECK#1 +if (Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#1: Infinity + Infinity === Infinity. Actual: ' + (Infinity + Infinity)); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#2: -Infinity + -Infinity === -Infinity. Actual: ' + (-Infinity + -Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T4.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T4.js new file mode 100644 index 0000000000..7d4dab38bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T4.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T4 +description: > + The sum of an infinity and a finite value is equal to the infinite + operand +---*/ + +//CHECK#1 +if (Number.POSITIVE_INFINITY + 1 !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#1: Infinity + 1 === Infinity. Actual: ' + (Infinity + 1)); +} + +//CHECK#2 +if (-1 + Number.POSITIVE_INFINITY !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#2: -1 + Infinity === Infinity. Actual: ' + (-1 + Infinity)); +} + +//CHECK#3 +if (Number.NEGATIVE_INFINITY + 1 !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#3: -Infinity + 1 === -Infinity. Actual: ' + (-Infinity + 1)); +} + +//CHECK#4 +if (-1 + Number.NEGATIVE_INFINITY !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#4: -1 + -Infinity === -Infinity. Actual: ' + (-1 + -Infinity)); +} + +//CHECK#5 +if (Number.POSITIVE_INFINITY + Number.MAX_VALUE !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#5: Infinity + Number.MAX_VALUE === Infinity. Actual: ' + (Infinity + Number.MAX_VALUE)); +} + +//CHECK#6 +if (-Number.MAX_VALUE + Number.POSITIVE_INFINITY !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#6: -Number.MAX_VALUE + Infinity === Infinity. Actual: ' + (-Number.MAX_VALUE + Infinity)); +} + +//CHECK#7 +if (Number.NEGATIVE_INFINITY + Number.MAX_VALUE !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#7: -Infinity + Number.MAX_VALUE === -Infinity. Actual: ' + (-Infinity + Number.MAX_VALUE)); +} + +//CHECK#8 +if (-Number.MAX_VALUE + Number.NEGATIVE_INFINITY !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#8: -Number.MAX_VALUE + -Infinity === -Infinity. Actual: ' + (-Number.MAX_VALUE + -Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T5.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T5.js new file mode 100644 index 0000000000..cf5b93af93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T5.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T5 +description: > + The sum of two negative zeros is -0. The sum of two positive + zeros, or of two zeros of opposite sign is +0 +---*/ + +//CHECK#1 +if (-0 + -0 !== -0 ) { + throw new Test262Error('#1.1: -0 + -0 === 0. Actual: ' + (-0 + -0)); +} else { + if (1 / (-0 + -0) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.1: -0 + -0 === - 0. Actual: +0'); + } +} + +//CHECK#2 +if (0 + -0 !== 0 ) { + throw new Test262Error('#2.1: 0 + -0 === 0. Actual: ' + (0 + -0)); +} else { + if (1 / (0 + -0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: 0 + -0 === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (-0 + 0 !== 0 ) { + throw new Test262Error('#3.1: -0 + 0 === 0. Actual: ' + (-0 + 0)); +} else { + if (1 / (-0 + 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3.2: -0 + 0 === + 0. Actual: -0'); + } +} + +//CHECK#4 +if (0 + 0 !== 0 ) { + throw new Test262Error('#4.1: 0 + 0 === 0. Actual: ' + (0 + 0)); +} else { + if (1 / (0 + 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#4.2: 0 + 0 === + 0. Actual: -0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T6.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T6.js new file mode 100644 index 0000000000..6c3a70aa99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T6.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T6 +description: > + The sum of a zero and a nonzero finite value is equal to the + nonzero operand +---*/ + +//CHECK#1 +if (1 + -0 !== 1 ) { + throw new Test262Error('#1: 1 + -0 === 1. Actual: ' + (1 + -0)); +} + +//CHECK#2 +if (1 + 0 !== 1 ) { + throw new Test262Error('#2: 1 + 0 === 1. Actual: ' + (1 + 0)); +} + +//CHECK#3 +if (-0 + 1 !== 1 ) { + throw new Test262Error('#3: -0 + 1 === 1. Actual: ' + (-0 + 1)); +} + +//CHECK#4 +if (0 + 1 !== 1 ) { + throw new Test262Error('#4: 0 + 1 === 1. Actual: ' + (0 + 1)); +} + +//CHECK#5 +if (Number.MAX_VALUE + -0 !== Number.MAX_VALUE ) { + throw new Test262Error('#5: Number.MAX_VALUE + -0 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE + -0)); +} + +//CHECK#6 +if (Number.MAX_VALUE + 0 !== Number.MAX_VALUE ) { + throw new Test262Error('#6: Number.MAX_VALUE + 0 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE + 0)); +} + +//CHECK#7 +if (-0 + Number.MIN_VALUE !== Number.MIN_VALUE ) { + throw new Test262Error('#7: -0 + Number.MIN_VALUE === Number.MIN_VALUE. Actual: ' + (-0 + Number.MIN_VALUE)); +} + +//CHECK#8 +if (0 + Number.MIN_VALUE !== Number.MIN_VALUE ) { + throw new Test262Error('#8: 0 + Number.MIN_VALUE === Number.MIN_VALUE. Actual: ' + (0 + Number.MIN_VALUE)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T7.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T7.js new file mode 100644 index 0000000000..22c73a972a --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T7.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T7 +description: > + The sum of two nonzero finite values of the same magnitude and + opposite sign is +0 +---*/ + +//CHECK#1 +if (-Number.MIN_VALUE + Number.MIN_VALUE !== +0) { + throw new Test262Error('#1.1: -Number.MIN_VALUE + Number.MIN_VALUE === 0. Actual: ' + (-Number.MIN_VALUE + Number.MIN_VALUE)); +} else { + if (1 / (-Number.MIN_VALUE + Number.MIN_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: -Number.MIN_VALUE + Number.MIN_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#2 +if (-Number.MAX_VALUE + Number.MAX_VALUE !== +0) { + throw new Test262Error('#2.1: -Number.MAX_VALUE + Number.MAX_VALUE === 0. Actual: ' + (-Number.MAX_VALUE + Number.MAX_VALUE)); +} else { + if (1 / (-Number.MAX_VALUE + Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: -Number.MAX_VALUE + Number.MAX_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (-1 / Number.MAX_VALUE + 1 / Number.MAX_VALUE !== +0) { + throw new Test262Error('#3.1: -1 / Number.MAX_VALUE + 1 / Number.MAX_VALUE === 0. Actual: ' + (-1 / Number.MAX_VALUE + 1 / Number.MAX_VALUE)); +} else { + if (1 / (-1 / Number.MAX_VALUE + 1 / Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3.2: -1 / Number.MAX_VALUE + 1 / Number.MAX_VALUE === + 0. Actual: -0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T8.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T8.js new file mode 100644 index 0000000000..6bb303daa0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T8 +description: > + If the magnitude is too large to represent, the operation + overflows and the result is then an infinity of appropriate sign +---*/ + +//CHECK#1 +if (Number.MAX_VALUE + Number.MAX_VALUE !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: Number.MAX_VALUE + Number.MAX_VALUE === Number.POSITIVE_INFINITY. Actual: ' + (Number.MAX_VALUE + Number.MAX_VALUE)); +} + +//CHECK#2 +if (-Number.MAX_VALUE - Number.MAX_VALUE !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2: -Number.MAX_VALUE - Number.MAX_VALUE === Number.NEGATIVE_INFINITY. Actual: ' + (-Number.MAX_VALUE - Number.MAX_VALUE)); +} + +//CHECK#3 +if (1e+308 + 1e+308 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: 1e+308 + 1e+308 === Number.POSITIVE_INFINITY. Actual: ' + (1e+308 + 1e+308)); +} + +//CHECK#4 +if (-8.99e+307 - 8.99e+307 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4: -8.99e+307 - 8.99e+307 === Number.NEGATIVE_INFINITY. Actual: ' + (-8.99e+307 - 8.99e+307)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T9.js b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T9.js new file mode 100644 index 0000000000..58a53e7ca9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/S11.6.1_A4_T9.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of an addition is determined using the rules of IEEE 754 + double-precision arithmetics +es5id: 11.6.1_A4_T9 +description: > + The addition operator is not always associative ( x + y + z is the + same (x + y) + z, not x + (y + z)) +---*/ + +//CHECK#1 +if (-Number.MAX_VALUE + Number.MAX_VALUE + Number.MAX_VALUE !== (-Number.MAX_VALUE + Number.MAX_VALUE) + Number.MAX_VALUE) { + throw new Test262Error('#1: -Number.MAX_VALUE + Number.MAX_VALUE + Number.MAX_VALUE === (-Number.MAX_VALUE + Number.MAX_VALUE) + Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE + Number.MAX_VALUE + Number.MAX_VALUE)); +} + +//CHECK#2 +if ((-Number.MAX_VALUE + Number.MAX_VALUE) + Number.MAX_VALUE === -Number.MAX_VALUE + (Number.MAX_VALUE + Number.MAX_VALUE)) { + throw new Test262Error('#2: (-Number.MAX_VALUE + Number.MAX_VALUE) + Number.MAX_VALUE === -Number.MAX_VALUE + (Number.MAX_VALUE + Number.MAX_VALUE). Actual: ' + ((-Number.MAX_VALUE + Number.MAX_VALUE) + Number.MAX_VALUE)); +} + +//CHECK#3 +if ("1" + 1 + 1 !== ("1" + 1) + 1) { + throw new Test262Error('#3: "1" + 1 + 1 === ("1" + 1) + 1. Actual: ' + ("1" + 1 + 1)); +} + +//CHECK#4 +if (("1" + 1) + 1 === "1" + (1 + 1)) { + throw new Test262Error('#4: ("1" + 1) + 1 !== "1" + (1 + 1)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/bigint-and-number.js b/js/src/tests/test262/language/expressions/addition/bigint-and-number.js new file mode 100644 index 0000000000..28cc14b315 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/bigint-and-number.js @@ -0,0 +1,87 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for addition operator +features: [BigInt] +info: | + Let lprim be ? ToPrimitive(lval). + Let rprim be ? ToPrimitive(rval). + ... + Let lnum be ? ToNumeric(lprim) + Let rnum be ? ToNumeric(rprim) + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n + 1; +}, '1n + 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 + 1n; +}, '1 + 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) + 1; +}, 'Object(1n) + 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 + Object(1n); +}, '1 + Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n + Object(1); +}, '1n + Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) + 1n; +}, 'Object(1) + 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) + Object(1); +}, 'Object(1n) + Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) + Object(1n); +}, 'Object(1) + Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n + NaN; +}, '1n + NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN + 1n; +}, 'NaN + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + Infinity; +}, '1n + Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity + 1n; +}, 'Infinity + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + true; +}, '1n + true throws TypeError'); + +assert.throws(TypeError, function() { + true + 1n; +}, 'true + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + null; +}, '1n + null throws TypeError'); + +assert.throws(TypeError, function() { + null + 1n; +}, 'null + 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n + undefined; +}, '1n + undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined + 1n; +}, 'undefined + 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/bigint-arithmetic.js b/js/src/tests/test262/language/expressions/addition/bigint-arithmetic.js new file mode 100644 index 0000000000..39b21fb086 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/bigint-arithmetic.js @@ -0,0 +1,1403 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +description: BigInt addition arithmetic +features: [BigInt] +---*/ +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA98n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA98n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA98n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA98n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA97n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA97n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0xFEDCBA97n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA9876543210n + 0xFEDCBA97n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1234n, + 0xFEDCBA9876544444n, + 'The result of (0xFEDCBA9876543210n + 0x1234n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1234n, + 0xFEDCBA9876544444n, + 'The result of (0xFEDCBA9876543210n + 0x1234n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x3n, + 0xFEDCBA9876543213n, + 'The result of (0xFEDCBA9876543210n + 0x3n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x3n, + 0xFEDCBA9876543213n, + 'The result of (0xFEDCBA9876543210n + 0x3n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x2n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA9876543210n + 0x2n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x2n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA9876543210n + 0x2n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA9876543210n + 0x1n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x1n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA9876543210n + 0x1n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x0n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n + 0x0n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + 0x0n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n + 0x0n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA9876543210n + -0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA9876543210n + -0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x2n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA9876543210n + -0x2n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x2n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA9876543210n + -0x2n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x3n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA9876543210n + -0x3n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x3n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA9876543210n + -0x3n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1234n, + 0xFEDCBA9876541FDCn, + 'The result of (0xFEDCBA9876543210n + -0x1234n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0x1234n, + 0xFEDCBA9876541FDCn, + 'The result of (0xFEDCBA9876543210n + -0x1234n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA97n, + 0xFEDCBA9777777779n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA97n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA97n, + 0xFEDCBA9777777779n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA97n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA98n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA98n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA98n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA98n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA98n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA98n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA98n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA98n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA97n, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA97n) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0xFEDCBA97n, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA987654320Fn + 0xFEDCBA97n) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1234n, + 0xFEDCBA9876544443n, + 'The result of (0xFEDCBA987654320Fn + 0x1234n) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1234n, + 0xFEDCBA9876544443n, + 'The result of (0xFEDCBA987654320Fn + 0x1234n) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x3n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA987654320Fn + 0x3n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x3n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA987654320Fn + 0x3n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x2n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA987654320Fn + 0x2n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x2n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA987654320Fn + 0x2n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA987654320Fn + 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA987654320Fn + 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x0n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn + 0x0n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + 0x0n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn + 0x0n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA987654320Fn + -0x1n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA987654320Fn + -0x1n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x2n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA987654320Fn + -0x2n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x2n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA987654320Fn + -0x2n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x3n, + 0xFEDCBA987654320Cn, + 'The result of (0xFEDCBA987654320Fn + -0x3n) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x3n, + 0xFEDCBA987654320Cn, + 'The result of (0xFEDCBA987654320Fn + -0x3n) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1234n, + 0xFEDCBA9876541FDBn, + 'The result of (0xFEDCBA987654320Fn + -0x1234n) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0x1234n, + 0xFEDCBA9876541FDBn, + 'The result of (0xFEDCBA987654320Fn + -0x1234n) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA97n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA97n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA97n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA97n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA98n, + 0xFEDCBA9777777777n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA98n) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA98n, + 0xFEDCBA9777777777n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA98n) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n + 0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n + 0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA97n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA98n + 0xFEDCBA97n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA98n + 0xFEDCBA97n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA98n + 0xFEDCBA97n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1234n, + 0xFEDCCCCCn, + 'The result of (0xFEDCBA98n + 0x1234n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1234n, + 0xFEDCCCCCn, + 'The result of (0xFEDCBA98n + 0x1234n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x3n, + 0xFEDCBA9Bn, + 'The result of (0xFEDCBA98n + 0x3n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x3n, + 0xFEDCBA9Bn, + 'The result of (0xFEDCBA98n + 0x3n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0xFEDCBA98n + 0x2n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA98n + 0x2n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA98n + 0x2n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA98n + 0x2n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA98n + 0x1n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA98n + 0x1n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA98n + 0x1n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA98n + 0x0n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n + 0x0n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n + 0x0n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n + 0x0n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA98n + -0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA98n + -0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x2n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA98n + -0x2n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x2n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA98n + -0x2n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x3n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA98n + -0x3n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x3n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA98n + -0x3n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1234n, + 0xFEDCA864n, + 'The result of (0xFEDCBA98n + -0x1234n) is 0xFEDCA864n' +); + +assert.sameValue( + 0xFEDCBA98n + -0x1234n, + 0xFEDCA864n, + 'The result of (0xFEDCBA98n + -0x1234n) is 0xFEDCA864n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n + -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n + -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n + -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n + -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777777n, + 'The result of (0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777777n, + 'The result of (0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n + 0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n + 0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n + 0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n + 0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1234n, + 0xFEDCCCCBn, + 'The result of (0xFEDCBA97n + 0x1234n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1234n, + 0xFEDCCCCBn, + 'The result of (0xFEDCBA97n + 0x1234n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0xFEDCBA97n + 0x3n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA97n + 0x3n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA97n + 0x3n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA97n + 0x3n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA97n + 0x2n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA97n + 0x2n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x2n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA97n + 0x2n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA97n + 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA97n + 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x0n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n + 0x0n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n + 0x0n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n + 0x0n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA97n + -0x1n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA97n + -0x1n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x2n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA97n + -0x2n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x2n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA97n + -0x2n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x3n, + 0xFEDCBA94n, + 'The result of (0xFEDCBA97n + -0x3n) is 0xFEDCBA94n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x3n, + 0xFEDCBA94n, + 'The result of (0xFEDCBA97n + -0x3n) is 0xFEDCBA94n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1234n, + 0xFEDCA863n, + 'The result of (0xFEDCBA97n + -0x1234n) is 0xFEDCA863n' +); + +assert.sameValue( + 0xFEDCBA97n + -0x1234n, + 0xFEDCA863n, + 'The result of (0xFEDCBA97n + -0x1234n) is 0xFEDCA863n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n + -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n + -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA97n + -0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA97n + -0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777779n, + 'The result of (0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA9777777779n, + 'The result of (0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA9777777779n' +); + +assert.sameValue(0x1234n + 0x1234n, 0x2468n, 'The result of (0x1234n + 0x1234n) is 0x2468n'); +assert.sameValue(0x1234n + 0x1234n, 0x2468n, 'The result of (0x1234n + 0x1234n) is 0x2468n'); +assert.sameValue(0x1234n + 0x3n, 0x1237n, 'The result of (0x1234n + 0x3n) is 0x1237n'); +assert.sameValue(0x1234n + 0x3n, 0x1237n, 'The result of (0x1234n + 0x3n) is 0x1237n'); +assert.sameValue(0x1234n + 0x2n, 0x1236n, 'The result of (0x1234n + 0x2n) is 0x1236n'); +assert.sameValue(0x1234n + 0x2n, 0x1236n, 'The result of (0x1234n + 0x2n) is 0x1236n'); +assert.sameValue(0x1234n + 0x1n, 0x1235n, 'The result of (0x1234n + 0x1n) is 0x1235n'); +assert.sameValue(0x1234n + 0x1n, 0x1235n, 'The result of (0x1234n + 0x1n) is 0x1235n'); +assert.sameValue(0x1234n + 0x0n, 0x1234n, 'The result of (0x1234n + 0x0n) is 0x1234n'); +assert.sameValue(0x1234n + 0x0n, 0x1234n, 'The result of (0x1234n + 0x0n) is 0x1234n'); +assert.sameValue(0x1234n + -0x1n, 0x1233n, 'The result of (0x1234n + -0x1n) is 0x1233n'); +assert.sameValue(0x1234n + -0x1n, 0x1233n, 'The result of (0x1234n + -0x1n) is 0x1233n'); +assert.sameValue(0x1234n + -0x2n, 0x1232n, 'The result of (0x1234n + -0x2n) is 0x1232n'); +assert.sameValue(0x1234n + -0x2n, 0x1232n, 'The result of (0x1234n + -0x2n) is 0x1232n'); +assert.sameValue(0x1234n + -0x3n, 0x1231n, 'The result of (0x1234n + -0x3n) is 0x1231n'); +assert.sameValue(0x1234n + -0x3n, 0x1231n, 'The result of (0x1234n + -0x3n) is 0x1231n'); +assert.sameValue(0x1234n + -0x1234n, 0x0n, 'The result of (0x1234n + -0x1234n) is 0x0n'); +assert.sameValue(0x1234n + -0x1234n, 0x0n, 'The result of (0x1234n + -0x1234n) is 0x0n'); + +assert.sameValue( + 0x1234n + -0xFEDCBA97n, + -0xFEDCA863n, + 'The result of (0x1234n + -0xFEDCBA97n) is -0xFEDCA863n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA97n, + -0xFEDCA863n, + 'The result of (0x1234n + -0xFEDCBA97n) is -0xFEDCA863n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA98n, + -0xFEDCA864n, + 'The result of (0x1234n + -0xFEDCBA98n) is -0xFEDCA864n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA98n, + -0xFEDCA864n, + 'The result of (0x1234n + -0xFEDCBA98n) is -0xFEDCA864n' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876541FDBn, + 'The result of (0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876541FDBn, + 'The result of (0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876541FDCn, + 'The result of (0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876541FDCn, + 'The result of (0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue(0x3n + 0x3n, 0x6n, 'The result of (0x3n + 0x3n) is 0x6n'); +assert.sameValue(0x3n + 0x3n, 0x6n, 'The result of (0x3n + 0x3n) is 0x6n'); +assert.sameValue(0x3n + 0x2n, 0x5n, 'The result of (0x3n + 0x2n) is 0x5n'); +assert.sameValue(0x3n + 0x2n, 0x5n, 'The result of (0x3n + 0x2n) is 0x5n'); +assert.sameValue(0x3n + 0x1n, 0x4n, 'The result of (0x3n + 0x1n) is 0x4n'); +assert.sameValue(0x3n + 0x1n, 0x4n, 'The result of (0x3n + 0x1n) is 0x4n'); +assert.sameValue(0x3n + 0x0n, 0x3n, 'The result of (0x3n + 0x0n) is 0x3n'); +assert.sameValue(0x3n + 0x0n, 0x3n, 'The result of (0x3n + 0x0n) is 0x3n'); +assert.sameValue(0x3n + -0x1n, 0x2n, 'The result of (0x3n + -0x1n) is 0x2n'); +assert.sameValue(0x3n + -0x1n, 0x2n, 'The result of (0x3n + -0x1n) is 0x2n'); +assert.sameValue(0x3n + -0x2n, 0x1n, 'The result of (0x3n + -0x2n) is 0x1n'); +assert.sameValue(0x3n + -0x2n, 0x1n, 'The result of (0x3n + -0x2n) is 0x1n'); +assert.sameValue(0x3n + -0x3n, 0x0n, 'The result of (0x3n + -0x3n) is 0x0n'); +assert.sameValue(0x3n + -0x3n, 0x0n, 'The result of (0x3n + -0x3n) is 0x0n'); +assert.sameValue(0x3n + -0x1234n, -0x1231n, 'The result of (0x3n + -0x1234n) is -0x1231n'); +assert.sameValue(0x3n + -0x1234n, -0x1231n, 'The result of (0x3n + -0x1234n) is -0x1231n'); + +assert.sameValue( + 0x3n + -0xFEDCBA97n, + -0xFEDCBA94n, + 'The result of (0x3n + -0xFEDCBA97n) is -0xFEDCBA94n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA97n, + -0xFEDCBA94n, + 'The result of (0x3n + -0xFEDCBA97n) is -0xFEDCBA94n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA98n, + -0xFEDCBA95n, + 'The result of (0x3n + -0xFEDCBA98n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA98n, + -0xFEDCBA95n, + 'The result of (0x3n + -0xFEDCBA98n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Cn, + 'The result of (0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Cn, + 'The result of (0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Dn, + 'The result of (0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Dn, + 'The result of (0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue(0x2n + 0x2n, 0x4n, 'The result of (0x2n + 0x2n) is 0x4n'); +assert.sameValue(0x2n + 0x2n, 0x4n, 'The result of (0x2n + 0x2n) is 0x4n'); +assert.sameValue(0x2n + 0x1n, 0x3n, 'The result of (0x2n + 0x1n) is 0x3n'); +assert.sameValue(0x2n + 0x1n, 0x3n, 'The result of (0x2n + 0x1n) is 0x3n'); +assert.sameValue(0x2n + 0x0n, 0x2n, 'The result of (0x2n + 0x0n) is 0x2n'); +assert.sameValue(0x2n + 0x0n, 0x2n, 'The result of (0x2n + 0x0n) is 0x2n'); +assert.sameValue(0x2n + -0x1n, 0x1n, 'The result of (0x2n + -0x1n) is 0x1n'); +assert.sameValue(0x2n + -0x1n, 0x1n, 'The result of (0x2n + -0x1n) is 0x1n'); +assert.sameValue(0x2n + -0x2n, 0x0n, 'The result of (0x2n + -0x2n) is 0x0n'); +assert.sameValue(0x2n + -0x2n, 0x0n, 'The result of (0x2n + -0x2n) is 0x0n'); +assert.sameValue(0x2n + -0x3n, -0x1n, 'The result of (0x2n + -0x3n) is -0x1n'); +assert.sameValue(0x2n + -0x3n, -0x1n, 'The result of (0x2n + -0x3n) is -0x1n'); +assert.sameValue(0x2n + -0x1234n, -0x1232n, 'The result of (0x2n + -0x1234n) is -0x1232n'); +assert.sameValue(0x2n + -0x1234n, -0x1232n, 'The result of (0x2n + -0x1234n) is -0x1232n'); + +assert.sameValue( + 0x2n + -0xFEDCBA97n, + -0xFEDCBA95n, + 'The result of (0x2n + -0xFEDCBA97n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA97n, + -0xFEDCBA95n, + 'The result of (0x2n + -0xFEDCBA97n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA98n, + -0xFEDCBA96n, + 'The result of (0x2n + -0xFEDCBA98n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA98n, + -0xFEDCBA96n, + 'The result of (0x2n + -0xFEDCBA98n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Dn, + 'The result of (0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Dn, + 'The result of (0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320En, + 'The result of (0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320En, + 'The result of (0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320En' +); + +assert.sameValue(0x1n + 0x1n, 0x2n, 'The result of (0x1n + 0x1n) is 0x2n'); +assert.sameValue(0x1n + 0x1n, 0x2n, 'The result of (0x1n + 0x1n) is 0x2n'); +assert.sameValue(0x1n + 0x0n, 0x1n, 'The result of (0x1n + 0x0n) is 0x1n'); +assert.sameValue(0x1n + 0x0n, 0x1n, 'The result of (0x1n + 0x0n) is 0x1n'); +assert.sameValue(0x1n + -0x1n, 0x0n, 'The result of (0x1n + -0x1n) is 0x0n'); +assert.sameValue(0x1n + -0x1n, 0x0n, 'The result of (0x1n + -0x1n) is 0x0n'); +assert.sameValue(0x1n + -0x2n, -0x1n, 'The result of (0x1n + -0x2n) is -0x1n'); +assert.sameValue(0x1n + -0x2n, -0x1n, 'The result of (0x1n + -0x2n) is -0x1n'); +assert.sameValue(0x1n + -0x3n, -0x2n, 'The result of (0x1n + -0x3n) is -0x2n'); +assert.sameValue(0x1n + -0x3n, -0x2n, 'The result of (0x1n + -0x3n) is -0x2n'); +assert.sameValue(0x1n + -0x1234n, -0x1233n, 'The result of (0x1n + -0x1234n) is -0x1233n'); +assert.sameValue(0x1n + -0x1234n, -0x1233n, 'The result of (0x1n + -0x1234n) is -0x1233n'); + +assert.sameValue( + 0x1n + -0xFEDCBA97n, + -0xFEDCBA96n, + 'The result of (0x1n + -0xFEDCBA97n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA97n, + -0xFEDCBA96n, + 'The result of (0x1n + -0xFEDCBA97n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (0x1n + -0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (0x1n + -0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320En, + 'The result of (0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320En, + 'The result of (0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue(0x0n + 0x0n, 0x0n, 'The result of (0x0n + 0x0n) is 0x0n'); +assert.sameValue(0x0n + 0x0n, 0x0n, 'The result of (0x0n + 0x0n) is 0x0n'); +assert.sameValue(0x0n + -0x1n, -0x1n, 'The result of (0x0n + -0x1n) is -0x1n'); +assert.sameValue(0x0n + -0x1n, -0x1n, 'The result of (0x0n + -0x1n) is -0x1n'); +assert.sameValue(0x0n + -0x2n, -0x2n, 'The result of (0x0n + -0x2n) is -0x2n'); +assert.sameValue(0x0n + -0x2n, -0x2n, 'The result of (0x0n + -0x2n) is -0x2n'); +assert.sameValue(0x0n + -0x3n, -0x3n, 'The result of (0x0n + -0x3n) is -0x3n'); +assert.sameValue(0x0n + -0x3n, -0x3n, 'The result of (0x0n + -0x3n) is -0x3n'); +assert.sameValue(0x0n + -0x1234n, -0x1234n, 'The result of (0x0n + -0x1234n) is -0x1234n'); +assert.sameValue(0x0n + -0x1234n, -0x1234n, 'The result of (0x0n + -0x1234n) is -0x1234n'); + +assert.sameValue( + 0x0n + -0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x0n + -0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x0n + -0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x0n + -0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x0n + -0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x0n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n + -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x0n + -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x0n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0x0n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x0n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue(-0x1n + -0x1n, -0x2n, 'The result of (-0x1n + -0x1n) is -0x2n'); +assert.sameValue(-0x1n + -0x1n, -0x2n, 'The result of (-0x1n + -0x1n) is -0x2n'); +assert.sameValue(-0x1n + -0x2n, -0x3n, 'The result of (-0x1n + -0x2n) is -0x3n'); +assert.sameValue(-0x1n + -0x2n, -0x3n, 'The result of (-0x1n + -0x2n) is -0x3n'); +assert.sameValue(-0x1n + -0x3n, -0x4n, 'The result of (-0x1n + -0x3n) is -0x4n'); +assert.sameValue(-0x1n + -0x3n, -0x4n, 'The result of (-0x1n + -0x3n) is -0x4n'); +assert.sameValue(-0x1n + -0x1234n, -0x1235n, 'The result of (-0x1n + -0x1234n) is -0x1235n'); +assert.sameValue(-0x1n + -0x1234n, -0x1235n, 'The result of (-0x1n + -0x1234n) is -0x1235n'); + +assert.sameValue( + -0x1n + -0xFEDCBA97n, + -0xFEDCBA98n, + 'The result of (-0x1n + -0xFEDCBA97n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA97n, + -0xFEDCBA98n, + 'The result of (-0x1n + -0xFEDCBA97n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA98n, + -0xFEDCBA99n, + 'The result of (-0x1n + -0xFEDCBA98n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA98n, + -0xFEDCBA99n, + 'The result of (-0x1n + -0xFEDCBA98n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543210n, + 'The result of (-0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543210n, + 'The result of (-0x1n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543211n, + 'The result of (-0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x1n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543211n, + 'The result of (-0x1n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543211n' +); + +assert.sameValue(-0x2n + -0x2n, -0x4n, 'The result of (-0x2n + -0x2n) is -0x4n'); +assert.sameValue(-0x2n + -0x2n, -0x4n, 'The result of (-0x2n + -0x2n) is -0x4n'); +assert.sameValue(-0x2n + -0x3n, -0x5n, 'The result of (-0x2n + -0x3n) is -0x5n'); +assert.sameValue(-0x2n + -0x3n, -0x5n, 'The result of (-0x2n + -0x3n) is -0x5n'); +assert.sameValue(-0x2n + -0x1234n, -0x1236n, 'The result of (-0x2n + -0x1234n) is -0x1236n'); +assert.sameValue(-0x2n + -0x1234n, -0x1236n, 'The result of (-0x2n + -0x1234n) is -0x1236n'); + +assert.sameValue( + -0x2n + -0xFEDCBA97n, + -0xFEDCBA99n, + 'The result of (-0x2n + -0xFEDCBA97n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA97n, + -0xFEDCBA99n, + 'The result of (-0x2n + -0xFEDCBA97n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA98n, + -0xFEDCBA9An, + 'The result of (-0x2n + -0xFEDCBA98n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x2n + -0xFEDCBA98n, + -0xFEDCBA9An, + 'The result of (-0x2n + -0xFEDCBA98n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543211n, + 'The result of (-0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543211n, + 'The result of (-0x2n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543212n, + 'The result of (-0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x2n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543212n, + 'The result of (-0x2n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543212n' +); + +assert.sameValue(-0x3n + -0x3n, -0x6n, 'The result of (-0x3n + -0x3n) is -0x6n'); +assert.sameValue(-0x3n + -0x3n, -0x6n, 'The result of (-0x3n + -0x3n) is -0x6n'); +assert.sameValue(-0x3n + -0x1234n, -0x1237n, 'The result of (-0x3n + -0x1234n) is -0x1237n'); +assert.sameValue(-0x3n + -0x1234n, -0x1237n, 'The result of (-0x3n + -0x1234n) is -0x1237n'); + +assert.sameValue( + -0x3n + -0xFEDCBA97n, + -0xFEDCBA9An, + 'The result of (-0x3n + -0xFEDCBA97n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x3n + -0xFEDCBA97n, + -0xFEDCBA9An, + 'The result of (-0x3n + -0xFEDCBA97n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x3n + -0xFEDCBA98n, + -0xFEDCBA9Bn, + 'The result of (-0x3n + -0xFEDCBA98n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0x3n + -0xFEDCBA98n, + -0xFEDCBA9Bn, + 'The result of (-0x3n + -0xFEDCBA98n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543212n, + 'The result of (-0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x3n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876543212n, + 'The result of (-0x3n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543213n, + 'The result of (-0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543213n' +); + +assert.sameValue( + -0x3n + -0xFEDCBA9876543210n, + -0xFEDCBA9876543213n, + 'The result of (-0x3n + -0xFEDCBA9876543210n) is -0xFEDCBA9876543213n' +); + +assert.sameValue(-0x1234n + -0x1234n, -0x2468n, 'The result of (-0x1234n + -0x1234n) is -0x2468n'); +assert.sameValue(-0x1234n + -0x1234n, -0x2468n, 'The result of (-0x1234n + -0x1234n) is -0x2468n'); + +assert.sameValue( + -0x1234n + -0xFEDCBA97n, + -0xFEDCCCCBn, + 'The result of (-0x1234n + -0xFEDCBA97n) is -0xFEDCCCCBn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA97n, + -0xFEDCCCCBn, + 'The result of (-0x1234n + -0xFEDCBA97n) is -0xFEDCCCCBn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA98n, + -0xFEDCCCCCn, + 'The result of (-0x1234n + -0xFEDCBA98n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA98n, + -0xFEDCCCCCn, + 'The result of (-0x1234n + -0xFEDCBA98n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876544443n, + 'The result of (-0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA987654320Fn, + -0xFEDCBA9876544443n, + 'The result of (-0x1234n + -0xFEDCBA987654320Fn) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876544444n, + 'The result of (-0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0x1234n + -0xFEDCBA9876543210n, + -0xFEDCBA9876544444n, + 'The result of (-0x1234n + -0xFEDCBA9876543210n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (-0xFEDCBA97n + -0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (-0xFEDCBA97n + -0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA98n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA97n + -0xFEDCBA98n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA98n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA97n + -0xFEDCBA98n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA97n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA97n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA98n + -0xFEDCBA9876543210n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA98n + -0xFEDCBA9876543210n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn + -0xFEDCBA9876543210n, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA987654320Fn + -0xFEDCBA9876543210n) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (-0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); + +assert.sameValue( + -0xFEDCBA9876543210n + -0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (-0xFEDCBA9876543210n + -0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/bigint-errors.js b/js/src/tests/test262/language/expressions/addition/bigint-errors.js new file mode 100644 index 0000000000..fbfc6021c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: addition operator ToNumeric with BigInt operands +esid: sec-addition-operator-plus-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') + 0n; +}, 'Symbol("1") + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + Symbol('1'); +}, '0n + Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) + 0n; +}, 'Object(Symbol("1")) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + Object(Symbol('1')); +}, '0n + Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) + 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n + {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) + 0n; +}, '({valueOf: function() {return Symbol("1");}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n + {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) + 0n; +}, '({toString: function() {return Symbol("1");}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + toString: function() { + return Symbol('1'); + } + }; +}, '0n + {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/addition/bigint-toprimitive.js new file mode 100644 index 0000000000..ddd4608c31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: addition operator ToNumeric with BigInt operands +esid: sec-addition-operator-plus-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) + 1n) is 3n'); + +assert.sameValue(1n + { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} + 1n, 3n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) + 1n) is 3n'); + +assert.sameValue(1n + { + valueOf: function() { + return 2n; + }, + + toString: err +}, 3n, 'The result of (1n + {valueOf: function() {return 2n;}, toString: err}) is 3n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({toString: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n + {toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + valueOf: null, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n + {valueOf: null, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n + {valueOf: 1, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n + {valueOf: {}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n + {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n + {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 3n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) + 0n; +}, '({[Symbol.toPrimitive]: 1}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + [Symbol.toPrimitive]: 1 + }; +}, '0n + {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) + 0n; +}, '({[Symbol.toPrimitive]: {}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + [Symbol.toPrimitive]: {} + }; +}, '0n + {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) + 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n + {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) + 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n + {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) + 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) + 0n throws MyError'); + +assert.throws(MyError, function() { + 0n + { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n + {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) + 0n; +}, '({valueOf: function() {throw new MyError();}}) + 0n throws MyError'); + +assert.throws(MyError, function() { + 0n + { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n + {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) + 0n; +}, '({toString: function() {throw new MyError();}}) + 0n throws MyError'); + +assert.throws(MyError, function() { + 0n + { + toString: function() { + throw new MyError(); + } + }; +}, '0n + {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) + 0n; +}, '({valueOf: null, toString: null}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + valueOf: null, + toString: null + }; +}, '0n + {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) + 0n; +}, '({valueOf: 1, toString: 1}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + valueOf: 1, + toString: 1 + }; +}, '0n + {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) + 0n; +}, '({valueOf: {}, toString: {}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + valueOf: {}, + toString: {} + }; +}, '0n + {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) + 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n + {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) + 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) + 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n + { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n + {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/addition/bigint-wrapped-values.js new file mode 100644 index 0000000000..2b31c35fc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: addition operator ToNumeric with BigInt operands +esid: sec-addition-operator-plus-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) + 1n, 3n, 'The result of (Object(2n) + 1n) is 3n'); +assert.sameValue(1n + Object(2n), 3n, 'The result of (1n + Object(2n)) is 3n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 3n, 'The result of (1n + {[Symbol.toPrimitive]: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({valueOf: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + valueOf: function() { + return 2n; + } +}, 3n, 'The result of (1n + {valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} + 1n, 3n, 'The result of (({toString: function() {return 2n;}}) + 1n) is 3n'); + +assert.sameValue(1n + { + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n + {toString: function() {return 2n;}}) is 3n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/browser.js b/js/src/tests/test262/language/expressions/addition/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/addition/coerce-bigint-to-string.js b/js/src/tests/test262/language/expressions/addition/coerce-bigint-to-string.js new file mode 100644 index 0000000000..4fb927520a --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/coerce-bigint-to-string.js @@ -0,0 +1,35 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: ToString is applied BigInt values in an additive expression with another string +esid: prod-AdditiveExpression +info: | + AdditiveExpression: AdditiveExpression + MultiplicativeExpression + + ... + 7. If Type(lprim) is String or Type(rprim) is String, then + a. Let lstr be ? ToString(lprim). + b. Let rstr be ? ToString(rprim). + c. Return the String that is the result of concatenating lstr and rstr. + ... + + ToString Applied to the BigInt Type + + 1. If i is less than zero, return the String concatenation of the String "-" and ToString(-i). + 2. Return the String consisting of the code units of the digits of the decimal representation of i. +features: [BigInt] +---*/ + +assert.sameValue(-1n + "", "-1"); +assert.sameValue("" + -1n, "-1"); +assert.sameValue(0n + "", "0"); +assert.sameValue("" + 0n, "0"); +assert.sameValue(1n + "", "1"); +assert.sameValue("" + 1n, "1"); +assert.sameValue(123456789000000000000000n + "", "123456789000000000000000"); +assert.sameValue("" + 123456789000000000000000n, "123456789000000000000000"); +assert.sameValue(-123456789000000000000000n + "", "-123456789000000000000000"); +assert.sameValue("" + -123456789000000000000000n, "-123456789000000000000000"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-err.js b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-err.js new file mode 100644 index 0000000000..13617e9dc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-err.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +es6id: 12.7.3.1 +description: > + Behavior when error thrown by invocation of `Symbol.toPrimitive` method + during coercion +info: | + [...] + 5. Let lprim be ? ToPrimitive(lval). + 6. Let rprim be ? ToPrimitive(rval). + [...] + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + b. ReturnIfAbrupt(result). +features: [Symbol.toPrimitive] +---*/ + +var thrower = {}; +var counter = {}; +var log; + +Object.defineProperty(thrower, Symbol.toPrimitive, { + get: function() { + log += 'accessThrower'; + return function() { throw new Test262Error(); }; + } +}); +Object.defineProperty(counter, Symbol.toPrimitive, { + get: function() { + log += 'accessCounter'; + return function() { log += 'callCounter'; }; + } +}); + +log = ''; + +assert.throws(Test262Error, function() { + thrower + counter; +}, 'error thrown by left-hand side'); +assert.sameValue(log, 'accessThrower'); + +log = ''; + +assert.throws(Test262Error, function() { + counter + thrower; +}, 'error thrown by right-hand side'); +assert.sameValue(log, 'accessCountercallCounteraccessThrower'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-invocation.js b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-invocation.js new file mode 100644 index 0000000000..8e84913f02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-invocation.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +es6id: 12.7.3.1 +description: Invocation of `Symbol.toPrimitive` method during coercion +info: | + [...] + 5. Let lprim be ? ToPrimitive(lval). + 6. Let rprim be ? ToPrimitive(rval). + [...] + + ES6 Section 7.2.12 Abstract Equality Comparison + + [...] + 10. If Type(x) is either String, Number, or Symbol and Type(y) is Object, + then return the result of the comparison x == ToPrimitive(y). + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + 1. If PreferredType was not passed, let hint be "default". + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + [...] +features: [Symbol.toPrimitive] +---*/ + +var left = {}; +var right = {}; +var log = ''; +var leftThisVal, rightThisVal, leftArgs, rightArgs; + +left[Symbol.toPrimitive] = function() { + log += 'left'; + leftThisVal = this; + leftArgs = arguments; +}; + +right[Symbol.toPrimitive] = function() { + log += 'right'; + rightThisVal = this; + rightArgs = arguments; +}; + + +left + right; + +assert.sameValue(log, 'leftright', 'methods invoked in correct sequence'); + +assert.sameValue(leftThisVal, left, 'left-hand side `this` value'); +assert.sameValue(leftArgs.length, 1, 'left-hand side argument length'); +assert.sameValue(leftArgs[0], 'default', 'left-hand side argument value'); + +assert.sameValue(rightThisVal, right, 'right-hand side `this` value'); +assert.sameValue(rightArgs.length, 1, 'right-hand side argument length'); +assert.sameValue(rightArgs[0], 'default', 'right-hand side argument value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-obj.js b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-obj.js new file mode 100644 index 0000000000..e09ff50bf4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-obj.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +es6id: 12.7.3.1 +description: > + Behavior when coercion via `Symbol.toPrimitive` yields an Object +info: | + [...] + 5. Let lprim be ? ToPrimitive(lval). + 6. Let rprim be ? ToPrimitive(rval). + [...] + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + b. ReturnIfAbrupt(result). + c. If Type(result) is not Object, return result. + d. Throw a TypeError exception. +features: [Symbol.toPrimitive] +---*/ + +var y = {}; +var retVal; + +y[Symbol.toPrimitive] = function() { + return retVal; +}; + +retVal = {}; +assert.throws(TypeError, function() { + 0 + y; +}, 'ordinary object value, right-hand side'); +assert.throws(TypeError, function() { + y + 0; +}, 'ordinary object value, left-hand side'); + +retVal = (function() { return arguments; }()); +assert.throws(TypeError, function() { + 0 + y; +}, 'arguments exotic object value, right-hand side'); +assert.throws(TypeError, function() { + y + 0; +}, 'arguments exotic object value, left-hand side'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-prim.js b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-prim.js new file mode 100644 index 0000000000..ad4d2d24ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/coerce-symbol-to-prim-return-prim.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +es6id: 12.7.3.1 +description: > + Behavior when coercion via `Symbol.toPrimitive` yields a primitive value +info: | + [...] + 5. Let lprim be ? ToPrimitive(lval). + 6. Let rprim be ? ToPrimitive(rval). + 7. If Type(lprim) is String or Type(rprim) is String, then + a. Let lstr be ? ToString(lprim). + b. Let rstr be ? ToString(rprim). + c. Return the String that is the result of concatenating lstr and rstr. + 8. Let lnum be ? ToNumber(lprim). + 9. Let rnum be ? ToNumber(rprim). + 10. Return the result of applying the addition operation to lnum and rnum. + See the Note below 12.8.5. + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + b. ReturnIfAbrupt(result). + c. If Type(result) is not Object, return result. +features: [Symbol.toPrimitive] +---*/ + +var y = {}; +var retVal; + +y[Symbol.toPrimitive] = function() { + return retVal; +}; + +retVal = 86; +assert.sameValue(1 + y, 87); +assert.sameValue(y + 2, 88); +assert.sameValue('s' + y, 's86'); +assert.sameValue(y + 's', '86s'); + +retVal = 'str'; +assert.sameValue(0 + y, '0str'); +assert.sameValue(y + 0, 'str0'); +assert.sameValue('s' + y, 'sstr'); +assert.sameValue(y + 's', 'strs'); + +retVal = Symbol.toPrimitive; +assert.throws(TypeError, function() { + 0 + y; +}, 'ToNumber(Symbol): right-hand side'); +assert.throws(TypeError, function() { + y + 0; +}, 'ToNumber(Symbol): left-hand side'); +assert.throws(TypeError, function() { + '' + y; +}, 'ToString(Symbol): right-hand side'); +assert.throws(TypeError, function() { + y + ''; +}, 'ToString(Symbol): left-hand size'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/get-symbol-to-prim-err.js b/js/src/tests/test262/language/expressions/addition/get-symbol-to-prim-err.js new file mode 100644 index 0000000000..00fadaa04a --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/get-symbol-to-prim-err.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +es6id: 12.7.3.1 +description: > + Behavior when error is thrown while accessing `Symbol.toPrimitive` property +info: | + [...] + 5. Let lprim be ? ToPrimitive(lval). + 6. Let rprim be ? ToPrimitive(rval). + [...] + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + 1. If PreferredType was not passed, let hint be "default". + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + [...] +features: [Symbol.toPrimitive] +---*/ + +var thrower = {}; +var counter = {}; +var callCount = 0; + +Object.defineProperty(thrower, Symbol.toPrimitive, { + get: function() { + throw new Test262Error(); + } +}); +Object.defineProperty(counter, Symbol.toPrimitive, { + get: function() { + callCount += 1; + } +}); + +assert.throws(Test262Error, function() { + thrower + counter; +}, 'error from property access of left-hand side'); + +assert.sameValue(callCount, 0); + +assert.throws(Test262Error, function() { + counter + thrower; +}, 'error from property access of right-hand side'); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/order-of-evaluation.js b/js/src/tests/test262/language/expressions/addition/order-of-evaluation.js new file mode 100644 index 0000000000..abe4f32ebb --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/order-of-evaluation.js @@ -0,0 +1,142 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus-runtime-semantics-evaluation +description: Type coercion order of operations for addition operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToPrimitive(lhs) + ToPrimitive(rhs) + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() + (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() + (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() + (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() + (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToPrimive(rhs) is called before ?ToNumeric(lhs). +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() + (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) is called before ?ToNumeric(lhs)."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) is called before ?ToNumeric(lhs)."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() + (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/addition/shell.js b/js/src/tests/test262/language/expressions/addition/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/addition/symbol-to-string.js b/js/src/tests/test262/language/expressions/addition/symbol-to-string.js new file mode 100644 index 0000000000..390f37c051 --- /dev/null +++ b/js/src/tests/test262/language/expressions/addition/symbol-to-string.js @@ -0,0 +1,19 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-addition-operator-plus +es6id: 12.7.3 +description: Symbol value cannot be converted to a String +info: | + [...] + 7. If Type(lprim) is String or Type(rprim) is String, then + a. Let lstr be ? ToString(lprim). +features: [Symbol] +---*/ + +var s = Symbol('66'); +assert.throws(TypeError, function() { + s + ''; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/11.1.4-0.js b/js/src/tests/test262/language/expressions/array/11.1.4-0.js new file mode 100644 index 0000000000..a8541c380a --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/11.1.4-0.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.4-0 +description: > + elements elided at the end of an array do not contribute to its + length +---*/ + + var a = [,]; + +assert.sameValue(a.length, 1, 'a.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/11.1.4_4-5-1.js b/js/src/tests/test262/language/expressions/array/11.1.4_4-5-1.js new file mode 100644 index 0000000000..dbb5ec41e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/11.1.4_4-5-1.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.4; + The production + ElementList : Elisionopt AssignmentExpression + 5.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(firstIndex), the Property Descriptor { [[Value]]: initValue, [[Writable]]: true + , [[Enumerable]]: true, [[Configurable]]: true}, and false. +es5id: 11.1.4_4-5-1 +description: > + Initialize array using ElementList (Elisionopt + AssignmentExpression) when index property (read-only) exists in + Array.prototype (step 5) +---*/ + + Object.defineProperty(Array.prototype, "0", { + value: 100, + writable: false, + configurable: true + }); + var arr = [101]; + +assert(arr.hasOwnProperty("0"), 'arr.hasOwnProperty("0") !== true'); +assert.sameValue(arr[0], 101, 'arr[0]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/11.1.4_5-6-1.js b/js/src/tests/test262/language/expressions/array/11.1.4_5-6-1.js new file mode 100644 index 0000000000..c10e03c7e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/11.1.4_5-6-1.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.4; + The production + ElementList : ElementList , Elisionopt AssignmentExpression + 6.Call the [[DefineOwnProperty]] internal method of array with arguments ToString(ToUint32((pad+len)) and the Property Descriptor { [[Value]]: initValue + , [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true}, and false. +es5id: 11.1.4_5-6-1 +description: > + Initialize array using ElementList (ElementList , Elisionopt + AssignmentExpression) when index property (read-only) exists in + Array.prototype (step 6) +---*/ + + Object.defineProperty(Array.prototype, "1", { + value: 100, + writable: false, + configurable: true + }); + var arr = [101, 12]; + +assert(arr.hasOwnProperty("1"), 'arr.hasOwnProperty("1") !== true'); +assert.sameValue(arr[1], 12, 'arr[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A1.1.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.1.js new file mode 100644 index 0000000000..f0d3b83deb --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Evaluate the production ArrayLiteral: [ ]" +es5id: 11.1.4_A1.1 +description: > + Checking various properties of the array defined with expression + "var array = []" +---*/ + +var array = []; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = []; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = []; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = []; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 0) { + throw new Test262Error('#4: var array = []; array.length === 0. Actual: ' + (array.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A1.2.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.2.js new file mode 100644 index 0000000000..01111b8c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Evaluate the production ArrayLiteral: [ Elision ]" +es5id: 11.1.4_A1.2 +description: > + Checking various properties the array defined with "var array = + [,,,,,]" +---*/ + +var array = [,,,,,]; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = [,,,,,]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = [,,,,,]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = [,,,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + throw new Test262Error('#4: var array = [,,,,,]; array.length === 5. Actual: ' + (array.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A1.3.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.3.js new file mode 100644 index 0000000000..158bbcd25d --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.3.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Evaluate the production ArrayLiteral: [ AssignmentExpression ]" +es5id: 11.1.4_A1.3 +description: > + Checking various properteis and contents of the array defined with + "var array = [1,2,3,4,5]" +---*/ + +var array = [1,2,3,4,5]; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = [1,2,3,4,5]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = [1,2,3,4,5]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = [1,2,3,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + throw new Test262Error('#4: var array = [1,2,3,4,5]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== 1) { + throw new Test262Error('#5: var array = [1,2,3,4,5]; array[0] === 1. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== 2) { + throw new Test262Error('#6: var array = [1,2,3,4,5]; array[1] === 2. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== 3) { + throw new Test262Error('#7: var array = [1,2,3,4,5]; array[2] === 3. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== 4) { + throw new Test262Error('#8: var array = [1,2,3,4,5]; array[3] === 4. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== 5) { + throw new Test262Error('#9: var array = [1,2,3,4,5]; array[4] === 5. Actual: ' + (array[4])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A1.4.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.4.js new file mode 100644 index 0000000000..06298f24dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.4.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Evaluate the production ArrayLiteral: [ Elision, AssignmentExpression ]" +es5id: 11.1.4_A1.4 +description: > + Checking various properteis and content of the array defined with + "var array = [,,,1,2]" +---*/ + +var array = [,,,1,2]; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = [,,,1,2]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = [,,,1,2]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = [,,,1,2]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + throw new Test262Error('#4: var array = [,,,1,2]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== undefined) { + throw new Test262Error('#5: var array = [,,,1,2]; array[0] === undefined. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== undefined) { + throw new Test262Error('#6: var array = [,,,1,2]; array[1] === undefined. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== undefined) { + throw new Test262Error('#7: var array = [,,,1,2]; array[2] === undefined. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== 1) { + throw new Test262Error('#8: var array = [,,,1,2]; array[3] === 1. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== 2) { + throw new Test262Error('#9: var array = [,,,1,2]; array[4] === 2. Actual: ' + (array[4])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A1.5.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.5.js new file mode 100644 index 0000000000..2909b08365 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.5.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision ]" +es5id: 11.1.4_A1.5 +description: > + Checking various properteis and contents of the array defined with + "var array = [4,5,,,,]" +---*/ + +var array = [4,5,,,,]; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = [4,5,,,,]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = [4,5,,,,]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = [4,5,,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + throw new Test262Error('#4: var array = [4,5,,,,]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== 4) { + throw new Test262Error('#5: var array = [4,5,,,,]; array[0] === 4. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== 5) { + throw new Test262Error('#6: var array = [4,5,,,,]; array[1] === 5. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== undefined) { + throw new Test262Error('#7: var array = [4,5,,,,]; array[2] === undefined. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== undefined) { + throw new Test262Error('#8: var array = [4,5,,,,]; array[3] === undefined. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== undefined) { + throw new Test262Error('#9: var array = [4,5,,,,]; array[4] === undefined. Actual: ' + (array[4])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A1.6.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.6.js new file mode 100644 index 0000000000..32be59534d --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.6.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Evaluate the production ArrayLiteral: [ Elision, AssignmentExpression, + Elision ] +es5id: 11.1.4_A1.6 +description: > + Checking various properteis and contents of the array defined with + "var array = [,,3,,,]" +---*/ + +var array = [,,3,,,]; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = [,,3,,,]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = [,,3,,,]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = [,,3,,,]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + throw new Test262Error('#4: var array = [,,3,,,]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== undefined) { + throw new Test262Error('#5: var array = [,,3,,,]; array[0] === undefined. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== undefined) { + throw new Test262Error('#6: var array = [,,3,,,]; array[1] === undefined. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== 3) { + throw new Test262Error('#7: var array = [,,3,,,]; array[2] === 3. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== undefined) { + throw new Test262Error('#8: var array = [,,3,,,]; array[3] === undefined. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== undefined) { + throw new Test262Error('#9: var array = [,,3,,,]; array[4] === undefined. Actual: ' + (array[4])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A1.7.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.7.js new file mode 100644 index 0000000000..46c51c2d1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A1.7.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Evaluate the production ArrayLiteral: [ AssignmentExpression, Elision, + AssignmentExpression ] +es5id: 11.1.4_A1.7 +description: > + Checking various properteis and contents of the array defined with + "var array = [1,2,,4,5]" +---*/ + +var array = [1,2,,4,5]; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = [1,2,,4,5]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = [1,2,,4,5]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = [1,2,,4,5]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 5) { + throw new Test262Error('#4: var array = [1,2,,4,5]; array.length === 5. Actual: ' + (array.length)); +} + +//CHECK#5 +if (array[0] !== 1) { + throw new Test262Error('#5: var array = [1,2,,4,5]; array[0] === 1. Actual: ' + (array[0])); +} + +//CHECK#6 +if (array[1] !== 2) { + throw new Test262Error('#6: var array = [1,2,,4,5]; array[1] === 2. Actual: ' + (array[1])); +} + +//CHECK#7 +if (array[2] !== undefined) { + throw new Test262Error('#7: var array = [1,2,,4,5]; array[2] === undefined. Actual: ' + (array[2])); +} + +//CHECK#8 +if (array[3] !== 4) { + throw new Test262Error('#8: var array = [1,2,,4,5]; array[3] === 4. Actual: ' + (array[3])); +} + +//CHECK#9 +if (array[4] !== 5) { + throw new Test262Error('#9: var array = [1,2,,4,5]; array[4] === 5. Actual: ' + (array[4])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/S11.1.4_A2.js b/js/src/tests/test262/language/expressions/array/S11.1.4_A2.js new file mode 100644 index 0000000000..652f88c69c --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/S11.1.4_A2.js @@ -0,0 +1,130 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Create multi dimensional array +es5id: 11.1.4_A2 +description: > + Checking various properteis and contents of the arrya defined with + "var array = [[1,2], [3], []]" +---*/ + +var array = [[1,2], [3], []]; + +//CHECK#1 +if (typeof array !== "object") { + throw new Test262Error('#1: var array = [[1,2], [3], []]; typeof array === "object". Actual: ' + (typeof array)); +} + +//CHECK#2 +if (array instanceof Array !== true) { + throw new Test262Error('#2: var array = [[1,2], [3], []]; array instanceof Array === true'); +} + +//CHECK#3 +if (array.toString !== Array.prototype.toString) { + throw new Test262Error('#3: var array = [[1,2], [3], []]; array.toString === Array.prototype.toString. Actual: ' + (array.toString)); +} + +//CHECK#4 +if (array.length !== 3) { + throw new Test262Error('#4: var array = [[1,2], [3], []]; array.length === 3. Actual: ' + (array.length)); +} + +var subarray = array[0]; + +//CHECK#5 +if (typeof subarray !== "object") { + throw new Test262Error('#5: var array = [[1,2], [3], []]; var subarray = array[0]; typeof subarray === "object". Actual: ' + (typeof subarray)); +} + +//CHECK#6 +if (subarray instanceof Array !== true) { + throw new Test262Error('#6: var array = [[1,2], [3], []]; var subarray = array[0]; subarray instanceof Array === true'); +} + +//CHECK#7 +if (subarray.toString !== Array.prototype.toString) { + throw new Test262Error('#7: var array = [[1,2], [3], []]; var subarray = array[0]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString)); +} + +//CHECK#8 +if (subarray.length !== 2) { + throw new Test262Error('#8: var array = [[1,2], [3], []]; var subarray = array[0]; subarray.length === 2. Actual: ' + (subarray.length)); +} + +//CHECK#9 +if (subarray[0] !== 1) { + throw new Test262Error('#9: var array = [[1,2], [3], []]; var subarray = array[0]; subarray[0] === 1. Actual: ' + (subarray[0])); +} + +//CHECK#10 +if (subarray[1] !== 2) { + throw new Test262Error('#10: var array = [[1,2], [3], []]; var subarray = array[1]; subarray[1] === 2. Actual: ' + (subarray[1])); +} + +var subarray = array[1]; + +//CHECK#11 +if (typeof subarray !== "object") { +throw new Test262Error('#11: var array = [[1,2], [3], []]; var subarray = array[1]; typeof subarray === "object". Actual: ' + (typeof subarray)); +} + +//CHECK#12 +if (subarray instanceof Array !== true) { +throw new Test262Error('#12: var array = [[1,2], [3], []]; var subarray = array[1]; subarray instanceof Array === true'); +} + +//CHECK#13 +if (subarray.toString !== Array.prototype.toString) { +throw new Test262Error('#13: var array = [[1,2], [3], []]; var subarray = array[1]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString)); +} + +//CHECK#14 +if (subarray.length !== 1) { +throw new Test262Error('#14: var array = [[1,2], [3], []]; var subarray = array[1]; subarray.length === 1. Actual: ' + (subarray.length)); +} + +//CHECK#15 +if (subarray[0] !== 3) { +throw new Test262Error('#15: var array = [[1,2], [3], []]; var subarray = array[1]; subarray[0] === 3. Actual: ' + (subarray[0])); +} + +var subarray = array[2]; + +//CHECK#16 +if (typeof subarray !== "object") { +throw new Test262Error('#16: var array = [[1,2], [3], []]; var subarray = array[2]; typeof subarray === "object". Actual: ' + (typeof subarray)); +} + +//CHECK#17 +if (subarray instanceof Array !== true) { +throw new Test262Error('#17: var array = [[1,2], [3], []]; var subarray = array[2]; subarray instanceof Array === true'); +} + +//CHECK#18 +if (subarray.toString !== Array.prototype.toString) { +throw new Test262Error('#18: var array = [[1,2], [3], []]; var subarray = array[2]; subarray.toString === Array.prototype.toString. Actual: ' + (subarray.toString)); +} + +//CHECK#19 +if (subarray.length !== 0) { +throw new Test262Error('#19: var array = [[1,2], [3], []]; var subarray = array[2]; subarray.length === 0. Actual: ' + (subarray.length)); +} + +//CHECK#20 +if (array[0][0] !== 1) { + throw new Test262Error('#20: var array = [[1,2], [3], []]; array[0][0] === 1. Actual: ' + (array[0][0])); +} + +//CHECK#21 +if (array[0][1] !== 2) { + throw new Test262Error('#21: var array = [[1,2], [3], []]; array[0][1] === 2. Actual: ' + (array[0][1])); +} + +//CHECK#22 +if (array[1][0] !== 3) { + throw new Test262Error('#722: var array = [[1,2], [3], []]; array[1][0] === 3. Actual: ' + (array[1][0])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/browser.js b/js/src/tests/test262/language/expressions/array/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/array/shell.js b/js/src/tests/test262/language/expressions/array/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-expr-throws.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-expr-throws.js new file mode 100644 index 0000000000..deaf9c43dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-expr-throws.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-expr-throws.case +// - src/spread/error/array.template +/*--- +description: Spread operator following other arguments when evaluation throws (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [generators] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + +---*/ + +assert.throws(Test262Error, function() { + [0, ...function*() { throw new Test262Error(); }()]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-iter-get-value.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-iter-get-value.js new file mode 100644 index 0000000000..0867a9fa27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-iter-get-value.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-iter-get-value.case +// - src/spread/error/array.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + return null; + } +}); + +assert.throws(TypeError, function() { + [0, ...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-call.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-call.js new file mode 100644 index 0000000000..d8543c3fa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-call.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-call.case +// - src/spread/error/array.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + [0, ...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-get.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-get.js new file mode 100644 index 0000000000..f80cc68d13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-get-get.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-get.case +// - src/spread/error/array.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + [0, ...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-step.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-step.js new file mode 100644 index 0000000000..f55ade0a5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-step.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-step.case +// - src/spread/error/array.template +/*--- +description: Spread operator following other arguments when IteratorStep fails (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + [0, ...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-value.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-value.js new file mode 100644 index 0000000000..cde32ee06a --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-itr-value.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-value.case +// - src/spread/error/array.template +/*--- +description: Spread operator following other arguments when IteratorValue fails (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +assert.throws(Test262Error, function() { + [0, ...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-obj-unresolvable.js new file mode 100644 index 0000000000..3111abca28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-obj-unresolvable.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-obj-unresolvable.case +// - src/spread/error/array.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +assert.throws(ReferenceError, function() { + [{a: 0, ...unresolvableReference}]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-mult-err-unresolvable.js b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-unresolvable.js new file mode 100644 index 0000000000..34348cce7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-mult-err-unresolvable.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-unresolvable.case +// - src/spread/error/array.template +/*--- +description: Spread operator following other arguments when reference is unresolvable (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +assert.throws(ReferenceError, function() { + [0, ...unresolvableReference]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-expr-throws.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-expr-throws.js new file mode 100644 index 0000000000..99dd2cd60e --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-expr-throws.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-expr-throws.case +// - src/spread/error/array.template +/*--- +description: Spread operator applied to the only argument when evaluation throws (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [generators] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). +---*/ + +assert.throws(Test262Error, function() { + [...function*() { throw new Test262Error(); }()]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-call.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-call.js new file mode 100644 index 0000000000..c10deb08ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-call.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-call.case +// - src/spread/error/array.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + [...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-get.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-get.js new file mode 100644 index 0000000000..82e463fe16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-get.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-get.case +// - src/spread/error/array.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + [...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-value.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-value.js new file mode 100644 index 0000000000..a6933c639b --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-get-value.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-value.case +// - src/spread/error/array.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return null; +}; + +assert.throws(TypeError, function() { + [...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-step.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-step.js new file mode 100644 index 0000000000..9f77be3502 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-step.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-step.case +// - src/spread/error/array.template +/*--- +description: Spread operator applied to the only argument when IteratorStep fails (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + [...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-value.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-value.js new file mode 100644 index 0000000000..3970e6f59d --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-itr-value.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-value.case +// - src/spread/error/array.template +/*--- +description: Spread operator applied to the only argument when IteratorValue fails (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +assert.throws(Test262Error, function() { + [...iter]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-obj-unresolvable.js new file mode 100644 index 0000000000..d089e0127b --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-obj-unresolvable.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-obj-unresolvable.case +// - src/spread/error/array.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +assert.throws(ReferenceError, function() { + [{...unresolvableReference}]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-unresolvable.js b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-unresolvable.js new file mode 100644 index 0000000000..f796a010f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-err-sngl-err-unresolvable.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-unresolvable.case +// - src/spread/error/array.template +/*--- +description: Spread operator applied to the only argument when reference is unresolvable (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +assert.throws(ReferenceError, function() { + [...unresolvableReference]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-mult-empty.js b/js/src/tests/test262/language/expressions/array/spread-mult-empty.js new file mode 100644 index 0000000000..58bfdf99d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-mult-empty.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-empty.case +// - src/spread/default/array.template +/*--- +description: Spread operator following other arguments when no iteration occurs (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + callCount += 1; +}.apply(null, [1, 2, 3, ...[]])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-mult-expr.js b/js/src/tests/test262/language/expressions/array/spread-mult-expr.js new file mode 100644 index 0000000000..6d6de57fbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-mult-expr.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-expr.case +// - src/spread/default/array.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ +var source = [3, 4, 5]; +var target; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + assert.sameValue(target, source); + callCount += 1; +}.apply(null, [1, 2, ...target = source])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-mult-iter.js b/js/src/tests/test262/language/expressions/array/spread-mult-iter.js new file mode 100644 index 0000000000..58bf244d25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-mult-iter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-iter.case +// - src/spread/default/array.template +/*--- +description: Spread operator following other arguments with a valid iterator (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 3; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 6, value: nextCount }; + } + }; +}; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + callCount += 1; +}.apply(null, [1, 2, 3, ...iter])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-mult-literal.js b/js/src/tests/test262/language/expressions/array/spread-mult-literal.js new file mode 100644 index 0000000000..99200683ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-mult-literal.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-literal.case +// - src/spread/default/array.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 5); + assert.sameValue(arguments[1], 6); + assert.sameValue(arguments[2], 7); + assert.sameValue(arguments[3], 8); + assert.sameValue(arguments[4], 9); + callCount += 1; +}.apply(null, [5, ...[6, 7, 8], 9])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-mult-obj-ident.js b/js/src/tests/test262/language/expressions/array/spread-mult-obj-ident.js new file mode 100644 index 0000000000..376867e5d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-mult-obj-ident.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-ident.case +// - src/spread/default/array.template +/*--- +description: Object Spread operator following other properties (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 4); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; +}.apply(null, [{a: 1, b: 2, ...o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-mult-obj-null.js b/js/src/tests/test262/language/expressions/array/spread-mult-obj-null.js new file mode 100644 index 0000000000..89b71fb411 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-mult-obj-null.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-null.case +// - src/spread/default/array.template +/*--- +description: Object Spread operator following other arguments with null value (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}.apply(null, [{a: 1, b: 2, ...null}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-mult-obj-undefined.js b/js/src/tests/test262/language/expressions/array/spread-mult-obj-undefined.js new file mode 100644 index 0000000000..06afb0eb3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-mult-obj-undefined.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-undefined.case +// - src/spread/default/array.template +/*--- +description: Object Spread operator following other arguments with undefined (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}.apply(null, [{a: 1, b: 2, ...undefined}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-getter-descriptor.js b/js/src/tests/test262/language/expressions/array/spread-obj-getter-descriptor.js new file mode 100644 index 0000000000..565807388e --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-getter-descriptor.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-descriptor.case +// - src/spread/default/array.template +/*--- +description: Spread operation with getter results in data property descriptor (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = { + get a() { + return 42; + } +}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 42 + }); + callCount += 1; +}.apply(null, [{...o, c: 4, d: 5}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-getter-init.js b/js/src/tests/test262/language/expressions/array/spread-obj-getter-init.js new file mode 100644 index 0000000000..d3d196353e --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-getter-init.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-init.case +// - src/spread/default/array.template +/*--- +description: Getter in object literal is not evaluated (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. +---*/ + +let o = {a: 2, b: 3}; +let executedGetter = false; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(executedGetter, false) + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}.apply(null, [{...o, get c() { executedGetter = true; }}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-manipulate-outter-obj-in-getter.js b/js/src/tests/test262/language/expressions/array/spread-obj-manipulate-outter-obj-in-getter.js new file mode 100644 index 0000000000..c7e5cdb8df --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-manipulate-outter-obj-in-getter.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-manipulate-outter-obj-in-getter.case +// - src/spread/default/array.template +/*--- +description: Getter manipulates outter object before it's spread operation (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var o = { a: 0, b: 1 }; +var cthulhu = { get x() { + delete o.a; + o.b = 42; + o.c = "ni"; +}}; + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.hasOwnProperty("a"), false); + assert.sameValue(obj.b, 42); + assert.sameValue(obj.c, "ni"); + assert(obj.hasOwnProperty("x")); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}.apply(null, [{...cthulhu, ...o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-mult-spread-getter.js b/js/src/tests/test262/language/expressions/array/spread-obj-mult-spread-getter.js new file mode 100644 index 0000000000..717990ed84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-mult-spread-getter.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread-getter.case +// - src/spread/default/array.template +/*--- +description: Multiple Object Spread usage calls getter multiple times (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let getterCallCount = 0; +let o = { + get a() { + return ++getterCallCount; + } +}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}.apply(null, [{...o, c: 4, d: 5, a: 42, ...o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-mult-spread.js b/js/src/tests/test262/language/expressions/array/spread-obj-mult-spread.js new file mode 100644 index 0000000000..fbeace4e76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-mult-spread.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread.case +// - src/spread/default/array.template +/*--- +description: Multiple Object Spread operation (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +let o = {a: 2, b: 3}; +let o2 = {c: 4, d: 5}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 4); + callCount += 1; +}.apply(null, [{...o, ...o2}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-null.js b/js/src/tests/test262/language/expressions/array/spread-obj-null.js new file mode 100644 index 0000000000..ae106cfd5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-null.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-null.case +// - src/spread/default/array.template +/*--- +description: Null Object Spread is ignored (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}.apply(null, [{...null}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-override-immutable.js b/js/src/tests/test262/language/expressions/array/spread-obj-override-immutable.js new file mode 100644 index 0000000000..3a97d624d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-override-immutable.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-override-immutable.case +// - src/spread/default/array.template +/*--- +description: Object Spread overriding immutable properties (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. +---*/ + +let o = {b: 2}; +Object.defineProperty(o, "a", {value: 1, enumerable: true, writable: false, configurable: true}); + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 3) + assert.sameValue(obj.b, 2); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount += 1; +}.apply(null, [{...o, a: 3}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-overrides-prev-properties.js b/js/src/tests/test262/language/expressions/array/spread-obj-overrides-prev-properties.js new file mode 100644 index 0000000000..a7da2822d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-overrides-prev-properties.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-overrides-prev-properties.case +// - src/spread/default/array.template +/*--- +description: Object Spread properties overrides previous definitions (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(Object.keys(obj).length, 2); + assert.sameValue(o.a, 2); + assert.sameValue(o.b, 3); + callCount += 1; +}.apply(null, [{a: 1, b: 7, ...o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/array/spread-obj-skip-non-enumerable.js new file mode 100644 index 0000000000..e064545086 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-skip-non-enumerable.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-skip-non-enumerable.case +// - src/spread/default/array.template +/*--- +description: Object Spread doesn't copy non-enumerable properties (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. +---*/ + +let o = {}; +Object.defineProperty(o, "b", {value: 3, enumerable: false}); + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.hasOwnProperty("b"), false) + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}.apply(null, [{...o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-spread-order.js b/js/src/tests/test262/language/expressions/array/spread-obj-spread-order.js new file mode 100644 index 0000000000..3e15329cfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-spread-order.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-spread-order.case +// - src/spread/default/array.template +/*--- +description: Spread operation follows [[OwnPropertyKeys]] order (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol, object-spread] +flags: [generated] +includes: [compareArray.js] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var calls = []; +var o = { get z() { calls.push('z') }, get a() { calls.push('a') } }; +Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true }); +Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true }); + + +var callCount = 0; + +(function(obj) { + assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}.apply(null, [{...o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-symbol-property.js b/js/src/tests/test262/language/expressions/array/spread-obj-symbol-property.js new file mode 100644 index 0000000000..2d675ed5c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-symbol-property.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-symbol-property.case +// - src/spread/default/array.template +/*--- +description: Spread operation where source object contains Symbol properties (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol, object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let symbol = Symbol('foo'); +let o = {}; +o[symbol] = 1; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj[symbol], 1); + assert(Object.prototype.hasOwnProperty.call(obj, symbol), "symbol is an own property"); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}.apply(null, [{...o, c: 4, d: 5}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-undefined.js b/js/src/tests/test262/language/expressions/array/spread-obj-undefined.js new file mode 100644 index 0000000000..36485e9b93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-undefined.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-undefined.case +// - src/spread/default/array.template +/*--- +description: Undefined Object Spread is ignored (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}.apply(null, [{...undefined}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-obj-with-overrides.js b/js/src/tests/test262/language/expressions/array/spread-obj-with-overrides.js new file mode 100644 index 0000000000..9ffb6bd799 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-obj-with-overrides.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-with-overrides.case +// - src/spread/default/array.template +/*--- +description: Object Spread properties being overriden (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol, object-spread] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3, c: 4, e: undefined, f: null, g: false}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 7); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert(obj.hasOwnProperty("e")); + assert.sameValue(obj.f, null); + assert.sameValue(obj.g, false); + assert.sameValue(obj.h, -0); + assert.sameValue(obj.i.toString(), "Symbol(foo)"); + assert(Object.is(obj.j, o)); + assert.sameValue(Object.keys(obj).length, 10); + callCount += 1; +}.apply(null, [{...o, a: 1, b: 7, d: 5, h: -0, i: Symbol("foo"), j: o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-sngl-empty.js b/js/src/tests/test262/language/expressions/array/spread-sngl-empty.js new file mode 100644 index 0000000000..13871d8b11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-sngl-empty.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-empty.case +// - src/spread/default/array.template +/*--- +description: Spread operator applied to the only argument when no iteration occurs (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + [...] +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 0); + callCount += 1; +}.apply(null, [...[]])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-sngl-expr.js b/js/src/tests/test262/language/expressions/array/spread-sngl-expr.js new file mode 100644 index 0000000000..1eda282be1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-sngl-expr.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-expr.case +// - src/spread/default/array.template +/*--- +description: Spread operator applied to AssignmentExpression as only element (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var source = [2, 3, 4]; +var target; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 2); + assert.sameValue(arguments[1], 3); + assert.sameValue(arguments[2], 4); + assert.sameValue(target, source); + callCount += 1; +}.apply(null, [...target = source])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-sngl-iter.js b/js/src/tests/test262/language/expressions/array/spread-sngl-iter.js new file mode 100644 index 0000000000..9a2aa19b94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-sngl-iter.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-iter.case +// - src/spread/default/array.template +/*--- +description: Spread operator applied to the only argument with a valid iterator (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [Symbol.iterator] +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 0; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 3, value: nextCount }; + } + }; +}; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + callCount += 1; +}.apply(null, [...iter])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-sngl-literal.js b/js/src/tests/test262/language/expressions/array/spread-sngl-literal.js new file mode 100644 index 0000000000..68151e80a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-sngl-literal.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-literal.case +// - src/spread/default/array.template +/*--- +description: Spread operator applied to array literal as only element (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +flags: [generated] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 3); + assert.sameValue(arguments[1], 4); + assert.sameValue(arguments[2], 5); + callCount += 1; +}.apply(null, [...[3, 4, 5]])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/array/spread-sngl-obj-ident.js b/js/src/tests/test262/language/expressions/array/spread-sngl-obj-ident.js new file mode 100644 index 0000000000..584b6937d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/array/spread-sngl-obj-ident.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-obj-ident.case +// - src/spread/default/array.template +/*--- +description: Object Spread operator without other arguments (Array initializer) +esid: sec-runtime-semantics-arrayaccumulation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SpreadElement : ...AssignmentExpression + + 1. Let spreadRef be the result of evaluating AssignmentExpression. + 2. Let spreadObj be ? GetValue(spreadRef). + 3. Let iterator be ? GetIterator(spreadObj). + 4. Repeat + a. Let next be ? IteratorStep(iterator). + b. If next is false, return nextIndex. + c. Let nextValue be ? IteratorValue(next). + d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), + nextValue). + e. Assert: status is true. + f. Let nextIndex be nextIndex + 1. + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 2); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; +}.apply(null, [{...o}])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/ArrowFunction_restricted-properties.js b/js/src/tests/test262/language/expressions/arrow-function/ArrowFunction_restricted-properties.js new file mode 100644 index 0000000000..fe3dfa61d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/ArrowFunction_restricted-properties.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions created using ArrowFunction syntactic form do not have + own properties "caller" or "arguments", but inherit them from + %FunctionPrototype%. +es6id: 16.1 +---*/ + +var arrowFn = () => {}; + +assert.sameValue(arrowFn.hasOwnProperty('caller'), false, 'Functions created using ArrowFunction syntactic form do not have own property "caller"'); +assert.sameValue(arrowFn.hasOwnProperty('arguments'), false, 'Functions created using ArrowFunction syntactic form do not have own property "arguments"'); + +assert.throws(TypeError, function() { + return arrowFn.caller; +}); + +assert.throws(TypeError, function() { + arrowFn.caller = {}; +}); + +assert.throws(TypeError, function() { + return arrowFn.arguments; +}); + +assert.throws(TypeError, function() { + arrowFn.arguments = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/arrow-function/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..491794f1b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/array-destructuring-param-strict-body.js @@ -0,0 +1,132 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/arrow-function.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, ([element]) => { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-1.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-1.js new file mode 100644 index 0000000000..7d7a0d3ed1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-1.js @@ -0,0 +1,16 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: this binding tests +flags: [noStrict] +es6id: 14.2 +---*/ + +function foo(){ + return eval("()=>this"); + } + +assert.sameValue(foo()(), this, "This binding initialization was incorrect for arrow capturing this from closure."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-2.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-2.js new file mode 100644 index 0000000000..7d7a0d3ed1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-2.js @@ -0,0 +1,16 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: this binding tests +flags: [noStrict] +es6id: 14.2 +---*/ + +function foo(){ + return eval("()=>this"); + } + +assert.sameValue(foo()(), this, "This binding initialization was incorrect for arrow capturing this from closure."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-3.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-3.js new file mode 100644 index 0000000000..5925e477f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/arrow/binding-tests-3.js @@ -0,0 +1,16 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: this binding tests +flags: [noStrict] +es6id: 14.2 +---*/ + +function foo(){ + return ()=>eval("this"); + } + +assert.sameValue(eval("foo()()"), this, "This binding initialization was incorrect for arrow capturing this from closure."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/browser.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-1.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-1.js new file mode 100644 index 0000000000..237c76486d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-1.js @@ -0,0 +1,17 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Capturing closure variables +es6id: 14.2 +---*/ + +var a; +function foo(){ + eval("a = 10"); + return ()=>a; + } + +assert.sameValue(foo()(), 10, "Closure variable was captured incorrectly."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-2.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-2.js new file mode 100644 index 0000000000..76ecabb129 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/arrow/capturing-closure-variables-2.js @@ -0,0 +1,19 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Capturing closure variables - with +es6id: 14.2 +flags: [noStrict] +---*/ + +function foo(){ + var a = {a : 10}; + with(a){ + return () => a; + } + } + +assert.sameValue(foo()(), 10, "Closure variable was captured incorrectly."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-1.js new file mode 100644 index 0000000000..8df3661ffa --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-1.js @@ -0,0 +1,11 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: "ConciseBody :[lookahead { { }] AssignmentExpression" +es6id: 14.2 +---*/ + +x => x => x + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-2.js new file mode 100644 index 0000000000..0365eebc2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/arrow/concisebody-lookahead-assignmentexpression-2.js @@ -0,0 +1,11 @@ +// Copyright 2015 Microsoft Corporation. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: "ConciseBody :[lookahead { { }] AssignmentExpression" +es6id: 14.2 +---*/ + +x => function(){} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/arrow/shell.js b/js/src/tests/test262/language/expressions/arrow-function/arrow/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/browser.js b/js/src/tests/test262/language/expressions/arrow-function/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/cannot-override-this-with-thisArg.js b/js/src/tests/test262/language/expressions/arrow-function/cannot-override-this-with-thisArg.js new file mode 100644 index 0000000000..0ed46492de --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/cannot-override-this-with-thisArg.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction `this` cannot be overridden by thisArg + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + ... + 9. If kind is Arrow, set the [[ThisMode]] internal slot of F to lexical. + ... + + 9.2.1.2 OrdinaryCallBindThis ( F, calleeContext, thisArgument ) + + 1. Let thisMode be the value of F’s [[ThisMode]] internal slot. + 2. If thisMode is lexical, return NormalCompletion(undefined). + ... + +---*/ + +var calls = 0; +var usurper = {}; +[1].forEach(value => { + calls++; + assert.notSameValue(this, usurper); +}, usurper); + +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-abrupt.js new file mode 100644 index 0000000000..ea8633d42b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-abrupt.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/arrow-function.template +/*--- +description: Abrupt completion returned by evaluation of initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var f; +f = (_ = (function() { throw new Test262Error(); }())) => { + + callCount = callCount + 1; +}; + +assert.throws(Test262Error, function() { + f(); +}); +assert.sameValue(callCount, 0, 'arrow function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..d2cb5aed3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/arrow-function.template +/*--- +description: Use of initializer when argument value is not `undefined` (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) => { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..d217484582 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-arg-val-undefined.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/arrow-function.template +/*--- +description: Use of initializer when argument value is `undefined` (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (fromLiteral = 23, fromExpr = 45, fromHole = 99) => { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-duplicates.js new file mode 100644 index 0000000000..8ea9a7db3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-duplicates.js @@ -0,0 +1,61 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/arrow-function.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, (x = 0, x) => { + +}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-later.js new file mode 100644 index 0000000000..ab20e63219 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-later.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/arrow-function.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var f; +f = (x = y, y) => { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'arrow function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-prior.js new file mode 100644 index 0000000000..f796e60328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-prior.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/arrow-function.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (x, y = x, z = y) => { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-self.js new file mode 100644 index 0000000000..8188fc9662 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-ref-self.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/arrow-function.template +/*--- +description: Referencing a parameter from within its own initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var f; +f = (x = x) => { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'arrow function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-rest.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-rest.js new file mode 100644 index 0000000000..fe388474d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-rest.js @@ -0,0 +1,65 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/arrow-function.template +/*--- +description: RestParameter does not support an initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, (...x = []) => { + +}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..64c4e17ebd --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dflt-params-trailing-comma.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (a, b = 39,) => { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-close.js new file mode 100644 index 0000000000..321cab1592 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-close.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = ([x]) => { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..4d93b550f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Abrupt completion returned by GetIterator (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var f = ([x, y, z]) => {}; + +assert.throws(TypeError, function() { + f([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err.js new file mode 100644 index 0000000000..f27f9639ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-get-err.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Abrupt completion returned by GetIterator (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var f = ([x]) => {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-no-close.js new file mode 100644 index 0000000000..db1e6223ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-init-iter-no-close.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = ([x]) => { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-name-iter-val.js new file mode 100644 index 0000000000..c6ef481967 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-name-iter-val.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding with normal value iteration (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x, y, z]) => { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..fd39028d58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([[x, y, z] = [4, 5, 6]]) => { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..03d3115a9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([[x, y, z] = [4, 5, 6]]) => { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f([[7, 8, 9]]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..03d4023908 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = ([[,] = g()]) => { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..fb718c5a8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var f; +f = ([[,] = g()]) => { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f([[]]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..34669c2920 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var f; +f = ([[] = function() { initCount += 1; return iter; }()]) => { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..f39c5f7aca --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var f; +f = ([[] = function() { initCount += 1; }()]) => { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([[23]]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..88095f1075 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var f; +f = ([[...x] = values]) => { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..cc6db8c8db --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var f; +f = ([[...x] = function() { initCount += 1; }()]) => { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([values]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..eb39ae0aee --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Nested array destructuring with a null value (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var f = ([[x]]) => {}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..9080fc5f54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Destructuring initializer with an exhausted iterator (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x = 23]) => { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..0d58b7ad47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding does assign name to arrow functions (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([arrow = () => {}]) => { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..ba2a78eec7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) => { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..cbdb42bf81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([cover = (function () {}), xCover = (0, function() {})]) => { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..2ff2aa2ce0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([fn = function () {}, xFn = function x() {}]) => { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..f9401d4b93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var f; +f = ([gen = function* () {}, xGen = function* x() {}]) => { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..c6d8e0041d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Destructuring initializer with a "hole" (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x = 23]) => { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f([,]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..98d1e59a44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = ([w = counter(), x = counter(), y = counter(), z = counter()]) => { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([null, 0, false, '']); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..714510a841 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Destructuring initializer returns an abrupt completion (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var f = ([x = (function() { throw new Test262Error(); })()]) => {}; + +assert.throws(Test262Error, function() { + f([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..66ac06f0e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Destructuring initializer with an undefined value (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x = 23]) => { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([undefined]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..cefa3ae1fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Destructuring initializer is an unresolvable reference (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = ([ x = unresolvableReference ]) => {}; + +assert.throws(ReferenceError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..e82552f3d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding when value iteration completes (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x]) => { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..e7326f71e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding when value iteration was completed previously (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([_, x]) => { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..844c7a1232 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var f = ([x]) => {}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..1c388b46e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var f; +f = ([x, y, z]) => { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..c10a9c26aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = ([x]) => {}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..6a2879f73f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding when value iteration was completed previously (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x, y, z]) => { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..27e9abff2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with object binding pattern and initializer is used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ x, y, z } = { x: 44, y: 55, z: 66 }]) => { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..58f1d9e545 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ x, y, z } = { x: 44, y: 55, z: 66 }]) => { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f([{ x: 11, y: 22, z: 33 }]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..ac5eecaaa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with object binding pattern and initializer is used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) => { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..37195d1069 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) => { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([{ u: 777, w: 888, y: 999 }]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..a83d588223 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Nested object destructuring with a null value (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = ([{ x }]) => {}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..b8deaaf648 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Nested object destructuring with a value of `undefined` (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = ([{ x }]) => {}; + +assert.throws(TypeError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..5b9aac53c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-exhausted.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Elision accepts exhausted iterator (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var f; +f = ([,]) => { + + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..0284275f23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision-step-err.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Elision advances iterator and forwards abrupt completions (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var f = ([,]) => {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision.js new file mode 100644 index 0000000000..4d25b9b979 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-elision.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Elision advances iterator (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = ([,]) => { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(g()); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-empty.js new file mode 100644 index 0000000000..645523cbf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-empty.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = ([]) => { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..6b5219a009 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elem.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element containing an array BindingElementList pattern (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([...[x, y, z]]) => { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f([3, 4, 5]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..8b3adc6d00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-elision.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element containing an elision (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = ([...[,]]) => { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f(g()); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..822b257545 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-empty.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element containing an "empty" array pattern (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = ([...[]]) => { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..c8f18b1cd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-ary-rest.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element containing a rest element (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = ([...[...x]]) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f(values); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..44a1a6a253 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-direct.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Lone rest element (direct binding) (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var f; +f = ([...x]) => { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f([1]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..111160243a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Rest element following elision elements (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var f = ([, ...x]) => {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..7e8a579b4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-elision.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element following elision elements (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var f; +f = ([ , , ...x]) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..a721cbcb1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: RestElement applied to an exhausted iterator (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var f; +f = ([, , ...x]) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f([1, 2]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..c80c748b62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var f = ([...x]) => {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..6c5837bb54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = ([...x]) => {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id.js new file mode 100644 index 0000000000..225fcb2f1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-id.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Lone rest element (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = ([...x]) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..821554578e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-ary.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element (nested array pattern) does not support initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...[ x ] = []]) => { + + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..c78b2967b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-id.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element (identifier) does not support initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...x = []]) => { + + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..1d100d195a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-init-obj.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element (nested object pattern) does not support initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...{ x } = []]) => { + + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..73e6a9a917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...[x], y]) => { + + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..fbd913af33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-id.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element (identifier) may not be followed by any element (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...x, y]) => { + + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..f94da19b77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...{ x }, y]) => { + + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..9834f42054 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-id.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element containing an object binding pattern (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = ([...{ length }]) => { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..ec7b377b26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest element containing an object binding pattern (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var f; +f = ([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) => { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f([7, 8, 9]); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/browser.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..3fe5417e76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-close.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = ([x] = iter) => { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..a4b808f0dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var f = ([x, y, z] = [1, 2, 3]) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..bbcc8d0a53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-get-err.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var f = ([x] = iter) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..b3dd22db95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-init-iter-no-close.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = ([x] = iter) => { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..6398e3dd98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-name-iter-val.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x, y, z] = [1, 2, 3]) => { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..26a559610e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([[x, y, z] = [4, 5, 6]] = []) => { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..c5849a3cac --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) => { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..2dac8f092b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = ([[,] = g()] = []) => { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..261631e424 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var f; +f = ([[,] = g()] = [[]]) => { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..acbb15fb95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var f; +f = ([[] = function() { initCount += 1; return iter; }()] = []) => { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..6123c6211c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var f; +f = ([[] = function() { initCount += 1; }()] = [[23]]) => { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..a6ed320ef4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var f; +f = ([[...x] = values] = []) => { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..5809569037 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var f; +f = ([[...x] = function() { initCount += 1; }()] = [values]) => { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..143b335cdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Nested array destructuring with a null value (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var f = ([[x]] = [null]) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..f46dad8d7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x = 23] = []) => { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..2bdceda9a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([arrow = () => {}] = []) => { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..0eb415b0c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) => { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..075eb5734f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([cover = (function () {}), xCover = (0, function() {})] = []) => { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..9f5185f39e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([fn = function () {}, xFn = function x() {}] = []) => { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..d41c7da94f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var f; +f = ([gen = function* () {}, xGen = function* x() {}] = []) => { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..6865014ca5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Destructuring initializer with a "hole" (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x = 23] = [,]) => { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..f502fc771e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = ([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) => { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..6cfb421d94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var f = ([x = (function() { throw new Test262Error(); })()] = [undefined]) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..75b9fdc6ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Destructuring initializer with an undefined value (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x = 23] = [undefined]) => { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..fe7be58cb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = ([ x = unresolvableReference ] = []) => {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..3cda97aac8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x] = []) => { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..1cd22fec2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([_, x] = []) => { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..e1d9a3a270 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var f = ([x] = g) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..6f06a1555a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var f; +f = ([x, y, z] = [1, 2, 3]) => { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..3060690a78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = ([x] = g) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..6c158b9115 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([x, y, z] = [1, 2, 3]) => { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..0136cae13b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) => { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..b1ef1365cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) => { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..1f09945685 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) => { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..9a6c3aa92b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = ([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) => { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..5c5670b99b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Nested object destructuring with a null value (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = ([{ x }] = [null]) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..8275c6e5f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = ([{ x }] = []) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..ec2bc0d04e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Elision accepts exhausted iterator (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var f; +f = ([,] = iter) => { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..2ea6619ef3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var f = ([,] = iter) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..ecf3e29ca4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-elision.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Elision advances iterator (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = ([,] = g()) => { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..fb6a6995b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-empty.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = ([] = iter) => { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..e11d10f92d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ([...[x, y, z]] = [3, 4, 5]) => { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..7bc00bdb3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element containing an elision (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = ([...[,]] = g()) => { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..88dff90e6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = ([...[]] = iter) => { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..eba15c2907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element containing a rest element (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = ([...[...x]] = values) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..f43415887e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Lone rest element (direct binding) (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var f; +f = ([...x] = [1]) => { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..25929d6a9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Rest element following elision elements (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var f = ([, ...x] = iter) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..5761d9765c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element following elision elements (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var f; +f = ([ , , ...x] = values) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..b66689b26f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var f; +f = ([, , ...x] = [1, 2]) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..46a95f6441 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var f = ([...x] = iter) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..58bf84d5ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = ([...x] = iter) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..86b8b4a46a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-id.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Lone rest element (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = ([...x] = values) => { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..ee2cbad23e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...[ x ] = []] = []) => { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..09183d1e09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...x = []] = []) => { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..9943a471bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...{ x } = []] = []) => { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..4020348a7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...[x], y] = [1, 2, 3]) => { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..f4540acd2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...x, y] = [1, 2, 3]) => { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..0d019d01eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,59 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = ([...{ x }, y] = [1, 2, 3]) => { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..a8c83dc296 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element containing an object binding pattern (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = ([...{ length }] = [1, 2, 3]) => { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..daaecca03a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest element containing an object binding pattern (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var f; +f = ([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) => { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-null.js new file mode 100644 index 0000000000..3d60e93133 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-null.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = ({} = null) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-undefined.js new file mode 100644 index 0000000000..0a77e7dcc1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-init-undefined.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = ({} = undefined) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..2b472ea4fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-empty.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var f; +f = ({} = obj) => { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..c0e7eedd07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = ({ poisoned } = poisonedProperty) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..231c1d8d2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ arrow = () => {} } = {}) => { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..4796f3f58e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) => { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..69d5069d16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ cover = (function () {}), xCover = (0, function() {}) } = {}) => { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..e82b1c4e1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ fn = function () {}, xFn = function x() {} } = {}) => { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..6d01512f3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var f; +f = ({ gen = function* () {}, xGen = function* x() {} } = {}) => { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..2c186eff0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = ({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) => { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..ce433e7b1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error thrown when evaluating the initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = ({ x = thrower() } = {}) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..fa58f049e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = ({ x = unresolvableReference } = {}) => {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..93a4a7b91c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = ({ x, } = { x: 23 }) => { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..14f6ea519e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-list-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var f = ({ a, b = thrower(), c = ++initCount } = {}) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..e1028e1a0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: [x, y, z] = [4, 5, 6] } = {}) => { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..4cfd6eff2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = ({ x: [y], } = { x: [45] }) => { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..067363aafe --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = ({ w: [x, y, z] = [4, 5, 6] } = { w: null }) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..126db86627 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) => { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..de4e1614db --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = ({ [thrower()]: x } = {}) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..13b292e275 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = ({ poisoned: x = ++initEvalCount } = poisonedProperty) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..b122345205 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = ({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) => { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..48f7063932 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Error thrown when evaluating the initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = ({ x: y = thrower() } = {}) => {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..50c7e1b05a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = ({ x: y = unresolvableReference } = {}) => {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..15b471e2ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ({ x: y = 33 } = { }) => { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..e634557516 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = ({ x: y, } = { x: 23 }) => { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..0523ad60f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-id.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Binding as specified via property name and identifier (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ({ x: y } = { x: 23 }) => { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..901bba3c87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) => { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..7b35c6de94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..5c8718acfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/arrow-function-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = ({ w: { x, y, z } = undefined } = { }) => {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..247d72902c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) => { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..22147ee150 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var f; +f = ({...x} = { get v() { count++; return 2; } }) => { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..e9aa58bde3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var f; +f = ({...rest} = o) => { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..26045d23aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/arrow-function-dflt.template +/*--- +description: Rest object contains just unextracted data (arrow function expression (default parameter)) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = ({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) => { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-null.js new file mode 100644 index 0000000000..056054dc18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-null.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = ({}) => {}; + +assert.throws(TypeError, function() { + f(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-undefined.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-undefined.js new file mode 100644 index 0000000000..7424368136 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-init-undefined.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = ({}) => {}; + +assert.throws(TypeError, function() { + f(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-empty.js new file mode 100644 index 0000000000..85b5394c34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-empty.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: No property access occurs for an "empty" object binding pattern (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var f; +f = ({}) => { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f(obj); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..773d9fadf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-get-value-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = ({ poisoned }) => {}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..14f07118b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ arrow = () => {} }) => { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..96992e838f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) => { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..87132006d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ cover = (function () {}), xCover = (0, function() {}) }) => { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..0e02360064 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = ({ fn = function () {}, xFn = function x() {} }) => { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..dcf2433d65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var f; +f = ({ gen = function* () {}, xGen = function* x() {} }) => { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..59e18a0370 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-skipped.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = ({ w = counter(), x = counter(), y = counter(), z = counter() }) => { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f({ w: null, x: 0, y: false, z: '' }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..81afe54335 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-throws.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error thrown when evaluating the initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = ({ x = thrower() }) => {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..db2d70c2c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Destructuring initializer is an unresolvable reference (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = ({ x = unresolvableReference }) => {}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..d14d6837fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-id-trailing-comma.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = ({ x, }) => { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f({ x: 23 }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-list-err.js new file mode 100644 index 0000000000..66fcf2cf24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-list-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var f = ({ a, b = thrower(), c = ++initCount }) => {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..3d51eca6ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-init.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: [x, y, z] = [4, 5, 6] }) => { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..8ed63ded12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = ({ x: [y], }) => { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f({ x: [45] }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..a3734dc91c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = ({ w: [x, y, z] = [4, 5, 6] }) => {}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..f73422a22a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-ary.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: [x, y, z] = [4, 5, 6] }) => { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: [7, undefined, ] }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..59e84071b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-eval-err.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Evaluation of property name returns an abrupt completion (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = ({ [thrower()]: x }) => {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..a693b19fbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = ({ poisoned: x = ++initEvalCount }) => {}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..394f871b01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = ({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) => { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f({ s: null, u: 0, w: false, y: '' }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..baba9898f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Error thrown when evaluating the initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = ({ x: y = thrower() }) => {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..92d4dd36ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Destructuring initializer is an unresolvable reference (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = ({ x: y = unresolvableReference }) => {}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..3151838b23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-init.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Binding as specified via property name, identifier, and initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ({ x: y = 33 }) => { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..77adefdd33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = ({ x: y, }) => { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id.js new file mode 100644 index 0000000000..05f396557b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-id.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Binding as specified via property name and identifier (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = ({ x: y }) => { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..92a8bf65f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-init.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) => { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: undefined }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..a1698400e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) => {}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..1f3386f728 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/arrow-function.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = ({ w: { x, y, z } = undefined }) => {}; + +assert.throws(TypeError, function() { + f({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..3d67c6e88e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-prop-obj.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = ({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) => { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: { x: undefined, z: 7 } }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..7c2b3f65ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-getter.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var f; +f = ({...x}) => { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({ get v() { count++; return 2; } }); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..b67747fde2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest object doesn't contain non-enumerable properties (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var f; +f = ({...rest}) => { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f(o); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..f99759ce0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/obj-ptrn-rest-val-obj.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/arrow-function.template +/*--- +description: Rest object contains just unextracted data (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = ({a, b, ...rest}) => { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({x: 1, y: 2, a: 5, b: 3}); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/shell.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-break-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-break-escaped.js new file mode 100644 index 0000000000..2950fe8e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-break-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: break is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ bre\u0061k }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-case-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-case-escaped.js new file mode 100644 index 0000000000..12352be844 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-case-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: case is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ c\u0061se }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-catch-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-catch-escaped.js new file mode 100644 index 0000000000..e4a95cb5ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-catch-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: catch is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ c\u0061tch }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-class-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-class-escaped.js new file mode 100644 index 0000000000..a5e40b8732 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-class-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: class is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ cl\u0061ss }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-const-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-const-escaped.js new file mode 100644 index 0000000000..cf228ecd22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-const-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: const is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0063onst }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-continue-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-continue-escaped.js new file mode 100644 index 0000000000..edcd00d964 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-continue-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: continue is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0063ontinue }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-debugger-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-debugger-escaped.js new file mode 100644 index 0000000000..752e99b1f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-debugger-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: debugger is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0064ebugger }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped-ext.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped-ext.js new file mode 100644 index 0000000000..bc88f1ee9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped-ext.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: default is a valid identifier name, using extended escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ def\u{61}ult }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped.js new file mode 100644 index 0000000000..0204030bed --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: default is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ def\u0061ult }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default.js new file mode 100644 index 0000000000..698be6d47e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-default.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: default is a valid identifier name (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ default }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-delete-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-delete-escaped.js new file mode 100644 index 0000000000..3bdfebf4d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-delete-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: delete is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0064elete }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-do-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-do-escaped.js new file mode 100644 index 0000000000..cac26016b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-do-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: do is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0064o }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-else-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-else-escaped.js new file mode 100644 index 0000000000..f7b60b21f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-else-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: else is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0065lse }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-enum-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-enum-escaped.js new file mode 100644 index 0000000000..05efbaf047 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-enum-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: enum is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0065num }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-export-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-export-escaped.js new file mode 100644 index 0000000000..e63acb5139 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-export-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: export is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0065xport }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped-ext.js new file mode 100644 index 0000000000..a205070c2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped-ext.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: extends is a valid identifier name, using extended escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u{65}xtends }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped.js new file mode 100644 index 0000000000..94e0753eee --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: extends is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0065xtends }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends.js new file mode 100644 index 0000000000..aba775913c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-extends.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: extends is a valid identifier name (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ extends }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-finally-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-finally-escaped.js new file mode 100644 index 0000000000..a0ebbe01a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-finally-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: finally is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0066inally }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-for-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-for-escaped.js new file mode 100644 index 0000000000..dcb71a3b1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-for-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: for is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0066or }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-function-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-function-escaped.js new file mode 100644 index 0000000000..f5d07650b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-function-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: function is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0066unction }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-if-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-if-escaped.js new file mode 100644 index 0000000000..9b9a5e0324 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-if-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: if is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ i\u0066 }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-implements-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-implements-escaped-strict.js new file mode 100644 index 0000000000..5a41302de8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-implements-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: implements is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0069mplements }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-import-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-import-escaped.js new file mode 100644 index 0000000000..9db19e47c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-import-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: import is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0069mport }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-in-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-in-escaped.js new file mode 100644 index 0000000000..b4e5f9437b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-in-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: in is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0069n }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-instanceof-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-instanceof-escaped.js new file mode 100644 index 0000000000..6b41cf3025 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-instanceof-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: instanceof is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ \u0069nstanceof }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-interface-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-interface-escaped-strict.js new file mode 100644 index 0000000000..03249d04b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-interface-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: interface is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ interf\u0061ce }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-let-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-let-escaped-strict.js new file mode 100644 index 0000000000..fc76235686 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-let-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: let is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ l\u0065t }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-new-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-new-escaped.js new file mode 100644 index 0000000000..654e51103d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-new-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: new is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ n\u0065w }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-package-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-package-escaped-strict.js new file mode 100644 index 0000000000..c1b3bff90f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-package-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: package is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ p\u0061ckage }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-private-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-private-escaped-strict.js new file mode 100644 index 0000000000..2f30564dc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-private-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: private is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ privat\u0065 }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-protected-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-protected-escaped-strict.js new file mode 100644 index 0000000000..65dcdfbd9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-protected-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: protected is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ prot\u0065cted }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-public-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-public-escaped-strict.js new file mode 100644 index 0000000000..ddb51dc96e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-public-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: public is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ pu\u0062lic }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-return-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-return-escaped.js new file mode 100644 index 0000000000..0d963fb2f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-return-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: return is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ r\u0065turn }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-static-escaped-strict.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-static-escaped-strict.js new file mode 100644 index 0000000000..22ae8de49d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-static-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template +/*--- +description: static is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ st\u0061tic }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-super-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-super-escaped.js new file mode 100644 index 0000000000..c63abb7df3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-super-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: super is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ sup\u0065r }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-switch-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-switch-escaped.js new file mode 100644 index 0000000000..ca46b7331b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-switch-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: switch is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ sw\u0069tch }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-this-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-this-escaped.js new file mode 100644 index 0000000000..2bdcc1da43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-this-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: this is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ th\u0069s }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-throw-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-throw-escaped.js new file mode 100644 index 0000000000..d1cf2c3f24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-throw-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: throw is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ t\u0068row }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-try-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-try-escaped.js new file mode 100644 index 0000000000..40e1a59b4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-try-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: try is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ tr\u0079 }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-typeof-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-typeof-escaped.js new file mode 100644 index 0000000000..1ca4518406 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-typeof-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: typeof is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ typ\u0065of }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-var-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-var-escaped.js new file mode 100644 index 0000000000..c8849a8a45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-var-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: var is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ v\u0061r }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-void-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-void-escaped.js new file mode 100644 index 0000000000..0a5ab3450d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-void-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: void is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ voi\u0064 }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-while-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-while-escaped.js new file mode 100644 index 0000000000..a25ab82010 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-while-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: while is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ whil\u0065 }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-with-escaped.js b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-with-escaped.js new file mode 100644 index 0000000000..1aed56ca9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/dstr/syntax-error-ident-ref-with-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/arrow-fn-assignment-identifier.template +/*--- +description: with is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [arrow-function, destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = ({ w\u0069th }) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/empty-function-body-returns-undefined.js b/js/src/tests/test262/language/expressions/arrow-function/empty-function-body-returns-undefined.js new file mode 100644 index 0000000000..4e5bad8840 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/empty-function-body-returns-undefined.js @@ -0,0 +1,12 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + Empty arrow function returns undefined +---*/ + +var empty = () => {}; +assert.sameValue(empty(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/arrow-function/eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..f28c7fb46d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/eval-var-scope-syntax-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/arrow-function.template +/*--- +description: sloppy direct eval in params introduces var (arrow function expression in sloppy code) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + +var callCount = 0; +var f; +f = (a = eval("var a = 42")) => { + + callCount = callCount + 1; +}; + +assert.throws(SyntaxError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'arrow function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/expression-body-implicit-return.js b/js/src/tests/test262/language/expressions/arrow-function/expression-body-implicit-return.js new file mode 100644 index 0000000000..dbb5da13b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/expression-body-implicit-return.js @@ -0,0 +1,11 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + Expression Body implicit return +---*/ +var plusOne = v => v + 1; +assert.sameValue(plusOne(1), 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/extensibility.js b/js/src/tests/test262/language/expressions/arrow-function/extensibility.js new file mode 100644 index 0000000000..e645da2179 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/extensibility.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +description: The [[Extensible]] slot of arrow functions +info: | + 15.3.4 Runtime Semantics: InstantiateArrowFunctionExpression + [...] + 4. Let closure be OrdinaryFunctionCreate(%Function.prototype%, sourceText, + ArrowParameters, ConciseBody, lexical-this, scope). + + 10.2.3 OrdinaryFunctionCreate ( functionPrototype, sourceText, ParameterList, Body, thisMode, Scope ) + [...] + 3. Let F be ! OrdinaryObjectCreate(functionPrototype, internalSlotsList). + + 10.1.12 OrdinaryObjectCreate ( proto [ , additionalInternalSlotsList ] ) + 1. Let internalSlotsList be « [[Prototype]], [[Extensible]] ». + 2. If additionalInternalSlotsList is present, append each of its elements + to internalSlotsList. + 3. Let O be ! MakeBasicObject(internalSlotsList). + + 7.3.1 MakeBasicObject ( internalSlotsList ) + [...] + 6. If internalSlotsList contains [[Extensible]], set obj.[[Extensible]] to + true. +---*/ + +assert(Object.isExtensible(() => {})); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..5fcfb8d6e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/arrow-function.template +/*--- +description: Forbidden extension, f.arguments (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [arrow-function] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var f; +f = () => { + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +}; + + + f(); +assert.sameValue(callCount, 1, 'arrow function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..a48d9328de --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/arrow-function-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/arrow-function.template +/*--- +description: Forbidden extension, o.caller (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [arrow-function] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var f; +f = () => { + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +}; + + + f(); +assert.sameValue(callCount, 1, 'arrow function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..11fd3af5f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/arrow-function.template +/*--- +description: Forbidden extension, o.caller (arrow function expression) +esid: sec-arrow-definitions-runtime-semantics-evaluation +features: [arrow-function] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = () => { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..4a61c3147a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/arrow-function.template +/*--- +description: Forbidden extension, o.caller (arrow function expression) +esid: sec-arrow-definitions-runtime-semantics-evaluation +features: [arrow-function] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = () => { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..65d2f51cb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/arrow-function-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/arrow-function.template +/*--- +description: Forbidden extension, o.caller (arrow function expression) +esid: sec-arrow-definitions-runtime-semantics-evaluation +features: [arrow-function] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = () => { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/arrow-function/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/length-dflt.js b/js/src/tests/test262/language/expressions/arrow-function/length-dflt.js new file mode 100644 index 0000000000..6930da09b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/length-dflt.js @@ -0,0 +1,70 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [default-parameters] +includes: [propertyHelper.js] +---*/ + + +var f1 = (x = 42) => {}; + +verifyProperty(f1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f2 = (x = 42, y) => {}; + +verifyProperty(f2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f3 = (x, y = 42) => {}; + +verifyProperty(f3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var f4 = (x, y = 42, z) => {}; + +verifyProperty(f4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-arguments.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-arguments.js new file mode 100644 index 0000000000..3af9125bde --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-arguments.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + arguments + + ... + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + ... + + The non-normative note elaborates on the "scope" argument: + + An ArrowFunction does not define local bindings for arguments, super, this, or new.target. Any reference to arguments, super, or this within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an ArrowFunction may contain references to super, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super is always contained within a non-ArrowFunction and the necessary state to implement super is accessible via the scope that is captured by the function object of the ArrowFunction. +---*/ + +function f() { + var args = arguments; + + var af = _ => { + return arguments; + }; + + return args === af(); +} + +assert(f()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-bindings-overriden-by-formal-parameters-non-strict.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-bindings-overriden-by-formal-parameters-non-strict.js new file mode 100644 index 0000000000..5cdf078a46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-bindings-overriden-by-formal-parameters-non-strict.js @@ -0,0 +1,16 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + +flags: [noStrict] +---*/ +function f() { + return (arguments) => arguments; +} + +assert.sameValue(f(1)(2), 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-new.target-closure-returned.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-new.target-closure-returned.js new file mode 100644 index 0000000000..175e6a828c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-new.target-closure-returned.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + new.target + + ... + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + ... + + The non-normative note elaborates on the "scope" argument: + + An ArrowFunction does not define local bindings for arguments, super, this, or new.target. Any reference to arguments, super, or this within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an ArrowFunction may contain references to super, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super is always contained within a non-ArrowFunction and the necessary state to implement super is accessible via the scope that is captured by the function object of the ArrowFunction. +features: [arrow-function, new.target] +---*/ + +function F() { + this.af = _ => { + if (new.target) { + return 1; + } + return 2; + }; +} + +var f = new F(); + +assert.sameValue(f.af(), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-new.target.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-new.target.js new file mode 100644 index 0000000000..271a71444b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-new.target.js @@ -0,0 +1,36 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + new.target + + ... + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + ... + + The non-normative note elaborates on the "scope" argument: + + An ArrowFunction does not define local bindings for arguments, super, this, or new.target. Any reference to arguments, super, or this within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an ArrowFunction may contain references to super, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super is always contained within a non-ArrowFunction and the necessary state to implement super is accessible via the scope that is captured by the function object of the ArrowFunction. +features: [arrow-function, new.target] +---*/ + +var functionInvocationCount = 0; +var newInvocationCount = 0; + +function F() { + if ((_ => new.target)() !== undefined) { + newInvocationCount++; + } + functionInvocationCount++; +} + +F(); +new F(); + +assert.sameValue(functionInvocationCount, 2); +assert.sameValue(newInvocationCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-super-call-from-within-constructor.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-super-call-from-within-constructor.js new file mode 100644 index 0000000000..43835d4479 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-super-call-from-within-constructor.js @@ -0,0 +1,48 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.5.1 +description: > + Runtime Semantics: Evaluation + + SuperCall : super Arguments + + ... + 7. Let result be Construct(func, argList, newTarget). + ... + 10. Return thisER.BindThisValue(result) + + + 8.1.1.3.1 BindThisValue(V) + + ... + 3. If envRec.[[thisBindingStatus]] is "initialized", throw a ReferenceError exception. + ... +---*/ + +var count = 0; + +class A { + constructor() { + count++; + } +} + +class B extends A { + constructor() { + super(); + // envRec.[[thisBindingStatus]] is "initialized" + this.af = _ => super(); + } +} + +var b = new B(); + +assert.throws(ReferenceError, function() { + b.af(); +}); + + +assert.sameValue(count, 2, "The value of `count` is `2`, because S7 of `SuperCall : super Arguments` will call the super constructor."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-super-property-from-within-constructor.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-super-property-from-within-constructor.js new file mode 100644 index 0000000000..b242efa84e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-super-property-from-within-constructor.js @@ -0,0 +1,42 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + super + + ... + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + ... + + The non-normative note elaborates on the "scope" argument: + + An ArrowFunction does not define local bindings for arguments, super, this, or new.target. Any reference to arguments, super, or this within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an ArrowFunction may contain references to super, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super is always contained within a non-ArrowFunction and the necessary state to implement super is accessible via the scope that is captured by the function object of the ArrowFunction. +---*/ + +var count = 0; + +class A { + constructor() { + count++; + } + increment() { + count++; + } +} + +class B extends A { + constructor() { + super(); + (_ => super.increment())(); + } +} + + +var bar = new B(); + +assert.sameValue(count, 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-super-property.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-super-property.js new file mode 100644 index 0000000000..7aedb5245b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-super-property.js @@ -0,0 +1,40 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + super + + ... + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + ... + + The non-normative note elaborates on the "scope" argument: + + An ArrowFunction does not define local bindings for arguments, super, this, or new.target. Any reference to arguments, super, or this within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an ArrowFunction may contain references to super, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super is always contained within a non-ArrowFunction and the necessary state to implement super is accessible via the scope that is captured by the function object of the ArrowFunction. +---*/ + +var count = 0; + +class A { + increment() { + count++; + } +} + +class B extends A { + incrementer() { + (_ => super.increment())(); + } +} + + +var bar = new B(); + +bar.incrementer(); + +assert.sameValue(count, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-supercall-from-immediately-invoked-arrow.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-supercall-from-immediately-invoked-arrow.js new file mode 100644 index 0000000000..2b7525172d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-supercall-from-immediately-invoked-arrow.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + super + + ... + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + ... + + The non-normative note elaborates on the "scope" argument: + + An ArrowFunction does not define local bindings for arguments, super, this, or new.target. Any reference to arguments, super, or this within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an ArrowFunction may contain references to super, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super is always contained within a non-ArrowFunction and the necessary state to implement super is accessible via the scope that is captured by the function object of the ArrowFunction. +---*/ + +var count = 0; + +class A { + constructor() { + count++; + } +} + +class B extends A { + constructor() { + (_ => super())(); + } +} + +var bar = new B(); + +assert.sameValue(count, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/lexical-this.js b/js/src/tests/test262/language/expressions/arrow-function/lexical-this.js new file mode 100644 index 0000000000..caffcc9f6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/lexical-this.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + this + + ... + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + ... + + The non-normative note elaborates on the "scope" argument: + + An ArrowFunction does not define local bindings for arguments, super, this, or new.target. Any reference to arguments, super, or this within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the Function Environment of an immediately enclosing function. Even though an ArrowFunction may contain references to super, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super is always contained within a non-ArrowFunction and the necessary state to implement super is accessible via the scope that is captured by the function object of the ArrowFunction. +---*/ + +function F() { + this.af = _ => { + return this; + }; +} + +var usurper = {}; +var f = new F(); + +assert.sameValue(f.af(), f); +assert.sameValue(f.af.apply(usurper), f); +assert.sameValue(f.af.call(usurper), f); +assert.sameValue(f.af.bind(usurper)(), f); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/low-precedence-expression-body-no-parens.js b/js/src/tests/test262/language/expressions/arrow-function/low-precedence-expression-body-no-parens.js new file mode 100644 index 0000000000..98a4f162bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/low-precedence-expression-body-no-parens.js @@ -0,0 +1,12 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + No need for parentheses even for lower-precedence expression body +---*/ + +var square = x => x * x; +assert.sameValue(square(3), 9); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/name.js b/js/src/tests/test262/language/expressions/arrow-function/name.js new file mode 100644 index 0000000000..f4cbc8d41f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/name.js @@ -0,0 +1,26 @@ +// Copyright (C) 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +description: Assignment of function `name` attribute +info: | + ArrowFunction : ArrowParameters => ConciseBody + + 1. Let scope be the LexicalEnvironment of the running execution context. + 2. Let parameters be CoveredFormalsList of ArrowParameters. + 3. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, ""). + ... + 5. Return closure. +includes: [propertyHelper.js] +---*/ + +verifyProperty(x => {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(() => {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/non-strict.js b/js/src/tests/test262/language/expressions/arrow-function/non-strict.js new file mode 100644 index 0000000000..f0319effd1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/non-strict.js @@ -0,0 +1,22 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + 1. If the function code for this ArrowFunction is strict mode code (10.2.1), + let strict be true. Otherwise let strict be false. + ... + +flags: [noStrict] +---*/ +var af = _ => { + foo = 1; +}; + +af(); + +assert.sameValue(foo, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/arrow-function/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..d6e11e3eb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/object-destructuring-param-strict-body.js @@ -0,0 +1,132 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/arrow-function.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, ({property}) => { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/object-literal-return-requires-body-parens.js b/js/src/tests/test262/language/expressions/arrow-function/object-literal-return-requires-body-parens.js new file mode 100644 index 0000000000..500f17303c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/object-literal-return-requires-body-parens.js @@ -0,0 +1,12 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + Parenthesize the body to return an object literal expression +---*/ + +var keyMaker = val => ({ key: val }); +assert.sameValue(keyMaker(1).key, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-expr.js b/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-expr.js new file mode 100644 index 0000000000..c9cc21fc6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-expr.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-arrow-function-definitions +es6id: 14.2 +description: > + The `yield` token is interpreted contextually outside of strict mode +info: | + ArrowFunction[In, Yield] : + + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + 14.2.1 Static Semantics: Early Errors# + + ArrowFunction : ArrowParameters=>ConciseBody + + - It is a Syntax Error if ArrowParameters Contains YieldExpression is true. +features: [generators, default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function *g() { + (x = yield) => {}; +} diff --git a/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-non-strict.js b/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-non-strict.js new file mode 100644 index 0000000000..2a6daf10cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-non-strict.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-arrow-function-definitions +es6id: 14.2 +description: > + The `yield` token is interpreted as an IdentifierReference outside of strict + mode and outside of generator function bodies. +info: | + ArrowFunction[In, Yield] : + + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] +features: [default-parameters] +flags: [noStrict] +---*/ + +var yield = 23; +var f, paramValue; + +f = (x = yield) => { paramValue = x; }; + +f(); + +assert.sameValue(paramValue, 23); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-strict-strict.js b/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-strict-strict.js new file mode 100644 index 0000000000..8b6662f6aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/param-dflt-yield-id-strict-strict.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-arrow-function-definitions +es6id: 14.2 +description: > + The `yield` token is interpreted as a FutureReservedWord within strict mode +info: | + ArrowFunction[In, Yield] : + + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] +features: [default-parameters] +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(x = yield) => {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/params-duplicate.js b/js/src/tests/test262/language/expressions/arrow-function/params-duplicate.js new file mode 100644 index 0000000000..02ad57408d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/params-duplicate.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright 2019 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arrow-function-definitions +description: Formal parameters may not contain duplicates +info: | + # 14.2 Arrow Function Definitions + + When the production + + ArrowParameters:CoverParenthesizedExpressionAndArrowParameterList + + is recognized the following grammar is used to refine the interpretation + of CoverParenthesizedExpressionAndArrowParameterList: + + ArrowFormalParameters[Yield, Await]: + (UniqueFormalParameters[?Yield, ?Await]) + + # 14.1.2 Static Semantics: Early Errors + + UniqueFormalParameters:FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, (a, a) => { }; diff --git a/js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..0460b1c7ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-multiple.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (a, b,) => { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-single.js new file mode 100644 index 0000000000..e447de3eeb --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/params-trailing-comma-single.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (a,) => { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/prototype-rules.js b/js/src/tests/test262/language/expressions/arrow-function/prototype-rules.js new file mode 100644 index 0000000000..66082b4b00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/prototype-rules.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + Arrow functions are like functions, except they throw when using the + "new" operator on them. +---*/ + +assert.sameValue(typeof (() => {}), "function"); +assert.sameValue(Object.getPrototypeOf(() => {}), Function.prototype); +assert.sameValue("prototype" in (() => {}), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/arrow-function/rest-param-strict-body.js new file mode 100644 index 0000000000..d45e154d4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/rest-param-strict-body.js @@ -0,0 +1,132 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/arrow-function.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, (a,...rest) => { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/arrow-function/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..35a3c6e657 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/rest-params-trailing-comma-early-error.js @@ -0,0 +1,57 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/arrow-function.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, (...a,) => { + +}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/scope-body-lex-distinct.js b/js/src/tests/test262/language/expressions/arrow-function/scope-body-lex-distinct.js new file mode 100644 index 0000000000..ae6ba116c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/scope-body-lex-distinct.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new lexical environment (distinct from the variable + environment) for the function body outside of strict mode +info: | + [...] + 29. If strict is false, then + a. Let lexEnv be NewDeclarativeEnvironment(varEnv). + b. NOTE: Non-strict functions use a separate lexical Environment Record + for top-level lexical declarations so that a direct eval can + determine whether any var scoped declarations introduced by the eval + code conflict with pre-existing top-level lexically scoped + declarations. This is not needed for strict functions because a + strict direct eval always places all declarations into a new + Environment Record. + [...] + + 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation + + [...] + 5. If strict is false, then + [...] + b. Let thisLex be lexEnv. + c. Assert: The following loop will terminate. + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + ii. NOTE: Annex B.3.5 defines alternate semantics for the + above step. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. +flags: [noStrict] +features: [let] +---*/ + +var a = () => { let x; eval('var x;'); }; + +assert.throws(SyntaxError, a); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-close.js b/js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-close.js new file mode 100644 index 0000000000..5e31628181 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-close.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2, probeBody; + +(( + _ = (eval('var x = "inside";'), probe1 = function() { return x; }), + __ = probe2 = function() { return x; } + ) => { + probeBody = function() { return x; }; +})(); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-open.js b/js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-open.js new file mode 100644 index 0000000000..5eae959c7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/scope-param-elem-var-open.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2; + +(( + _ = probe1 = function() { return x; }, + __ = (eval('var x = "inside";'), probe2 = function() { return x; }) + ) => { +})(); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-close.js b/js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-close.js new file mode 100644 index 0000000000..4d5a568021 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-close.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probeParam, probeBody; + +(( + ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })] + ) => { + probeBody = function() { return x; } +})(); + +assert.sameValue(probeParam(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-open.js b/js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-open.js new file mode 100644 index 0000000000..5649098bad --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/scope-param-rest-elem-var-open.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2; + +(( + _ = probe1 = function() { return x; }, + ...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })] + ) => { +})(); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-close.js new file mode 100644 index 0000000000..97d33e95c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-close.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +// A parameter expression is necessary to trigger the creation of the scope +// under test. +((_ = null) => { + var x = 'inside'; + probe = function() { return x; }; +})(); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-open.js new file mode 100644 index 0000000000..6f6f12b23a --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/scope-paramsbody-var-open.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +((_ = probeParams = function() { return x; }) => { + var x = 'inside'; + probeBody = function() { return x; }; +})(); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/shell.js b/js/src/tests/test262/language/expressions/arrow-function/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly-missing.js b/js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly-missing.js new file mode 100644 index 0000000000..78c0ab018f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly-missing.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + Statement body needs braces, must use 'return' explicitly if not void +---*/ +var plusOne = v => { + v + 1; +}; + +assert.sameValue(plusOne(1), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly.js b/js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly.js new file mode 100644 index 0000000000..323a6188e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/statement-body-requires-braces-must-return-explicitly.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + Statement body needs braces, must use 'return' explicitly if not void +---*/ +var plusOne = v => { + return v + 1; +}; + +assert.sameValue(plusOne(1), 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/static-init-await-binding.js b/js/src/tests/test262/language/expressions/arrow-function/static-init-await-binding.js new file mode 100644 index 0000000000..84c6ae07a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/static-init-await-binding.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is disallowed in the BindingIdentifier position +features: [class-static-block] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class C { + static { + (await => 0); + } +} diff --git a/js/src/tests/test262/language/expressions/arrow-function/static-init-await-reference.js b/js/src/tests/test262/language/expressions/arrow-function/static-init-await-reference.js new file mode 100644 index 0000000000..b15a4513ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/static-init-await-reference.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is disallowed in the IdentifierReference position +features: [class-static-block] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class C { + static { + ((x = await) => 0); + } +} diff --git a/js/src/tests/test262/language/expressions/arrow-function/strict-strict.js b/js/src/tests/test262/language/expressions/arrow-function/strict-strict.js new file mode 100644 index 0000000000..7482b76d49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/strict-strict.js @@ -0,0 +1,25 @@ +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.16 +description: > + Runtime Semantics: Evaluation + + 1. If the function code for this ArrowFunction is strict mode code (10.2.1), + let strict be true. Otherwise let strict be false. + ... + +flags: [onlyStrict] +---*/ +assert.throws(ReferenceError, function() { + var af = _ => { + foo = 1; + }; + + af(); +}); + +assert.sameValue(typeof foo, "undefined"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-arguments.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-arguments.js new file mode 100644 index 0000000000..b12c83bbef --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-arguments.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + ... + + Parameter named "arguments", non-strict + +flags: [noStrict] +---*/ +var af = arguments => arguments; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-assignmentexpression.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-assignmentexpression.js new file mode 100644 index 0000000000..03f04c63ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-assignmentexpression.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator not present + ArrowParameters[Yield] : BindingIdentifier + ConciseBody[In] : AssignmentExpression[?In] +---*/ +var af = x => x; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-functionbody.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-functionbody.js new file mode 100644 index 0000000000..7cec13a842 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-concisebody-functionbody.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + ... + + ConciseBody[In] : + ... + { FunctionBody } +---*/ +var af = BindingIdentifier => { + return BindingIdentifier; +}; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-eval.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-eval.js new file mode 100644 index 0000000000..385fd4d096 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-eval.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + ... + + Parameter named "eval", non-strict + +flags: [noStrict] +---*/ +var af = eval => eval; + + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-assignmentexpression.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-assignmentexpression.js new file mode 100644 index 0000000000..8ed35e6169 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-assignmentexpression.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator between arrow and ConciseBody + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : AssignmentExpression[?In] +---*/ +var af = x => +x; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-functionbody.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-functionbody.js new file mode 100644 index 0000000000..4a61c2e8bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-lineterminator-concisebody-functionbody.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator between arrow and ConciseBody[?In] + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : { FunctionBody } +---*/ +var af = x => +{ return x }; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-yield.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-yield.js new file mode 100644 index 0000000000..7cf558babc --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-bindingidentifier-yield.js @@ -0,0 +1,16 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + ... + + Parameter named "yield", non-strict + +flags: [noStrict] +---*/ +var af = yield => 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-assignmentexpression.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-assignmentexpression.js new file mode 100644 index 0000000000..8856b010c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-assignmentexpression.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator not present + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : [lookahead ≠ { ] AssignmentExpression[?In] +---*/ +var af = (x) => x; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-functionbody.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-functionbody.js new file mode 100644 index 0000000000..97273dbf1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-concisebody-functionbody.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : { FunctionBody } +---*/ +var af = (x) => { return x }; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-arguments.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-arguments.js new file mode 100644 index 0000000000..90b766b93e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-arguments.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + Parameter named "arguments", non-strict + +flags: [noStrict] +---*/ +var af = (arguments) => arguments; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-eval.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-eval.js new file mode 100644 index 0000000000..e23a1e2131 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-eval.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + Parameter named "eval", non-strict + +flags: [noStrict] +---*/ +var af = (eval) => eval; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-yield.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-yield.js new file mode 100644 index 0000000000..b8281168bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-formalparameters-yield.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + Parameter named "yield", non-strict + +flags: [noStrict] +---*/ +var af = (yield) => 1; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-includes-rest-concisebody-functionbody.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-includes-rest-concisebody-functionbody.js new file mode 100644 index 0000000000..e6993c463e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-includes-rest-concisebody-functionbody.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator between arrow and ConciseBody[?In] + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : { FunctionBody } + + Includes ...rest +---*/ +var af = (x, ...y) => { return [x, y.length]; }; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1, 1, 1)[0], 1); +assert.sameValue(af(1, 1, 1)[1], 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-1.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-1.js new file mode 100644 index 0000000000..af0755053b --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-1.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + +---*/ +var af = (x = 1) => x; + + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(), 1); +assert.sameValue(af(2), 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-2.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-2.js new file mode 100644 index 0000000000..54aee2a9f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-initialize-2.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + 12.14.5 +---*/ +var af = ({x = 1}) => x; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af({}), 1); +assert.sameValue(af({x: 2}), 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-assignmentexpression.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-assignmentexpression.js new file mode 100644 index 0000000000..50d8972a40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-assignmentexpression.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator not present + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : [lookahead ≠ { ] AssignmentExpression[?In] +---*/ +var af = (x) => +x; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-functionbody.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-functionbody.js new file mode 100644 index 0000000000..3b46652fbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-lineterminator-concisebody-functionbody.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator between arrow and ConciseBody[?In] + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : { FunctionBody } +---*/ +var af = (x) => +{ return x }; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-concisebody-functionbody.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-concisebody-functionbody.js new file mode 100644 index 0000000000..3900da74e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-concisebody-functionbody.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator between arrow and ConciseBody[?In] + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : { FunctionBody } + + Includes ...rest +---*/ +var af = (...x) => { return x.length; }; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1, 1, 1), 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-lineterminator-concisebody-functionbody.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-lineterminator-concisebody-functionbody.js new file mode 100644 index 0000000000..e55050789d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/arrowparameters-cover-rest-lineterminator-concisebody-functionbody.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + LineTerminator between arrow and ConciseBody[?In] + ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList[?Yield] + ConciseBody[In] : { FunctionBody } + + Includes ...rest +---*/ +var af = (...x) => +{ return x.length; }; + +assert.sameValue(typeof af, "function"); +assert.sameValue(af(1, 1, 1), 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/browser.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-futurereservedword.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-futurereservedword.js new file mode 100644 index 0000000000..6cc74682f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-futurereservedword.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + + (12.1) + BindingIdentifier[Yield] : + Identifier[~Yield] yield + + Identifier : + IdentifierName but not ReservedWord + + ReservedWord : FutureReservedWord + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = enum => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-strict-futurereservedword-strict.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-strict-futurereservedword-strict.js new file mode 100644 index 0000000000..0e6d8bdfe2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier-strict-futurereservedword-strict.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + + (12.1) + BindingIdentifier[Yield] : + Identifier[~Yield] yield + + Identifier : + IdentifierName but not ReservedWord + + ReservedWord : FutureReservedWord + + Strict Mode + +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +var af = package => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier.js new file mode 100644 index 0000000000..1d65d0e4cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-identifier.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + + (12.1) + BindingIdentifier[Yield] : + Identifier[~Yield] yield + + Identifier : + IdentifierName but not ReservedWord + + ReservedWord : Keyword + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = switch => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-arguments-strict.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-arguments-strict.js new file mode 100644 index 0000000000..05f1465dad --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-arguments-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + ... + + No parameter named "arguments" + +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +var af = arguments => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-eval-strict.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-eval-strict.js new file mode 100644 index 0000000000..79c081d343 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-eval-strict.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + ... + + + No parameter named "eval" + +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +var af = eval => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-yield-strict.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-yield-strict.js new file mode 100644 index 0000000000..ac5aa03501 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-no-yield-strict.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + BindingIdentifier[?Yield] + ... + + + No parameter named "yield" + +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +var af = yield => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-rest.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-rest.js new file mode 100644 index 0000000000..5a58c57305 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-bindingidentifier-rest.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowParameters : BindingIdentifier[?Yield] + + Includes ...rest + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = ...x => x; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-arguments-strict.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-arguments-strict.js new file mode 100644 index 0000000000..3344c6a634 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-arguments-strict.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + No parameters named "arguments" + +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +var af = (arguments) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-1.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-1.js new file mode 100644 index 0000000000..4cd5ca7a5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-1.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ArrayBindingPattern + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = (x, [x]) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-2.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-2.js new file mode 100644 index 0000000000..003f249d87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-2.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ArrayBindingPattern + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = ([x, x]) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-3.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-3.js new file mode 100644 index 0000000000..9dece76314 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-array-3.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ArrayBindingPattern + + BindingRestElement + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = ([x], ...x) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-1.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-1.js new file mode 100644 index 0000000000..41381e40bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-1.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ObjectBindingPattern + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = (x, {x}) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-2.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-2.js new file mode 100644 index 0000000000..575980a66d --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-2.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ObjectBindingPattern + + BindingPropertyList + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = (x, {y: x}) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-3.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-3.js new file mode 100644 index 0000000000..b4168054e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-3.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ObjectBindingPattern + + BindingPropertyList + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = ({x}, {y: x}) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-4.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-4.js new file mode 100644 index 0000000000..995f13fc5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-4.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ObjectBindingPattern + + BindingPropertyList + + BindingRestElement + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = ({x}, ...x) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-5.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-5.js new file mode 100644 index 0000000000..7115a09a43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-5.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ObjectBindingPattern + + BindingPropertyList + + BindingRestElement + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = ({y: x}, ...x) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-6.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-6.js new file mode 100644 index 0000000000..a6814bd5cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-binding-object-6.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + ObjectBindingPattern + + BindingPropertyList + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = ({y: x, x}) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-rest.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-rest.js new file mode 100644 index 0000000000..e281cf838f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates-rest.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + No duplicates, rest + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = (x, ...x) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js new file mode 100644 index 0000000000..d6e51befbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-duplicates.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + No duplicates + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = (x, x) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-eval-strict.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-eval-strict.js new file mode 100644 index 0000000000..d2e701663f --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-eval-strict.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + CoverParenthesizedExpressionAndArrowParameterList, refined by: + + ArrowFormalParameters[Yield, GeneratorParameter] : + ( StrictFormalParameters[?Yield, ?GeneratorParameter] ) + + No parameters named "eval" + +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +var af = (eval) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-yield-strict.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-yield-strict.js new file mode 100644 index 0000000000..2befc4eb73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/arrowparameters-cover-no-yield-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2.1 +description: > + ArrowParameters[Yield] : + ... + CoverParenthesizedExpressionAndArrowParameterList[?Yield] + + No parameter named "yield" + +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +var af = (yield) => 1; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters-expression-body.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters-expression-body.js new file mode 100644 index 0000000000..d8dd947b51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters-expression-body.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = x +=> x; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters.js new file mode 100644 index 0000000000..9a36c388c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid-parenless-parameters.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] + + No parens around ArrowParameters + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = x +=> {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid.js new file mode 100644 index 0000000000..fa3eb353e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/asi-restriction-invalid.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + ArrowFunction[In, Yield] : + ArrowParameters[?Yield] [no LineTerminator here] => ConciseBody[?In] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +var af = () +=> {}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/browser.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/shell.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/use-strict-with-non-simple-param.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/use-strict-with-non-simple-param.js new file mode 100644 index 0000000000..c8871d9add --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/early-errors/use-strict-with-non-simple-param.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-arrow-function-definitions-static-semantics-early-errors +description: > + A SyntaxError is thrown if an arrow function contains a non-simple parameter list and a UseStrict directive. +info: | + Static Semantics: Early Errors + + It is a Syntax Error if ContainsUseStrict of ConciseBody is true and IsSimpleParameterList of ArrowParameters is false. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var f = (a = 0) => { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/shell.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/arrow-function/syntax/variations.js b/js/src/tests/test262/language/expressions/arrow-function/syntax/variations.js new file mode 100644 index 0000000000..0b11f13494 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/syntax/variations.js @@ -0,0 +1,16 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.2 +description: > + Syntax variations of valid Arrow Functions +---*/ + +assert.sameValue((() => 1)(), 1); +assert.sameValue((a => a + 1)(1), 2); +assert.sameValue((() => { return 3; })(), 3); +assert.sameValue((a => { return a + 3; })(1), 4); +assert.sameValue(((a, b) => a + b)(1, 4), 5); +assert.sameValue(((a, b) => { return a + b; })(1, 5), 6); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/throw-new.js b/js/src/tests/test262/language/expressions/arrow-function/throw-new.js new file mode 100644 index 0000000000..a1070a5572 --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/throw-new.js @@ -0,0 +1,16 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.3.1.1 +description: > + Runtime Semantics: EvaluateNew(constructProduction, arguments) + + ... + 8. If IsConstructor (constructor) is false, throw a TypeError exception. + ... + +---*/ + +assert.throws(TypeError, function() { new (() => {}); }); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/arrow-function/unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..3a2ed073ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/unscopables-with-in-nested-fn.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/arrow-function.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [globalThis, Symbol.unscopables] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (x) => { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/arrow-function/unscopables-with.js b/js/src/tests/test262/language/expressions/arrow-function/unscopables-with.js new file mode 100644 index 0000000000..7d9f27548e --- /dev/null +++ b/js/src/tests/test262/language/expressions/arrow-function/unscopables-with.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/arrow-function.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +features: [globalThis, Symbol.unscopables] +flags: [generated, noStrict] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (x) => { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-1-6-s.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-1-6-s.js new file mode 100644 index 0000000000..c21ad81858 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-1-6-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: PutValue operates only on references (see step 3.a). +es5id: 11.13.1-1-6-s +description: > + simple assignment throws ReferenceError if LeftHandSide is an + unresolvable reference (base obj undefined) +---*/ + + +assert.throws(ReferenceError, function() { + __ES3_1_test_suite_test_11_13_1_unique_id_0__.x = 42; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-1-s-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-1-s-strict.js new file mode 100644 index 0000000000..cb32fcca40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-1-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-1-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide is a + reference to a data property with the attribute value + {[[Writable]]:false} under strict mode +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop = 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-2-s-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-2-s-strict.js new file mode 100644 index 0000000000..693dec26ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-2-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-2-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide is a + reference to an accessor property with the attribute value + {[[Set]]:undefined} under strict mode +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop = 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-3-s-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-3-s-strict.js new file mode 100644 index 0000000000..acca291f6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-3-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-3-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide is a + reference to a non-existent property of an object whose + [[Extensible]] internal property has the value false under strict + mode +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len = 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-4-1.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-1.js new file mode 100644 index 0000000000..423d3f1d65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-1.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: PutValue operates only on references (see step 3.b). +es5id: 11.13.1-4-1 +description: > + simple assignment creates property on the global object if + LeftHandSide is an unresolvable reference +flags: [noStrict] +---*/ + + function foo() { + __ES3_1_test_suite_test_11_13_1_unique_id_3__ = 42; + } + foo(); + + var desc = Object.getOwnPropertyDescriptor(this, '__ES3_1_test_suite_test_11_13_1_unique_id_3__'); + +assert.sameValue(desc.value, 42, 'desc.value'); +assert.sameValue(desc.writable, true, 'desc.writable'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-4-14-s-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-14-s-strict.js new file mode 100644 index 0000000000..6ceaa16864 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-14-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-4-14-s +description: > + simple assignment throws TypeError if LeftHandSide is a readonly + property in strict mode (Number.MAX_VALUE) +flags: [onlyStrict] +---*/ + + +assert.throws(TypeError, function() { + Number.MAX_VALUE = 42; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-4-27-s-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-27-s-strict.js new file mode 100644 index 0000000000..40b087e9aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-27-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-4-27-s +description: > + simple assignment throws TypeError if LeftHandSide is a readonly + property in strict mode (Global.undefined) +flags: [onlyStrict] +---*/ + +var global = this; +assert.throws(TypeError, function() { + global.undefined = 42; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-4-28gs-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-28gs-strict.js new file mode 100644 index 0000000000..d25f474f35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-28gs-strict.js @@ -0,0 +1,17 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-4-28gs +description: > + Strict Mode - TypeError is thrown if the identifier 'Math.PI' + appears as the LeftHandSideExpression of simple assignment(=) +flags: [onlyStrict] +---*/ + +assert.throws(TypeError, function() { + Math.PI = 20; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-4-29gs-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-29gs-strict.js new file mode 100644 index 0000000000..891293bbc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-29gs-strict.js @@ -0,0 +1,17 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-4-29gs +description: > + Strict Mode - TypeError is thrown if the identifier 'Math.PI' + appears as the LeftHandSideExpression of simple assignment(=) +flags: [onlyStrict] +---*/ + +assert.throws(TypeError, function() { + Math.PI = 20; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-4-3-s-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-3-s-strict.js new file mode 100644 index 0000000000..de3c2d4804 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-3-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-4-3-s +description: > + simple assignment throws TypeError if LeftHandSide is a readonly + property in strict mode (Global.Infinity) +flags: [onlyStrict] +---*/ + +var global = this; +assert.throws(TypeError, function() { + global.Infinity = 42; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/11.13.1-4-6-s-strict.js b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-6-s-strict.js new file mode 100644 index 0000000000..a5bc661296 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/11.13.1-4-6-s-strict.js @@ -0,0 +1,18 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.1-4-6-s +description: > + simple assignment throws TypeError if LeftHandSide is a readonly + property in strict mode (Function.length) +flags: [onlyStrict] +---*/ + + +assert.throws(TypeError, function() { + Function.length = 42; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_1.js b/js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_1.js new file mode 100644 index 0000000000..5fe405cfa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_1.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 8.12.5-3-b_1 +description: > + Changing the value of a data property should not affect it's + non-value property descriptor attributes. +---*/ + + var origDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); + var newDesc; + + Array.prototype.reduce = function () {;}; + newDesc = Object.getOwnPropertyDescriptor(Array.prototype, "reduce"); + var descArray = [origDesc, newDesc]; + + for (var j in descArray) { //Ensure no attributes are magically added to newDesc + for (var i in descArray[j]) { + if (i==="value") { + assert.notSameValue(origDesc[i], newDesc[i], 'origDesc[i]'); + } + else { + assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]'); + } + } + } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_2.js b/js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_2.js new file mode 100644 index 0000000000..b276570169 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/8.12.5-3-b_2.js @@ -0,0 +1,33 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 8.12.5-3-b_2 +description: > + Changing the value of a data property should not affect it's + non-value property descriptor attributes. +---*/ + + var tempObj = {}; + + Object.defineProperty(tempObj, "reduce", { value:456, enumerable:false, writable:true}); + var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); + + var newDesc; + + tempObj.reduce = 123; + newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); + var descArray = [origDesc, newDesc]; + + for (var j in descArray) { + for (var i in descArray[j]) { + if (i==="value") { + assert.notSameValue(origDesc[i], newDesc[i], 'origDesc[i]'); + } + else { + assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]'); + } + } + } + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/8.12.5-5-b_1.js b/js/src/tests/test262/language/expressions/assignment/8.12.5-5-b_1.js new file mode 100644 index 0000000000..b37a501262 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/8.12.5-5-b_1.js @@ -0,0 +1,30 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 8.12.5-5-b_1 +description: > + Changing the value of an accessor property should not affect it's + property descriptor attributes. +---*/ + + var tempObj = {}; + + Object.defineProperty(tempObj, "reduce", { get: function() {return 456;}, enumerable:false, set: function() {;}}); + var origDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); + + var newDesc; + + tempObj.reduce = 123; + newDesc = Object.getOwnPropertyDescriptor(tempObj, "reduce"); + var descArray = [origDesc, newDesc]; + + for (var j in descArray) { + for (var i in descArray[j]) { + assert.sameValue(origDesc[i], newDesc[i], 'origDesc[i]'); + } + } + +assert.sameValue(tempObj.reduce, 456, 'tempObj.reduce'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_1.js b/js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_1.js new file mode 100644 index 0000000000..e80c3d8ea0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_1.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 8.14.4-8-b_1 +description: Non-writable property on a prototype written to. +flags: [noStrict] +---*/ + + function foo() {}; + Object.defineProperty(foo.prototype, "bar", {value: "unwritable"}); + + var o = new foo(); + o.bar = "overridden"; + +assert.sameValue(o.hasOwnProperty("bar"), false, 'o.hasOwnProperty("bar")'); +assert.sameValue(o.bar, "unwritable", 'o.bar'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_2-strict.js b/js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_2-strict.js new file mode 100644 index 0000000000..8421c86137 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/8.14.4-8-b_2-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 8.14.4-8-b_2 +description: Non-writable property on a prototype written to in strict mode. +flags: [onlyStrict] +---*/ + + function foo() {}; + Object.defineProperty(foo.prototype, "bar", {value: "unwritable"}); + + var o = new foo(); +assert.throws(TypeError, function() { + o.bar = "overridden"; +}); +assert.sameValue(o.bar, "unwritable", 'o.bar'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T1.js new file mode 100644 index 0000000000..03cd57a083 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T1.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x = y uses GetValue and PutValue +es5id: 11.13.1_A2.1_T1 +description: Either AssigmentExpression is not Reference or GetBase is not null +---*/ + +//CHECK#1 +x = 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = 1; +if (x !== 1) { + throw new Test262Error('#2: var x = 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +y = 1; +x = y; +if (x !== 1) { + throw new Test262Error('#3: y = 1; x = y; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +var y = 1; +var x = y; +if (x !== 1) { + throw new Test262Error('#4: var y = 1; var x = y; x === 1. Actual: ' + (x)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objecty.prop = 1.1; +objectx.prop = objecty.prop; +if (objectx.prop !== objecty.prop) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objecty.prop = 1; objectx.prop = objecty.prop; objectx.prop === objecty.prop. Actual: ' + (objectx.prop)); +} else { + if (objectx === objecty) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objecty.prop = 1; objectx.prop = objecty.prop; objectx !== objecty'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T2.js new file mode 100644 index 0000000000..1d6919eee2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x = y uses GetValue and PutValue +es5id: 11.13.1_A2.1_T2 +description: If GetBase(AssigmentExpression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x = y; + throw new Test262Error('#1.1: x = y throw ReferenceError. Actual: ' + (x = y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x = y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.1.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.1.js new file mode 100644 index 0000000000..3dc00bf2c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x = y PutValue(x, y) +es5id: 11.13.1_A3.1 +description: Checking Expression and Variable statements +---*/ + +//CHECK#1 +var x = 1; +if (x !== 1) { + throw new Test262Error('#1: var x = 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.2.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.2.js new file mode 100644 index 0000000000..5e27a625a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A3.2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x = y returns GetValue(y) +es5id: 11.13.1_A3.2 +description: Checking Expression and Variable statements +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) !== 1) { + throw new Test262Error('#1: var x = 0; (x = 1) === 1. Actual: ' + ((x = 1))); +} + +//CHECK#2 +x = 0; +if ((x = 1) !== 1) { + throw new Test262Error('#2: x = 0; (x = 1) === 1. Actual: ' + ((x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T1.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T1.js new file mode 100644 index 0000000000..d615179322 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "AssignmentExpression : LeftHandSideExpression = AssignmentExpression" +es5id: 11.13.1_A4_T1 +description: Syntax check +---*/ + +//CHECK#1 +var x; +x = x = 1; +if (x !== 1) { + throw new Test262Error('#1: The expression x = x = 1 is the same x = (x = 1), not (x = x) = 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T2.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T2.js new file mode 100644 index 0000000000..aef46f9e1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A4_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "AssignmentExpression : LeftHandSideExpression = AssignmentExpression" +es5id: 11.13.1_A4_T2 +description: Syntax check if "x = x" throws ReferenceError +---*/ + +//CHECK#1 +try { + x = x; + throw new Test262Error('#1.1: x = x throw ReferenceError. Actual: ' + (x = x)); +} catch(e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x = x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T1.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T1.js new file mode 100644 index 0000000000..a47e0cb41f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T1.js @@ -0,0 +1,33 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator calls PutValue(lref, rval) +es5id: S11.13.1_A5_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, rval) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = {x: 1}; + + with (scope) { + x = (delete scope.x, 2); + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T2.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T2.js new file mode 100644 index 0000000000..aef7fc05d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T2.js @@ -0,0 +1,30 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator calls PutValue(lref, rval) +es5id: S11.13.1_A5_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, rval) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. +flags: [noStrict] +---*/ + +var x = 0; +var scope = {x: 1}; + +with (scope) { + x = (delete scope.x, 2); +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T3.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T3.js new file mode 100644 index 0000000000..43497e4573 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A5_T3.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator calls PutValue(lref, rval) +es5id: S11.13.1_A5_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, rval) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. +flags: [noStrict] +---*/ + +var outerScope = {x: 0}; +var innerScope = {x: 1}; + +with (outerScope) { + with (innerScope) { + x = (delete innerScope.x, 2); + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T1.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T1.js new file mode 100644 index 0000000000..30056f06b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T1.js @@ -0,0 +1,31 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator calls PutValue(lref, rval) +es5id: S11.13.1_A6_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, rval) uses the initially + created Reference even if a more local binding is available. +flags: [noStrict] +---*/ + +function testAssignment() { + var x = 0; + var innerX = (function() { + x = (eval("var x;"), 1); + return x; + })(); + + if (innerX !== undefined) { + throw new Test262Error('#1: innerX === undefined. Actual: ' + (innerX)); + } + if (x !== 1) { + throw new Test262Error('#2: x === 1. Actual: ' + (x)); + } +} +testAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T2.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T2.js new file mode 100644 index 0000000000..84670b0864 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T2.js @@ -0,0 +1,31 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator calls PutValue(lref, rval) +es5id: S11.13.1_A6_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, rval) uses the initially + created Reference even if a more local binding is available. +flags: [noStrict] +---*/ + +function testAssignment() { + var x = 0; + var innerX = (function() { + x = (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 1) { + throw new Test262Error('#2: x === 1. Actual: ' + (x)); + } +} +testAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T3.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T3.js new file mode 100644 index 0000000000..6a33126008 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A6_T3.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator calls PutValue(lref, rval) +es5id: S11.13.1_A6_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, rval) uses the initially + created Reference even if a more local binding is available. +flags: [noStrict] +---*/ + +function testAssignment() { + var x = 0; + var scope = {}; + + with (scope) { + x = (scope.x = 2, 1); + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 1) { + throw new Test262Error('#2: x === 1. Actual: ' + (x)); + } +} +testAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T3.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T3.js new file mode 100644 index 0000000000..8675448e23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T3.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] = expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T4.js b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T4.js new file mode 100644 index 0000000000..59ca4a3da9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S11.13.1_A7_T4.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] = expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S8.12.4_A1.js b/js/src/tests/test262/language/expressions/assignment/S8.12.4_A1.js new file mode 100644 index 0000000000..fe4abc8f36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S8.12.4_A1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property has the ReadOnly attribute, [[CanPut]](P) return false +es5id: 8.12.4_A1 +description: Try put other value for Math.E property +flags: [noStrict] +---*/ + +var __e = Math.E; +Math.E = 1; +if (Math.E !== __e){ + throw new Test262Error('#1: __e = Math.E; Math.E = 1; Math.E === __e. Actual: ' + (Math.E)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S8.12.5_A1.js b/js/src/tests/test262/language/expressions/assignment/S8.12.5_A1.js new file mode 100644 index 0000000000..67f1871c91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S8.12.5_A1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[Put]] method of O is called with property P and value V, + and If O doesn't have a property with name P, then + creates a property with name P, set its value to V and give it empty attributes +es5id: 8.12.5_A1 +description: Put to not existent properties +---*/ + +var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__map[1] !== "one") { + throw new Test262Error('#1: var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; __map[1] === "one". Actual: ' + (__map[1])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__map["two"] !== 2) { + throw new Test262Error('#2: var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; __map["two"] === 2. Actual: ' + (__map["two"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__map["3"] !== "tre") { + throw new Test262Error('#3: var __map={}; __map[1]="one"; __map["two"]=2; __map["3"]="tre"; __map["3"] === "tre". Actual: ' + (__map["3"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/S8.12.5_A2.js b/js/src/tests/test262/language/expressions/assignment/S8.12.5_A2.js new file mode 100644 index 0000000000..ab94c7ca5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/S8.12.5_A2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[Put]] method of O is called with property P and value V, + then set the value of the property to V. The attributes of the property are not changed +es5id: 8.12.5_A2 +description: Put to existent properties +---*/ + +var _map={1:"one",two:2}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +_map[1]="uno"; +if (_map[1] !== "uno") { + throw new Test262Error('#1: var _map={1:"one",two:2}; _map[1]="uno"; _map[1] === "uno". Actual: ' + (_map[1])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +_map["1"]=1; +if (_map[1] !== 1) { + throw new Test262Error('#2: var _map={1:"one",two:2}; _map[1]="uno"; _map["1"]=1; _map[1] === 1. Actual: ' + (_map[1])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +_map["two"]="two"; +if (_map["two"] !== "two") { + throw new Test262Error('#3: var _map={1:"one",two:2}; _map[1]="uno"; _map["1"]=1; _map["two"]="two"; _map["two"] === "two". Actual: ' + (_map["two"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +_map.two="duo"; +if (_map.two !== "duo") { + throw new Test262Error('#4: var _map={1:"one",two:2}; _map[1]="uno"; _map["1"]=1; _map["two"]="two"; _map.two="duo"; _map.two === "duo". Actual: ' + (_map.two)); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js b/js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js new file mode 100644 index 0000000000..4a4647f9c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval--1.js @@ -0,0 +1,43 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Assignment Operator calls PutValue(lref, rval) (formerly S11.13.1_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ + +var count = 0; +var global = this; + +Object.defineProperty(this, "x", { + configurable: true, + value: 1 +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x = (delete global.x, 2); + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); +assert(!('x' in global)); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js b/js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js new file mode 100644 index 0000000000..14dc6bf3ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/assignment-operator-calls-putvalue-lref--rval-.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Assignment Operator calls PutValue(lref, rval) (formerly S11.13.1_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ + +var count = 0; +var scope = {x: 1}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x = (delete scope.x, 2); + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/browser.js b/js/src/tests/test262/language/expressions/assignment/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignment/destructuring/browser.js b/js/src/tests/test262/language/expressions/assignment/destructuring/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order.js b/js/src/tests/test262/language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order.js new file mode 100644 index 0000000000..d552d8fa88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order.js @@ -0,0 +1,82 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-iteratordestructuringassignmentevaluation +description: > + Ensure correct evaluation order when destructuring target is property reference. +info: | + 12.15.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + AssignmentElement : DestructuringAssignmentTarget Initializer + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + 2. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[Iterator]]). + ... + 3. If iteratorRecord.[[Done]] is true, let value be undefined. + ... + 5. Else, let v be value. + ... + 8. Return ? PutValue(lref, v). +features: [Symbol.iterator] +includes: [compareArray.js] +---*/ + + +var log = []; + +function source() { + log.push("source"); + var iterator = { + next: function() { + log.push("iterator-step"); + return { + get done() { + log.push("iterator-done"); + return true; + }, + get value() { + // Note: This getter shouldn't be called. + log.push("iterator-value"); + } + }; + } + }; + var source = {}; + source[Symbol.iterator] = function() { + log.push("iterator"); + return iterator; + }; + return source; +} +function target() { + log.push("target"); + return target = { + set q(v) { + log.push("set"); + } + }; +} +function targetKey() { + log.push("target-key"); + return { + toString: function() { + log.push("target-key-tostring"); + return "q"; + } + }; +} + +([target()[targetKey()]] = source()); + +assert.compareArray(log, [ + "source", "iterator", + "target", "target-key", "target-key-tostring", + "iterator-step", "iterator-done", + "set", +]); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order.js b/js/src/tests/test262/language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order.js new file mode 100644 index 0000000000..3b610f6035 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order.js @@ -0,0 +1,77 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-keyeddestructuringassignmentevaluation +description: > + Ensure correct evaluation order when destructuring target is property reference. +info: | + 12.15.5.2 Runtime Semantics: DestructuringAssignmentEvaluation + + AssignmentProperty : PropertyName : AssignmentElement + + 1. Let name be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(name). + 3. Return the result of performing KeyedDestructuringAssignmentEvaluation of + AssignmentElement with value and name as the arguments. + + 12.15.5.4 Runtime Semantics: KeyedDestructuringAssignmentEvaluation + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + 2. Let v be ? GetV(value, propertyName). + ... + 4. Else, let rhsValue be v. + ... + 7. Return ? PutValue(lref, rhsValue). +includes: [compareArray.js] +---*/ + + +var log = []; + +function source() { + log.push("source"); + return { + get p() { + log.push("get"); + } + }; +} +function target() { + log.push("target"); + return { + set q(v) { + log.push("set"); + } + }; +} +function sourceKey() { + log.push("source-key"); + return { + toString: function() { + log.push("source-key-tostring"); + return "p"; + } + }; +} +function targetKey() { + log.push("target-key"); + return { + toString: function() { + log.push("target-key-tostring"); + return "q"; + } + }; +} + +({[sourceKey()]: target()[targetKey()]} = source()); + +assert.compareArray(log, [ + "source", "source-key", "source-key-tostring", + "target", "target-key", "target-key-tostring", + "get", "set", +]); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/destructuring/obj-prop-__proto__dup.js b/js/src/tests/test262/language/expressions/assignment/destructuring/obj-prop-__proto__dup.js new file mode 100644 index 0000000000..406b03b154 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/destructuring/obj-prop-__proto__dup.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-destructuring-assignment +es6id: 12.14.5 +description: Duplicate __proto__ property names +info: | + Annex B defines an early error for duplicate PropertyName of `__proto__`, + in object initializers, but this does not apply to Object Assignment + patterns +---*/ + +// Explicitly define an "own" property to avoid Annex B "__proto__ Property +// Names in Object Initializers" semantics (in environments which implement +// that extension) +var value = Object.defineProperty({}, '__proto__', { value: 123 }); +var result, x, y; + +result = { __proto__: x, __proto__: y } = value; + +assert.sameValue(result, value); +assert.sameValue(x, 123, 'first AssignmentProperty'); +assert.sameValue(y, 123, 'second AssignmentProperty'); + +result = x = y = null; + +// CoverParenthesizedExpressionAndArrowParameterList +result = ({ __proto__: x, __proto__: y } = value); + +assert.sameValue(result, value); +assert.sameValue(x, 123, 'first AssignmentProperty (CPEAAPL)'); +assert.sameValue(y, 123, 'second AssignmentProperty (CPEAAPL)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/destructuring/shell.js b/js/src/tests/test262/language/expressions/assignment/destructuring/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-assignment.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-assignment.js new file mode 100644 index 0000000000..6e8c60f05d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-assignment.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-assignment.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var v2, vNull, vHole, vUndefined, vOob; + +var result; +var vals = [2, null, , undefined]; + +result = [v2 = 10, vNull = 11, vHole = 12, vUndefined = 13, vOob = 14] = vals; + +assert.sameValue(v2, 2); +assert.sameValue(vNull, null); +assert.sameValue(vHole, 12); +assert.sameValue(vUndefined, 13); +assert.sameValue(vOob, 14); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-evaluation.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-evaluation.js new file mode 100644 index 0000000000..a4713139d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-evaluation.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-evaluation.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The Initializer should only be evaluated if v is undefined. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var flag1 = false, flag2 = false; +var _; + +var result; +var vals = [14]; + +result = [ _ = flag1 = true, _ = flag2 = true ] = vals; + +assert.sameValue(flag1, false); +assert.sameValue(flag2, true); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-arrow.js new file mode 100644 index 0000000000..fa90a9856f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-arrow.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-fn-name-arrow.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (ArrowFunction) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and value is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(v, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(v, + GetReferencedName(lref)). + +---*/ +var arrow; + +var result; +var vals = []; + +result = [ arrow = () => {} ] = vals; + +verifyProperty(arrow, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'arrow' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-class.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-class.js new file mode 100644 index 0000000000..564353795f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-class.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-fn-name-class.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (ClassExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [class, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and value is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(v, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(v, + GetReferencedName(lref)). + +---*/ +var xCls, cls, xCls2; + +var result; +var vals = []; + +result = [ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } ] = vals; + +assert(xCls.name !== 'xCls'); +assert(xCls2.name !== 'xCls2'); + +verifyProperty(cls, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'cls' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-cover.js new file mode 100644 index 0000000000..b92baae534 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-cover.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-fn-name-cover.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (CoverParenthesizedExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and value is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(v, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(v, + GetReferencedName(lref)). + +---*/ +var xCover, cover; + +var result; +var vals = []; + +result = [ xCover = (0, function() {}), cover = (function() {}) ] = vals; + +assert(xCover.name !== 'xCover'); + +verifyProperty(cover, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'cover' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-fn.js new file mode 100644 index 0000000000..31f2ebf66f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-fn.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-fn-name-fn.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (FunctionExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [class, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and value is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(v, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(v, + GetReferencedName(lref)). + +---*/ +var xFn, fn; + +var result; +var vals = []; + +result = [ xFn = function x() {}, fn = function() {} ] = vals; + +assert(xFn.name !== 'xFn'); + +verifyProperty(fn, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'fn' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-gen.js new file mode 100644 index 0000000000..470de386d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-fn-name-gen.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-fn-name-gen.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (GeneratorExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and value is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(v, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(v, + GetReferencedName(lref)). + +---*/ +var xGen, gen; + +var result; +var vals = []; + +result = [ xGen = function* x() {}, gen = function*() {} ] = vals; + +assert.notSameValue(xGen.name, 'xGen'); + +verifyProperty(gen, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'gen' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-in.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-in.js new file mode 100644 index 0000000000..c90e20eebb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-in.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-in.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The Initializer in an AssignmentElement may be an `in` expression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = []; + +result = [ x = 'x' in {} ] = vals; + +assert.sameValue(x, false); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-let.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-let.js new file mode 100644 index 0000000000..864b2050ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-let.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-let.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Value retrieval of Initializer obeys `let` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [let, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(ReferenceError, function() { + 0, [ x = y ] = []; +}); + +let y; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-order.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-order.js new file mode 100644 index 0000000000..3297560ac6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-order.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-order.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Initializer values should be assigned in left-to-right order. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = 0; +var a, b; + +var result; +var vals = []; + +result = [ a = x += 1, b = x *= 2 ] = vals; + +assert.sameValue(a, 1); +assert.sameValue(b, 2); +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-simple-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-simple-no-strict.js new file mode 100644 index 0000000000..7b0c99397f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-simple-no-strict.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-simple-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var argument, eval; + +var result; +var vals = []; + +result = [arguments = 4, eval = 5] = vals; + +assert.sameValue(arguments, 4); +assert.sameValue(eval, 5); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-expr.js new file mode 100644 index 0000000000..7099ec1567 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-expr.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var value = []; +var iterationResult, iter, x; +iter = (function*() { + +var result; +var vals = []; + +result = [ x = yield ] = vals; + + + +assert.sameValue(result, vals); + +})(); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x, undefined); + +iterationResult = iter.next(86); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x, 86); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..568a6ab3c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [ x = yield ] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-valid.js new file mode 100644 index 0000000000..89b4d680e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-init-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-init-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 4; +var x; + +var result; +var vals = []; + +result = [ x = yield ] = vals; + +assert.sameValue(x, 4); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-get-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-get-err.js new file mode 100644 index 0000000000..3aec9ccd2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-get-err.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-get-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from GetIterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iterable = {}; +iterable[Symbol.iterator] = function() { + throw new Test262Error(); +}; +var _; + +assert.throws(Test262Error, function() { + 0, [ _ ] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-err.js new file mode 100644 index 0000000000..dd59871882 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-err.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-nrml-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from IteratorClose (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result). + +---*/ +var nextCount = 0; +var returnCount = 0; +var _; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + throw new Test262Error(); + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ _ ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-null.js new file mode 100644 index 0000000000..fbfe85e1fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-null.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-nrml-close-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError + exception. + +---*/ +var _; +var iterable = {}; +var nextCount = 0; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + return null; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(TypeError, function() { + 0, [ _ ] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-skip.js new file mode 100644 index 0000000000..5bf9ef020b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close-skip.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-nrml-close-skip.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is not called when assignment evaluation has exhausted the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result). + 6. Return result. + +---*/ +var nextCount = 0; +var returnCount = 0; +var _; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + return {}; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ _ ] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close.js new file mode 100644 index 0000000000..60eaf96992 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-nrml-close.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-nrml-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when assignment evaluation has not exhausted the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var _; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ _ ] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-err.js new file mode 100644 index 0000000000..8421d79f6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-rtrn-close-err.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "return" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var returnCount = 0; +var unreachable = 0; +var iterable = {}; +var iterator = { + return: function() { + returnCount += 1; + throw new Test262Error(); + } +}; +var iter; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [ {}[ yield ] ] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} +iter = g(); +iter.next(); +assert.throws(Test262Error, function() { + iter.return(); +}); + +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-null.js new file mode 100644 index 0000000000..c4c12f4d64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-rtrn-close-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError + exception. + +---*/ +var nextCount = 0; +var returnCount = 0; +var unreachable = 0; +var iterator = { + next: function() { + nextCount += 1; + return {done: false, value: undefined}; + }, + return: function() { + returnCount += 1; + return null; + } +}; +var iterable = {}; +iterable[Symbol.iterator] = function() { + return iterator; +}; +function* g() { + +var result; +var vals = iterable; + +result = [ {} = yield ] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} + +var iter = g(); +iter.next(); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); +assert.throws(TypeError, function() { + iter.return(); +}); +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close.js new file mode 100644 index 0000000000..89ce986541 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-rtrn-close.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-rtrn-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "return" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var nextCount = 0; +var returnCount = 0; +var unreachable = 0; +var thisValue = null; +var args = null; +var iterator = { + next: function() { + nextCount += 1; + return {done: false, value: undefined}; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +var iterable = {}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [ {} = yield ] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} +var iter = g(); +iter.next(); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +var result = iter.return(777); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); +assert.sameValue(result.value, 777); +assert(result.done, 'Iterator correctly closed'); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-err.js new file mode 100644 index 0000000000..71009064d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-err.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-thrw-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "throw" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + +---*/ +var nextCount = 0; +var returnCount = 0; +function ReturnError() {} +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + + // This value should be discarded. + throw new ReturnError(); + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ {}[thrower()] ] = iterable; +}); + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-skip.js new file mode 100644 index 0000000000..338b68689c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close-skip.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-thrw-close-skip.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is not called when iteration produces an abrupt completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + throw new Test262Error(); + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; +var _; + +assert.throws(Test262Error, function() { + 0, [ x ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close.js new file mode 100644 index 0000000000..0bb12945ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-iter-thrw-close.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-iter-thrw-close.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "throw" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ AssignmentElementList ] + + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ {}[thrower()] ] = iterable; +}); + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-invalid.js new file mode 100644 index 0000000000..bc0cf9a518 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-invalid.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [[(x, y)]] = [[]]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-null.js new file mode 100644 index 0000000000..30369a5dce --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-null.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the value is `null`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var _; + +assert.throws(TypeError, function() { + 0, [[ _ ]] = [null]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-hole.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-hole.js new file mode 100644 index 0000000000..b94e8911b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-hole.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-undefined-hole.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the value is a "hole", a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var _; + +assert.throws(TypeError, function() { + 0, [[ _ ]] = [ , ]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-own.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-own.js new file mode 100644 index 0000000000..a9b7b96f9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined-own.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-undefined-own.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the value is `undefined`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var _; + +assert.throws(TypeError, function() { + 0, [[ x ]] = [undefined]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined.js new file mode 100644 index 0000000000..621539136e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-undefined.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-undefined.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and no value is defined, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var _; + +assert.throws(TypeError, function() { + 0, [[ x ]] = []; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-expr.js new file mode 100644 index 0000000000..4ad69704ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-expr.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var value = [[22]]; +var x = {}; +var iterationResult, iter; + +iter = (function*() { + +var result; +var vals = value; + +result = [[x[yield]]] = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x.prop, undefined); + +iterationResult = iter.next('prop'); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x.prop, 22); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..2c705f2591 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [[x[yield]]] = [[]]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-valid.js new file mode 100644 index 0000000000..3c2b0a9a35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 'prop'; +var x = {}; + +var result; +var vals = [[22]]; + +result = [[x[yield]]] = vals; + +assert.sameValue(x.prop, 22); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array.js new file mode 100644 index 0000000000..4f97f42494 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-array.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-array.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = [[1]]; + +result = [[x]] = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js new file mode 100644 index 0000000000..8bdeca68e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-memberexpr-optchain-prop-ref-init.js @@ -0,0 +1,57 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-memberexpr-optchain-prop-ref-init.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [optional-chaining, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + OptionalExpression: + MemberExpression OptionalChain + CallExpression OptionalChain + OptionalExpression OptionalChain + + OptionalChain: + ?. [ Expression ] + ?. IdentifierName + ?. Arguments + ?. TemplateLiteral + OptionalChain [ Expression ] + OptionalChain .IdentifierName + OptionalChain Arguments + OptionalChain TemplateLiteral + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true. + + Static Semantics: IsValidSimpleAssignmentTarget + + LeftHandSideExpression : OptionalExpression + 1. Return false. + +---*/ +$DONOTEVALUATE(); +var x = {}; + +0, [x?.y = 42] = [23]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-invalid.js new file mode 100644 index 0000000000..0bf4492dc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-invalid.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [{ get x() {} }] = [{}]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-null.js new file mode 100644 index 0000000000..e5a3804c1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-null.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and the value is `null`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, [{ x }] = [null]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-hole.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-hole.js new file mode 100644 index 0000000000..b2e7d0607a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-hole.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-undefined-hole.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and the value is a "hole", a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, [{ x }] = [ , ]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-own.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-own.js new file mode 100644 index 0000000000..7f3fdfcb73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined-own.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-undefined-own.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and the value is `undefined`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, [{ x }] = [undefined]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined.js new file mode 100644 index 0000000000..63c9866580 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-undefined.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-undefined.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and no value is defined, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, [{ x }] = []; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-expr.js new file mode 100644 index 0000000000..53ce33ea1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-expr.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var iterationResult, iter, x; + +iter = (function*() { + +var result; +var vals = [{}]; + +result = [{ x = yield }] = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x, undefined); + +iterationResult = iter.next(4); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x, 4); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..2dc2d6a1fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as a IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [{ x = yield }] = [{}]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-valid.js new file mode 100644 index 0000000000..dc9738b5be --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 2; +var x; + +var result; +var vals = [{}]; + +result = [{ x = yield }] = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj.js new file mode 100644 index 0000000000..8c12554c64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-nested-obj.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-nested-obj.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = [{ x: 2 }]; + +result = [{ x }] = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-const.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-const.js new file mode 100644 index 0000000000..d1dc500911 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-const.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-const.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `const` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [const, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +const c = null; + +assert.throws(TypeError, function() { + 0, [ c ] = [1]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-let.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-let.js new file mode 100644 index 0000000000..11d55da24e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-let.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-let.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `let` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [let, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, [ x ] = []; +}); + +let x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js new file mode 100644 index 0000000000..57d80fa31d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-optchain-prop-ref-init.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-obj-literal-optchain-prop-ref-init.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [optional-chaining, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + OptionalExpression: + MemberExpression OptionalChain + CallExpression OptionalChain + OptionalExpression OptionalChain + + OptionalChain: + ?. [ Expression ] + ?. IdentifierName + ?. Arguments + ?. TemplateLiteral + OptionalChain [ Expression ] + OptionalChain .IdentifierName + OptionalChain Arguments + OptionalChain TemplateLiteral + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true. + + Static Semantics: IsValidSimpleAssignmentTarget + + LeftHandSideExpression : OptionalExpression + 1. Return false. + +---*/ +$DONOTEVALUATE(); + +0, [{ + set y(val) { + throw new Test262Error('The property should not be accessed.'); + } +}?.y = 42] = [23]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init-active.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init-active.js new file mode 100644 index 0000000000..9b4dc59afb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init-active.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-obj-literal-prop-ref-init-active.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with activated initializer. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentPattern : ArrayAssignmentPattern + ArrayAssignmentPattern : [ AssignmentElementList ] + AssignmentElementList : AssignmentElisionElement + AssignmentElisionElement : Elision_opt AssignmentElement + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern. + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple. + + Runtime Semantics: DestructuringAssignmentEvaluation + ArrayAssignmentPattern : [ AssignmentElementList ] + + 1. Let iteratorRecord be ? GetIterator(value). + 2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord. + 3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result). + 4. Return result. + + Runtime Semantics: IteratorDestructuringAssignmentEvaluation + AssignmentElement : DestructuringAssignmentTarget Initializer + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + ... + 7. Return ? PutValue(lref, v). + +---*/ +var x, setValue; + +var result; +var vals = [undefined]; + +result = [{ + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42] = vals; + +assert.sameValue(setValue, 42); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init.js new file mode 100644 index 0000000000..68b98e1a0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref-init.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-obj-literal-prop-ref-init.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with initializer. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentPattern : ArrayAssignmentPattern + ArrayAssignmentPattern : [ AssignmentElementList ] + AssignmentElementList : AssignmentElisionElement + AssignmentElisionElement : Elision_opt AssignmentElement + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern. + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple. + + Runtime Semantics: DestructuringAssignmentEvaluation + ArrayAssignmentPattern : [ AssignmentElementList ] + + 1. Let iteratorRecord be ? GetIterator(value). + 2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord. + 3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result). + 4. Return result. + + Runtime Semantics: IteratorDestructuringAssignmentEvaluation + AssignmentElement : DestructuringAssignmentTarget Initializer + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + ... + 7. Return ? PutValue(lref, v). + +---*/ +var x, setValue; + +var result; +var vals = [23]; + +result = [{ + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42] = vals; + +assert.sameValue(setValue, 23); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref.js new file mode 100644 index 0000000000..10459a2e9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-obj-literal-prop-ref.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-obj-literal-prop-ref.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentPattern : ArrayAssignmentPattern + ArrayAssignmentPattern : [ AssignmentElementList ] + AssignmentElementList : AssignmentElisionElement + AssignmentElisionElement : Elision_opt AssignmentElement + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern. + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple. + + Runtime Semantics: DestructuringAssignmentEvaluation + ArrayAssignmentPattern : [ AssignmentElementList ] + + 1. Let iteratorRecord be ? GetIterator(value). + 2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord. + 3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result). + 4. Return result. + + Runtime Semantics: IteratorDestructuringAssignmentEvaluation + AssignmentElement : DestructuringAssignmentTarget Initializer + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + ... + 7. Return ? PutValue(lref, v). + +---*/ +var x, setValue; + +var result; +var vals = [23]; + +result = [{ + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y] = vals; + +assert.sameValue(setValue, 23); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-no-get.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-no-get.js new file mode 100644 index 0000000000..9a0e4df6d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-no-get.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-prop-ref-no-get.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x, setValue; +x = { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}; + +var result; +var vals = [23]; + +result = [x.y] = vals; + +assert.sameValue(setValue, 23); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-user-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-user-err.js new file mode 100644 index 0000000000..78dc5e7853 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref-user-err.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-prop-ref-user-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Any error raised as a result of setting the value should be forwarded to the runtime. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = { + set y(val) { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + 0, [x.y] = [23]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref.js new file mode 100644 index 0000000000..278006500f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-prop-ref.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-prop-ref.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = {}; + +var result; +var vals = [4]; + +result = [x.y] = vals; + +assert.sameValue(x.y, 4); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-no-strict.js new file mode 100644 index 0000000000..44d50f33b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-no-strict.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-unresolvable-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +{ + +var result; +var vals = []; + +result = [ unresolvable ] = vals; + + + +assert.sameValue(result, vals); + +} + +assert.sameValue(unresolvable, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-strict-strict.js new file mode 100644 index 0000000000..7993e668b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-put-unresolvable-strict-strict.js @@ -0,0 +1,24 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-put-unresolvable-strict.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, [ unresolvable ] = []; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-identifier.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-identifier.js new file mode 100644 index 0000000000..077947e6b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-identifier.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-target-identifier.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x, y, z; + +var result; +var vals = [1, 2, 3]; + +result = [x, y, z] = vals; + +assert.sameValue(x, 1); +assert.sameValue(y, 2); +assert.sameValue(z, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-no-strict.js new file mode 100644 index 0000000000..64b8661f4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-no-strict.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-target-simple-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var argument, eval; + +var result; +var vals = [2, 3]; + +result = [arguments, eval] = vals; + +assert.sameValue(arguments, 2); +assert.sameValue(eval, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-strict-strict.js new file mode 100644 index 0000000000..db1f72d58d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-simple-strict-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-target-simple-strict.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [arguments] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-expr.js new file mode 100644 index 0000000000..c265030dc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-expr.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-target-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var value = [33]; +var x = {}; +var iterationResult, iter; + +iter = (function*() { + +var result; +var vals = [33]; + +result = [ x[yield] ] = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x.prop, undefined); + +iterationResult = iter.next('prop'); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x.prop, 33); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-invalid-strict.js new file mode 100644 index 0000000000..fd9b6dd932 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-target-yield-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [ x[yield] ] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-valid.js new file mode 100644 index 0000000000..35e2df1b60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-target-yield-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-target-yield-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 'prop'; +var x = {}; + +var result; +var vals = [33]; + +result = [ x[yield] ] = vals; + +assert.sameValue(x.prop, 33); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-abpt.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-abpt.js new file mode 100644 index 0000000000..36b3073e54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-abpt.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-abpt.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned during evaluation of elision (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 6. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. If status is an abrupt completion, then + i. If iteratorRecord.[[done]] is false, return + IteratorClose(iterator, status). + ii. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + + if (nextCount === 2) { + throw new Test262Error(); + } + + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + + +assert.throws(Test262Error, function() { + 0, [ x , , ] = iterable; +}); + +assert.sameValue(nextCount, 2); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js new file mode 100644 index 0000000000..4f9998d039 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from IteratorClose (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 6. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. If status is an abrupt completion, then + [...] + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + throw new Test262Error(); + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ x , , ] = iterable; +}); + +assert.sameValue(nextCount, 2); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js new file mode 100644 index 0000000000..ae60643e24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-null.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 6. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. If status is an abrupt completion, then + [...] + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError + exception. + +---*/ +var iterable = {}; +var x; +var nextCount = 0; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + return null; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(TypeError, function() { + 0, [ x , , ] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js new file mode 100644 index 0000000000..160c75af9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close-skip.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close-skip.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose not invoked when elision exhausts the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 6. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. If status is an abrupt completion, then + [...] + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + + return { done: nextCount > 1 }; + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ x , , ] = vals; + +assert.sameValue(nextCount, 2); +assert.sameValue(returnCount, 0); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js new file mode 100644 index 0000000000..e57416f5a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-elision-iter-nrml-close.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-elision-iter-nrml-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose invoked when elision does not exhaust the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 6. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. If status is an abrupt completion, then + [...] + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ x , , ] = vals; + +assert.sameValue(nextCount, 2); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-get-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-get-err.js new file mode 100644 index 0000000000..91f18f559e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-get-err.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-get-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from GetIterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iterable = {}; +iterable[Symbol.iterator] = function() { + throw new Test262Error(); +}; +var x; + +assert.throws(Test262Error, function() { + 0, [ x , ] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-err.js new file mode 100644 index 0000000000..635d0cb425 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from IteratorClose (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var thrower = function() { + throw new Test262Error(); +}; +var x; +var iterator = { + next: function() { + nextCount += 1; + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + throw new Test262Error(); + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ x , ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-null.js new file mode 100644 index 0000000000..2e25ce202a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-null.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError + exception. + +---*/ +var iterable = {}; +var x; +var nextCount = 0; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + return null; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(TypeError, function() { + 0, [ x , ] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-skip.js new file mode 100644 index 0000000000..404ef3f813 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close-skip.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close-skip.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is not invoked when evaluation of AssignmentElementList exhausts the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var thrower = function() { + throw new Test262Error(); +}; +var x; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ x , ] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close.js new file mode 100644 index 0000000000..a1984ca05f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-nrml-close.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-nrml-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is invoked when evaluation of AssignmentElementList completes without exhausting the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ x , ] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-err.js new file mode 100644 index 0000000000..fe325a61f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close-err.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "return" completion and the iterator has not been marked as "done" (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var nextCount = 0; +var returnCount = 0; +var unreachable = 0; +var iterator = { + next: function() { + nextCount += 1; + return {done: false, value: undefined}; + }, + return: function() { + returnCount += 1; + + throw new Test262Error(); + } +}; +var iterable = {}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [ {} = yield , ] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} + +var iter = g(); +iter.next(); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); +assert.throws(Test262Error, function() { + iter.return(); +}); +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-null.js new file mode 100644 index 0000000000..a202f24ba9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close-null.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError + exception. + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterator = { + next: function() { + nextCount += 1; + return {done: false, value: undefined}; + }, + return: function() { + returnCount += 1; + return null; + } +}; +var iterable = {}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [ {} = yield , ] = vals; + + + +assert.sameValue(result, vals); + +} + +var iter = g(); +iter.next(); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); +assert.throws(TypeError, function() { + iter.return(); +}); +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close.js new file mode 100644 index 0000000000..0d9246d0cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-rtrn-close.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-rtrn-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "return" completion and the iterator has not been marked as "done" (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var nextCount = 0; +var returnCount = 0; +var unreachable = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return {done: false, value: undefined}; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +var iter, result; + +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [ {} = yield , ] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +}; + +iter = g(); +iter.next(); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +result = iter.return(888); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); +assert.sameValue(result.value, 888); +assert(result.done, 'Iterator correctly closed'); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-err.js new file mode 100644 index 0000000000..8337cbfc99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "throw" completion and the iterator has not been marked as "done" (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 7. If completion.[[type]] is throw, return Completion(completion). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var thrower = function() { + throw new Test262Error(); +}; +function ReturnError() {} +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + + // This value should be discarded. + throw new ReturnError(); + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + + +assert.throws(Test262Error, function() { + 0, [ {}[thrower()] , ] = iterable; +}); + + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-skip.js new file mode 100644 index 0000000000..a855ca1752 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close-skip.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close-skip.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is not invoked when evaluation of AssignmentElementList returns an abrupt completion and the iterator has been marked as "done" (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var thrower = function() { + throw new Test262Error(); +}; +var iterator = { + next: function() { + nextCount += 1; + throw new Test262Error(); + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; +var x; + +assert.throws(Test262Error, function() { + 0, [ x , ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close.js new file mode 100644 index 0000000000..5e7407c452 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-list-thrw-close.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-list-thrw-close.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is invoked when evaluation of AssignmentElementList returns a "throw" completion and the iterator has not been marked as "done" (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 3. Let iteratorRecord be Record {[[iterator]]: iterator, [[done]]: false}. + 4. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentElementList using + iteratorRecord as the argument. + 5. If status is an abrupt completion, then + a. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + b. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var thrower = function() { + throw new Test262Error(); +}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ {}[thrower()] , ] = iterable; +}); + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js new file mode 100644 index 0000000000..73bbb0a002 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-nrml-close-skip.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-rest-nrml-close-skip.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is not called when rest element evaluation has exhausted the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 7. If AssignmentRestElement is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement + with iteratorRecord as the argument. + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var x, y; +var iterator = { + next: function() { + nextCount += 1; + return { value: nextCount, done: nextCount > 1 }; + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ x , ...y ] = vals; + + + +assert.sameValue(result, vals); + +assert.sameValue(nextCount, 2, 'nextCount'); +assert.sameValue(returnCount, 0, 'returnCount'); +assert.sameValue(x, 1, 'x'); +assert.sameValue(y.length, 0, 'y.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js new file mode 100644 index 0000000000..53556fbaa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close-err.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when AssignmentRestEvaluation produces a "return" completion due to reference evaluation (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 7. If AssignmentRestElement is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement + with iteratorRecord as the argument. + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var nextCount = 0; +var returnCount = 0; +var unreachable = 0; +var x; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + + throw new Test262Error(); + } +}; +var iter; +iterable[Symbol.iterator] = function() { + return iterator; +}; +function* g() { + +var result; +var vals = iterable; + +result = [ x , ...{}[yield] ] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} + +iter = g(); +iter.next(); + +assert.throws(Test262Error, function() { + iter.return(); +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js new file mode 100644 index 0000000000..72f586a6a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 7. If AssignmentRestElement is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement + with iteratorRecord as the argument. + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var nextCount = 0; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + return null; + } +}; +var iter; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [ x , ...{}[yield] ] = vals; + + + +assert.sameValue(result, vals); + +} + +iter = g(); +iter.next(); + +assert.throws(TypeError, function() { + iter.return(); +}); + +assert.sameValue(nextCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close.js new file mode 100644 index 0000000000..59913ad167 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-rtrn-close.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-rest-rtrn-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when AssignmentRestEvaluation produces a "return" completion due to reference evaluation (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 7. If AssignmentRestElement is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement + with iteratorRecord as the argument. + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var nextCount = 0; +var returnCount = 0; +var unreachable = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +var iter, result; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [ x , ...{}[yield] ] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} + +iter = g(); +iter.next(); +result = iter.return(999); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); +assert.sameValue(result.value, 999); +assert(result.done, 'Iterator correctly closed'); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-err.js new file mode 100644 index 0000000000..d742a4e872 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is called when AssignmentRestEvaluation produces a "throw" completion due to reference evaluation (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 7. If AssignmentRestElement is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement + with iteratorRecord as the argument. + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 7. If completion.[[type]] is throw, return Completion(completion) + +---*/ +var nextCount = 0; +var returnCount = 0; +var x; +function ReturnError() {} +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + + // This value should be discarded. + throw new ReturnError(); + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ x , ...{}[thrower()] ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js new file mode 100644 index 0000000000..de19c8f80a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close-skip.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close-skip.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned during iteration for rest element (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 7. If AssignmentRestElement is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement + with iteratorRecord as the argument. + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + + if (nextCount === 2) { + throw new Test262Error(); + } + + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ x , ...x ] = iterable; +}); + +assert.sameValue(nextCount, 2); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close.js new file mode 100644 index 0000000000..d30f3a71a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elem-trlg-iter-rest-thrw-close.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elem-trlg-iter-rest-thrw-close.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is called when AssignmentRestEvaluation produces a "throw" completion due to reference evaluation (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : + [ AssignmentElementList , Elisionopt AssignmentRestElementopt ] + + [...] + 7. If AssignmentRestElement is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement + with iteratorRecord as the argument. + 8. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + status). + 9. Return Completion(status). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var x; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ x , ...{}[thrower()] ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-abpt.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-abpt.js new file mode 100644 index 0000000000..74f7309dba --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-abpt.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-iter-abpt.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is not called when iteration produces an abrupt completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elision ] + + 1. Let iterator be GetIterator(value). + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + throw new Test262Error(); + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ , ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-get-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-get-err.js new file mode 100644 index 0000000000..2ca34d47e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-get-err.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-iter-get-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from GetIterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elision ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iterable = {}; +iterable[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + 0, [ , ] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-err.js new file mode 100644 index 0000000000..b5b62fd7e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-err.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-iter-nrml-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from IteratorClose (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elision ] + + 1. Let iterator be GetIterator(value). + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 6. Return result. + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + throw new Test262Error(); + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [ , ] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-null.js new file mode 100644 index 0000000000..e6a3dd180c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-null.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-iter-nrml-close-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elision ] + + 1. Let iterator be GetIterator(value). + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + [...] + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError + exception. + +---*/ +var iterable = {}; +var nextCount = 0; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + return null; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(TypeError, function() { + 0, [ , ] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-skip.js new file mode 100644 index 0000000000..2c01037e9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close-skip.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-iter-nrml-close-skip.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is not called when iteration has exhausted the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elision ] + + 1. Let iterator be GetIterator(value). + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + return {}; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ , ] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close.js new file mode 100644 index 0000000000..0340338d29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-iter-nrml-close.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-iter-nrml-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when assignment evaluation has not exhausted the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elision ] + + 1. Let iterator be GetIterator(value). + [...] + 5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + [...] + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ , ] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-array.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-array.js new file mode 100644 index 0000000000..802b529a8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-array.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-val-array.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern containing only Elisions requires iterable values (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = []; + +result = [,] = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-bool.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-bool.js new file mode 100644 index 0000000000..39621c5830 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-bool.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-val-bool.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for boolean values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [,] = true; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-null.js new file mode 100644 index 0000000000..d73ad33646 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-null.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-val-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for `null`. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [,] = null; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-num.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-num.js new file mode 100644 index 0000000000..a8f5e71f8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-num.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-val-num.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for number values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [,] = 1; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-string.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-string.js new file mode 100644 index 0000000000..468ce5e9da --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-string.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-val-string.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern containing only Elisions requires iterable values (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = 'string literal'; + +result = [,] = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-symbol.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-symbol.js new file mode 100644 index 0000000000..81b7e6b68c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-symbol.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-val-symbol.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for symbol values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var s = Symbol(); + +assert.throws(TypeError, function() { + 0, [,] = s; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-undef.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-undef.js new file mode 100644 index 0000000000..1847e2eee1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-elision-val-undef.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-elision-val-undef.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern containing only Elisions requires iterable values and throws for `undefined`. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [,] = undefined; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-err.js new file mode 100644 index 0000000000..fe4d8a91aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-err.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-iter-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from IteratorClose (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + 3. Return IteratorClose(iterator, NormalCompletion(empty)). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + throw new Test262Error(); + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [] = iterable; +}); + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-null.js new file mode 100644 index 0000000000..9d3c42baf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close-null.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-iter-close-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + 3. Return IteratorClose(iterator, NormalCompletion(empty)). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + 9. If Type(innerResult.[[value]]) is not Object, throw a TypeError + exception. + +---*/ +var iterable = {}; +var iterator = { + next: function() { + return { done: true }; + }, + return: function() { + return null; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(TypeError, function() { + 0, [] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close.js new file mode 100644 index 0000000000..d7a57dbe0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-close.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-iter-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Iterator is closed without iterating (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + 3. Return IteratorClose(iterator, NormalCompletion(empty)). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [] = vals; + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-get-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-get-err.js new file mode 100644 index 0000000000..b717addb6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-iter-get-err.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-iter-get-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from GetIterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iterable = {}; +iterable[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + 0, [] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-array.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-array.js new file mode 100644 index 0000000000..34cdcf1cbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-array.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-val-array.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = []; + +result = [] = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-bool.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-bool.js new file mode 100644 index 0000000000..71c6b78238 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-bool.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-val-bool.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for boolean values (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [] = true; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-null.js new file mode 100644 index 0000000000..6f92dfb22d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-null.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-val-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for `null`. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [] = null; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-num.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-num.js new file mode 100644 index 0000000000..bb94582b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-num.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-val-num.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for number values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [] = 1; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-string.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-string.js new file mode 100644 index 0000000000..00c6d335ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-string.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-val-string.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = 'string literal'; + +result = [] = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-symbol.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-symbol.js new file mode 100644 index 0000000000..95d5a39733 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-symbol.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-val-symbol.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for Symbol values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var s = Symbol(); + +assert.throws(TypeError, function() { + 0, [] = s; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-undef.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-undef.js new file mode 100644 index 0000000000..5427aceb28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-empty-val-undef.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-empty-val-undef.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ArrayAssignmentPattern without an AssignmentElementList requires iterable values and throws for `undefined`. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, [] = undefined; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-iteration.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-iteration.js new file mode 100644 index 0000000000..acde85ea55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-iteration.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-iteration.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Value iteration only proceeds for the number of elements in the ArrayAssignmentPattern. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var count = 0; +var g = function*() { + count += 1; + yield; + count += 1; + yield; + count += 1; +} + +var result; +var vals = g(); + +result = [,,] = vals; + +assert.sameValue(count, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-element.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-element.js new file mode 100644 index 0000000000..d604cad121 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-element.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-after-element.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An AssignmentRestElement following an AssignmentElement consumes all remaining iterable values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x, y; + +var result; +var vals = [1, 2, 3]; + +result = [x, ...y] = vals; + +assert.sameValue(x, 1); +assert.sameValue(y.length, 2); +assert.sameValue(y[0], 2); +assert.sameValue(y[1], 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-elision.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-elision.js new file mode 100644 index 0000000000..f5f585b83c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-after-elision.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-after-elision.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An AssignmentRestElement following an elision consumes all remaining iterable values. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = [1, 2, 3]; + +result = [, ...x] = vals; + +assert.sameValue(x.length, 2); +assert.sameValue(x[0], 2); +assert.sameValue(x[1], 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-element.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-element.js new file mode 100644 index 0000000000..444c2118bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-element.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-before-element.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: An AssignmentElement may not follow an AssignmentRestElement in an AssignmentElementList. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...x, y] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-elision.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-elision.js new file mode 100644 index 0000000000..459a381bd1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-elision.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-before-elision.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: An elision may not follow an AssignmentRestElement in an AssignmentElementList. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...x,] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-rest.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-rest.js new file mode 100644 index 0000000000..ca326a85ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-before-rest.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-before-rest.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: An AssignmentRestElement may not follow another AssignmentRestElement in an AssignmentElementList. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...x, ...y] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-invalid.js new file mode 100644 index 0000000000..2a6f56988e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-invalid.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-elision-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: ArrayAssignmentPattern may not include elisions following an AssignmentRestElement in a AssignmentElementList. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...x,] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-iter-abpt.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-iter-abpt.js new file mode 100644 index 0000000000..ade40df9eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision-iter-abpt.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-elision-iter-abpt.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is not called when assignment evaluation produces an abrupt completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 4. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. If status is an abrupt completion, then + i. If iteratorRecord.[[done]] is false, return + IteratorClose(iterator, status). + ii. Return Completion(status). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + throw new Test262Error(); + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; +var x; + +assert.throws(Test262Error, function() { + 0, [ , ...x] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision.js new file mode 100644 index 0000000000..aa4d0267ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-elision.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-elision.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: ArrayAssignmentPattern may include elisions at any position preceding a AssignmentRestElement in a AssignmentElementList. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x, y; + +var result; +var vals = [1, 2, 3, 4, 5, 6]; + +result = [, , x, , ...y] = vals; + +assert.sameValue(x, 3); +assert.sameValue(y.length, 2); +assert.sameValue(y[0], 5); +assert.sameValue(y[1], 6); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-init.js new file mode 100644 index 0000000000..4dfd4e9960 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-init.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-init.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: The AssignmentRestElement does not support an initializer. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); +var x; + +0, [...x = 1] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-get-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-get-err.js new file mode 100644 index 0000000000..d003d388e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-get-err.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-get-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Abrupt completion returned from GetIterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iterable = {}; +var x; +iterable[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + 0, [...x] = iterable; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-nrml-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-nrml-close-skip.js new file mode 100644 index 0000000000..51dbe4c5f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-nrml-close-skip.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-nrml-close-skip.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is not called when assignment evaluation has exhausted the iterator (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + 7. Return result. + +---*/ +var nextCount = 0; +var returnCount = 0; +var x; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [ ...x ] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-err.js new file mode 100644 index 0000000000..9eae05c598 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-rtrn-close-err.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "return" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var returnCount = 0; +var unreachable = 0; +var iterable = {}; +var iterator = { + return: function() { + returnCount += 1; + + throw new Test262Error(); + } +}; +var iter; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [...{}[yield]] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} + +iter = g(); +iter.next(); +assert.throws(Test262Error, function() { + iter.return(); +}); + +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-null.js new file mode 100644 index 0000000000..6ee0957c11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-rtrn-close-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose throws a TypeError when `return` returns a non-Object value (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var iterable = {}; +var iterator = { + return: function() { + return null; + } +}; +var iter; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [...{}[yield]] = vals; + + + +assert.sameValue(result, vals); + +} + +iter = g(); +iter.next(); + +assert.throws(TypeError, function() { + iter.return(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close.js new file mode 100644 index 0000000000..7aaf8b7e1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-rtrn-close.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-rtrn-close.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "return" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + 7. If completion.[[type]] is throw, return Completion(completion). + 8. If innerResult.[[type]] is throw, return Completion(innerResult). + +---*/ +var returnCount = 0; +var unreachable = 0; +var thisValue = null; +var args = null; +var iterable = {}; +var iterator = { + next() { + throw new Test262Error(); + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + return {}; + } +}; +var iter, result; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +function* g() { + +var result; +var vals = iterable; + +result = [...{}[yield]] = vals; + +unreachable += 1; + +assert.sameValue(result, vals); + +} + +iter = g(); +iter.next(); +result = iter.return(444); + +assert.sameValue(returnCount, 1); +assert.sameValue(unreachable, 0, 'Unreachable statement was not executed'); +assert.sameValue(result.value, 444); +assert(result.done, 'Iterator correctly closed'); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-err.js new file mode 100644 index 0000000000..a9ff16b48b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-thrw-close-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "throw" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + +---*/ +var nextCount = 0; +var returnCount = 0; +var x; +function ReturnError() {} +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + + // This value should be discarded. + throw new ReturnError(); + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + + +assert.throws(Test262Error, function() { + 0, [...{}[thrower()]] = iterable; +}); + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-skip.js new file mode 100644 index 0000000000..0d4f1c2f97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close-skip.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-thrw-close-skip.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is not called when iteration produces an abrupt completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + +---*/ +var nextCount = 0; +var returnCount = 0; +var x; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + throw new Test262Error(); + }, + return: function() { + returnCount += 1; + } +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [...x] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close.js new file mode 100644 index 0000000000..77a7a8f576 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iter-thrw-close.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iter-thrw-close.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces a "throw" completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + + 7.4.6 IteratorClose( iterator, completion ) + + [...] + 6. Let innerResult be Call(return, iterator, « »). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var thisValue = null; +var args = null; +var x; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + // Set an upper-bound to limit unnecessary iteration in non-conformant + // implementations + return { done: nextCount > 10 }; + }, + return: function() { + returnCount += 1; + thisValue = this; + args = arguments; + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [...{}[thrower()]] = iterable; +}); + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); +assert.sameValue(thisValue, iterator, 'correct `this` value'); +assert(!!args, 'arguments object provided'); +assert.sameValue(args.length, 0, 'zero arguments specified'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iteration.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iteration.js new file mode 100644 index 0000000000..b7a7df2877 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-iteration.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-iteration.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: In the presense of an AssignmentRestElement, value iteration exhausts the iterable value; (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var count = 0; +var g = function*() { + count += 1; + yield; + count += 1; + yield; + count += 1; +} +var x; + +var result; +var vals = g(); + +result = [...x] = vals; + +assert.sameValue(count, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref-err.js new file mode 100644 index 0000000000..accc197bb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-lref-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is called when reference evaluation produces an abrupt completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [...{}[thrower()]] = iterable; +}); + +assert.sameValue(nextCount, 0); +assert.sameValue(returnCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref.js new file mode 100644 index 0000000000..9827e5ff66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-lref.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-lref.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Reference is evaluated during assignment (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + b. ReturnIfAbrupt(lref). + [...] + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + } +}; +var obj = {}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +var result; +var vals = iterable; + +result = [...obj['a' + 'b']] = vals; + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); +assert(!!obj.ab); +assert.sameValue(obj.ab.length, 0); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-invalid.js new file mode 100644 index 0000000000..184a68eef8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-invalid.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...[(x, y)]] = [[]]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-iter-thrw-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-iter-thrw-close-skip.js new file mode 100644 index 0000000000..5e71ef0752 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-iter-thrw-close-skip.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-iter-thrw-close-skip.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is not called when nested array pattern evaluation produces an abrupt completion (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + [...] + 4. Repeat while iteratorRecord.[[done]] is false + [...] + d. If next is false, set iteratorRecord.[[done]] to true. + [...] + 7. Return the result of performing DestructuringAssignmentEvaluation of + nestedAssignmentPattern with A as the argument. + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + } +}; +var thrower = function() { + throw new Test262Error(); +}; +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [...[...{}[thrower()]]] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-null.js new file mode 100644 index 0000000000..db98682592 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-null.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x, y; + +var result; +var vals = [null]; + +result = [...[x, y]] = vals; + +assert.sameValue(x, null); +assert.sameValue(y, undefined); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-hole.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-hole.js new file mode 100644 index 0000000000..9094260e59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-hole.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-undefined-hole.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; + +var result; +var vals = [ , ]; + +result = [...[x]] = vals; + +assert.sameValue(x, undefined); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-own.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-own.js new file mode 100644 index 0000000000..ea9ea94630 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined-own.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-undefined-own.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; + +var result; +var vals = [undefined]; + +result = [...[x]] = vals; + +assert.sameValue(x, undefined); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined.js new file mode 100644 index 0000000000..6817993dc1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-undefined.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-undefined.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; + +var result; +var vals = []; + +result = [...[x]] = vals; + +assert.sameValue(x, undefined); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-expr.js new file mode 100644 index 0000000000..f69cd97607 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-expr.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var value = [86]; +var x = {}; +var iterationResult, iter; + +iter = (function*() { + +var result; +var vals = [86]; + +result = [...[x[yield]]] = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x.prop, undefined); + +iterationResult = iter.next('prop'); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x.prop, 86); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..7498198fb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...[x[yield]]] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-valid.js new file mode 100644 index 0000000000..85d2d45de8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 'prop'; +var x = {}; + +var result; +var vals = [86]; + +result = [...[x[yield]]] = vals; + +assert.sameValue(x.prop, 86); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array.js new file mode 100644 index 0000000000..f9c4ea7f11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-array.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-array.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = [1, 2, 3]; + +result = [...[x]] = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-invalid.js new file mode 100644 index 0000000000..8ec363df99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-invalid.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...{ get x() {} }] = [[]]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-null.js new file mode 100644 index 0000000000..98cc4efe48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-null.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and the iterable emits `null` as the only value, an array with a single `null` element should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x, length; + +var result; +var vals = [null]; + +result = [...{ 0: x, length }] = vals; + +assert.sameValue(x, null); +assert.sameValue(length, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-hole.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-hole.js new file mode 100644 index 0000000000..36cd215bce --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-hole.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-undefined-hole.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the iterable is an array with a "hole", an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +// Use the the top-level lexical scope for 'length' to provide compatibility with browsers +// where length and name are properties of WindowProxy +let length; + +var result; +var vals = [ , ]; + +result = [...{ 0: x, length }] = vals; + +assert.sameValue(x, undefined); +assert.sameValue(length, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-own.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-own.js new file mode 100644 index 0000000000..31d1ef08ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined-own.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-undefined-own.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the iterable emits `undefined` as the only value, an array with a single `undefined` element should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +// Use the the top-level lexical scope for 'length' to provide compatibility with browsers +// where length and name are properties of WindowProxy +let length; + +var result; +var vals = [undefined]; + +result = [...{ 0: x, length }] = vals; + +assert.sameValue(x, undefined); +assert.sameValue(length, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined.js new file mode 100644 index 0000000000..550168927a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-undefined.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-undefined.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an obect literal and the iterable is emits no values, an empty array should be used as the value of the nested DestructuringAssignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +// Use the the top-level lexical scope for 'length' to provide compatibility with browsers +// where length and name are properties of WindowProxy +let length; + +var result; +var vals = []; + +result = [...{ 0: x, length }] = vals; + +assert.sameValue(x, undefined); +assert.sameValue(length, 0); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-expr.js new file mode 100644 index 0000000000..c19d6c3d1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-expr.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var iterationResult, iter, x; + +iter = (function*() { + +var result; +var vals = [{}]; + +result = [...{ x = yield }] = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x, undefined); + +iterationResult = iter.next(4); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x, 4); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..45d52fb208 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, [...{ x = yield }] = [{}]; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-valid.js new file mode 100644 index 0000000000..49a63f6a8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 2; +var x; + +var result; +var vals = [{}]; + +result = [...{ x = yield }] = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj.js new file mode 100644 index 0000000000..064a3eead0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-nested-obj.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-nested-obj.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = [1, 2, 3]; + +result = [...{ 1: x }] = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-const.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-const.js new file mode 100644 index 0000000000..78b2e86304 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-const.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-const.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `const` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [const, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +const c = null; + +assert.throws(TypeError, function() { + 0, [ ...c ] = [1]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-let.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-let.js new file mode 100644 index 0000000000..b4147637b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-let.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-let.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `let` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [let, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, [ ...x ] = []; +}); + +let x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-no-get.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-no-get.js new file mode 100644 index 0000000000..6ec8b83172 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-no-get.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-prop-ref-no-get.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var setValue; +var x = { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}; + +var result; +var vals = [23, 45, 99]; + +result = [...x.y] = vals; + +assert.sameValue(setValue.length, 3); +assert.sameValue(setValue[0], 23); +assert.sameValue(setValue[1], 45); +assert.sameValue(setValue[2], 99); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js new file mode 100644 index 0000000000..ca7d2f3e9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err-iter-close-skip.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-prop-ref-user-err-iter-close-skip.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: IteratorClose is not called when value assignment produces an abrupt completion. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ] + + [...] + 5. Let result be the result of performing + IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with + iteratorRecord as the argument + 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, + result). + + AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget + + [...] + 4. Repeat while iteratorRecord.[[done]] is false + [...] + d. If next is false, set iteratorRecord.[[done]] to true. + [...] + 5. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an + ArrayLiteral, then + a. Return PutValue(lref, A). + +---*/ +var nextCount = 0; +var returnCount = 0; +var iterable = {}; +var iterator = { + next: function() { + nextCount += 1; + return { done: true }; + }, + return: function() { + returnCount += 1; + } +}; +var obj = Object.defineProperty({}, 'poisoned', { + set: function(x) { + throw new Test262Error(); + } +}); +iterable[Symbol.iterator] = function() { + return iterator; +}; + +assert.throws(Test262Error, function() { + 0, [...obj.poisoned] = iterable; +}); + +assert.sameValue(nextCount, 1); +assert.sameValue(returnCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err.js new file mode 100644 index 0000000000..8265b28bf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref-user-err.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-prop-ref-user-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Any error raised as a result of setting the value should be forwarded to the runtime. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = { + set y(val) { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + 0, [...x.y] = [23]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref.js new file mode 100644 index 0000000000..0aa5d01042 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-prop-ref.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-prop-ref.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = {}; + +var result; +var vals = [4, 3, 2]; + +result = [...x.y] = vals; + +assert.sameValue(x.y.length, 3); +assert.sameValue(x.y[0], 4); +assert.sameValue(x.y[1], 3); +assert.sameValue(x.y[2], 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-no-strict.js new file mode 100644 index 0000000000..b6aa3bc182 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-no-strict.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-unresolvable-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +{ + +var result; +var vals = []; + +result = [ ...unresolvable ] = vals; + + + +assert.sameValue(result, vals); + +} + +assert.sameValue(unresolvable.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-strict-strict.js new file mode 100644 index 0000000000..9259515c07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-put-unresolvable-strict-strict.js @@ -0,0 +1,24 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-put-unresolvable-strict.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, [ ...unresolvable ] = []; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-expr.js new file mode 100644 index 0000000000..18d828315a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-expr.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and within the body of a generator function, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = {}; +var iterationResult, iter; + +iter = (function*() { + +var result; +var vals = [33, 44, 55]; + +result = [...x[yield]] = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x.prop, undefined); + +iterationResult = iter.next('prop'); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x.prop.length, 3); +assert.sameValue(x.prop[0], 33); +assert.sameValue(x.prop[1], 44); +assert.sameValue(x.prop[2], 55); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..eecefb75a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-invalid-strict.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); +var x = {}; + +0, [...x[yield]] = []; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-valid.js new file mode 100644 index 0000000000..da7097314c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/array-rest-yield-ident-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/array-rest-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentRestElement and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 'prop'; +var x = {}; + +var result; +var vals = [33, 44, 55]; + +result = [...x[yield]] = vals; + +assert.sameValue(x.prop.length, 3); +assert.sameValue(x.prop[0], 33); +assert.sameValue(x.prop[1], 44); +assert.sameValue(x.prop[2], 55); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/browser.js b/js/src/tests/test262/language/expressions/assignment/dstr/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-break-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-break-escaped.js new file mode 100644 index 0000000000..f3302919de --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-break-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: break is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { bre\u0061k: x } = { break: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['break'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-case-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-case-escaped.js new file mode 100644 index 0000000000..e487afba5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-case-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: case is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { c\u0061se: x } = { case: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['case'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-catch-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-catch-escaped.js new file mode 100644 index 0000000000..4ddd4eefa5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-catch-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: catch is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { c\u0061tch: x } = { catch: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['catch'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-class-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-class-escaped.js new file mode 100644 index 0000000000..1179b693f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-class-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: class is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { cl\u0061ss: x } = { class: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['class'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-const-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-const-escaped.js new file mode 100644 index 0000000000..f8875ac7c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-const-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: const is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0063onst: x } = { const: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['const'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-continue-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-continue-escaped.js new file mode 100644 index 0000000000..f8314c8f1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-continue-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: continue is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0063ontinue: x } = { continue: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['continue'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-debugger-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-debugger-escaped.js new file mode 100644 index 0000000000..4c79f64111 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-debugger-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: debugger is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0064ebugger: x } = { debugger: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['debugger'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped-ext.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped-ext.js new file mode 100644 index 0000000000..17cd4152ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped-ext.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: default is a valid identifier name, using extended escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { def\u{61}ult: x } = { default: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['default'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped.js new file mode 100644 index 0000000000..bca7f3aade --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: default is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { def\u0061ult: x } = { default: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['default'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default.js new file mode 100644 index 0000000000..9bbba5e211 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-default.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: default is a valid identifier name (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { default: x } = { default: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['default'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-delete-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-delete-escaped.js new file mode 100644 index 0000000000..5df2b28dda --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-delete-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: delete is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0064elete: x } = { delete: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['delete'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-do-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-do-escaped.js new file mode 100644 index 0000000000..31624d5e1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-do-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: do is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0064o: x } = { do: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['do'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-else-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-else-escaped.js new file mode 100644 index 0000000000..0f43750477 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-else-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: else is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0065lse: x } = { else: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['else'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-enum-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-enum-escaped.js new file mode 100644 index 0000000000..7b42edf66d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-enum-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: enum is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0065num: x } = { enum: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['enum'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-export-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-export-escaped.js new file mode 100644 index 0000000000..813695821d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-export-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: export is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0065xport: x } = { export: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['export'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped-ext.js new file mode 100644 index 0000000000..4185adae44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped-ext.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: extends is a valid identifier name, using extended escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u{65}xtends: x } = { extends: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['extends'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped.js new file mode 100644 index 0000000000..5a2aeb01d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: extends is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0065xtends: x } = { extends: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['extends'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends.js new file mode 100644 index 0000000000..9502374c62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-extends.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: extends is a valid identifier name (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { extends: x } = { extends: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['extends'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-finally-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-finally-escaped.js new file mode 100644 index 0000000000..f30bcd67b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-finally-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: finally is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0066inally: x } = { finally: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['finally'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-for-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-for-escaped.js new file mode 100644 index 0000000000..5a8ad4abe1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-for-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: for is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0066or: x } = { for: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['for'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-function-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-function-escaped.js new file mode 100644 index 0000000000..727c213786 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-function-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: function is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0066unction: x } = { function: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['function'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-if-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-if-escaped.js new file mode 100644 index 0000000000..2d28ca7849 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-if-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: if is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { i\u0066: x } = { if: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['if'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-implements-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-implements-escaped.js new file mode 100644 index 0000000000..b9eb90b619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-implements-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: implements is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0069mplements: x } = { implements: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['implements'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-import-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-import-escaped.js new file mode 100644 index 0000000000..8553f5c1ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-import-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: import is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0069mport: x } = { import: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['import'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-in-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-in-escaped.js new file mode 100644 index 0000000000..3d07e44893 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-in-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: in is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0069n: x } = { in: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['in'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-instanceof-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-instanceof-escaped.js new file mode 100644 index 0000000000..d54cb421b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-instanceof-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: instanceof is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { \u0069nstanceof: x } = { instanceof: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['instanceof'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-interface-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-interface-escaped.js new file mode 100644 index 0000000000..56310b2519 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-interface-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: interface is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { interf\u0061ce: x } = { interface: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['interface'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-let-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-let-escaped.js new file mode 100644 index 0000000000..d5bca3d4b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-let-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: let is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { l\u0065t: x } = { let: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['let'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-new-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-new-escaped.js new file mode 100644 index 0000000000..6e89cad5f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-new-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: new is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { n\u0065w: x } = { new: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['new'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-package-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-package-escaped.js new file mode 100644 index 0000000000..95098e7c00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-package-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: package is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { p\u0061ckage: x } = { package: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['package'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-private-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-private-escaped.js new file mode 100644 index 0000000000..552cd4f612 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-private-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: private is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { privat\u0065: x } = { private: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['private'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-protected-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-protected-escaped.js new file mode 100644 index 0000000000..0f8fa5c8aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-protected-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: protected is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { prot\u0065cted: x } = { protected: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['protected'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-public-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-public-escaped.js new file mode 100644 index 0000000000..577a3a161a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-public-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: public is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { pu\u0062lic: x } = { public: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['public'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-return-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-return-escaped.js new file mode 100644 index 0000000000..e38ada8a84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-return-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: return is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { r\u0065turn: x } = { return: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['return'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-static-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-static-escaped.js new file mode 100644 index 0000000000..b6d90b4708 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-static-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-prop-name.template +/*--- +description: static is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { st\u0061tic: x } = { static: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['static'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-super-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-super-escaped.js new file mode 100644 index 0000000000..0034acb501 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-super-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: super is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { sup\u0065r: x } = { super: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['super'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-switch-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-switch-escaped.js new file mode 100644 index 0000000000..9f4eacb8aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-switch-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: switch is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { sw\u0069tch: x } = { switch: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['switch'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-this-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-this-escaped.js new file mode 100644 index 0000000000..8d79281d61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-this-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: this is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { th\u0069s: x } = { this: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['this'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-throw-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-throw-escaped.js new file mode 100644 index 0000000000..a415369746 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-throw-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: throw is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { t\u0068row: x } = { throw: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['throw'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-try-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-try-escaped.js new file mode 100644 index 0000000000..e6daf9f44d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-try-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: try is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { tr\u0079: x } = { try: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['try'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-typeof-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-typeof-escaped.js new file mode 100644 index 0000000000..235dc02849 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-typeof-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: typeof is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { typ\u0065of: x } = { typeof: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['typeof'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-var-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-var-escaped.js new file mode 100644 index 0000000000..394e1b1652 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-var-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: var is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { v\u0061r: x } = { var: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['var'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-void-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-void-escaped.js new file mode 100644 index 0000000000..4487b69484 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-void-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: void is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { voi\u0064: x } = { void: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['void'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-while-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-while-escaped.js new file mode 100644 index 0000000000..990bdbec0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-while-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: while is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { whil\u0065: x } = { while: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['while'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-with-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-with-escaped.js new file mode 100644 index 0000000000..f581ef26f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/ident-name-prop-name-literal-with-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/obj-assignment-prop-name.template +/*--- +description: with is a valid identifier name, using escape (PropertyName of an ObjectAssignmentPattern) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, noStrict] +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var y = { w\u0069th: x } = { with: 42 }; + +assert.sameValue(x, 42, 'property exists'); +assert.sameValue(y['with'], 42, 'assignment successful'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-bool.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-bool.js new file mode 100644 index 0000000000..0a3e70db40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-bool.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-empty-bool.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (boolean value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = false; + +result = {} = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-null.js new file mode 100644 index 0000000000..864f2fc492 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-null.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-empty-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (null value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, {} = null; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-num.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-num.js new file mode 100644 index 0000000000..e86dbcf1ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-num.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-empty-num.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (number value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = 0; + +result = {} = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-obj.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-obj.js new file mode 100644 index 0000000000..25d50462d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-obj.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-empty-obj.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (object value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = {}; + +result = {} = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-string.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-string.js new file mode 100644 index 0000000000..d9aed2cf3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-string.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-empty-string.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (string value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +var result; +var vals = ''; + +result = {} = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-symbol.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-symbol.js new file mode 100644 index 0000000000..7602964816 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-symbol.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-empty-symbol.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (symbol value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var s = Symbol(); + +var result; +var vals = s; + +result = {} = vals; + + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-undef.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-undef.js new file mode 100644 index 0000000000..80ffa5a55d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-empty-undef.js @@ -0,0 +1,23 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-empty-undef.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: An ObjectAssignmentPattern without an AssignmentPropertyList requires an object-coercible value (undefined value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(TypeError, function() { + 0, {} = undefined; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-first.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-first.js new file mode 100644 index 0000000000..e9dac12e35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-first.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-resolution-first.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (first of many) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +var y; + +var result; +var vals = { x: 3 }; + +result = { x, y } = vals; + +assert.sameValue(x, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-last.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-last.js new file mode 100644 index 0000000000..54b833dce1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-last.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-resolution-last.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (last of many) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +var w; + +var result; +var vals = { x: 4 }; + +result = { w, x } = vals; + +assert.sameValue(x, 4); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-lone.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-lone.js new file mode 100644 index 0000000000..c88aebabcd --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-lone.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-resolution-lone.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (lone identifier) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; + +var result; +var vals = { x: 2 }; + +result = { x, } = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-middle.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-middle.js new file mode 100644 index 0000000000..62762c40fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-middle.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-resolution-middle.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (within many) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +var w, y; + +var result; +var vals = { x: 5 }; + +result = { w, x, y } = vals; + +assert.sameValue(x, 5); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-trlng.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-trlng.js new file mode 100644 index 0000000000..5c4bef3b12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-resolution-trlng.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-resolution-trlng.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (lone identifier with trailing comma) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; + +var result; +var vals = { x: 1 }; + +result = { x } = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-expr.js new file mode 100644 index 0000000000..6ca77fcf52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-expr.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-yield-expr.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: yield is not a valid IdentifierReference in an AssignmentProperty within generator function bodies. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); +(function*() { + +0, { yield } = {}; + +}); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..8b62852334 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: yield is not a valid IdentifierReference in an AssignmentProperty within strict mode code. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { yield } = {}; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-valid.js new file mode 100644 index 0000000000..4b55761131 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-identifier-yield-ident-valid.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-identifier-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: yield is a valid IdentifierReference in an AssignmentProperty outside of strict mode and generator functions. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield; + +var result; +var vals = { yield: 3 }; + +result = { yield } = vals; + +assert.sameValue(yield, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-missing.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-missing.js new file mode 100644 index 0000000000..ff0a8685eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-missing.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-assignment-missing.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (no corresponding property defined). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = {}; + +result = { x = 1 } = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-null.js new file mode 100644 index 0000000000..dc8014ede7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-null.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-assignment-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (null property value defined). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = { x: null }; + +result = { x = 1 } = vals; + +assert.sameValue(x, null); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-truthy.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-truthy.js new file mode 100644 index 0000000000..113dce8228 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-truthy.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-assignment-truthy.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy property value defined). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = { x: 2 }; + +result = { x = 1 } = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-undef.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-undef.js new file mode 100644 index 0000000000..153452a176 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-assignment-undef.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-assignment-undef.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference ("undefined" property value defined). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = { x: undefined }; + +result = { x = 1 } = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-evaluation.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-evaluation.js new file mode 100644 index 0000000000..af646d43f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-evaluation.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-evaluation.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The Initializer should only be evaluated if v is undefined. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var flag1 = false; +var flag2 = false; +var x, y; + +var result; +var vals = { y: 1 }; + +result = { x = flag1 = true, y = flag2 = true } = vals; + +assert.sameValue(flag1, true); +assert.sameValue(flag2, false); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..f52a00666e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-arrow.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-fn-name-arrow.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (ArrowFunction) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentProperty : IdentifierReference Initializeropt + [...] 6. If Initializeropt is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, P). + +---*/ +var arrow; + +var result; +var vals = {}; + +result = { arrow = () => {} } = vals; + +verifyProperty(arrow, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'arrow' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-class.js new file mode 100644 index 0000000000..3b0ea36979 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-class.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-fn-name-class.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (ClassExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [class, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentProperty : IdentifierReference Initializeropt + [...] 6. If Initializeropt is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, P). + +---*/ +var xCls, cls, xCls2; + +var result; +var vals = {}; + +result = { xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } } = vals; + +assert.notSameValue(xCls.name, 'xCls'); +assert.notSameValue(xCls2.name, 'xCls2'); + +verifyProperty(cls, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'cls' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-cover.js new file mode 100644 index 0000000000..53d2ac1f63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-cover.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-fn-name-cover.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (CoverParenthesizedExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentProperty : IdentifierReference Initializeropt + [...] 6. If Initializeropt is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, P). + +---*/ +var xCover, cover; + +var result; +var vals = {}; + +result = { xCover = (0, function() {}), cover = (function() {}) } = vals; + +assert.notSameValue(xCover.name, 'xCover'); + +verifyProperty(cover, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'cover' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-fn.js new file mode 100644 index 0000000000..d5d9c4aad3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-fn.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-fn-name-fn.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (FunctionExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentProperty : IdentifierReference Initializeropt + [...] 6. If Initializeropt is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, P). + +---*/ +var xFn, fn; + +var result; +var vals = {}; + +result = { xFn = function x() {}, fn = function() {} } = vals; + +assert.notSameValue(xFn.name, 'xFn'); + +verifyProperty(fn, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'fn' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-gen.js new file mode 100644 index 0000000000..192c957e00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-fn-name-gen.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-fn-name-gen.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (GeneratorExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentProperty : IdentifierReference Initializeropt + [...] 6. If Initializeropt is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, P). + +---*/ +var xGen, gen; + +var result; +var vals = {}; + +result = { xGen = function* x() {}, gen = function*() {} } = vals; + +assert.notSameValue(xGen.name, 'xGen'); + +verifyProperty(gen, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'gen' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-in.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-in.js new file mode 100644 index 0000000000..ed0ab551e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-in.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-in.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The Initializer in an AssignmentProperty may be an `in` expression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var prop; + +var result; +var vals = {}; + +result = { prop = 'x' in {} } = vals; + +assert.sameValue(prop, false); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-let.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-let.js new file mode 100644 index 0000000000..0198aa5f88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-let.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-let.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Value retrieval of Initializer obeys `let` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [let, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(ReferenceError, function() { + 0, { x = y } = {}; +}); + +let y; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-order.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-order.js new file mode 100644 index 0000000000..3d7fe2fae6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-order.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-order.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Initializer values should be assigned in left-to-right order. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = 0; +var a, b; + +var result; +var vals = {}; + +result = { a = x += 1, b = x *= 2 } = vals; + +assert.sameValue(a, 1); +assert.sameValue(b, 2); +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-no-strict.js new file mode 100644 index 0000000000..fc5b04ee2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-no-strict.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-simple-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var eval, arguments; + +var result; +var vals = {}; + +result = { eval = 3, arguments = 4 } = vals; + +assert.sameValue(eval, 3); +assert.sameValue(arguments, 4); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-strict-strict.js new file mode 100644 index 0000000000..b108c3cec5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-simple-strict-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-simple-strict.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if IsValidSimpleAssignmentTarget of IdentifierReference is false. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { eval = 0 } = {}; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-expr.js new file mode 100644 index 0000000000..4e47a1872e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-expr.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentProperty and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var iterationResult, x, iter; + +iter = (function*() { + +var result; +var vals = {}; + +result = { x = yield } = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x, undefined); + +iterationResult = iter.next(3); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x, 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..4e56c9ec35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentProperty and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { x = yield } = {}; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-valid.js new file mode 100644 index 0000000000..e7bed310df --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-init-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-init-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentProperty and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 3; +var x; + +var result; +var vals = {}; + +result = { x = yield } = vals; + +assert.sameValue(x, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-const.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-const.js new file mode 100644 index 0000000000..ec963a9aca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-const.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-put-const.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `const` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [const, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +const c = null; + +assert.throws(TypeError, function() { + 0, { c } = { c: 1 }; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-let.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-let.js new file mode 100644 index 0000000000..0aaf7c4238 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-let.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-put-let.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `let` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [let, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, { x } = {}; +}); + +let x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-no-strict.js new file mode 100644 index 0000000000..789446d242 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-no-strict.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-put-unresolvable-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +{ + +var result; +var vals = {}; + +result = { unresolvable } = vals; + + + +assert.sameValue(result, vals); + +} + +assert.sameValue(unresolvable, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-strict-strict.js new file mode 100644 index 0000000000..65b53f6c14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-put-unresolvable-strict-strict.js @@ -0,0 +1,24 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-put-unresolvable-strict.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, { unresolvable } = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-no-strict.js new file mode 100644 index 0000000000..ff3c3f4370 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-no-strict.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-simple-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var eval, arguments; + +var result; +var vals = { eval: 1, arguments: 2 }; + +result = { eval, arguments } = vals; + + + +assert.sameValue(result, vals); + +assert.sameValue(eval, 1); +assert.sameValue(arguments, 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-strict-strict.js new file mode 100644 index 0000000000..5eacfa0706 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-id-simple-strict-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-id-simple-strict.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if IsValidSimpleAssignmentTarget of IdentifierReference is false. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { eval } = {}; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-missing.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-missing.js new file mode 100644 index 0000000000..4162200ec9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-missing.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-assignment-missing.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (non-existent property) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = {}; + +result = { y: x = 1 } = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-null.js new file mode 100644 index 0000000000..934717387f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-null.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-assignment-null.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (null value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = { y: null }; + +result = { y: x = 1 } = vals; + +assert.sameValue(x, null); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-truthy.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-truthy.js new file mode 100644 index 0000000000..c820858676 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-truthy.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-assignment-truthy.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is not undefined, the Initializer should be evaluated and the result assigned to the target reference (truthy value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = { y: 2 }; + +result = { y: x = 1 } = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-undef.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-undef.js new file mode 100644 index 0000000000..1229fb58c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-assignment-undef.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-assignment-undef.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference (undefined value) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = { y: undefined }; + +result = { y: x = 1 } = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-evaluation.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-evaluation.js new file mode 100644 index 0000000000..1426148e15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-evaluation.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-evaluation.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The Initializer should only be evaluated if v is undefined. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var flag1 = false; +var flag2 = false; +var x, y; + +var result; +var vals = { y: 1 }; + +result = { x: x = flag1 = true, y: y = flag2 = true } = vals; + +assert.sameValue(x, true, 'value of `x`'); +assert.sameValue(flag1, true, 'value of `flag1`'); +assert.sameValue(y, 1, 'value of `y`'); +assert.sameValue(flag2, false, 'value of `flag2`'); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-arrow.js new file mode 100644 index 0000000000..353db9e6a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-arrow.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-fn-name-arrow.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (ArrowFunction) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and v is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(rhsValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(rhsValue, + GetReferencedName(lref)). + +---*/ +var arrow; + +var result; +var vals = {}; + +result = { x: arrow = () => {} } = vals; + +verifyProperty(arrow, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'arrow' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-class.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-class.js new file mode 100644 index 0000000000..5e73a4159e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-class.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-fn-name-class.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (ClassExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [class, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and v is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(rhsValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(rhsValue, + GetReferencedName(lref)). + +---*/ +var xCls, cls, xCls2; + +var result; +var vals = {}; + +result = { x: xCls = class x {}, x: cls = class {}, x: xCls2 = class { static name() {} } } = vals; + +assert.notSameValue(xCls.name, 'xCls'); +assert.notSameValue(xCls2.name, 'xCls2'); + +verifyProperty(cls, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'cls' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-cover.js new file mode 100644 index 0000000000..988d4736c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-cover.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-fn-name-cover.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (CoverParenthesizedExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and v is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(rhsValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(rhsValue, + GetReferencedName(lref)). + +---*/ +var xCover, cover; + +var result; +var vals = {}; + +result = { x: xCover = (0, function() {}), x: cover = (function() {}) } = vals; + +assert.notSameValue(xCover.name, 'xCover'); + +verifyProperty(cover, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'cover' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-fn.js new file mode 100644 index 0000000000..ff6f58bd21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-fn.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-fn-name-fn.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (FunctionExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and v is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(rhsValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(rhsValue, + GetReferencedName(lref)). + +---*/ +var xFn, fn; + +var result; +var vals = {}; + +result = { x: xFn = function x() {}, x: fn = function() {} } = vals; + +assert.notSameValue(xFn.name, 'xFn'); + +verifyProperty(fn, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'fn' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-gen.js new file mode 100644 index 0000000000..94eb2e7f13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-fn-name-gen.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-fn-name-gen.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Assignment of function `name` attribute (GeneratorExpression) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt + [...] 7. If Initializer is present and v is undefined and + IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of + DestructuringAssignmentTarget are both true, then + a. Let hasNameProperty be HasOwnProperty(rhsValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(rhsValue, + GetReferencedName(lref)). + +---*/ +var xGen, gen; + +var result; +var vals = {}; + +result = { x: xGen = function* x() {}, x: gen = function*() {} } = vals; + +assert.notSameValue(xGen.name, 'xGen'); + +verifyProperty(gen, 'name', { + enumerable: false, + writable: false, + configurable: true, + value: 'gen' +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-in.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-in.js new file mode 100644 index 0000000000..def4b5f246 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-in.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-in.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The Initializer in an AssignmentElement may be an `in` expression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var prop; + +var result; +var vals = {}; + +result = { x: prop = 'x' in {} } = vals; + +assert.sameValue(prop, false); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-let.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-let.js new file mode 100644 index 0000000000..ab885d9f71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-let.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-let.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Value retrieval of Initializer obeys `let` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [let, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(ReferenceError, function() { + 0, { x: x = y } = {}; +}); + +let y; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-expr.js new file mode 100644 index 0000000000..1fdcf239d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-expr.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentElement and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var iterationResult, iter, x; +iter = (function*() { + +var result; +var vals = {}; + +result = { x: x = yield } = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x, undefined); + +iterationResult = iter.next(86); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x, 86); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..06b04242e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { x: x = yield } = {}; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-valid.js new file mode 100644 index 0000000000..12d458c9c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-init-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-init-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 4; +var x; + +var result; +var vals = {}; + +result = { x: x = yield } = vals; + +assert.sameValue(x, 4); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js new file mode 100644 index 0000000000..b186432078 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.js @@ -0,0 +1,57 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-memberexpr-optchain-prop-ref-init.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (MemberExpression OptionalChain .IdentifierName Initializer) (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [optional-chaining, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + OptionalExpression: + MemberExpression OptionalChain + CallExpression OptionalChain + OptionalExpression OptionalChain + + OptionalChain: + ?. [ Expression ] + ?. IdentifierName + ?. Arguments + ?. TemplateLiteral + OptionalChain [ Expression ] + OptionalChain .IdentifierName + OptionalChain Arguments + OptionalChain TemplateLiteral + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true. + + Static Semantics: IsValidSimpleAssignmentTarget + + LeftHandSideExpression : OptionalExpression + 1. Return false. + +---*/ +$DONOTEVALUATE(); +var y = {}; + +0, { x: y?.z = 42 } = { x: 23 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js new file mode 100644 index 0000000000..d0b80f742e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-obj-literal-optchain-prop-ref-init.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple Using Object (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [optional-chaining, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + OptionalExpression: + MemberExpression OptionalChain + CallExpression OptionalChain + OptionalExpression OptionalChain + + OptionalChain: + ?. [ Expression ] + ?. IdentifierName + ?. Arguments + ?. TemplateLiteral + OptionalChain [ Expression ] + OptionalChain .IdentifierName + OptionalChain Arguments + OptionalChain TemplateLiteral + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true. + + Static Semantics: IsValidSimpleAssignmentTarget + + LeftHandSideExpression : OptionalExpression + 1. Return false. + +---*/ +$DONOTEVALUATE(); + +0, { x: { + set y(val) { + throw new Test262Error('The property should not be accessed.'); + } +}?.y = 42} = {x: 42}; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js new file mode 100644 index 0000000000..1af5151a3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init-active.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref-init-active.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with active initializer. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentPattern : ObjectAssignmentPattern + ObjectAssignmentPattern : { AssignmentPropertyList } + AssignmentPropertyList : AssignmentProperty + AssignmentProperty : PropertyName : AssignmentElement + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern. + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple. + + Runtime Semantics: DestructuringAssignmentEvaluation + ObjectAssignmentPattern : { AssignmentPropertyList } + + 1. Perform ? RequireObjectCoercible(value). + 2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument. + 3. Return NormalCompletion(empty). + + Runtime Semantics: PropertyDestructuringAssignmentEvaluation + + AssignmentProperty : PropertyName : AssignmentElement + + 1. Let name be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(name). + 3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments. + 4. Return a new List containing name. + + Runtime Semantics: KeyedDestructuringAssignmentEvaluation + + AssignmentElement : DestructuringAssignmentTarget Initializer + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + ... + +---*/ +var setValue; + +var result; +var vals = {x: undefined}; + +result = { x: { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42} = vals; + +assert.sameValue(setValue, 42); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js new file mode 100644 index 0000000000..0e9560589c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref-init.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref-init.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with initializer. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentPattern : ObjectAssignmentPattern + ObjectAssignmentPattern : { AssignmentPropertyList } + AssignmentPropertyList : AssignmentProperty + AssignmentProperty : PropertyName : AssignmentElement + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern. + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple. + + Runtime Semantics: DestructuringAssignmentEvaluation + ObjectAssignmentPattern : { AssignmentPropertyList } + + 1. Perform ? RequireObjectCoercible(value). + 2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument. + 3. Return NormalCompletion(empty). + + Runtime Semantics: PropertyDestructuringAssignmentEvaluation + + AssignmentProperty : PropertyName : AssignmentElement + + 1. Let name be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(name). + 3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments. + 4. Return a new List containing name. + + Runtime Semantics: KeyedDestructuringAssignmentEvaluation + + AssignmentElement : DestructuringAssignmentTarget Initializer + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + ... + +---*/ +var setValue; + +var result; +var vals = {x: 23}; + +result = { x: { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y = 42} = vals; + +assert.sameValue(setValue, 23); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref.js new file mode 100644 index 0000000000..ec5453c000 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-obj-literal-prop-ref.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. + + Syntax + + AssignmentPattern : ObjectAssignmentPattern + ObjectAssignmentPattern : { AssignmentPropertyList } + AssignmentPropertyList : AssignmentProperty + AssignmentProperty : PropertyName : AssignmentElement + AssignmentElement : DestructuringAssignmentTarget Initializer_opt + DestructuringAssignmentTarget : LeftHandSideExpression + + Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + - It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern. + - It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple. + + Runtime Semantics: DestructuringAssignmentEvaluation + ObjectAssignmentPattern : { AssignmentPropertyList } + + 1. Perform ? RequireObjectCoercible(value). + 2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument. + 3. Return NormalCompletion(empty). + + Runtime Semantics: PropertyDestructuringAssignmentEvaluation + + AssignmentProperty : PropertyName : AssignmentElement + + 1. Let name be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(name). + 3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments. + 4. Return a new List containing name. + + Runtime Semantics: KeyedDestructuringAssignmentEvaluation + + AssignmentElement : DestructuringAssignmentTarget Initializer + + 1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then + a. Let lref be the result of evaluating DestructuringAssignmentTarget. + ... + +---*/ +var setValue; + +var result; +var vals = {x: 23}; + +result = { x: { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}.y} = vals; + +assert.sameValue(setValue, 23); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-expr.js new file mode 100644 index 0000000000..b0856136d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-expr.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = {}; +var iterationResult, iter; + +iter = (function*() { + +var result; +var vals = { x: 23 }; + +result = { x: x[yield] } = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x.prop, undefined); + +iterationResult = iter.next('prop'); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x.prop, 23); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..102e371bcf --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { x: x[yield] } = {}; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-valid.js new file mode 100644 index 0000000000..792a3647cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-elem-target-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-elem-target-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 'prop'; +var x = {}; + +var result; +var vals = { x: 23 }; + +result = { x: x[yield] } = vals; + +assert.sameValue(x.prop, 23); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-first.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-first.js new file mode 100644 index 0000000000..254311e74b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-first.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-identifier-resolution-first.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (first of many). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +var y; + +var result; +var vals = { a: 3 }; + +result = { a: x, y } = vals; + +assert.sameValue(x, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-last.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-last.js new file mode 100644 index 0000000000..8d2fb78a54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-last.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-identifier-resolution-last.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (last of many). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +var w; + +var result; +var vals = { a: 4 }; + +result = { w, a: x } = vals; + +assert.sameValue(x, 4); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-lone.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-lone.js new file mode 100644 index 0000000000..6c2eb1194c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-lone.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-identifier-resolution-lone.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (lone element). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; + +var result; +var vals = { a: 1 }; + +result = { a: x } = vals; + +assert.sameValue(x, 1); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-middle.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-middle.js new file mode 100644 index 0000000000..687b89b83a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-middle.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-identifier-resolution-middle.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (within many). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; +var w, y; + +var result; +var vals = { a: 5 }; + +result = { w, a: x, y } = vals; + +assert.sameValue(x, 5); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-trlng.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-trlng.js new file mode 100644 index 0000000000..6d8bbaab70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-identifier-resolution-trlng.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-identifier-resolution-trlng.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Evaluation of DestructuringAssignmentTarget (lone element with trailing comma). (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = null; + +var result; +var vals = { a: 2 }; + +result = { a: x, } = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation-error.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation-error.js new file mode 100644 index 0000000000..661e6cedf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation-error.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-name-evaluation-error.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Any error raised as a result of evaluating PropertyName should be forwarded to the runtime. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a, x; + +assert.throws(TypeError, function() { + 0, { [a.b]: x } = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation.js new file mode 100644 index 0000000000..dd5b19795f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-name-evaluation.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-name-evaluation.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: PropertyName of an AssignmentProperty may be a ComputedPropertyName. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x, y, xy; + +var result; +var vals = { x: 1, xy: 23, y: 2 }; + +result = { ['x' + 'y']: x } = vals; + +assert.sameValue(x, 23); +assert.sameValue(y, undefined); +assert.sameValue(xy, undefined); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-invalid.js new file mode 100644 index 0000000000..969c72ffff --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-invalid.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { x: [(x, y)] } = { x: [] }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-null.js new file mode 100644 index 0000000000..dee74a0b37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-null.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the value is `null`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, { x: [ x ] } = { x: null }; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined-own.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined-own.js new file mode 100644 index 0000000000..c54cd5a2f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined-own.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array-undefined-own.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the value is `undefined`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, { x: [ x ] } = { x: undefined }; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined.js new file mode 100644 index 0000000000..2cdf77353c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-undefined.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array-undefined.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal and the value is not defined, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, { x: [ x ] } = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-expr.js new file mode 100644 index 0000000000..60c6799f1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-expr.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var iterationResult, iter, x; + +iter = (function*() { + +var result; +var vals = { x: [] }; + +result = { x: [x = yield] } = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x, undefined); + +iterationResult = iter.next(24601); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x, 24601); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..a5069df25a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { x: [x = yield] } = { x: [] }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-valid.js new file mode 100644 index 0000000000..6a05f43771 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 22; +var x; + +var result; +var vals = { x: [] }; + +result = { x: [x = yield] } = vals; + +assert.sameValue(x, 22); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array.js new file mode 100644 index 0000000000..75de956ec0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-array.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-array.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var y; + +var result; +var vals = { x: [321] }; + +result = { x: [y] } = vals; + +assert.sameValue(y, 321); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-invalid.js new file mode 100644 index 0000000000..9963d779a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-invalid.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { x: { get x() {} } } = { x: {} }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-null.js new file mode 100644 index 0000000000..7f4128cc77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-null.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and the value is `null`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, { x: { x } } = { x: null }; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined-own.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined-own.js new file mode 100644 index 0000000000..0818d0b8fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined-own.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj-undefined-own.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and the value is `undefined`, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, { x: { x } } = { x: undefined }; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined.js new file mode 100644 index 0000000000..10da50bd6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-undefined.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj-undefined.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal and the value is not defined, a TypeError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +assert.throws(TypeError, function() { + 0, { x: { x } } = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-expr.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-expr.js new file mode 100644 index 0000000000..12c6b1d113 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-expr.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj-yield-expr.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var iterationResult, iter, x = undefined; + +iter = (function*() { + +var result; +var vals = { x: {} }; + +result = { x: { x = yield } } = vals; + + + +assert.sameValue(result, vals); + +}()); + +iterationResult = iter.next(); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, false); +assert.sameValue(x, undefined); + +iterationResult = iter.next(4); + +assert.sameValue(iterationResult.value, undefined); +assert.sameValue(iterationResult.done, true); +assert.sameValue(x, 4); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..4a5ecc8e53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-invalid-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj-yield-ident-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); + +0, { x: { x = yield } } = { x: {} }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-valid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-valid.js new file mode 100644 index 0000000000..03e5f6a40a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj-yield-ident-valid.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj-yield-ident-valid.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When a `yield` token appears within the Initializer of a nested destructuring assignment and outside of a generator function body, it should behave as an IdentifierReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var yield = 2; +var result, x; + +var result; +var vals = { x: {} }; + +result = { x: { x = yield } } = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj.js new file mode 100644 index 0000000000..0f5a84f5cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-nested-obj.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-nested-obj.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object literal, it should be parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var result, y; + +var result; +var vals = { x: { y: 2 } }; + +result = { x: { y } } = vals; + +assert.sameValue(y, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-const.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-const.js new file mode 100644 index 0000000000..33e1ad8d0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-const.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-const.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `const` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [const, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +const c = 1; + +assert.throws(TypeError, function() { + 0, { a: c } = { a: 2 }; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-let.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-let.js new file mode 100644 index 0000000000..65c55a18f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-let.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-let.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The assignment target should obey `let` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [let, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, { a: x } = {}; +}); + +let x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-order.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-order.js new file mode 100644 index 0000000000..cf9bc3e7a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-order.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-order.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The AssignmentElements in an AssignmentElementList are evaluated in left- to-right order. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; + +var result; +var vals = { a: 2, z: 1 }; + +result = { z: x, a: x } = vals; + +assert.sameValue(x, 2); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-no-get.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-no-get.js new file mode 100644 index 0000000000..022e817e9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-no-get.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-prop-ref-no-get.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: If the DestructuringAssignmentTarget of an AssignmentElement is a PropertyReference, it should not be evaluated. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var setValue; +var x = { + get y() { + throw new Test262Error('The property should not be accessed.'); + }, + set y(val) { + setValue = val; + } +}; + +var result; +var vals = { a: 23 }; + +result = { a: x.y } = vals; + +assert.sameValue(setValue, 23); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-user-err.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-user-err.js new file mode 100644 index 0000000000..ef0a42b309 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref-user-err.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-prop-ref-user-err.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Any error raised as a result of setting the value should be forwarded to the runtime. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = { + set y(val) { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + 0, { a: x.y } = { a: 23 }; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref.js new file mode 100644 index 0000000000..3f1d3b389e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-prop-ref.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-prop-ref.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: The DestructuringAssignmentTarget of an AssignmentElement may be a PropertyReference. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x = {}; + +var result; +var vals = { xy: 4 }; + +result = { xy: x.y } = vals; + +assert.sameValue(x.y, 4); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-no-strict.js new file mode 100644 index 0000000000..0e46e0f6ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-no-strict.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-unresolvable-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Outside of strict mode, if the the assignment target is an unresolvable reference, a new `var` binding should be created in the environment record. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, noStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +{ + +var result; +var vals = {}; + +result = { x: unresolvable } = vals; + + + +assert.sameValue(result, vals); + +} + +assert.sameValue(unresolvable, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-strict-strict.js new file mode 100644 index 0000000000..e85875a580 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-prop-put-unresolvable-strict-strict.js @@ -0,0 +1,24 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-prop-put-unresolvable-strict.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated, onlyStrict] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ + +assert.throws(ReferenceError, function() { + 0, { x: unresolvable } = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property-no-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property-no-strict.js new file mode 100644 index 0000000000..bf76ec497a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property-no-strict.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-computed-property-no-strict.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a computed property, i.e it can be defined only at runtime. Rest operantion needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated, noStrict] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = "foo"; + +var result; +var vals = { foo: 1, bar: 2, baz: 3 }; + +result = {[a]:b, ...rest} = vals; + +assert.sameValue(b, 1); +assert.sameValue(rest.bar, 2); +assert.sameValue(rest.baz, 3); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "foo"), undefined); + +verifyProperty(rest, "bar", { + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(rest, "baz", { + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property.js new file mode 100644 index 0000000000..da00c69bf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-computed-property.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-computed-property.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a computed property, i.e it can be defined only at runtime. Rest operantion needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = "foo"; +var b, rest; + +var result; +var vals = { foo: 1, bar: 2, baz: 3 }; + +result = {[a]:b, ...rest} = vals; + +assert.sameValue(b, 1); +assert.sameValue(rest.bar, 2); +assert.sameValue(rest.baz, 3); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "foo"), undefined); + +verifyProperty(rest, "bar", { + enumerable: true, + writable: true, + configurable: true +}); + +verifyProperty(rest, "baz", { + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-descriptors.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-descriptors.js new file mode 100644 index 0000000000..4f15e7389c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-descriptors.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-descriptors.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Object created from rest deconstruction doesn't copy source object property descriptors. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; +var obj = {}; +Object.defineProperty(obj, "a", { value: 3, configurable: false, enumerable: true }); +Object.defineProperty(obj, "b", { value: 4, writable: false, enumerable: true }); + +var result; +var vals = obj; + +result = {...rest} = vals; + +verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 +}); + +verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-empty-obj.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-empty-obj.js new file mode 100644 index 0000000000..71bea4852e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-empty-obj.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-empty-obj.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: RestBindingInitialization creates a new object even if lhs is an empty object (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; + + +var result; +var vals = {}; + +result = {...rest} = vals; + +assert.notSameValue(rest, undefined); +assert.notSameValue(rest, null); +assert.sameValue(typeof rest, "object"); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter-abrupt-get-error.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter-abrupt-get-error.js new file mode 100644 index 0000000000..fa96091ae8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter-abrupt-get-error.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-getter-abrupt-get-error.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: Rest deconstruction doesn't happen if getter return is abrupt (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; +var count = 0; + +assert.throws(Test262Error, function() { + 0, {...x} = { get v() { count++; throw new Test262Error(); } }; +}); + +assert.sameValue(count, 1); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter.js new file mode 100644 index 0000000000..56abb3f8b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-getter.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-getter.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var x; +var count = 0; + +var result; +var vals = { get v() { count++; return 2; } }; + +result = {...x} = vals; + +assert.sameValue(count, 1); + +verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1.js new file mode 100644 index 0000000000..e2d14c2ffa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-non-string-computed-property-1.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = 1.; +var b, rest; + +var result; +var vals = {[a]: 1, bar: 2 }; + +result = {[a]:b, ...rest} = vals; + +assert.sameValue(b, 1); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined); + +verifyProperty(rest, "bar", { + value: 2, + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot.js new file mode 100644 index 0000000000..3bcee308a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-non-string-computed-property-1dot.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [compareArray.js, propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = 1.; +var b, rest; + +var result; +var vals = {[a]: [1], bar: 2 }; + +result = {[a]:b, ...rest} = vals; + +assert.compareArray(b, [1]); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined); + +verifyProperty(rest, "bar", { + value: 2, + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot0.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot0.js new file mode 100644 index 0000000000..9f9dac8e6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1dot0.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-non-string-computed-property-1dot0.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = 1.; +var b, rest; + +var result; +var vals = {[a]: 1.0, bar: 2 }; + +result = {[a]:b, ...rest} = vals; + +assert.sameValue(b, 1); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined); + +verifyProperty(rest, "bar", { + value: 2, + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1e0.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1e0.js new file mode 100644 index 0000000000..c14618f693 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-1e0.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-non-string-computed-property-1e0.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = 1.; +var b, rest; + +var result; +var vals = {[a]: 1e0, bar: 2 }; + +result = {[a]:b, ...rest} = vals; + +assert.sameValue(b, 1); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined); + +verifyProperty(rest, "bar", { + value: 2, + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1.js new file mode 100644 index 0000000000..1dca7cf988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-non-string-computed-property-array-1.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [compareArray.js, propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = 1.; +var b, rest; + +var result; +var vals = {[a]: [1], bar: 2 }; + +result = {[a]:b, ...rest} = vals; + +assert.compareArray(b, [1]); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined); + +verifyProperty(rest, "bar", { + value: 2, + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1e0.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1e0.js new file mode 100644 index 0000000000..b42f45876d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-array-1e0.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-non-string-computed-property-array-1e0.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [compareArray.js, propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = 1.; +var b, rest; + +var result; +var vals = {[a]: [1e0], bar: 2 }; + +result = {[a]:b, ...rest} = vals; + +assert.compareArray(b, [1]); + + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined); + +verifyProperty(rest, "bar", { + value: 2, + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-string-1.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-string-1.js new file mode 100644 index 0000000000..4a3fab8a11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-non-string-computed-property-string-1.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-non-string-computed-property-string-1.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Destructuring field can be a non-string computed property, i.e it can be defined only at runtime. Rest operation needs to skip these properties as well. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var a = 1.; +var b, rest; + +var result; +var vals = {[a]: "1", bar: 2 }; + +result = {[a]:b, ...rest} = vals; + +assert.sameValue(b, "1"); + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "1"), undefined); + +verifyProperty(rest, "bar", { + value: 2, + enumerable: true, + writable: true, + configurable: true +}); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-not-last-element-invalid.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-not-last-element-invalid.js new file mode 100644 index 0000000000..7b8df749b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-not-last-element-invalid.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-not-last-element-invalid.case +// - src/dstr-assignment/syntax/assignment-expr.template +/*--- +description: Object rest element needs to be the last AssignmenProperty in ObjectAssignmentPattern. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +$DONOTEVALUATE(); +var rest, b; + +0, {...rest, b} = {} +; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-number.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-number.js new file mode 100644 index 0000000000..30f97831b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-number.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-number.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: RestBindingInitialization creates a new object even if lhs is a Number (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; + + +var result; +var vals = 51; + +result = {...rest} = vals; + +assert.notSameValue(rest, undefined); +assert.notSameValue(rest, null); +assert(rest instanceof Object); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-order.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-order.js new file mode 100644 index 0000000000..ebe5ee76fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-order.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-order.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Rest operation follows [[OwnPropertyKeys]] order (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol, object-rest, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; +var calls = []; +var o = { get z() { calls.push('z') }, get a() { calls.push('a') } }; +Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true }); +Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true }); + +var result; +var vals = o; + +result = {...rest} = vals; + +assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); +assert.sameValue(Object.keys(rest).length, 3); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-put-const.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-put-const.js new file mode 100644 index 0000000000..e5fee31f33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-put-const.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-put-const.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: The object rest deconstruction assignment target should obey `const` semantics. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +const rest = null; + +assert.throws(TypeError, function() { + 0, {...rest} = {} +; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-same-name.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-same-name.js new file mode 100644 index 0000000000..5957e8d5dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-same-name.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-same-name.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Proper setting in the values for rest name equal to a property name. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var o = { + x: 42, + y: 39, + z: 'cheeseburger' +}; + +var x, y, z; + +var result; +var vals = o; + +result = { x, ...z } = vals; + +assert.sameValue(x, 42); +assert.sameValue(y, undefined); +assert.sameValue(z.y, 39); +assert.sameValue(z.z, 'cheeseburger'); + +var keys = Object.getOwnPropertyNames(z); +assert.sameValue(keys.length, 2); +assert.sameValue(keys[0], 'y'); +assert.sameValue(keys[1], 'z'); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..b8bf7d6be7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-skip-non-enumerable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-skip-non-enumerable.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Rest object doesn't contain non-enumerable properties (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; +var obj = {a: 3, b: 4}; +Object.defineProperty(obj, "x", { value: 4, enumerable: false }); + +var result; +var vals = obj; + +result = {...rest} = vals; + +assert.sameValue(Object.getOwnPropertyDescriptor(rest, "x"), undefined); + +verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 +}); + +verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-str-val.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-str-val.js new file mode 100644 index 0000000000..1b51b24b6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-str-val.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-str-val.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: RestBindingInitialization creats an object with indexes as property name (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; + + +var result; +var vals = "foo"; + +result = {...rest} = vals; + +assert.sameValue(rest["0"], "f"); +assert.sameValue(rest["1"], "o"); +assert.sameValue(rest["2"], "o"); +assert(rest instanceof Object); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-symbol-val.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-symbol-val.js new file mode 100644 index 0000000000..8ee1b81cf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-symbol-val.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-symbol-val.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: RestBindingInitialization creates a new object if lhs is a Symbol (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [Symbol, object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; + + +var result; +var vals = Symbol("foo"); + +result = {...rest} = vals; + +assert.notSameValue(rest, undefined); +assert.notSameValue(rest, null); +assert(rest instanceof Object); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property-with-setter.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property-with-setter.js new file mode 100644 index 0000000000..8312f614a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property-with-setter.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-to-property-with-setter.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object property setter, its value should be binded as rest object. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var settedValue; +var executedGetter = false; +var src = { + get y() { executedGetter = true; }, + set y(v) { + settedValue = v; + } +} +src.y = undefined; + +var result; +var vals = { x: 1, y: 2}; + +result = {...src.y} = vals; + +assert.sameValue(settedValue.x, 1); +assert.sameValue(settedValue.y, 2); +assert(!executedGetter, "The property should not be accessed"); + + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property.js new file mode 100644 index 0000000000..414320f095 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-to-property.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-to-property.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: When DestructuringAssignmentTarget is an object property, its value should be binded as rest object. (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var src = {}; + +var result; +var vals = { x: 1, y: 2}; + +result = {...src.y} = vals; + +assert.sameValue(src.y.x, 1); +assert.sameValue(src.y.y, 2); + +verifyProperty(src, "y", { + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-null.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-null.js new file mode 100644 index 0000000000..3837360fa5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-null.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-val-null.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: TypeError is thrown when rhs is null because of 7.1.13 ToObject ( argument ) used by CopyDataProperties (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; + +assert.throws(TypeError, function() { + 0, {...rest} = null +; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-undefined.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-undefined.js new file mode 100644 index 0000000000..0e7bebb084 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-val-undefined.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-val-undefined.case +// - src/dstr-assignment/error/assignment-expr.template +/*--- +description: TypeError is thrown when rhs is ```undefined``` because of 7.1.13 ToObject ( argument ) used by CopyDataProperties (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest; + +assert.throws(TypeError, function() { + 0, {...rest} = undefined +; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-valid-object.js b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-valid-object.js new file mode 100644 index 0000000000..8c4e7779af --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/obj-rest-valid-object.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-assignment/obj-rest-valid-object.case +// - src/dstr-assignment/default/assignment-expr.template +/*--- +description: Rest object contains just unextracted data (AssignmentExpression) +esid: sec-variable-statement-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +---*/ +var rest, a, b; + + +var result; +var vals = {x: 1, y: 2, a: 5, b: 3}; + +result = {a, b, ...rest} = vals; + +assert.sameValue(rest.a, undefined); +assert.sameValue(rest.b, undefined); + +verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 +}); + +verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 +}); + +assert.sameValue(result, vals); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/shell.js b/js/src/tests/test262/language/expressions/assignment/dstr/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-break-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-break-escaped.js new file mode 100644 index 0000000000..4021e72bf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-break-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: break is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { bre\u0061k } = { break: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-case-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-case-escaped.js new file mode 100644 index 0000000000..0250a07c3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-case-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: case is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { c\u0061se } = { case: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-catch-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-catch-escaped.js new file mode 100644 index 0000000000..58a44f4811 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-catch-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: catch is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { c\u0061tch } = { catch: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-class-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-class-escaped.js new file mode 100644 index 0000000000..42241bf14c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-class-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: class is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { cl\u0061ss } = { class: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-const-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-const-escaped.js new file mode 100644 index 0000000000..f9059ccacd --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-const-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: const is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0063onst } = { const: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-continue-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-continue-escaped.js new file mode 100644 index 0000000000..0844d028ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-continue-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: continue is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0063ontinue } = { continue: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-debugger-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-debugger-escaped.js new file mode 100644 index 0000000000..57743fe821 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-debugger-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: debugger is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0064ebugger } = { debugger: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped-ext.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped-ext.js new file mode 100644 index 0000000000..dd1b705aba --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped-ext.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: default is a valid identifier name, using extended escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { def\u{61}ult } = { default: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped.js new file mode 100644 index 0000000000..9ee78fed40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: default is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { def\u0061ult } = { default: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default.js new file mode 100644 index 0000000000..0a575392d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-default.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: default is a valid identifier name (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { default } = { default: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-delete-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-delete-escaped.js new file mode 100644 index 0000000000..e140eaace9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-delete-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: delete is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0064elete } = { delete: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-do-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-do-escaped.js new file mode 100644 index 0000000000..43a6ea3d5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-do-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: do is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0064o } = { do: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-else-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-else-escaped.js new file mode 100644 index 0000000000..3f3239013f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-else-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: else is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0065lse } = { else: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-enum-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-enum-escaped.js new file mode 100644 index 0000000000..2f995e1068 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-enum-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: enum is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0065num } = { enum: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-export-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-export-escaped.js new file mode 100644 index 0000000000..0b72342f39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-export-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: export is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0065xport } = { export: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped-ext.js new file mode 100644 index 0000000000..d6c134a590 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped-ext.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: extends is a valid identifier name, using extended escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u{65}xtends } = { extends: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped.js new file mode 100644 index 0000000000..790b7acce9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: extends is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0065xtends } = { extends: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends.js new file mode 100644 index 0000000000..4e581b8a0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-extends.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: extends is a valid identifier name (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { extends } = { extends: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-finally-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-finally-escaped.js new file mode 100644 index 0000000000..99fb08d33f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-finally-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: finally is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0066inally } = { finally: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-for-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-for-escaped.js new file mode 100644 index 0000000000..d0c357ec35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-for-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: for is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0066or } = { for: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-function-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-function-escaped.js new file mode 100644 index 0000000000..7712561dd1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-function-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: function is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0066unction } = { function: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-if-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-if-escaped.js new file mode 100644 index 0000000000..7df6b01ae6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-if-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: if is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { i\u0066 } = { if: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-implements-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-implements-escaped-strict.js new file mode 100644 index 0000000000..89fe2b9ed5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-implements-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: implements is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0069mplements } = { implements: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-import-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-import-escaped.js new file mode 100644 index 0000000000..b6a6a1b72f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-import-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: import is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0069mport } = { import: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-in-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-in-escaped.js new file mode 100644 index 0000000000..fe1fc01ef6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-in-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: in is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0069n } = { in: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-instanceof-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-instanceof-escaped.js new file mode 100644 index 0000000000..5bd56e7ae5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-instanceof-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: instanceof is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { \u0069nstanceof } = { instanceof: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-interface-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-interface-escaped-strict.js new file mode 100644 index 0000000000..f74aedca37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-interface-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: interface is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { interf\u0061ce } = { interface: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-let-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-let-escaped-strict.js new file mode 100644 index 0000000000..83cc39551e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-let-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: let is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { l\u0065t } = { let: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-new-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-new-escaped.js new file mode 100644 index 0000000000..852271aa3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-new-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: new is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { n\u0065w } = { new: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-package-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-package-escaped-strict.js new file mode 100644 index 0000000000..8c352baa40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-package-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: package is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { p\u0061ckage } = { package: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-private-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-private-escaped-strict.js new file mode 100644 index 0000000000..9eaf631c39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-private-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: private is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { privat\u0065 } = { private: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-protected-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-protected-escaped-strict.js new file mode 100644 index 0000000000..6e657c7ee7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-protected-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: protected is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { prot\u0065cted } = { protected: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-public-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-public-escaped-strict.js new file mode 100644 index 0000000000..0370a9bc63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-public-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: public is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { pu\u0062lic } = { public: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-return-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-return-escaped.js new file mode 100644 index 0000000000..40ed1c9f5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-return-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: return is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { r\u0065turn } = { return: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-static-escaped-strict.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-static-escaped-strict.js new file mode 100644 index 0000000000..3ce4742e81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-static-escaped-strict.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/obj-assignment-identifier.template +/*--- +description: static is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { st\u0061tic } = { static: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-super-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-super-escaped.js new file mode 100644 index 0000000000..27b59ef36f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-super-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: super is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { sup\u0065r } = { super: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-switch-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-switch-escaped.js new file mode 100644 index 0000000000..63cdf87388 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-switch-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: switch is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { sw\u0069tch } = { switch: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-this-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-this-escaped.js new file mode 100644 index 0000000000..dcbc415081 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-this-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: this is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { th\u0069s } = { this: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-throw-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-throw-escaped.js new file mode 100644 index 0000000000..c02a3906e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-throw-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: throw is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { t\u0068row } = { throw: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-try-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-try-escaped.js new file mode 100644 index 0000000000..fabbb2381d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-try-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: try is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { tr\u0079 } = { try: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-typeof-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-typeof-escaped.js new file mode 100644 index 0000000000..519ee04405 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-typeof-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: typeof is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { typ\u0065of } = { typeof: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-var-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-var-escaped.js new file mode 100644 index 0000000000..609dff33ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-var-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: var is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { v\u0061r } = { var: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-void-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-void-escaped.js new file mode 100644 index 0000000000..c385489504 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-void-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: void is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { voi\u0064 } = { void: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-while-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-while-escaped.js new file mode 100644 index 0000000000..303357d74c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-while-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: while is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { whil\u0065 } = { while: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-with-escaped.js b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-with-escaped.js new file mode 100644 index 0000000000..ec6ee2a5ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/dstr/syntax-error-ident-ref-with-escaped.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/obj-assignment-identifier.template +/*--- +description: with is a valid identifier name, using escape (IdentifierReference in ObjectAssignmentPattern cannot be a ReservedWord) +esid: prod-AssignmentPattern +features: [destructuring-assignment] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AssignmentPattern: + ObjectAssignmentPattern + + ObjectAssignmentPattern: + { AssignmentPropertyList } + + AssignmentPropertyList: + AssignmentProperty + AssignmentPropertyList , AssignmentProperty + + AssignmentProperty: + IdentifierReference Initializer_opt + PropertyName : AssignmentElement + + IdentifierReference: + Identifier + [~Yield]yield + [~Await]await + + Identifier: + IdentifierName but not ReservedWord + +---*/ + + +$DONOTEVALUATE(); + +var x = { w\u0069th } = { with: 42 }; diff --git a/js/src/tests/test262/language/expressions/assignment/fn-name-arrow.js b/js/src/tests/test262/language/expressions/assignment/fn-name-arrow.js new file mode 100644 index 0000000000..425d626e72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/fn-name-arrow.js @@ -0,0 +1,35 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.14.4 +description: Assignment of function `name` attribute (ArrowFunction) +info: | + AssignmentExpression[In, Yield] : + LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield] + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral, then + [...] + e. If IsAnonymousFunctionDefinition(AssignmentExpression) and + IsIdentifierRef of LeftHandSideExpression are both true, then + + i. Let hasNameProperty be HasOwnProperty(rval, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(rval, + GetReferencedName(lref)). +includes: [propertyHelper.js] +---*/ + +var arrow; + +arrow = () => {}; + +verifyProperty(arrow, 'name', { + value: 'arrow', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/fn-name-class.js b/js/src/tests/test262/language/expressions/assignment/fn-name-class.js new file mode 100644 index 0000000000..d719330d17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/fn-name-class.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.14.4 +description: Assignment of function `name` attribute (ClassExpression) +info: | + AssignmentExpression[In, Yield] : + LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield] + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral, then + [...] + e. If IsAnonymousFunctionDefinition(AssignmentExpression) and + IsIdentifierRef of LeftHandSideExpression are both true, then + + i. Let hasNameProperty be HasOwnProperty(rval, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(rval, + GetReferencedName(lref)). +includes: [propertyHelper.js] +features: [class] +---*/ + +var xCls, cls, xCls2; + +xCls = class x {}; +cls = class {}; +xCls2 = class { static name() {} }; + +assert.notSameValue(xCls.name, 'xCls'); +assert.notSameValue(xCls2.name, 'xCls2'); + +verifyProperty(cls, 'name', { + value: 'cls', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/fn-name-cover.js b/js/src/tests/test262/language/expressions/assignment/fn-name-cover.js new file mode 100644 index 0000000000..b68f672952 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/fn-name-cover.js @@ -0,0 +1,39 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.14.4 +description: > + Assignment of function `name` attribute (CoverParenthesizedExpression) +info: | + AssignmentExpression[In, Yield] : + LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield] + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral, then + [...] + e. If IsAnonymousFunctionDefinition(AssignmentExpression) and + IsIdentifierRef of LeftHandSideExpression are both true, then + + i. Let hasNameProperty be HasOwnProperty(rval, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(rval, + GetReferencedName(lref)). +includes: [propertyHelper.js] +---*/ + +var xCover, cover; + +xCover = (0, function() {}); +cover = (function() {}); + +assert(xCover.name !== 'xCover'); + +verifyProperty(cover, 'name', { + value: 'cover', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/fn-name-fn.js b/js/src/tests/test262/language/expressions/assignment/fn-name-fn.js new file mode 100644 index 0000000000..1e520addde --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/fn-name-fn.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.14.4 +description: Assignment of function `name` attribute (FunctionExpression) +info: | + AssignmentExpression[In, Yield] : + LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield] + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral, then + [...] + e. If IsAnonymousFunctionDefinition(AssignmentExpression) and + IsIdentifierRef of LeftHandSideExpression are both true, then + + i. Let hasNameProperty be HasOwnProperty(rval, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(rval, + GetReferencedName(lref)). +includes: [propertyHelper.js] +---*/ + +var xFn, fn; + +xFn = function x() {}; +fn = function() {}; + +assert(xFn.name !== 'xFn'); + +verifyProperty(fn, 'name', { + value: 'fn', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/fn-name-gen.js b/js/src/tests/test262/language/expressions/assignment/fn-name-gen.js new file mode 100644 index 0000000000..04439260ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/fn-name-gen.js @@ -0,0 +1,39 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.14.4 +description: Assignment of function `name` attribute (GeneratorExpression) +info: | + AssignmentExpression[In, Yield] : + LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield] + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral, then + [...] + e. If IsAnonymousFunctionDefinition(AssignmentExpression) and + IsIdentifierRef of LeftHandSideExpression are both true, then + + i. Let hasNameProperty be HasOwnProperty(rval, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(rval, + GetReferencedName(lref)). +includes: [propertyHelper.js] +features: [generators] +---*/ + +var xGen, gen; + +xGen = function* x() {}; +gen = function*() {}; + +assert(xGen.name !== 'xGen'); + +verifyProperty(gen, 'name', { + value: 'gen', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/fn-name-lhs-cover.js b/js/src/tests/test262/language/expressions/assignment/fn-name-lhs-cover.js new file mode 100644 index 0000000000..851579395b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/fn-name-lhs-cover.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Left-hand side as a CoverParenthesizedExpression +info: | + AssignmentExpression[In, Yield, Await] : + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral, then + [...] + c. If IsAnonymousFunctionDefinition(AssignmentExpression) and + IsIdentifierRef of LeftHandSideExpression are both true, then + i. Let rval be NamedEvaluation of AssignmentExpression with argument + GetReferencedName(lref). +includes: [propertyHelper.js] +---*/ + +var fn; + +(fn) = function() {}; + +verifyProperty(fn, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/fn-name-lhs-member.js b/js/src/tests/test262/language/expressions/assignment/fn-name-lhs-member.js new file mode 100644 index 0000000000..bdf4b01ab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/fn-name-lhs-member.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Left-hand side as a MemberExpression +info: | + AssignmentExpression[In, Yield, Await] : + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral, then + [...] + c. If IsAnonymousFunctionDefinition(AssignmentExpression) and + IsIdentifierRef of LeftHandSideExpression are both true, then + i. Let rval be NamedEvaluation of AssignmentExpression with argument + GetReferencedName(lref). +includes: [propertyHelper.js] +---*/ + +var o = {}; + +o.attr = function() {}; + +verifyProperty(o.attr, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/id-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/id-arguments-strict-strict.js new file mode 100644 index 0000000000..1b688ca1e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/id-arguments-strict-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.13.1-4-30-s +description: > + Strict Mode - SyntaxError is thrown if the identifier 'arguments' appears as + the LeftHandSideExpression (PrimaryExpression) of simple assignment(=). +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(arguments) = 20; diff --git a/js/src/tests/test262/language/expressions/assignment/id-eval-strict-strict.js b/js/src/tests/test262/language/expressions/assignment/id-eval-strict-strict.js new file mode 100644 index 0000000000..14a99e387f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/id-eval-strict-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.13.1-4-30-s +description: > + Strict Mode - SyntaxError is thrown if the identifier 'eval' appears as the + LeftHandSideExpression (PrimaryExpression) of simple assignment(=). +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(eval) = 20; diff --git a/js/src/tests/test262/language/expressions/assignment/line-terminator.js b/js/src/tests/test262/language/expressions/assignment/line-terminator.js new file mode 100644 index 0000000000..9c239b9557 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/line-terminator.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + White Space between LeftHandSideExpression and "=" or between "=" and + AssignmentExpression is allowed +es5id: 11.13.1_A1 +---*/ + +var x; + +x += +true; + +if (x !== true) { + throw new Test262Error('#6: (x\\u000A=\\u000Atrue) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-break-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-break-escaped.js new file mode 100644 index 0000000000..c4e41cec40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-break-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: break is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.bre\u0061k = 42; + +assert.sameValue(obj['break'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-case-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-case-escaped.js new file mode 100644 index 0000000000..e7cf8f5054 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-case-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: case is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.c\u0061se = 42; + +assert.sameValue(obj['case'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-catch-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-catch-escaped.js new file mode 100644 index 0000000000..8726bb4412 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-catch-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: catch is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.c\u0061tch = 42; + +assert.sameValue(obj['catch'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-class-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-class-escaped.js new file mode 100644 index 0000000000..279764714c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-class-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: class is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.cl\u0061ss = 42; + +assert.sameValue(obj['class'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-const-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-const-escaped.js new file mode 100644 index 0000000000..610b4af903 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-const-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: const is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0063onst = 42; + +assert.sameValue(obj['const'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-continue-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-continue-escaped.js new file mode 100644 index 0000000000..0c7fc186b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-continue-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: continue is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0063ontinue = 42; + +assert.sameValue(obj['continue'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-debugger-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-debugger-escaped.js new file mode 100644 index 0000000000..f0c950c5cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-debugger-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: debugger is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0064ebugger = 42; + +assert.sameValue(obj['debugger'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped-ext.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped-ext.js new file mode 100644 index 0000000000..59b454709e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped-ext.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/member-expr.template +/*--- +description: default is a valid identifier name, using extended escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.def\u{61}ult = 42; + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped.js new file mode 100644 index 0000000000..9dab69ac5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: default is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.def\u0061ult = 42; + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default.js new file mode 100644 index 0000000000..7048fd5790 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-default.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/member-expr.template +/*--- +description: default is a valid identifier name (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.default = 42; + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-delete-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-delete-escaped.js new file mode 100644 index 0000000000..3622802786 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-delete-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: delete is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0064elete = 42; + +assert.sameValue(obj['delete'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-do-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-do-escaped.js new file mode 100644 index 0000000000..815589e7af --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-do-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: do is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0064o = 42; + +assert.sameValue(obj['do'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-else-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-else-escaped.js new file mode 100644 index 0000000000..1c59e91b86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-else-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: else is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0065lse = 42; + +assert.sameValue(obj['else'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-enum-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-enum-escaped.js new file mode 100644 index 0000000000..b6fac3639e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-enum-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: enum is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0065num = 42; + +assert.sameValue(obj['enum'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-export-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-export-escaped.js new file mode 100644 index 0000000000..2153c92704 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-export-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: export is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0065xport = 42; + +assert.sameValue(obj['export'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped-ext.js new file mode 100644 index 0000000000..78f93e5c2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped-ext.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/member-expr.template +/*--- +description: extends is a valid identifier name, using extended escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u{65}xtends = 42; + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped.js new file mode 100644 index 0000000000..dcfa282fd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: extends is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0065xtends = 42; + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends.js new file mode 100644 index 0000000000..8f7257c85a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-extends.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/member-expr.template +/*--- +description: extends is a valid identifier name (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.extends = 42; + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-finally-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-finally-escaped.js new file mode 100644 index 0000000000..e5f14173a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-finally-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: finally is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0066inally = 42; + +assert.sameValue(obj['finally'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-for-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-for-escaped.js new file mode 100644 index 0000000000..7af5f3e21b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-for-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: for is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0066or = 42; + +assert.sameValue(obj['for'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-function-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-function-escaped.js new file mode 100644 index 0000000000..8137fe2749 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-function-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: function is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0066unction = 42; + +assert.sameValue(obj['function'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-if-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-if-escaped.js new file mode 100644 index 0000000000..bd53cfb7ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-if-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: if is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.i\u0066 = 42; + +assert.sameValue(obj['if'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-implements-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-implements-escaped.js new file mode 100644 index 0000000000..e60fb6b590 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-implements-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: implements is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0069mplements = 42; + +assert.sameValue(obj['implements'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-import-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-import-escaped.js new file mode 100644 index 0000000000..2d54d1bed8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-import-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: import is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0069mport = 42; + +assert.sameValue(obj['import'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-in-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-in-escaped.js new file mode 100644 index 0000000000..4eaf396217 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-in-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: in is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0069n = 42; + +assert.sameValue(obj['in'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-instanceof-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-instanceof-escaped.js new file mode 100644 index 0000000000..85e755dd13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-instanceof-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: instanceof is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.\u0069nstanceof = 42; + +assert.sameValue(obj['instanceof'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-interface-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-interface-escaped.js new file mode 100644 index 0000000000..fc20e81cc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-interface-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: interface is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.interf\u0061ce = 42; + +assert.sameValue(obj['interface'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-let-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-let-escaped.js new file mode 100644 index 0000000000..bba82ac17b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-let-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: let is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.l\u0065t = 42; + +assert.sameValue(obj['let'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-new-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-new-escaped.js new file mode 100644 index 0000000000..c32fba4fbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-new-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: new is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.n\u0065w = 42; + +assert.sameValue(obj['new'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-package-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-package-escaped.js new file mode 100644 index 0000000000..d0982c50dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-package-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: package is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.p\u0061ckage = 42; + +assert.sameValue(obj['package'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-private-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-private-escaped.js new file mode 100644 index 0000000000..bd26da549e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-private-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: private is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.privat\u0065 = 42; + +assert.sameValue(obj['private'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-protected-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-protected-escaped.js new file mode 100644 index 0000000000..dcd520d905 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-protected-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: protected is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.prot\u0065cted = 42; + +assert.sameValue(obj['protected'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-public-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-public-escaped.js new file mode 100644 index 0000000000..d47f59da0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-public-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: public is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.pu\u0062lic = 42; + +assert.sameValue(obj['public'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-return-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-return-escaped.js new file mode 100644 index 0000000000..71328e0bdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-return-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: return is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.r\u0065turn = 42; + +assert.sameValue(obj['return'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-static-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-static-escaped.js new file mode 100644 index 0000000000..df9d1db9aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-static-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/member-expr.template +/*--- +description: static is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.st\u0061tic = 42; + +assert.sameValue(obj['static'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-super-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-super-escaped.js new file mode 100644 index 0000000000..4e9b53a4ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-super-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: super is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.sup\u0065r = 42; + +assert.sameValue(obj['super'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-switch-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-switch-escaped.js new file mode 100644 index 0000000000..8d2d40dd66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-switch-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: switch is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.sw\u0069tch = 42; + +assert.sameValue(obj['switch'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-this-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-this-escaped.js new file mode 100644 index 0000000000..a8f2f1e9c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-this-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: this is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.th\u0069s = 42; + +assert.sameValue(obj['this'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-throw-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-throw-escaped.js new file mode 100644 index 0000000000..dcbac3674f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-throw-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: throw is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.t\u0068row = 42; + +assert.sameValue(obj['throw'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-try-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-try-escaped.js new file mode 100644 index 0000000000..2ccf2188d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-try-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: try is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.tr\u0079 = 42; + +assert.sameValue(obj['try'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-typeof-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-typeof-escaped.js new file mode 100644 index 0000000000..839ece3b05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-typeof-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: typeof is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.typ\u0065of = 42; + +assert.sameValue(obj['typeof'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-var-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-var-escaped.js new file mode 100644 index 0000000000..a260f72a93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-var-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: var is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.v\u0061r = 42; + +assert.sameValue(obj['var'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-void-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-void-escaped.js new file mode 100644 index 0000000000..257bf58a70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-void-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: void is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.voi\u0064 = 42; + +assert.sameValue(obj['void'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-while-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-while-escaped.js new file mode 100644 index 0000000000..47b8163ac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-while-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: while is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.whil\u0065 = 42; + +assert.sameValue(obj['while'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-with-escaped.js b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-with-escaped.js new file mode 100644 index 0000000000..811c59766f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/member-expr-ident-name-with-escaped.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/member-expr.template +/*--- +description: with is a valid identifier name, using escape (MemberExpression IdentifierName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + MemberExpression: + ... + MemberExpression . IdentifierName + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = {}; + +obj.w\u0069th = 42; + +assert.sameValue(obj['with'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/non-simple-target.js b/js/src/tests/test262/language/expressions/assignment/non-simple-target.js new file mode 100644 index 0000000000..a06f9fb7a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/non-simple-target.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 = 1; diff --git a/js/src/tests/test262/language/expressions/assignment/shell.js b/js/src/tests/test262/language/expressions/assignment/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignment/target-assignment-inside-function.js b/js/src/tests/test262/language/expressions/assignment/target-assignment-inside-function.js new file mode 100644 index 0000000000..4ba6dee38c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-assignment-inside-function.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Applied to assignment +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function f() { + var a, b = 2; + (a = b) = 1; +} diff --git a/js/src/tests/test262/language/expressions/assignment/target-assignment.js b/js/src/tests/test262/language/expressions/assignment/target-assignment.js new file mode 100644 index 0000000000..63e62d461f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-assignment.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Applied to assignment +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var a, b = 2; +(a = b) = 1; diff --git a/js/src/tests/test262/language/expressions/assignment/target-boolean.js b/js/src/tests/test262/language/expressions/assignment/target-boolean.js new file mode 100644 index 0000000000..af28d1fd76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-boolean.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: > + simple assignment throws SyntaxError if LeftHandSide is not a + reference (boolean) +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +true = 42; diff --git a/js/src/tests/test262/language/expressions/assignment/target-cover-id.js b/js/src/tests/test262/language/expressions/assignment/target-cover-id.js new file mode 100644 index 0000000000..c99d79e821 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-cover-id.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +es6id: 12.14.1 +es5id: 11.1.6_A3_T5 +description: Applied to a "covered" IdentifierReference +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Reference Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of + LeftHandSideExpression is false. + + Static Semantics: IsValidSimpleAssignmentTarget + + IdentifierReference : Identifier + + 1. If this IdentifierReference is contained in strict mode code and + StringValue of Identifier is "eval" or "arguments", return false. + 2. Return true. +---*/ + +var x; + +(x) = 1; + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/target-cover-newtarget.js b/js/src/tests/test262/language/expressions/assignment/target-cover-newtarget.js new file mode 100644 index 0000000000..536ab71888 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-cover-newtarget.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Applied to a "covered" new.target +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + (new.target) = 1; +} diff --git a/js/src/tests/test262/language/expressions/assignment/target-cover-yieldexpr.js b/js/src/tests/test262/language/expressions/assignment/target-cover-yieldexpr.js new file mode 100644 index 0000000000..9cd34e279f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-cover-yieldexpr.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Applied to a "covered" YieldExpression +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.15.3 Static Semantics: IsValidSimpleAssignmentTarget + + AssignmentExpression: + YieldExpression + ArrowFunction + AsyncArrowFunction + LeftHandSideExpression = AssignmentExpression + LeftHandSideExpression AssignmentOperator AssignmentExpression + + 1. Return invalid. +features: [generators] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function* g() { + (yield) = 1; +} diff --git a/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-null.js b/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-null.js new file mode 100644 index 0000000000..d0a87d3cca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-null.js @@ -0,0 +1,52 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: Assignment Operator evaluates the value prior validating a MemberExpression's reference (null) +info: | + # 13.15.2 Runtime Semantics: Evaluation + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, + then + a. Let lref be the result of evaluating LeftHandSideExpression. + [...] + e. Perform ? PutValue(lref, rval). + + # 6.2.4.5 PutValue ( V, W ) + + [...] + 5. If IsPropertyReference(V) is true, then + a. Let baseObj be ? ToObject(V.[[Base]]). +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] = expr(); +}); + +assert.throws(DummyError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new DummyError(); + }; + + base[prop] = expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js b/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js new file mode 100644 index 0000000000..d9b488a1af --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-member-computed-reference-undefined.js @@ -0,0 +1,52 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: Assignment Operator evaluates the value prior validating a MemberExpression's reference (undefined) +info: | + # 13.15.2 Runtime Semantics: Evaluation + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, + then + a. Let lref be the result of evaluating LeftHandSideExpression. + [...] + e. Perform ? PutValue(lref, rval). + + # 6.2.4.5 PutValue ( V, W ) + + [...] + 5. If IsPropertyReference(V) is true, then + a. Let baseObj be ? ToObject(V.[[Base]]). +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] = expr(); +}); + +assert.throws(DummyError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new DummyError(); + }; + + base[prop] = expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-null.js b/js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-null.js new file mode 100644 index 0000000000..80b6c1c4fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-null.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: Assignment Operator evaluates the value prior validating a MemberExpression's reference (null) +info: | + # 13.15.2 Runtime Semantics: Evaluation + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, + then + a. Let lref be the result of evaluating LeftHandSideExpression. + [...] + e. Perform ? PutValue(lref, rval). + + # 6.2.4.5 PutValue ( V, W ) + + [...] + 5. If IsPropertyReference(V) is true, then + a. Let baseObj be ? ToObject(V.[[Base]]). +---*/ + +var count = 0; +var base = null; + +assert.throws(TypeError, function() { + base.prop = count += 1; +}); + +assert.sameValue(count, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-undefined.js b/js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-undefined.js new file mode 100644 index 0000000000..35d4d8640e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-member-identifier-reference-undefined.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: Assignment Operator evaluates the value prior validating a MemberExpression's reference (undefined) +info: | + # 13.15.2 Runtime Semantics: Evaluation + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, + then + a. Let lref be the result of evaluating LeftHandSideExpression. + [...] + e. Perform ? PutValue(lref, rval). + + # 6.2.4.5 PutValue ( V, W ) + + [...] + 5. If IsPropertyReference(V) is true, then + a. Let baseObj be ? ToObject(V.[[Base]]). +---*/ + +var count = 0; +var base = undefined; + +assert.throws(TypeError, function() { + base.prop = count += 1; +}); + +assert.sameValue(count, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/target-newtarget.js b/js/src/tests/test262/language/expressions/assignment/target-newtarget.js new file mode 100644 index 0000000000..4e72ebc44d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-newtarget.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: Applied to new.target +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + new.target = 1; +} diff --git a/js/src/tests/test262/language/expressions/assignment/target-null.js b/js/src/tests/test262/language/expressions/assignment/target-null.js new file mode 100644 index 0000000000..e7d0cb4ecc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-null.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: > + simple assignment throws SyntaxError if LeftHandSide is not a + reference (null) +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +null = 42; diff --git a/js/src/tests/test262/language/expressions/assignment/target-number.js b/js/src/tests/test262/language/expressions/assignment/target-number.js new file mode 100644 index 0000000000..572019de9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-number.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: > + simple assignment throws SyntaxError if LeftHandSide is not a + reference (number) +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +42 = 42; diff --git a/js/src/tests/test262/language/expressions/assignment/target-string.js b/js/src/tests/test262/language/expressions/assignment/target-string.js new file mode 100644 index 0000000000..891933e326 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-string.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: > + simple assignment throws SyntaxError if LeftHandSide is not a + reference (string) +info: | + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + It is an early Syntax Error if LeftHandSideExpression is neither an + ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +'x' = 42; diff --git a/js/src/tests/test262/language/expressions/assignment/target-super-computed-reference-null.js b/js/src/tests/test262/language/expressions/assignment/target-super-computed-reference-null.js new file mode 100644 index 0000000000..a7903058aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-super-computed-reference-null.js @@ -0,0 +1,39 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: Assignment Operator evaluates the value prior validating a SuperProperty's reference (null) +info: | + # 13.15.2 Runtime Semantics: Evaluation + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, + then + a. Let lref be the result of evaluating LeftHandSideExpression. + [...] + e. Perform ? PutValue(lref, rval). + + # 6.2.4.5 PutValue ( V, W ) + + [...] + 5. If IsPropertyReference(V) is true, then + a. Let baseObj be ? ToObject(V.[[Base]]). +---*/ + +var count = 0; +class C { + static m() { + super[0] = count += 1; + } +} + +Object.setPrototypeOf(C, null); + +assert.throws(TypeError, function() { + C.m(); +}); + +assert.sameValue(count, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/target-super-identifier-reference-null.js b/js/src/tests/test262/language/expressions/assignment/target-super-identifier-reference-null.js new file mode 100644 index 0000000000..18428d95be --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/target-super-identifier-reference-null.js @@ -0,0 +1,39 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: Assignment Operator evaluates the value prior validating a SuperProperty's reference (null) +info: | + # 13.15.2 Runtime Semantics: Evaluation + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + 1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, + then + a. Let lref be the result of evaluating LeftHandSideExpression. + [...] + e. Perform ? PutValue(lref, rval). + + # 6.2.4.5 PutValue ( V, W ) + + [...] + 5. If IsPropertyReference(V) is true, then + a. Let baseObj be ? ToObject(V.[[Base]]). +---*/ + +var count = 0; +class C { + static m() { + super.x = count += 1; + } +} + +Object.setPrototypeOf(C, null); + +assert.throws(TypeError, function() { + C.m(); +}); + +assert.sameValue(count, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignment/white-space.js b/js/src/tests/test262/language/expressions/assignment/white-space.js new file mode 100644 index 0000000000..35cdb23e7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignment/white-space.js @@ -0,0 +1,61 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + White Space between LeftHandSideExpression and "=" or between "=" and + AssignmentExpression is allowed +es5id: 11.13.1_A1 +---*/ + +var x; + +x = 'U+0009'; +if (x !== 'U+0009') { + throw new Test262Error('#1: (x\\u0009=\\u0009true) === true'); +} + +x = 'U+000B'; +if (x !== 'U+000B') { + throw new Test262Error('#2: (x\\u000B=\\u000Btrue) === true'); +} + +x = 'U+000C'; +if (x !== 'U+000C') { + throw new Test262Error('#3: (x\\u000C=\\u000Ctrue) === true'); +} + +x = 'U+0020'; +if (x !== 'U+0020') { + throw new Test262Error('#4: (x\\u0020=\\u0020true) === true'); +} + +x = 'U+00A0'; +if (x !== 'U+00A0') { + throw new Test262Error('#5: (x\\u00A0=\\u00A0true) === true'); +} + +x += +'U+000D'; +if (x !== 'U+000D') { + throw new Test262Error('#7: (x\\u000D=\\u000Dtrue) === true'); +} + +x
=
'U+2028'; +if (x !== 'U+2028') { + throw new Test262Error('#8: (x\\u2028=\\u2028true) === true'); +} + +x
=
'U+2029'; +if (x !== 'U+2029') { + throw new Test262Error('#9: (x\\u2029=\\u2029true) === true'); +} + +x   +

=   +

'U+0009U+000BU+000CU+0020U+00A0U+000DU+2028U+2029'; +if (x !== 'U+0009U+000BU+000CU+0020U+00A0U+000DU+2028U+2029') { + throw new Test262Error('#10: (x\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000D\\u2028\\u2029=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000D\\u2028\\u2029true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/browser.js b/js/src/tests/test262/language/expressions/assignmenttargettype/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-0.js new file mode 100644 index 0000000000..c923a74e49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-minus-multiplicativeexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AdditiveExpression - MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x - y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-1.js new file mode 100644 index 0000000000..18cd0c47da --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-minus-multiplicativeexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AdditiveExpression - MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 - 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-2.js new file mode 100644 index 0000000000..5c8fcebf56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-minus-multiplicativeexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-minus-multiplicativeexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AdditiveExpression - MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true - false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-0.js new file mode 100644 index 0000000000..b594893d3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-plus-multiplicativeexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AdditiveExpression + MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x + y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-1.js new file mode 100644 index 0000000000..df5b0796c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-plus-multiplicativeexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AdditiveExpression + MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 + 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-2.js new file mode 100644 index 0000000000..c0ed684edc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-additiveexpression-plus-multiplicativeexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-plus-multiplicativeexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AdditiveExpression + MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true + false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-0.js new file mode 100644 index 0000000000..237513ed18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +() => {} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-1.js new file mode 100644 index 0000000000..1d8792cb50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +() => ({}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-2.js new file mode 100644 index 0000000000..d9f3231c95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x => x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-3.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-3.js new file mode 100644 index 0000000000..d889ddf6c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-3.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-3.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x) => x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-4.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-4.js new file mode 100644 index 0000000000..83be1e3c92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-4.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-4.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(() => 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-5.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-5.js new file mode 100644 index 0000000000..af0f5e0c30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-5.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-5.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(() => true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-6.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-6.js new file mode 100644 index 0000000000..b712819681 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-arrowfunction-6.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-6.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(() => 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-0.js new file mode 100644 index 0000000000..4de735d2a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +async () => {} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-1.js new file mode 100644 index 0000000000..72d33e9883 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +async () => ({}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-2.js new file mode 100644 index 0000000000..80cf45925b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(async x => x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-3.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-3.js new file mode 100644 index 0000000000..18b982fc4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-3.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-3.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(async (x) => x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-4.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-4.js new file mode 100644 index 0000000000..1f76a7cd93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-4.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-4.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(async () => 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-5.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-5.js new file mode 100644 index 0000000000..f97facb3b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-5.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-5.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(async () => true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-6.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-6.js new file mode 100644 index 0000000000..cd54db777c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-asyncarrowfunction-6.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-6.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(async () => 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-0.js new file mode 100644 index 0000000000..7e4ad534e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseandexpression-bitwise-and-equalityexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseANDExpression: BitwiseANDExpression & EqualityExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x & y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-1.js new file mode 100644 index 0000000000..40656a84e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseandexpression-bitwise-and-equalityexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseANDExpression: BitwiseANDExpression & EqualityExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 & 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-2.js new file mode 100644 index 0000000000..f33a1acd89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseandexpression-bitwise-and-equalityexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseandexpression-bitwise-and-equalityexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseANDExpression: BitwiseANDExpression & EqualityExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true & false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js new file mode 100644 index 0000000000..94441f0f8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseorexpression-bitwise-or-bitwisexorexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseORExpression: BitwiseORExpression | BitwiseXORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x | y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js new file mode 100644 index 0000000000..216414c877 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseorexpression-bitwise-or-bitwisexorexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseORExpression: BitwiseORExpression | BitwiseXORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 | 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js new file mode 100644 index 0000000000..de9cf492ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseorexpression-bitwise-or-bitwisexorexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseORExpression: BitwiseORExpression | BitwiseXORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true | false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js new file mode 100644 index 0000000000..d889583ca8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseXORExpression: BitwiseXORExpression ^ BitwiseANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x ^ y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js new file mode 100644 index 0000000000..ee974f213d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseXORExpression: BitwiseXORExpression ^ BitwiseANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 ^ 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js new file mode 100644 index 0000000000..9a3a18b519 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + BitwiseXORExpression: BitwiseXORExpression ^ BitwiseANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true ^ false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-arguments.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-arguments.js new file mode 100644 index 0000000000..0b89359d9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-arguments.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/callexpression-arguments.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + CallExpression Arguments + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +f() = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-templateliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-templateliteral.js new file mode 100644 index 0000000000..8a5c79f8c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-callexpression-templateliteral.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/callexpression-templateliteral.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + CallExpression TemplateLiteral + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +f()`` = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js new file mode 100644 index 0000000000..f74c9fad2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/coalesceexpressionhead-coalesce-bitwiseorexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + CoalesceExpression: CoalesceExpressionHead ?? BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x ?? y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js new file mode 100644 index 0000000000..fb81084461 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/coalesceexpressionhead-coalesce-bitwiseorexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + CoalesceExpression: CoalesceExpressionHead ?? BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 ?? 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js new file mode 100644 index 0000000000..a3bdb79659 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/coalesceexpressionhead-coalesce-bitwiseorexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + CoalesceExpression: CoalesceExpressionHead ?? BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true ?? false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-0.js new file mode 100644 index 0000000000..f4a4723b41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression == RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x == y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-1.js new file mode 100644 index 0000000000..b6ca14b657 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression == RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 == 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-2.js new file mode 100644 index 0000000000..8977c56b9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-equal-relationalexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression == RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true == false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-0.js new file mode 100644 index 0000000000..b5c660250a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-not-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression != RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x != y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-1.js new file mode 100644 index 0000000000..e48299cf8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-not-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression != RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 != 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-2.js new file mode 100644 index 0000000000..8c8f71b07b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-abstract-not-equal-relationalexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-not-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression != RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true != false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-0.js new file mode 100644 index 0000000000..e5368c6cc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression === RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x == y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-1.js new file mode 100644 index 0000000000..5650e860cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression === RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 == 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-2.js new file mode 100644 index 0000000000..734357d15d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-equal-relationalexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression === RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true == false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-0.js new file mode 100644 index 0000000000..56ed763bca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-not-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression !== RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x !== y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-1.js new file mode 100644 index 0000000000..a76976c29c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-not-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression !== RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 !== 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-2.js new file mode 100644 index 0000000000..d000cff2c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-equalityexpression-strict-not-equal-relationalexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-not-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + EqualityExpression !== RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true !== false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-0.js new file mode 100644 index 0000000000..8a72fdd6a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/expression-comma-assignmentexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + Expression: Expression , AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x, y = z) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-1.js new file mode 100644 index 0000000000..efc1a3926c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/expression-comma-assignmentexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + Expression: Expression , AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x, y = 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-2.js new file mode 100644 index 0000000000..a449ffbccf --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-expression-comma-assignmentexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/expression-comma-assignmentexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + Expression: Expression , AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x, y = true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-arguments-strict-strict.js new file mode 100644 index 0000000000..25874528bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-arguments-strict-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-arguments-strict.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return invalid. (Direct assignment) +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +arguments = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-eval-strict-strict.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-eval-strict-strict.js new file mode 100644 index 0000000000..19cb581b3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-identifierreference-eval-strict-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-eval-strict.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return invalid. (Direct assignment) +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +eval = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-import.meta.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-import.meta.js new file mode 100644 index 0000000000..c728033105 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-import.meta.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/import.meta.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + import.meta + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +import.meta = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-importcall.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-importcall.js new file mode 100644 index 0000000000..5e45a325bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-importcall.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError module +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/importcall.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ImportCall + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +import() = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..db2c980fbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression = AssignmentExpression + If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +(x = y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..f112454a5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression = AssignmentExpression + If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +(x = 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..23a48e6f75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-assignment-assignmentexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression = AssignmentExpression + If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +(x = true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..de1b6b53f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-coalesce-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression ??= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ??= y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..5529032866 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-coalesce-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression ??= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ??= 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..e34830b303 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-coalesce-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression ??= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ??= true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..4e204d29da --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-and-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression &&= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x &&= y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..5cf90937f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-and-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression &&= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x &&= 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..e2cbbb079d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-and-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression &&= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x &&= true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..d96d2d8144 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-or-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression ||= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ||= y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..26f112aca1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-or-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression ||= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ||= 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..ada85abf34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-or-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LeftHandSideExpression ||= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ||= true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-minus-minus.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-minus-minus.js new file mode 100644 index 0000000000..5974ad0d0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-minus-minus.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-minus-minus.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UpdateExpression: LeftHandSideExpression-- + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +x-- = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-plus-plus.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-plus-plus.js new file mode 100644 index 0000000000..7745d60f62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-lefthandsideexpression-plus-plus.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-plus-plus.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UpdateExpression: LeftHandSideExpression ++ + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +x++ = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-0.js new file mode 100644 index 0000000000..16aba3e697 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalandexpression-logical-and-bitwiseorexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LogicalANDExpression: LogicalANDExpression && BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x && y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-1.js new file mode 100644 index 0000000000..41859a7b26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalandexpression-logical-and-bitwiseorexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LogicalANDExpression: LogicalANDExpression && BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 && 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-2.js new file mode 100644 index 0000000000..71c8558f9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalandexpression-logical-and-bitwiseorexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalandexpression-logical-and-bitwiseorexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LogicalANDExpression: LogicalANDExpression && BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true && false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-0.js new file mode 100644 index 0000000000..e6432da489 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalorexpression-logical-or-logicalandexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LogicalORExpression: LogicalORExpression || LogicalANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x || y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-1.js new file mode 100644 index 0000000000..28462a0282 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalorexpression-logical-or-logicalandexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LogicalORExpression: LogicalORExpression || LogicalANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 || 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-2.js new file mode 100644 index 0000000000..49f676d981 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-logicalorexpression-logical-or-logicalandexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalorexpression-logical-or-logicalandexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + LogicalORExpression: LogicalORExpression || LogicalANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true || false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-memberexpression-templateliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-memberexpression-templateliteral.js new file mode 100644 index 0000000000..1ad3095f19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-memberexpression-templateliteral.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/memberexpression-templateliteral.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + MemberExpression TemplateLiteral + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +o.f()`` = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-minus-minus-unaryexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-minus-minus-unaryexpression.js new file mode 100644 index 0000000000..aef2f56c1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-minus-minus-unaryexpression.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/minus-minus-unaryexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UpdateExpression: --UnaryExpression + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +--x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js new file mode 100644 index 0000000000..835028c16a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x * y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js new file mode 100644 index 0000000000..593289fc7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 * 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js new file mode 100644 index 0000000000..a1ee2b78f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true * false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js new file mode 100644 index 0000000000..2e4af3467b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x / y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js new file mode 100644 index 0000000000..221956131a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 / 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js new file mode 100644 index 0000000000..7412a58f78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true / false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-memberexpression-arguments.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-memberexpression-arguments.js new file mode 100644 index 0000000000..c0bbe9fc82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-memberexpression-arguments.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/new-memberexpression-arguments.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + new MemberExpression Arguments + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +new f() = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-newexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-newexpression.js new file mode 100644 index 0000000000..61beb6d603 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-new-newexpression.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/new-newexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + new NewExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +new f = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-optionalexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-optionalexpression.js new file mode 100644 index 0000000000..1b89458572 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-optionalexpression.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/optionalexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +features: [optional-chaining] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + OptionalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x?.y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-plus-plus-unaryexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-plus-plus-unaryexpression.js new file mode 100644 index 0000000000..066a8898cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-plus-plus-unaryexpression.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/plus-plus-unaryexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UpdateExpression: ++UnaryExpression + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +++x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncfunctionexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncfunctionexpression.js new file mode 100644 index 0000000000..edb05be2d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncfunctionexpression.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-asyncfunctionexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression AsyncFunctionExpression; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +async function () {} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncgeneratorexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncgeneratorexpression.js new file mode 100644 index 0000000000..c165a2a58d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-asyncgeneratorexpression.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-asyncgeneratorexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression AsyncGeneratorExpression; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +async function () {} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-classexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-classexpression.js new file mode 100644 index 0000000000..ee90fe8849 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-classexpression.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-classexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression ClassExpression; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +class {} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-functionexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-functionexpression.js new file mode 100644 index 0000000000..7e4e4a3e2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-functionexpression.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-functionexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression FunctionExpression, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +function() {} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-generatorexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-generatorexpression.js new file mode 100644 index 0000000000..ed919f5fff --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-generatorexpression.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-generatorexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression ArrayLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +function * () {} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-boolean.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-boolean.js new file mode 100644 index 0000000000..9589ddfe5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-boolean.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-boolean.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression Literal BooleanLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +true = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-null.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-null.js new file mode 100644 index 0000000000..143619507c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-null.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-null.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression Literal NullLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +null = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-numeric.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-numeric.js new file mode 100644 index 0000000000..98f1f0153a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-numeric.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-numeric.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression Literal NumericLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +0 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-string.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-string.js new file mode 100644 index 0000000000..11315f9e36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-literal-string.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-string.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression Literal StringLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +'' = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-objectliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-objectliteral.js new file mode 100644 index 0000000000..38074ca00d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-objectliteral.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-objectliteral.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression ObjectLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +{} = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-regularexpressionliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-regularexpressionliteral.js new file mode 100644 index 0000000000..5fa8441975 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-regularexpressionliteral.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-regularexpressionliteral.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression RegularExpressionLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +/1/ = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-templateliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-templateliteral.js new file mode 100644 index 0000000000..4969115e93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-templateliteral.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-templateliteral.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression TemplateLiteral; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +`` = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-this.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-this.js new file mode 100644 index 0000000000..46be392d6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-primaryexpression-this.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-this.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: PrimaryExpression this; Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment +---*/ + +$DONOTEVALUATE(); + +this = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js new file mode 100644 index 0000000000..c4aee6224e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-or-equal-to-shiftexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression >= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x >= y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js new file mode 100644 index 0000000000..e56dcb1ed6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-or-equal-to-shiftexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression >= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 >= 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js new file mode 100644 index 0000000000..f50beb562d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-or-equal-to-shiftexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression >= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true >= false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-0.js new file mode 100644 index 0000000000..91b645d8ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-shiftexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression > ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x > y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-1.js new file mode 100644 index 0000000000..d5a02ddf03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-shiftexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression > ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 > 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-2.js new file mode 100644 index 0000000000..bbc30a6fa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-greater-than-shiftexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-shiftexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression > ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true > false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-0.js new file mode 100644 index 0000000000..45b07d1b1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-in-shiftexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression in ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x in y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-1.js new file mode 100644 index 0000000000..277ebde21a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-in-shiftexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression in ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 in 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-2.js new file mode 100644 index 0000000000..0ded44ee95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-in-shiftexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-in-shiftexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression in ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true in false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-0.js new file mode 100644 index 0000000000..5aadccfc68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-instanceof-shiftexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression instanceof ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x instanceof y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-1.js new file mode 100644 index 0000000000..119f5df5a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-instanceof-shiftexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression instanceof ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 instanceof 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-2.js new file mode 100644 index 0000000000..db8261dbd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-instanceof-shiftexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-instanceof-shiftexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression instanceof ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true instanceof false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-0.js new file mode 100644 index 0000000000..b8d53e1d5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-or-equal-to-shiftexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression <= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x <= y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-1.js new file mode 100644 index 0000000000..fa26048841 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-or-equal-to-shiftexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression <= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 <= 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-2.js new file mode 100644 index 0000000000..f26e7b8952 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-or-equal-to-shiftexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-or-equal-to-shiftexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression <= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true <= false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-0.js new file mode 100644 index 0000000000..1304ecc863 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-shiftexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression < ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x < y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-1.js new file mode 100644 index 0000000000..96be4cbf53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-shiftexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression < ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 < 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-2.js new file mode 100644 index 0000000000..551aafcfa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-relationalexpression-less-than-shiftexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-shiftexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + RelationalExpression < ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true < false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-0.js new file mode 100644 index 0000000000..8a39888ceb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-left-additiveexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression << AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x << y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-1.js new file mode 100644 index 0000000000..d0b9aac2ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-left-additiveexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression << AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 << 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-2.js new file mode 100644 index 0000000000..9b75110526 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-left-additiveexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-left-additiveexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression << AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true << false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-0.js new file mode 100644 index 0000000000..ae29e98de0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-right-additiveexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression >> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x >> y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-1.js new file mode 100644 index 0000000000..d0a0086392 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-right-additiveexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression >> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 >> 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-2.js new file mode 100644 index 0000000000..8e21ce2514 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-bitwise-right-additiveexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-right-additiveexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression >> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true >> false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js new file mode 100644 index 0000000000..d266bdff36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-unsigned-bitwise-right-additiveexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression >>> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x >>> y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js new file mode 100644 index 0000000000..cbf4cca44a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-unsigned-bitwise-right-additiveexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression >>> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 >>> 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js new file mode 100644 index 0000000000..54bf950ee4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-unsigned-bitwise-right-additiveexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShiftExpression >>> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true >>> false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js new file mode 100644 index 0000000000..3ba11d625b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ? y : z) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js new file mode 100644 index 0000000000..11b69bba48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 ? 2 : 3) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js new file mode 100644 index 0000000000..f0d3067cca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true ? false : true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-delete-unaryexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-delete-unaryexpression.js new file mode 100644 index 0000000000..c7e1f9f063 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-delete-unaryexpression.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-delete-unaryexpression.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: delete UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +delete x.y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-0.js new file mode 100644 index 0000000000..8a0485ba0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-exclamation-unaryexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: ! UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +!x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-1.js new file mode 100644 index 0000000000..42f5b8f954 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-exclamation-unaryexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: ! UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +!1 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-2.js new file mode 100644 index 0000000000..94f4e88dc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-exclamation-unaryexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-exclamation-unaryexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: ! UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +!true = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-0.js new file mode 100644 index 0000000000..ac195ce3af --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-minus-unaryexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: - UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +-x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-1.js new file mode 100644 index 0000000000..f6e37a35e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-minus-unaryexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: - UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +-1 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-2.js new file mode 100644 index 0000000000..60470125cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-minus-unaryexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-minus-unaryexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: - UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +-true = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-0.js new file mode 100644 index 0000000000..beb9c8900a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-plus-unaryexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: + UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + ++x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-1.js new file mode 100644 index 0000000000..fcc62936ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-plus-unaryexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: + UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + ++1 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-2.js new file mode 100644 index 0000000000..02e0e8a72a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-plus-unaryexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-plus-unaryexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: + UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + ++true = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-0.js new file mode 100644 index 0000000000..8bb4fba1b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-tilde-unaryexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: ~ UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +~x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-1.js new file mode 100644 index 0000000000..2d7795f419 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-tilde-unaryexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: ~ UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +~1 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-2.js new file mode 100644 index 0000000000..c1195b53ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-tilde-unaryexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-tilde-unaryexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: ~ UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +~true = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-0.js new file mode 100644 index 0000000000..62f950c9b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-typeof-unaryexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: typeof UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +typeof x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-1.js new file mode 100644 index 0000000000..fc7db02825 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-typeof-unaryexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: typeof UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +typeof 1 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-2.js new file mode 100644 index 0000000000..e57f785fec --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-typeof-unaryexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-typeof-unaryexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: typeof UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +typeof true = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-0.js new file mode 100644 index 0000000000..beb038b686 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-void-unaryexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: void UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +void x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-1.js new file mode 100644 index 0000000000..5912b41028 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-void-unaryexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: void UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +void 1 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-2.js new file mode 100644 index 0000000000..995ef8d1aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-unaryexpression-void-unaryexpression-2.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-void-unaryexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UnaryExpression: void UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +void true = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-0.js new file mode 100644 index 0000000000..bb5eef707d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-0.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/updateexpression-star-star-exponentiationexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +features: [exponentiation] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UpdateExpression ** ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +x ** y = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-1.js new file mode 100644 index 0000000000..b689ea570c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-1.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/updateexpression-star-star-exponentiationexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +features: [exponentiation] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UpdateExpression ** ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +1 ** 2 = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-2.js new file mode 100644 index 0000000000..26329bf152 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-updateexpression-star-star-exponentiationexpression-2.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/updateexpression-star-star-exponentiationexpression-2.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +features: [exponentiation] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + UpdateExpression ** ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +true ** false = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-0.js new file mode 100644 index 0000000000..cf25897ad8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-0.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/yieldexpression-0.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + YieldExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +yield x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-1.js new file mode 100644 index 0000000000..f4d19bea26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/direct-yieldexpression-1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/yieldexpression-1.case +// - src/assignment-target-type/invalid/direct.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (Direct assignment) +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Direct assignment + + YieldExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +yield * x = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-0.js new file mode 100644 index 0000000000..94f421eb02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-minus-multiplicativeexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AdditiveExpression - MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x - y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-1.js new file mode 100644 index 0000000000..685bde6bbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-minus-multiplicativeexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AdditiveExpression - MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 - 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-2.js new file mode 100644 index 0000000000..e78757381c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-minus-multiplicativeexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-minus-multiplicativeexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AdditiveExpression - MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true - false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-0.js new file mode 100644 index 0000000000..2b3875f5e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-plus-multiplicativeexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AdditiveExpression + MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x + y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-1.js new file mode 100644 index 0000000000..e1cfc6b3f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-plus-multiplicativeexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AdditiveExpression + MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 + 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-2.js new file mode 100644 index 0000000000..9e231f7d9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-additiveexpression-plus-multiplicativeexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/additiveexpression-plus-multiplicativeexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AdditiveExpression + MultiplicativeExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true + false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-0.js new file mode 100644 index 0000000000..96ba3369a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(() => {}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-1.js new file mode 100644 index 0000000000..800504dccb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(() => ({})) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-2.js new file mode 100644 index 0000000000..1d4be742db --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x => x)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-3.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-3.js new file mode 100644 index 0000000000..a9b566c765 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-3.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-3.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(((x) => x)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-4.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-4.js new file mode 100644 index 0000000000..bff8138021 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-4.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-4.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((() => 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-5.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-5.js new file mode 100644 index 0000000000..f022f6e753 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-5.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-5.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((() => true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-6.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-6.js new file mode 100644 index 0000000000..a15c64fc74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-arrowfunction-6.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/arrowfunction-6.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((() => 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-0.js new file mode 100644 index 0000000000..48d411ae35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(async () => {}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-1.js new file mode 100644 index 0000000000..7e59540a87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(async () => ({})) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-2.js new file mode 100644 index 0000000000..7b3a1bfe34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((async x => x)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-3.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-3.js new file mode 100644 index 0000000000..02958bb7db --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-3.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-3.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((async (x) => x)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-4.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-4.js new file mode 100644 index 0000000000..7627bc9cdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-4.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-4.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((async () => 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-5.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-5.js new file mode 100644 index 0000000000..8c8daacace --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-5.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-5.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((async () => true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-6.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-6.js new file mode 100644 index 0000000000..56aca576e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-asyncarrowfunction-6.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/asyncarrowfunction-6.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + AsyncArrowFunction + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((async () => 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-0.js new file mode 100644 index 0000000000..ff50fe4a9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseandexpression-bitwise-and-equalityexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseANDExpression: BitwiseANDExpression & EqualityExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x & y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-1.js new file mode 100644 index 0000000000..93b55a94da --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseandexpression-bitwise-and-equalityexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseANDExpression: BitwiseANDExpression & EqualityExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 & 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-2.js new file mode 100644 index 0000000000..d621316bd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseandexpression-bitwise-and-equalityexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseandexpression-bitwise-and-equalityexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseANDExpression: BitwiseANDExpression & EqualityExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true & false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js new file mode 100644 index 0000000000..c18626b16b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseorexpression-bitwise-or-bitwisexorexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseORExpression: BitwiseORExpression | BitwiseXORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x | y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js new file mode 100644 index 0000000000..f7c18340d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseorexpression-bitwise-or-bitwisexorexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseORExpression: BitwiseORExpression | BitwiseXORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 | 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js new file mode 100644 index 0000000000..1866e4b657 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwiseorexpression-bitwise-or-bitwisexorexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwiseorexpression-bitwise-or-bitwisexorexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseORExpression: BitwiseORExpression | BitwiseXORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true | false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js new file mode 100644 index 0000000000..b09b707a69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwisexorexpression-bitwise-xor-bitwiseandexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseXORExpression: BitwiseXORExpression ^ BitwiseANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ^ y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js new file mode 100644 index 0000000000..f13d6d5a02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwisexorexpression-bitwise-xor-bitwiseandexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseXORExpression: BitwiseXORExpression ^ BitwiseANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 ^ 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js new file mode 100644 index 0000000000..11f4341f51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/bitwisexorexpression-bitwise-xor-bitwiseandexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + BitwiseXORExpression: BitwiseXORExpression ^ BitwiseANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true ^ false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-arguments.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-arguments.js new file mode 100644 index 0000000000..194196750b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-arguments.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/callexpression-arguments.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + CallExpression Arguments + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(f()) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-templateliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-templateliteral.js new file mode 100644 index 0000000000..672e887225 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-callexpression-templateliteral.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/callexpression-templateliteral.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + CallExpression TemplateLiteral + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(f()``) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js new file mode 100644 index 0000000000..85bba8cc13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/coalesceexpressionhead-coalesce-bitwiseorexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + CoalesceExpression: CoalesceExpressionHead ?? BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ?? y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js new file mode 100644 index 0000000000..135065be45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/coalesceexpressionhead-coalesce-bitwiseorexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + CoalesceExpression: CoalesceExpressionHead ?? BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 ?? 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js new file mode 100644 index 0000000000..e4f6f1448c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-coalesceexpressionhead-coalesce-bitwiseorexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/coalesceexpressionhead-coalesce-bitwiseorexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + CoalesceExpression: CoalesceExpressionHead ?? BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true ?? false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-0.js new file mode 100644 index 0000000000..b19c3e04e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression == RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x == y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-1.js new file mode 100644 index 0000000000..5b82bb5124 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression == RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 == 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-2.js new file mode 100644 index 0000000000..5923d4ad4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-equal-relationalexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression == RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true == false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-0.js new file mode 100644 index 0000000000..54f2955dad --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-not-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression != RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x != y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-1.js new file mode 100644 index 0000000000..bfe4a030aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-not-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression != RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 != 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-2.js new file mode 100644 index 0000000000..aecdeddd11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-abstract-not-equal-relationalexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-abstract-not-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression != RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true != false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-0.js new file mode 100644 index 0000000000..3b145874a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression === RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x == y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-1.js new file mode 100644 index 0000000000..627efc4a12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression === RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 == 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-2.js new file mode 100644 index 0000000000..25e0eef0ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-equal-relationalexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression === RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true == false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-0.js new file mode 100644 index 0000000000..2acd3bd3a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-not-equal-relationalexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression !== RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x !== y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-1.js new file mode 100644 index 0000000000..4dce4a5206 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-not-equal-relationalexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression !== RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 !== 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-2.js new file mode 100644 index 0000000000..98f758b3fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-equalityexpression-strict-not-equal-relationalexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/equalityexpression-strict-not-equal-relationalexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + EqualityExpression !== RelationalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true !== false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-0.js new file mode 100644 index 0000000000..c6653c0d8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/expression-comma-assignmentexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + Expression: Expression , AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x, y = z)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-1.js new file mode 100644 index 0000000000..2a40106ff0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/expression-comma-assignmentexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + Expression: Expression , AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x, y = 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-2.js new file mode 100644 index 0000000000..e4b10c9bf6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-expression-comma-assignmentexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/expression-comma-assignmentexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + Expression: Expression , AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x, y = true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-arguments-strict-strict.js new file mode 100644 index 0000000000..dccc3ac382 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-arguments-strict.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(arguments) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-eval-strict-strict.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-eval-strict-strict.js new file mode 100644 index 0000000000..c3f9aa703a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-identifierreference-eval-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-eval-strict.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(eval) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-import.meta.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-import.meta.js new file mode 100644 index 0000000000..3b9bd6eb00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-import.meta.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/import.meta.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + import.meta + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(import.meta) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-importcall.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-importcall.js new file mode 100644 index 0000000000..6bfedf14b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-importcall.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError module +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/importcall.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated, module] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ImportCall + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(import()) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..69ed85e46e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression = AssignmentExpression + If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +((x = y)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..0d6cf6a5cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression = AssignmentExpression + If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +((x = 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..e983ebdfc1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-assignment-assignmentexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression = AssignmentExpression + If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, the following Early Error rule is applied, It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +((x = true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..965893068b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-coalesce-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression ??= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x ??= y)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..64fbc2b200 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-coalesce-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression ??= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x ??= 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..473e60760e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-coalesce-assignment-assignmentexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-coalesce-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression ??= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x ??= true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..3468fb6b9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-and-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression &&= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x &&= y)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..cc687f3a54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-and-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression &&= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x &&= 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..e7e1e9a443 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-and-assignment-assignmentexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-and-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression &&= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x &&= true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js new file mode 100644 index 0000000000..6cf570e900 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-or-assignment-assignmentexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression ||= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x ||= y)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js new file mode 100644 index 0000000000..bd374e10e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-or-assignment-assignmentexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression ||= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x ||= 1)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js new file mode 100644 index 0000000000..fe2e00af28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-logical-or-assignment-assignmentexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-logical-or-assignment-assignmentexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LeftHandSideExpression ||= AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x ||= true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-minus-minus.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-minus-minus.js new file mode 100644 index 0000000000..6d4693b21b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-minus-minus.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-minus-minus.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UpdateExpression: LeftHandSideExpression-- + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +(x--) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-plus-plus.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-plus-plus.js new file mode 100644 index 0000000000..94fc0b7834 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-lefthandsideexpression-plus-plus.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/lefthandsideexpression-plus-plus.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UpdateExpression: LeftHandSideExpression ++ + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +(x++) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-0.js new file mode 100644 index 0000000000..ae56b272de --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalandexpression-logical-and-bitwiseorexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LogicalANDExpression: LogicalANDExpression && BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x && y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-1.js new file mode 100644 index 0000000000..8f4ffcbb5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalandexpression-logical-and-bitwiseorexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LogicalANDExpression: LogicalANDExpression && BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 && 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-2.js new file mode 100644 index 0000000000..70dc2b1b2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalandexpression-logical-and-bitwiseorexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalandexpression-logical-and-bitwiseorexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LogicalANDExpression: LogicalANDExpression && BitwiseORExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true && false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-0.js new file mode 100644 index 0000000000..b816e1cab7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalorexpression-logical-or-logicalandexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LogicalORExpression: LogicalORExpression || LogicalANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x || y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-1.js new file mode 100644 index 0000000000..da75ec942f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalorexpression-logical-or-logicalandexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LogicalORExpression: LogicalORExpression || LogicalANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 || 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-2.js new file mode 100644 index 0000000000..cf26188944 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-logicalorexpression-logical-or-logicalandexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/logicalorexpression-logical-or-logicalandexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + LogicalORExpression: LogicalORExpression || LogicalANDExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true || false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-memberexpression-templateliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-memberexpression-templateliteral.js new file mode 100644 index 0000000000..673d4b953f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-memberexpression-templateliteral.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/memberexpression-templateliteral.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + MemberExpression TemplateLiteral + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(o.f()``) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-minus-minus-unaryexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-minus-minus-unaryexpression.js new file mode 100644 index 0000000000..66b07fcc1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-minus-minus-unaryexpression.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/minus-minus-unaryexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UpdateExpression: --UnaryExpression + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +(--x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js new file mode 100644 index 0000000000..8f82be4f5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x * y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js new file mode 100644 index 0000000000..645169d1dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 * 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js new file mode 100644 index 0000000000..5909302944 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true * false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js new file mode 100644 index 0000000000..5a16471849 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-3.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x / y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js new file mode 100644 index 0000000000..66177688b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-4.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 / 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js new file mode 100644 index 0000000000..8ab4d4f87e --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/multiplicativeexpression-multiplicativeoperator-exponentiationexpression-5.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true / false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-memberexpression-arguments.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-memberexpression-arguments.js new file mode 100644 index 0000000000..f496a12233 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-memberexpression-arguments.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/new-memberexpression-arguments.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + new MemberExpression Arguments + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(new f()) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-newexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-newexpression.js new file mode 100644 index 0000000000..f15374cd24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-new-newexpression.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/new-newexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + new NewExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(new f) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-optionalexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-optionalexpression.js new file mode 100644 index 0000000000..9ce49a883f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-optionalexpression.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/optionalexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +features: [optional-chaining] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + OptionalExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x?.y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-plus-plus-unaryexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-plus-plus-unaryexpression.js new file mode 100644 index 0000000000..f383021fee --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-plus-plus-unaryexpression.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/plus-plus-unaryexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UpdateExpression: ++UnaryExpression + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. + +---*/ + +$DONOTEVALUATE(); + +(++x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncfunctionexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncfunctionexpression.js new file mode 100644 index 0000000000..19860969c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncfunctionexpression.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-asyncfunctionexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression AsyncFunctionExpression; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(async function () {}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncgeneratorexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncgeneratorexpression.js new file mode 100644 index 0000000000..47627a8805 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-asyncgeneratorexpression.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-asyncgeneratorexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression AsyncGeneratorExpression; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(async function () {}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-classexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-classexpression.js new file mode 100644 index 0000000000..3eb97ec5a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-classexpression.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-classexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression ClassExpression; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(class {}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-functionexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-functionexpression.js new file mode 100644 index 0000000000..992a35b619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-functionexpression.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-functionexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression FunctionExpression, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(function() {}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-generatorexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-generatorexpression.js new file mode 100644 index 0000000000..5aed2db1a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-generatorexpression.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-generatorexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression ArrayLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(function * () {}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-boolean.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-boolean.js new file mode 100644 index 0000000000..614c50d036 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-boolean.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-boolean.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression Literal BooleanLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-null.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-null.js new file mode 100644 index 0000000000..f0254f5522 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-null.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-null.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression Literal NullLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(null) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-numeric.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-numeric.js new file mode 100644 index 0000000000..e4cb9514bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-numeric.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-numeric.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression Literal NumericLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(0) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-string.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-string.js new file mode 100644 index 0000000000..019f7b3d74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-literal-string.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-literal-string.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression Literal StringLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +('') = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-objectliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-objectliteral.js new file mode 100644 index 0000000000..227be22bd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-objectliteral.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-objectliteral.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression ObjectLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +({}) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-regularexpressionliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-regularexpressionliteral.js new file mode 100644 index 0000000000..5dee5676eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-regularexpressionliteral.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-regularexpressionliteral.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression RegularExpressionLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(/1/) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-templateliteral.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-templateliteral.js new file mode 100644 index 0000000000..1d61170995 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-templateliteral.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-templateliteral.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression TemplateLiteral; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(``) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-this.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-this.js new file mode 100644 index 0000000000..c36825468d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-primaryexpression-this.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/primaryexpression-this.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: PrimaryExpression this; Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. +---*/ + +$DONOTEVALUATE(); + +(this) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js new file mode 100644 index 0000000000..98321a0905 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-or-equal-to-shiftexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression >= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x >= y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js new file mode 100644 index 0000000000..742c393ef1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-or-equal-to-shiftexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression >= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 >= 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js new file mode 100644 index 0000000000..cab5a82213 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-or-equal-to-shiftexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-or-equal-to-shiftexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression >= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true >= false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-0.js new file mode 100644 index 0000000000..160d6eeff0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-shiftexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression > ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x > y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-1.js new file mode 100644 index 0000000000..db9f68c48c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-shiftexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression > ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 > 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-2.js new file mode 100644 index 0000000000..4c9ecf16f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-greater-than-shiftexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-greater-than-shiftexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression > ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true > false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-0.js new file mode 100644 index 0000000000..d38c5556de --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-in-shiftexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression in ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x in y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-1.js new file mode 100644 index 0000000000..0df0fa2a55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-in-shiftexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression in ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 in 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-2.js new file mode 100644 index 0000000000..5471a52b4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-in-shiftexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-in-shiftexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression in ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true in false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-0.js new file mode 100644 index 0000000000..70d4718ac0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-instanceof-shiftexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression instanceof ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x instanceof y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-1.js new file mode 100644 index 0000000000..e80922ea44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-instanceof-shiftexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression instanceof ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 instanceof 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-2.js new file mode 100644 index 0000000000..531e5e1939 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-instanceof-shiftexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-instanceof-shiftexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression instanceof ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true instanceof false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-0.js new file mode 100644 index 0000000000..01982e5255 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-or-equal-to-shiftexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression <= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x <= y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-1.js new file mode 100644 index 0000000000..e28a31efe4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-or-equal-to-shiftexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression <= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 <= 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-2.js new file mode 100644 index 0000000000..64ad32cd97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-or-equal-to-shiftexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-or-equal-to-shiftexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression <= ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true <= false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-0.js new file mode 100644 index 0000000000..67f46c919a --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-shiftexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression < ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x < y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-1.js new file mode 100644 index 0000000000..ebcb8eae3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-shiftexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression < ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 < 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-2.js new file mode 100644 index 0000000000..c24389711f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-relationalexpression-less-than-shiftexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/relationalexpression-less-than-shiftexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + RelationalExpression < ShiftExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true < false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-0.js new file mode 100644 index 0000000000..670bc75eb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-left-additiveexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression << AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x << y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-1.js new file mode 100644 index 0000000000..01881dcbd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-left-additiveexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression << AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 << 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-2.js new file mode 100644 index 0000000000..1b399462c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-left-additiveexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-left-additiveexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression << AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true << false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-0.js new file mode 100644 index 0000000000..a16c781555 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-right-additiveexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression >> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x >> y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-1.js new file mode 100644 index 0000000000..b04eaf95c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-right-additiveexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression >> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 >> 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-2.js new file mode 100644 index 0000000000..eca24aecd1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-bitwise-right-additiveexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-bitwise-right-additiveexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression >> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true >> false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js new file mode 100644 index 0000000000..3d489ec618 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-unsigned-bitwise-right-additiveexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression >>> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x >>> y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js new file mode 100644 index 0000000000..2ad51b637d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-unsigned-bitwise-right-additiveexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression >>> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 >>> 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js new file mode 100644 index 0000000000..772f4f2b44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shiftexpression-unsigned-bitwise-right-additiveexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shiftexpression-unsigned-bitwise-right-additiveexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShiftExpression >>> AdditiveExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true >>> false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js new file mode 100644 index 0000000000..9b69798a58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((x ? y : z)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js new file mode 100644 index 0000000000..d542d9aba1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((1 ? 2 : 3)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js new file mode 100644 index 0000000000..acac9876c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/shortcircuitexpression-question-assignmentexpression-else-assignmentexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +((true ? false : true)) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-delete-unaryexpression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-delete-unaryexpression.js new file mode 100644 index 0000000000..9703bc5308 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-delete-unaryexpression.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-delete-unaryexpression.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: delete UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(delete x.y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-0.js new file mode 100644 index 0000000000..a4863a7e54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-exclamation-unaryexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: ! UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(!x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-1.js new file mode 100644 index 0000000000..cec221dcaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-exclamation-unaryexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: ! UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(!1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-2.js new file mode 100644 index 0000000000..d48a33ca5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-exclamation-unaryexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-exclamation-unaryexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: ! UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(!true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-0.js new file mode 100644 index 0000000000..ab9d29c9ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-minus-unaryexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: - UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(-x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-1.js new file mode 100644 index 0000000000..348df17180 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-minus-unaryexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: - UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(-1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-2.js new file mode 100644 index 0000000000..b352f1e870 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-minus-unaryexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-minus-unaryexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: - UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(-true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-0.js new file mode 100644 index 0000000000..9720bc0344 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-plus-unaryexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: + UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(+x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-1.js new file mode 100644 index 0000000000..cf6d77193b --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-plus-unaryexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: + UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(+1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-2.js new file mode 100644 index 0000000000..eb2e841612 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-plus-unaryexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-plus-unaryexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: + UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(+true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-0.js new file mode 100644 index 0000000000..35f153ecb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-tilde-unaryexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: ~ UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(~x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-1.js new file mode 100644 index 0000000000..69e2eacacb --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-tilde-unaryexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: ~ UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(~1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-2.js new file mode 100644 index 0000000000..fef2d67bd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-tilde-unaryexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-tilde-unaryexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: ~ UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(~true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-0.js new file mode 100644 index 0000000000..7b8e41192c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-typeof-unaryexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: typeof UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(typeof x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-1.js new file mode 100644 index 0000000000..82cbb0edc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-typeof-unaryexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: typeof UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(typeof 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-2.js new file mode 100644 index 0000000000..89542f3aa5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-typeof-unaryexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-typeof-unaryexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: typeof UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(typeof true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-0.js new file mode 100644 index 0000000000..5d372ed97c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-void-unaryexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: void UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(void x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-1.js new file mode 100644 index 0000000000..434ba8c9a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-void-unaryexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: void UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(void 1) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-2.js new file mode 100644 index 0000000000..1638cc4690 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-unaryexpression-void-unaryexpression-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/unaryexpression-void-unaryexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UnaryExpression: void UnaryExpression + Static Semantics AssignmentTargetType, Return invalid + +---*/ + +$DONOTEVALUATE(); + +(void true) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-0.js new file mode 100644 index 0000000000..d23bd8da77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-0.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/updateexpression-star-star-exponentiationexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +features: [exponentiation] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UpdateExpression ** ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(x ** y) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-1.js new file mode 100644 index 0000000000..8a277b91bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-1.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/updateexpression-star-star-exponentiationexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +features: [exponentiation] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UpdateExpression ** ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(1 ** 2) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-2.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-2.js new file mode 100644 index 0000000000..526a503b45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-updateexpression-star-star-exponentiationexpression-2.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/updateexpression-star-star-exponentiationexpression-2.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +features: [exponentiation] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + UpdateExpression ** ExponentiationExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(true ** false) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-0.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-0.js new file mode 100644 index 0000000000..a8ff571c6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-0.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/yieldexpression-0.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + YieldExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(yield x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-1.js b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-1.js new file mode 100644 index 0000000000..e4d31ec786 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/parenthesized-yieldexpression-1.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/yieldexpression-1.case +// - src/assignment-target-type/invalid/parenthesized.template +/*--- +description: Static Semantics AssignmentTargetType, Return invalid. (ParenthesizedExpression) +esid: sec-grouping-operator-static-semantics-assignmenttargettype +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ParenthesizedExpression: (Expression) + + Return AssignmentTargetType of Expression. + + YieldExpression + Static Semantics AssignmentTargetType, Return invalid. + +---*/ + +$DONOTEVALUATE(); + +(yield * x) = 1; diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/shell.js b/js/src/tests/test262/language/expressions/assignmenttargettype/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-arguments.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-arguments.js new file mode 100644 index 0000000000..dbef75d850 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-arguments.js @@ -0,0 +1,12 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-arguments.case +// - src/assignment-target-type/simple/basic/default.template +/*--- +description: IdentifierReference Identifier, Return simple. (Simple Direct assignment) +flags: [generated, noStrict] +---*/ + + +arguments = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js new file mode 100644 index 0000000000..4ccd1fa3e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-await.js @@ -0,0 +1,13 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-await.case +// - src/assignment-target-type/simple/basic/default.template +/*--- +description: IdentifierReference await Return simple. (Simple Direct assignment) +flags: [generated] +---*/ +var await = 0; + + +await = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-eval.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-eval.js new file mode 100644 index 0000000000..14b382fc2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-eval.js @@ -0,0 +1,12 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-eval.case +// - src/assignment-target-type/simple/basic/default.template +/*--- +description: IdentifierReference Identifier, Return simple. (Simple Direct assignment) +flags: [generated, noStrict] +---*/ + + +eval = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-yield.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-yield.js new file mode 100644 index 0000000000..364a61930f --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-basic-identifierreference-yield.js @@ -0,0 +1,12 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/identifierreference-yield.case +// - src/assignment-target-type/simple/basic/default.template +/*--- +description: IdentifierReference yield, Return simple. (Simple Direct assignment) +flags: [generated, noStrict] +---*/ + + +yield = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression-expression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression-expression.js new file mode 100644 index 0000000000..b9258e3f3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression-expression.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/callexpression-expression.case +// - src/assignment-target-type/simple/complex/default.template +/*--- +description: Static Semantics AssignmentTargetType, Return simple (Simple Direct assignment) +flags: [generated] +info: | + CallExpression [ Expression ] + Static Semantics AssignmentTargetType, Return simple + +---*/ + + +let v = 'v'; +let o = { [v]: 1, f() {} }; +let f = () => o; + +f()[v] = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression.identifiername.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression.identifiername.js new file mode 100644 index 0000000000..dc1f694b91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-callexpression.identifiername.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/callexpression.identifiername.case +// - src/assignment-target-type/simple/complex/default.template +/*--- +description: Static Semantics AssignmentTargetType, Return simple (Simple Direct assignment) +flags: [generated] +info: | + CallExpression . IdentifierName + Static Semantics AssignmentTargetType, Return simple + +---*/ + + +let v = 'v'; +let o = { [v]: 1, f() {} }; +let f = () => o; + +f().IdentifierName = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression-expression.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression-expression.js new file mode 100644 index 0000000000..421a5d1ec3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression-expression.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/memberexpression-expression.case +// - src/assignment-target-type/simple/complex/default.template +/*--- +description: Static Semantics AssignmentTargetType, Return simple (Simple Direct assignment) +flags: [generated] +info: | + MemberExpression [ Expression ] + Static Semantics AssignmentTargetType, Return simple + +---*/ + + +let v = 'v'; +let o = { [v]: 1, f() {} }; +let f = () => o; + +o[v] = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression.identifiername.js b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression.identifiername.js new file mode 100644 index 0000000000..c72a3267d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/assignmenttargettype/simple-complex-memberexpression.identifiername.js @@ -0,0 +1,20 @@ +// This file was procedurally generated from the following sources: +// - src/assignment-target-type/memberexpression.identifiername.case +// - src/assignment-target-type/simple/complex/default.template +/*--- +description: Static Semantics AssignmentTargetType, Return simple (Simple Direct assignment) +flags: [generated] +info: | + MemberExpression . IdentifierName + Static Semantics AssignmentTargetType, Return simple + +---*/ + + +let v = 'v'; +let o = { [v]: 1, f() {} }; +let f = () => o; + +o.v = 1; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..3d8bcdefa8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/array-destructuring-param-strict-body.js @@ -0,0 +1,124 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-arrow-function.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async ([element]) => { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js b/js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js new file mode 100644 index 0000000000..2b99c630e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/arrow-returns-promise.js @@ -0,0 +1,18 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Async arrow functions return promises +flags: [async] +---*/ + +var p = (async () => await 1 + await 2)(); +assert(Object.getPrototypeOf(p) === Promise.prototype); +p.then(function (v) { + assert.sameValue(v, 3); + $DONE(); +}, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js b/js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js new file mode 100644 index 0000000000..51cfd59d43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/async-lineterminator-identifier-throws.js @@ -0,0 +1,21 @@ +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-AsyncArrowFunction +description: > + async arrows cannot have a line terminator between "async" and the AsyncArrowBindingIdentifier +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction: + async [no LineTerminator here] AsyncArrowBindingIdentifier [no LineTerminator here] => AsyncConciseBody + [...] +---*/ + +assert.throws(ReferenceError, function() { + async + identifier => {} +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..e0e6055ce6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier-escaped.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier-escaped.case +// - src/async-functions/syntax/async-arrow.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async arrow function) +esid: prod-AsyncArrowFunction +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Arrow Function Definitions + + AsyncArrowFunction[In, Yield, Await]: + async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In] + + AsyncConciseBody[In]: + { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +async () => { + var \u0061wait; +} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js new file mode 100644 index 0000000000..709fb658f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-binding-identifier.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier.case +// - src/async-functions/syntax/async-arrow.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async arrow function) +esid: prod-AsyncArrowFunction +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Arrow Function Definitions + + AsyncArrowFunction[In, Yield, Await]: + async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In] + + AsyncConciseBody[In]: + { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +async () => { + var await; +} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..9f4cc56460 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference-escaped.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference-escaped.case +// - src/async-functions/syntax/async-arrow.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async arrow function) +esid: prod-AsyncArrowFunction +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Arrow Function Definitions + + AsyncArrowFunction[In, Yield, Await]: + async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In] + + AsyncConciseBody[In]: + { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +async () => { + void \u0061wait; +} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js new file mode 100644 index 0000000000..d8e08a5a8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-identifier-reference.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference.case +// - src/async-functions/syntax/async-arrow.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async arrow function) +esid: prod-AsyncArrowFunction +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Arrow Function Definitions + + AsyncArrowFunction[In, Yield, Await]: + async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In] + + AsyncConciseBody[In]: + { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +async () => { + void await; +} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..fd86e78d21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier-escaped.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier-escaped.case +// - src/async-functions/syntax/async-arrow.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async arrow function) +esid: prod-AsyncArrowFunction +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Arrow Function Definitions + + AsyncArrowFunction[In, Yield, Await]: + async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In] + + AsyncConciseBody[In]: + { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +async () => { + \u0061wait: ; +} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js new file mode 100644 index 0000000000..7106dabe86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-label-identifier.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier.case +// - src/async-functions/syntax/async-arrow.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async arrow function) +esid: prod-AsyncArrowFunction +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Arrow Function Definitions + + AsyncArrowFunction[In, Yield, Await]: + async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] + CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] [no LineTerminator here] => AsyncConciseBody[?In] + + AsyncConciseBody[In]: + { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +async () => { + await: ; +} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js new file mode 100644 index 0000000000..e7ea042d25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-ident-nested-arrow-parameter-position.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-arrow-function-definitions +description: > + It is a SyntaxError if FormalParameters' default expressions contains await. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +async(a = await => {}) => {}; diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js new file mode 100644 index 0000000000..94b9c21236 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-body-position.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-arrow-function-definitions +description: > + It is a SyntaxError if FormalParameters' default expressions contains await. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +async() => { (a = await/r/g) => {} }; diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js new file mode 100644 index 0000000000..dacd19f3c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-nested-arrow-parameter-position.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-arrow-function-definitions +description: > + It is a SyntaxError if FormalParameters' default expressions contains await. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +async(a = (await) => {}) => {}; diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js new file mode 100644 index 0000000000..92d65c6302 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/await-as-param-rest-nested-arrow-parameter-position.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-arrow-function-definitions +description: > + It is a SyntaxError if FormalParameters' default expressions contains await. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +async(a = (...await) => {}) => {}; diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js new file mode 100644 index 0000000000..f85de001a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-abrupt.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/async-arrow-function.template +/*--- +description: Abrupt completion returned by evaluation of initializer (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; +var f; +f = async (_ = (function() { throw new Test262Error(); }())) => { + + callCount = callCount + 1; +}; + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, Test262Error)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..5b2234077d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: Use of initializer when argument value is not `undefined` (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) => { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..f78735f5b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-arg-val-undefined.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: Use of initializer when argument value is `undefined` (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (fromLiteral = 23, fromExpr = 45, fromHole = 99) => { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js new file mode 100644 index 0000000000..998ec75d3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-duplicates.js @@ -0,0 +1,53 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/async-arrow-function.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + + +(async (x = 0, x) => { + +}); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js new file mode 100644 index 0000000000..9c463259ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-later.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/async-arrow-function.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f; +f = async (x = y, y) => { + + callCount = callCount + 1; +}; + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js new file mode 100644 index 0000000000..0ce7a9f5d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-prior.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (x, y = x, z = y) => { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js new file mode 100644 index 0000000000..016d517105 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-ref-self.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/async-arrow-function.template +/*--- +description: Referencing a parameter from within its own initializer (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f; +f = async (x = x) => { + + callCount = callCount + 1; +}; + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js new file mode 100644 index 0000000000..b6fc000ba1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-rest.js @@ -0,0 +1,57 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/async-arrow-function.template +/*--- +description: RestParameter does not support an initializer (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + + +(async (...x = []) => { + +}); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..80f5b4f503 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/dflt-params-trailing-comma.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (a, b = 39,) => { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js new file mode 100644 index 0000000000..c3c922803f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-NSPL-with-USD.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is *true* and IsSimpleParameterList of ArrowParameters is *false*. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async (x = 1) => {"use strict"} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js new file mode 100644 index 0000000000..86ae49eb27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-arguments-in-formal-parameters-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters contains arguments +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +async(arguments) => { } + diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js new file mode 100644 index 0000000000..70f8de19a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals-default.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters' default expressions contains await +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +async(x = await) => { } diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js new file mode 100644 index 0000000000..23a22ac953 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-await-in-formals.js @@ -0,0 +1,15 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters contains await +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +async(await) => { } diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js new file mode 100644 index 0000000000..f488d1c401 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-call.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if AsyncFunctionBody contains SuperCall is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async(foo) => { super() }; diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js new file mode 100644 index 0000000000..fb39611fc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-body-contains-super-property.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if AsyncFunctionBody contains SuperProperty is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async(foo) => { super.prop }; diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js new file mode 100644 index 0000000000..419e6422f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-duplicate-parameters.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: sec-async-arrow-function-definitions +description: Formal parameters may not contain duplicates +info: | + # 14.2 Arrow Function Definitions + + When the production + + ArrowParameters:CoverParenthesizedExpressionAndArrowParameterList + + is recognized the following grammar is used to refine the interpretation + of CoverParenthesizedExpressionAndArrowParameterList: + + ArrowFormalParameters[Yield, Await]: + (UniqueFormalParameters[?Yield, ?Await]) + + # 14.1.2 Static Semantics: Early Errors + + UniqueFormalParameters:FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +async(a, a) => { } diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js new file mode 100644 index 0000000000..07c07ef96f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-eval-in-formal-parameters-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters contains eval +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +async(eval) => { } diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js new file mode 100644 index 0000000000..d1b956e3f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-body-duplicate.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async(bar) => { let bar; } diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js new file mode 100644 index 0000000000..1b82159d4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-call.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if FormalParameters contains SuperCall is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async(foo = super()) => {} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js new file mode 100644 index 0000000000..2ac2381d93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-contains-super-property.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if FormalParameters contains SuperCall is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async (foo = super.foo) => { } diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js new file mode 100644 index 0000000000..1a5b378ae8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/early-errors-arrow-formals-lineterminator.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-AsyncArrowHead +description: async arrows cannot have a line terminator between "async" and the formals +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction: + [...] + CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] => AsyncConciseBody + + Supplemental Syntax + + When processing an instance of the production + + AsyncArrowFunction: + CoverCallExpressionAndAsyncArrowHead [no LineTerminator here] => AsyncConciseBody + + the interpretation of CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead: + async [no LineTerminator here] ArrowFormalParameters +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async +(foo) => { } diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js new file mode 100644 index 0000000000..859941b747 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async-line-terminator.js @@ -0,0 +1,31 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-arrow-function-definitions +description: > + Escaped "async" followed by a line-terminator is not misinterpreted as an AsyncArrowFunction. +info: | + 14.7 Async Function Definitions + + async [no LineTerminator here] AsyncArrowBindingIdentifier[?Yield] [no LineTerminator here] => AsyncConciseBody[?In] + + 5.1.5 Grammar Notation + + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +features: [async-functions] +---*/ + +// Throws ReferenceError because reference for "async" cannot be resolved. +assert.throws(ReferenceError, function() { + \u0061sync + p => {} +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js new file mode 100644 index 0000000000..420c506c80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/escaped-async.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `async` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +\u0061sync () => {} diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..d903924cc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/eval-var-scope-syntax-err.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/async-arrow-function.template +/*--- +description: sloppy direct eval in params introduces var (async arrow function expression in sloppy code) +esid: sec-async-arrow-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async, noStrict] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + + +var callCount = 0; +var f; +f = async (a = eval("var a = 42")) => { + + callCount = callCount + 1; +}; + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, SyntaxError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..33fcdb625b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template +/*--- +description: Forbidden extension, f.arguments (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f; +f = async () => { + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +}; + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..3578b85579 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/async-arrow-function-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template +/*--- +description: Forbidden extension, o.caller (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f; +f = async () => { + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +}; + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..f032c71462 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template +/*--- +description: Forbidden extension, o.caller (async arrow function expression) +esid: sec-async-arrow-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async () => { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..e60e9e85c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template +/*--- +description: Forbidden extension, o.caller (async arrow function expression) +esid: sec-async-arrow-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async () => { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..74358dc047 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/async-arrow-function-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template +/*--- +description: Forbidden extension, o.caller (async arrow function expression) +esid: sec-async-arrow-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async () => { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/name.js b/js/src/tests/test262/language/expressions/async-arrow-function/name.js new file mode 100644 index 0000000000..169a7ea036 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/name.js @@ -0,0 +1,37 @@ +// Copyright (C) 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-arrow-function-definitions-runtime-semantics-evaluation +description: Assignment of function `name` attribute +info: | + AsyncArrowFunction : async AsyncArrowBindingIdentifier => AsyncConciseBody + + 1. Let scope be the LexicalEnvironment of the running execution context. + 2. Let parameters be AsyncArrowBindingIdentifier. + 3. Let closure be ! AsyncFunctionCreate(Arrow, parameters, AsyncConciseBody, + scope, ""). + ... + 5. Return closure. + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + 1. Let scope be the LexicalEnvironment of the running execution context. + 2. Let head be CoveredAsyncArrowHead of CoverCallExpressionAndAsyncArrowHead. + 3. Let parameters be the ArrowFormalParameters of head. + 4. Let closure be ! AsyncFunctionCreate(Arrow, parameters, AsyncConciseBody, + scope, ""). + ... + 6. Return closure. +includes: [propertyHelper.js] +---*/ + +verifyProperty(async x => {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(async () => {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..033d885c65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/object-destructuring-param-strict-body.js @@ -0,0 +1,124 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-arrow-function.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async ({property}) => { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..4a5a5cd808 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-multiple.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (a, b,) => { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js new file mode 100644 index 0000000000..3d81239b67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/params-trailing-comma-single.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (a,) => { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js new file mode 100644 index 0000000000..5eff09d848 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/rest-param-strict-body.js @@ -0,0 +1,124 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/async-arrow-function.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async (a,...rest) => { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..10f131d4ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/rest-params-trailing-comma-early-error.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/async-arrow-function.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async arrow function expression) +esid: sec-async-arrow-function-definitions +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + + +(async (...a,) => { + +}); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/shell.js b/js/src/tests/test262/language/expressions/async-arrow-function/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js new file mode 100644 index 0000000000..80c02eace1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-reject.js @@ -0,0 +1,28 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + await new Promise(function(resolve, reject) { + reject("early-reject"); + }); + } finally { + await new Promise(function(resolve, reject) { + reject("override"); + }); + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Awaited rejection in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js new file mode 100644 index 0000000000..75bf2d4f9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-return.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + await new Promise(function(resolve, reject) { + reject("early-reject"); + }); + } finally { + return "override"; + } +}; + +f().then(function(value) { + assert.sameValue(value, "override", "Return in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js new file mode 100644 index 0000000000..9b9235965c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-reject-finally-throw.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + await new Promise(function(resolve, reject) { + reject("early-reject"); + }); + } finally { + throw "override"; + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Exception thrown in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js new file mode 100644 index 0000000000..29bb82bc08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-reject.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer resolving an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + return "early-return"; + } finally { + await new Promise(function(resolve, reject) { + reject("override"); + }); + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Awaited rejection in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js new file mode 100644 index 0000000000..4b7bd86c85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-return.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer resolving an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + return "early-return"; + } finally { + return await new Promise(function(resolve, reject) { + resolve("override"); + }); + } +}; + +f().then(function(value) { + assert.sameValue(value, "override", "Return in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js new file mode 100644 index 0000000000..28dbdd7869 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-return-finally-throw.js @@ -0,0 +1,24 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer resolving an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + return "early-return"; + } finally { + throw "override"; + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Exception thrown in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js new file mode 100644 index 0000000000..aad6bb1e99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-reject.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + throw "early-throw"; + } finally { + await new Promise(function(resolve, reject) { + reject("override"); + }); + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Awaited rejection in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js new file mode 100644 index 0000000000..56045d416c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-return.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + throw "early-throw"; + } finally { + return await new Promise(function(resolve, reject) { + resolve("override"); + }); + } +}; + +f().then(function(value) { + assert.sameValue(value, "override", "Return in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js new file mode 100644 index 0000000000..36e8821007 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/try-throw-finally-throw.js @@ -0,0 +1,24 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async() => { + try { + throw "early-throw"; + } finally { + throw "override"; + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Exception thrown in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..6884e1524d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with-in-nested-fn.js @@ -0,0 +1,95 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [globalThis, Symbol.unscopables, async-functions] +flags: [generated, noStrict, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (x) => { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js new file mode 100644 index 0000000000..09b90cd6bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-arrow-function/unscopables-with.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/async-arrow-function.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async arrow function expression) +esid: sec-async-arrow-function-definitions +features: [globalThis, Symbol.unscopables, async-functions] +flags: [generated, noStrict, async] +info: | + 14.7 Async Arrow Function Definitions + + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + + ... + + Supplemental Syntax + + When processing an instance of the production AsyncArrowFunction : + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody the interpretation of + CoverCallExpressionAndAsyncArrowHead is refined using the following grammar: + + AsyncArrowHead : + async ArrowFormalParameters + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref = async (x) => { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).then(() => { + assert.sameValue(callCount, 1, 'async arrow function invoked exactly once') +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..3c3a5f7f7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier-escaped.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier-escaped.case +// - src/async-functions/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function () { + var \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js new file mode 100644 index 0000000000..26fd230ecb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/await-as-binding-identifier.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier.case +// - src/async-functions/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function () { + var await; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..b87b3947c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference-escaped.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference-escaped.case +// - src/async-functions/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function () { + void \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js new file mode 100644 index 0000000000..b4ef353d9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/await-as-identifier-reference.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference.case +// - src/async-functions/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function () { + void await; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..3f1860d874 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier-escaped.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier-escaped.case +// - src/async-functions/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function () { + \u0061wait: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js new file mode 100644 index 0000000000..489c6915bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/await-as-label-identifier.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier.case +// - src/async-functions/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function ( FormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function () { + await: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/browser.js b/js/src/tests/test262/language/expressions/async-function/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-NSPL-with-USD.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-NSPL-with-USD.js new file mode 100644 index 0000000000..25cf218555 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-NSPL-with-USD.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is *true* and IsSimpleParameterList of ArrowParameters is *false*. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(async function (x = 1) {"use strict"}) diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-strict.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-strict.js new file mode 100644 index 0000000000..71974b5b8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-arguments-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + If the source code matching this production is strict code, it is a Syntax Error if BindingIdentifier is the IdentifierName arguments. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +(async function arguments () { }) + diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-strict.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-strict.js new file mode 100644 index 0000000000..6ae127531a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-binding-identifier-eval-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + If the source code matching this production is strict code, it is a Syntax Error if BindingIdentifier is the IdentifierName eval. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); +(async function eval () { }) diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-call.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-call.js new file mode 100644 index 0000000000..2e48bd063a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-call.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if AsyncFunctionBody contains SuperCall is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(async function foo (foo) { super() }) diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.js new file mode 100644 index 0000000000..4a22fe862a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-body-contains-super-property.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if AsyncFunctionBody contains SuperProperty is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(async function foo (foo) { super.prop }); + diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters-strict.js new file mode 100644 index 0000000000..140d721525 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-eval-in-formal-parameters-strict.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters contains eval in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(async function foo (eval) { }) diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-body-duplicate.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-body-duplicate.js new file mode 100644 index 0000000000..7ffe6e4e9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-body-duplicate.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(async function foo (bar) { let bar; }); diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-call.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-call.js new file mode 100644 index 0000000000..7b15bad0aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-call.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if FormalParameters contains SuperCall is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(async function foo (foo = super()) { var bar; }); diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-property.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-property.js new file mode 100644 index 0000000000..2bdfc7c5ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-formals-contains-super-property.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if FormalParameters contains SuperCall is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(async function foo (foo = super.foo) { var bar; }); diff --git a/js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.js b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.js new file mode 100644 index 0000000000..114df74a2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/early-errors-expression-not-simple-assignment-target.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Async function expressions are not a simple assignment target. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(async function foo() { } = 1) diff --git a/js/src/tests/test262/language/expressions/async-function/escaped-async.js b/js/src/tests/test262/language/expressions/async-function/escaped-async.js new file mode 100644 index 0000000000..329569898d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/escaped-async.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `async` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +void \u0061sync function f(){} diff --git a/js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js b/js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js new file mode 100644 index 0000000000..cb6d4ed35a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/expression-returns-promise.js @@ -0,0 +1,14 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Async function expressions return promises +---*/ + +var p = async function() { }(); +assert(p instanceof Promise, "async functions return promise instances"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..e0b79f9456 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template +/*--- +description: Forbidden extension, f.arguments (async function named expression) +esid: sec-async-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f = async function f() { + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..eba158b5e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-named-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template +/*--- +description: Forbidden extension, o.caller (async function named expression) +esid: sec-async-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f = async function f() { + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..adb55c34c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template +/*--- +description: Forbidden extension, f.arguments (async function nameless expression) +esid: sec-async-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f = async function() { + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..3f2b3dec4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/async-func-expr-nameless-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template +/*--- +description: Forbidden extension, o.caller (async function nameless expression) +esid: sec-async-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f = async function() { + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..907d2d93b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template +/*--- +description: Forbidden extension, o.caller (async function named expression) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function f() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..b388bb4057 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template +/*--- +description: Forbidden extension, o.caller (async function named expression) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function f() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..d5ba5804ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-named-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template +/*--- +description: Forbidden extension, o.caller (async function named expression) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function f() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..0b6014752c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template +/*--- +description: Forbidden extension, o.caller (async function nameless expression) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..0abb2354e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template +/*--- +description: Forbidden extension, o.caller (async function nameless expression) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..553328afd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/async-func-expr-nameless-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template +/*--- +description: Forbidden extension, o.caller (async function nameless expression) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +} + +f() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-function/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/async-function/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-function/name.js b/js/src/tests/test262/language/expressions/async-function/name.js new file mode 100644 index 0000000000..2991e5a649 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/name.js @@ -0,0 +1,38 @@ +// Copyright (C) 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-async-function-definitions-runtime-semantics-evaluation +description: Assignment of function `name` attribute +info: | + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + + 1. Let scope be the LexicalEnvironment of the running execution context. + 2. Let closure be ! AsyncFunctionCreate(Normal, FormalParameters, + AsyncFunctionBody, scope, ""). + ... + 4. Return closure. + + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + 1. Let scope be the running execution context's LexicalEnvironment. + 2. Let funcEnv be ! NewDeclarativeEnvironment(scope). + 3. Let envRec be funcEnv's EnvironmentRecord. + 4. Let name be StringValue of BindingIdentifier. + 5. Perform ! envRec.CreateImmutableBinding(name). + 6. Let closure be ! AsyncFunctionCreate(Normal, FormalParameters, + AsyncFunctionBody, funcEnv, name). + ... + 9. Return closure. +includes: [propertyHelper.js] +---*/ + +verifyProperty(async function() {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(async function func() {}, "name", { + value: "func", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..8e534ff382 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-array-destructuring-param-strict-body.js @@ -0,0 +1,110 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-func-expr-named.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function named expression) +esid: sec-async-function-definitions +features: [rest-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async function f([element]) { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..b84e02fb71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier-escaped.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier-escaped.case +// - src/async-functions/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function asyncFn() { + var \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js new file mode 100644 index 0000000000..5993397273 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-binding-identifier.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier.case +// - src/async-functions/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function asyncFn() { + var await; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..1b1e940b80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference-escaped.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference-escaped.case +// - src/async-functions/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function asyncFn() { + void \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js new file mode 100644 index 0000000000..f76f93e27e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-identifier-reference.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference.case +// - src/async-functions/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function asyncFn() { + void await; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..179b33bff2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier-escaped.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier-escaped.case +// - src/async-functions/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function asyncFn() { + \u0061wait: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js new file mode 100644 index 0000000000..96c7c2fa93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-await-as-label-identifier.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier.case +// - src/async-functions/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var asyncFn = async function asyncFn() { + await: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js new file mode 100644 index 0000000000..dc5214cea9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-abrupt.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/async-func-expr-named.template +/*--- +description: Abrupt completion returned by evaluation of initializer (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; +var f = async function f(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, Test262Error)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..6cb14f54ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-not-undefined.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: Use of initializer when argument value is not `undefined` (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..22e620a2dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-arg-val-undefined.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: Use of initializer when argument value is `undefined` (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js new file mode 100644 index 0000000000..04beb5d7bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-duplicates.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/async-func-expr-named.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + + +(async function f(x = 0, x) { + +}); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js new file mode 100644 index 0000000000..12241382ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-later.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/async-func-expr-named.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f = async function f(x = y, y) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-prior.js new file mode 100644 index 0000000000..613e7ad9f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-prior.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js new file mode 100644 index 0000000000..9ec6996ebd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-ref-self.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/async-func-expr-named.template +/*--- +description: Referencing a parameter from within its own initializer (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f = async function f(x = x) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-rest.js new file mode 100644 index 0000000000..d5b69ad2c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-rest.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/async-func-expr-named.template +/*--- +description: RestParameter does not support an initializer (async function named expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + + +(async function f(...x = []) { + +}); diff --git a/js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js new file mode 100644 index 0000000000..9855054a3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-dflt-params-trailing-comma.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (async function named expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-function/named-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-function/named-eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..96a523d96e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-eval-var-scope-syntax-err.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/async-func-expr-named.template +/*--- +description: sloppy direct eval in params introduces var (async function named expression in sloppy code) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async, noStrict] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + + +var callCount = 0; +var f = async function f(a = eval("var a = 42")) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, SyntaxError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/named-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/named-object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..33e766dee6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-object-destructuring-param-strict-body.js @@ -0,0 +1,110 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-func-expr-named.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function named expression) +esid: sec-async-function-definitions +features: [rest-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async function f({property}) { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js new file mode 100644 index 0000000000..7e027423ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-multiple.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (async function named expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-single.js new file mode 100644 index 0000000000..ef2e252832 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-params-trailing-comma-single.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (async function named expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-arrow.js b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-arrow.js new file mode 100644 index 0000000000..e5c3d9e514 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-arrow.js @@ -0,0 +1,33 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/async-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in non-strict mode code) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async, noStrict] +includes: [asyncHelpers.js] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +asyncTest(async () => { + assert.sameValue(await ref(), ref); + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}); + diff --git a/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js new file mode 100644 index 0000000000..2409f60b72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body-in-eval.js @@ -0,0 +1,31 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/async-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in non-strict mode code) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async, noStrict] +includes: [asyncHelpers.js] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +asyncTest(async () => { + assert.sameValue(await ref(), ref); + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}); + diff --git a/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js new file mode 100644 index 0000000000..c8d2fd0945 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-reassign-fn-name-in-body.js @@ -0,0 +1,31 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/async-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in non-strict mode code) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async, noStrict] +includes: [asyncHelpers.js] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +asyncTest(async () => { + assert.sameValue(await ref(), ref); + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}); + diff --git a/js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js new file mode 100644 index 0000000000..bd0e9b9a4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-rest-param-strict-body.js @@ -0,0 +1,110 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/async-func-expr-named.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async function named expression) +esid: sec-async-function-definitions +features: [rest-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async function f(a,...rest) { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..94ee94d4cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-rest-params-trailing-comma-early-error.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/async-func-expr-named.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function named expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + + +(async function f(...a,) { + +}); diff --git a/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js new file mode 100644 index 0000000000..95678677ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-arguments-from-parent-function.js @@ -0,0 +1,31 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Async function returns an async function. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var asyncFn = async function asyncFn(x) { + let a = arguments; + return async () => a === arguments; +}; + +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/async-function/named-returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-newtarget.js new file mode 100644 index 0000000000..c6ae92510f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow-returns-newtarget.js @@ -0,0 +1,30 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow-returns-newtarget.case +// - src/async-functions/evaluation/async-expression-named.template +/*--- +description: Async function returns an async function. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var asyncFn = async function asyncFn(x) { + return async () => new.target; +}; + +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/async-function/named-returns-async-arrow.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow.js new file mode 100644 index 0000000000..45f0ecf30f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-arrow.js @@ -0,0 +1,30 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow.case +// - src/async-functions/evaluation/async-expression-named.template +/*--- +description: Async function returns an async function. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var asyncFn = async function asyncFn(x) { + return async () => x; +}; + +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/async-function/named-returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-arguments-from-own-function.js new file mode 100644 index 0000000000..5b88b2786a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-arguments-from-own-function.js @@ -0,0 +1,31 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Async function returns an async function. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var asyncFn = async function asyncFn(x) { + let a = arguments; + return async function() { return a === arguments; }; +}; + +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/async-function/named-returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-newtarget.js new file mode 100644 index 0000000000..c4dc0fbc5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function-returns-newtarget.js @@ -0,0 +1,30 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function-returns-newtarget.case +// - src/async-functions/evaluation/async-expression-named.template +/*--- +description: Async function returns an async function. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var asyncFn = async function asyncFn(x) { + return async function() { return new.target; }; +}; + +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/async-function/named-returns-async-function.js b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function.js new file mode 100644 index 0000000000..0b181cbd92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-returns-async-function.js @@ -0,0 +1,30 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function.case +// - src/async-functions/evaluation/async-expression-named.template +/*--- +description: Async function returns an async function. (Named async function expression) +esid: prod-AsyncFunctionExpression +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async [no LineTerminator here] function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var asyncFn = async function asyncFn(x) { + return async function() { return x; }; +}; + +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/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js new file mode 100644 index 0000000000..323b1a09ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js @@ -0,0 +1,41 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/async-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in strict mode code) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async, onlyStrict] +includes: [asyncHelpers.js] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +asyncTest(async () => { + let catchCount = 0; + try { + await ref() + } catch (error) { + catchCount++; + assert(error instanceof TypeError); + } + assert.sameValue(catchCount, 1); + assert.sameValue(callCount, 1); +}); + diff --git a/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js new file mode 100644 index 0000000000..6f93a16f8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js @@ -0,0 +1,39 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/async-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in strict mode code) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async, onlyStrict] +includes: [asyncHelpers.js] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +asyncTest(async () => { + let catchCount = 0; + try { + await ref() + } catch (error) { + catchCount++; + assert(error instanceof TypeError); + } + assert.sameValue(catchCount, 1); + assert.sameValue(callCount, 1); +}); + diff --git a/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js new file mode 100644 index 0000000000..c3392f7ffa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-strict-error-reassign-fn-name-in-body-strict.js @@ -0,0 +1,39 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/async-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async function named expression in strict mode code) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async, onlyStrict] +includes: [asyncHelpers.js] +info: | + Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +asyncTest(async () => { + let catchCount = 0; + try { + await ref() + } catch (error) { + catchCount++; + assert(error instanceof TypeError); + } + assert.sameValue(catchCount, 1); + assert.sameValue(callCount, 1); +}); + diff --git a/js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..3092f4ad35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with-in-nested-fn.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async function named expression) +esid: sec-async-function-definitions +features: [globalThis, Symbol.unscopables, async-functions] +flags: [generated, noStrict, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(x) { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-function/named-unscopables-with.js b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with.js new file mode 100644 index 0000000000..2a135d058b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/named-unscopables-with.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/async-func-expr-named.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async function named expression) +esid: sec-async-function-definitions +features: [globalThis, Symbol.unscopables, async-functions] +flags: [generated, noStrict, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function ref(x) { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/nameless-array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..ad0d2436cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-array-destructuring-param-strict-body.js @@ -0,0 +1,110 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-func-expr-nameless.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function nameless expression) +esid: sec-async-function-definitions +features: [rest-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async function([element]) { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js new file mode 100644 index 0000000000..37757c9856 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-abrupt.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/async-func-expr-nameless.template +/*--- +description: Abrupt completion returned by evaluation of initializer (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; +var f = async function(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, Test262Error)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..801f8fed40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-not-undefined.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: Use of initializer when argument value is not `undefined` (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..f6dff99346 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-arg-val-undefined.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: Use of initializer when argument value is `undefined` (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js new file mode 100644 index 0000000000..89e91e917d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-duplicates.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/async-func-expr-nameless.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + + +(async function(x = 0, x) { + +}); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js new file mode 100644 index 0000000000..15b2f0ff8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-later.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/async-func-expr-nameless.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f = async function(x = y, y) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-prior.js new file mode 100644 index 0000000000..eb63bfe585 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-prior.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js new file mode 100644 index 0000000000..fe9d4e4d23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-ref-self.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/async-func-expr-nameless.template +/*--- +description: Referencing a parameter from within its own initializer (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f = async function(x = x) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-rest.js new file mode 100644 index 0000000000..b9ac26fa93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-rest.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/async-func-expr-nameless.template +/*--- +description: RestParameter does not support an initializer (async function nameless expression) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + + +(async function(...x = []) { + +}); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js new file mode 100644 index 0000000000..c000f723ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-dflt-params-trailing-comma.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (async function nameless expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-function/nameless-eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..6de089c5e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-eval-var-scope-syntax-err.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/async-func-expr-nameless.template +/*--- +description: sloppy direct eval in params introduces var (async function nameless expression in sloppy code) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async, noStrict] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + + +var callCount = 0; +var f = async function(a = eval("var a = 42")) { + + callCount = callCount + 1; +} + +f() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, SyntaxError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/nameless-object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..379bce0a3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-object-destructuring-param-strict-body.js @@ -0,0 +1,110 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-func-expr-nameless.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async function nameless expression) +esid: sec-async-function-definitions +features: [rest-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async function({property}) { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js new file mode 100644 index 0000000000..de1e6354bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-multiple.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (async function nameless expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-single.js new file mode 100644 index 0000000000..fc89ff49e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-params-trailing-comma-single.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (async function nameless expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-function/nameless-rest-param-strict-body.js new file mode 100644 index 0000000000..7765849e99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-rest-param-strict-body.js @@ -0,0 +1,110 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/async-func-expr-nameless.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async function nameless expression) +esid: sec-async-function-definitions +features: [rest-parameters, async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +(async function(a,...rest) { + "use strict"; +}); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..56de8e63f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-rest-params-trailing-comma-early-error.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/async-func-expr-nameless.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async function nameless expression) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + + +(async function(...a,) { + +}); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..87739cc8c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with-in-nested-fn.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async function nameless expression) +esid: sec-async-function-definitions +features: [globalThis, Symbol.unscopables, async-functions] +flags: [generated, noStrict, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(x) { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with.js b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with.js new file mode 100644 index 0000000000..b80372c435 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/nameless-unscopables-with.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/async-func-expr-nameless.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async function nameless expression) +esid: sec-async-function-definitions +features: [globalThis, Symbol.unscopables, async-functions] +flags: [generated, noStrict, async] +info: | + 14.6 Async Function Definitions + + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; + +// Stores a reference `ref` for case evaluation +var ref; +ref = async function(x) { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).then(() => { + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-function/shell.js b/js/src/tests/test262/language/expressions/async-function/shell.js new file mode 100644 index 0000000000..ae18ad584d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/shell.js @@ -0,0 +1,113 @@ +// GENERATED, DO NOT EDIT +// file: asyncHelpers.js +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + A collection of assertion and wrapper functions for testing asynchronous built-ins. +defines: [asyncTest] +---*/ + +function asyncTest(testFunc) { + if (!Object.hasOwn(globalThis, "$DONE")) { + throw new Test262Error("asyncTest called without async flag"); + } + if (typeof testFunc !== "function") { + $DONE(new Test262Error("asyncTest called with non-function argument")); + return; + } + try { + testFunc().then( + function () { + $DONE(); + }, + function (error) { + $DONE(error); + } + ); + } catch (syncError) { + $DONE(syncError); + } +} + +assert.throwsAsync = async function (expectedErrorConstructor, func, message) { + var innerThenable; + if (message === undefined) { + message = ""; + } else { + message += " "; + } + if (typeof func === "function") { + try { + innerThenable = func(); + if ( + innerThenable === null || + typeof innerThenable !== "object" || + typeof innerThenable.then !== "function" + ) { + message += + "Expected to obtain an inner promise that would reject with a" + + expectedErrorConstructor.name + + " but result was not a thenable"; + throw new Test262Error(message); + } + } catch (thrown) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise"; + throw new Test262Error(message); + } + } else { + message += + "assert.throwsAsync called with an argument that is not a function"; + throw new Test262Error(message); + } + + try { + return innerThenable.then( + function () { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but no exception was thrown at all"; + throw new Test262Error(message); + }, + function (thrown) { + var expectedName, actualName; + if (typeof thrown !== "object" || thrown === null) { + message += "Thrown value was not an object!"; + throw new Test262Error(message); + } else if (thrown.constructor !== expectedErrorConstructor) { + expectedName = expectedErrorConstructor.name; + actualName = thrown.constructor.name; + if (expectedName === actualName) { + message += + "Expected a " + + expectedName + + " but got a different error constructor with the same name"; + } else { + message += + "Expected a " + expectedName + " but got a " + actualName; + } + throw new Test262Error(message); + } + } + ); + } catch (thrown) { + if (typeof thrown !== "object" || thrown === null) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object "; + } else { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but a " + + thrown.constructor.name + + " was thrown synchronously"; + } + throw new Test262Error(message); + } +}; diff --git a/js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js b/js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js new file mode 100644 index 0000000000..705014ec22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/syntax-expression-is-PrimaryExpression.js @@ -0,0 +1,13 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Async function expressions are PrimaryExpressions +---*/ + +(async function foo() { }.prototype) + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-function/try-reject-finally-reject.js b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-reject.js new file mode 100644 index 0000000000..ff5ad4c766 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-reject.js @@ -0,0 +1,28 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + await new Promise(function(resolve, reject) { + reject("early-reject"); + }); + } finally { + await new Promise(function(resolve, reject) { + reject("override"); + }); + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Awaited rejection in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-reject-finally-return.js b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-return.js new file mode 100644 index 0000000000..0bddbe0241 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-return.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + await new Promise(function(resolve, reject) { + reject("early-reject"); + }); + } finally { + return "override"; + } +}; + +f().then(function(value) { + assert.sameValue(value, "override", "Return in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-reject-finally-throw.js b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-throw.js new file mode 100644 index 0000000000..e787503ddf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-reject-finally-throw.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + await new Promise(function(resolve, reject) { + reject("early-reject"); + }); + } finally { + throw "override"; + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Exception thrown in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-return-finally-reject.js b/js/src/tests/test262/language/expressions/async-function/try-return-finally-reject.js new file mode 100644 index 0000000000..d9a29ea6cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-return-finally-reject.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer resolving an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + return "early-return"; + } finally { + await new Promise(function(resolve, reject) { + reject("override"); + }); + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Awaited rejection in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-return-finally-return.js b/js/src/tests/test262/language/expressions/async-function/try-return-finally-return.js new file mode 100644 index 0000000000..bc73e9f9fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-return-finally-return.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer resolving an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + return "early-return"; + } finally { + return await new Promise(function(resolve, reject) { + resolve("override"); + }); + } +}; + +f().then(function(value) { + assert.sameValue(value, "override", "Return in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-return-finally-throw.js b/js/src/tests/test262/language/expressions/async-function/try-return-finally-throw.js new file mode 100644 index 0000000000..873569d12d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-return-finally-throw.js @@ -0,0 +1,24 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer resolving an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + return "early-return"; + } finally { + throw "override"; + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Exception thrown in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-throw-finally-reject.js b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-reject.js new file mode 100644 index 0000000000..d2431f4cfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-reject.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + throw "early-throw"; + } finally { + await new Promise(function(resolve, reject) { + reject("override"); + }); + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Awaited rejection in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-throw-finally-return.js b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-return.js new file mode 100644 index 0000000000..0ac681053e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-return.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + throw "early-throw"; + } finally { + return await new Promise(function(resolve, reject) { + resolve("override"); + }); + } +}; + +f().then(function(value) { + assert.sameValue(value, "override", "Return in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-function/try-throw-finally-throw.js b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-throw.js new file mode 100644 index 0000000000..ceebedd4f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-function/try-throw-finally-throw.js @@ -0,0 +1,24 @@ +// |reftest| async +// Copyright 2017 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: pending +description: > + Implementations must defer rejecting an async function's Promise until after + all finally blocks have been evaluated. +flags: [async] +---*/ + +var f = async function() { + try { + throw "early-throw"; + } finally { + throw "override"; + } +}; + +f().then($DONE, function(value) { + assert.sameValue(value, "override", "Exception thrown in finally block"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-generator/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..f784b81fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/array-destructuring-param-strict-body.js @@ -0,0 +1,113 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-gen-func-expr.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +0, async function*([element]) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..2cd503c078 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + var \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier.js new file mode 100644 index 0000000000..fcabda660d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/await-as-binding-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + var await; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..5a0c21c9b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + void \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference.js new file mode 100644 index 0000000000..6c90eb6de0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/await-as-identifier-reference.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + void await; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..7a02e08b63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + \u0061wait: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier.js new file mode 100644 index 0000000000..0c53650007 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/await-as-label-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + await: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/browser.js b/js/src/tests/test262/language/expressions/async-generator/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/default-proto.js b/js/src/tests/test262/language/expressions/async-generator/default-proto.js new file mode 100644 index 0000000000..0a3c32591f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/default-proto.js @@ -0,0 +1,53 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-asyncgenerator-definitions-evaluatebody +description: > + Default [[Prototype]] value derived from realm of the async generator function. +info: | + Runtime Semantics: EvaluateBody + + ... + 2. Let generator be ? OrdinaryCreateFromConstructor(functionObject, "%AsyncGeneratorPrototype%", « ... »). + 3. Perform ! AsyncGeneratorStart(generator, FunctionBody). + 4. Return Completion { [[Type]]: return, [[Value]]: generator, [[Target]]: empty }. + + OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] ) + + ... + 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto). + 3. Return ObjectCreate(proto, internalSlotsList). + + GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, 'prototype'). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Set proto to realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +features: [async-iteration, Symbol] +---*/ + +var fn = async function* () {}; +var AsyncGeneratorPrototype = Object.getPrototypeOf(fn.prototype); + +fn.prototype = undefined; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is undefined'); + +fn.prototype = null; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is null'); + +fn.prototype = false; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a Boolean'); + +fn.prototype = ''; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a String'); + +fn.prototype = Symbol(); +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a Symbol'); + +fn.prototype = 1; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a Number'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-abrupt.js new file mode 100644 index 0000000000..17d59b1006 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-abrupt.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/async-gen-func-expr.template +/*--- +description: Abrupt completion returned by evaluation of initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; +var f; +f = async function*(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; +}; + +assert.throws(Test262Error, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..d31b712980 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: Use of initializer when argument value is not `undefined` (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..cb336ce231 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-arg-val-undefined.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: Use of initializer when argument value is `undefined` (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-duplicates.js new file mode 100644 index 0000000000..f1958d74b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-duplicates.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/async-gen-func-expr.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + + +0, async function*(x = 0, x) { + +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-later.js new file mode 100644 index 0000000000..14c63f3d22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-later.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/async-gen-func-expr.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f; +f = async function*(x = y, y) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-prior.js new file mode 100644 index 0000000000..94a5a0fe46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-prior.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-self.js new file mode 100644 index 0000000000..cb5edc0a37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-ref-self.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/async-gen-func-expr.template +/*--- +description: Referencing a parameter from within its own initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f; +f = async function*(x = x) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-rest.js new file mode 100644 index 0000000000..ec30e10335 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-rest.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/async-gen-func-expr.template +/*--- +description: RestParameter does not support an initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + + +0, async function*(...x = []) { + +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..9ac29e9f5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dflt-params-trailing-comma.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-close.js new file mode 100644 index 0000000000..1dcc3e2656 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function*([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..5cb585bbbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Abrupt completion returned by GetIterator (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var f; +f = async function*([x, y, z]) { + +}; + +assert.throws(TypeError, function() { + f([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err.js new file mode 100644 index 0000000000..67b9f20367 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-get-err.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Abrupt completion returned by GetIterator (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var f; +f = async function*([x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-no-close.js new file mode 100644 index 0000000000..44864fc314 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-init-iter-no-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function*([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-name-iter-val.js new file mode 100644 index 0000000000..48ed914025 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-name-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding with normal value iteration (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..2d0e070008 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..266dc51dec --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f([[7, 8, 9]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..a49d427ea2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function*([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..cc70c99292 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var f; +f = async function*([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f([[]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..a37748b75b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var f; +f = async function*([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..e5a2e43d6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var f; +f = async function*([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([[23]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..19f0aea85c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var f; +f = async function*([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..83f4a32015 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var f; +f = async function*([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([values]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..2b1f1614e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Nested array destructuring with a null value (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var f; +f = async function*([[x]]) { + +}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..cc796ac033 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Destructuring initializer with an exhausted iterator (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..29069b8512 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding does assign name to arrow functions (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..ad46341436 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..976a55fd0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..c3f876d535 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..082991adf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var f; +f = async function*([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..5ce49a08c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Destructuring initializer with a "hole" (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f([,]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..9363556383 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function*([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([null, 0, false, '']).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..4e1e78a6d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Destructuring initializer returns an abrupt completion (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var f; +f = async function*([x = (function() { throw new Test262Error(); })()]) { + +}; + +assert.throws(Test262Error, function() { + f([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..f5a99edcba --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Destructuring initializer with an undefined value (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([undefined]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..75a446295c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function*([ x = unresolvableReference ]) { + +}; + +assert.throws(ReferenceError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..26a57379c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding when value iteration completes (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..2ea2da95af --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..26a2d14faa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var f; +f = async function*([x]) { + +}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..73d25c1705 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var f; +f = async function*([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..b02564fff1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f; +f = async function*([x]) { + +}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..6697962b06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..ea0eef697a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..7ff4b3d066 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-id.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f([{ x: 11, y: 22, z: 33 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..1e4325e2db --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..e2010ffac4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([{ u: 777, w: 888, y: 999 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..9d1a82fc2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Nested object destructuring with a null value (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f; +f = async function*([{ x }]) { + +}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..d580f6a081 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Nested object destructuring with a value of `undefined` (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f; +f = async function*([{ x }]) { + +}; + +assert.throws(TypeError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..cd6b7abcab --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-exhausted.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Elision accepts exhausted iterator (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var f; +f = async function*([,]) { + + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..c474cf744f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision-step-err.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Elision advances iterator and forwards abrupt completions (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var f; +f = async function*([,]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision.js new file mode 100644 index 0000000000..3c4cb4a8c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-elision.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Elision advances iterator (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function*([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-empty.js new file mode 100644 index 0000000000..023be481b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-empty.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function*([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..e13b0cfc47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elem.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element containing an array BindingElementList pattern (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f([3, 4, 5]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..294b44e669 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element containing an elision (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function*([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..63ef39c650 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-empty.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element containing an "empty" array pattern (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function*([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..9176882e76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-ary-rest.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element containing a rest element (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function*([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..7bcc2d0d53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-direct.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Lone rest element (direct binding) (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var f; +f = async function*([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f([1]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..9a11688bb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Rest element following elision elements (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var f; +f = async function*([, ...x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..9849f08ca2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-elision.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element following elision elements (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var f; +f = async function*([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..0f5e4b5117 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: RestElement applied to an exhausted iterator (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var f; +f = async function*([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f([1, 2]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..2045ded696 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var f; +f = async function*([...x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..8a82af9983 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f; +f = async function*([...x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id.js new file mode 100644 index 0000000000..4f05e3a47c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Lone rest element (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function*([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..7a760e18fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element (nested array pattern) does not support initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...[ x ] = []]) { + + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..98ed74335e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element (identifier) does not support initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...x = []]) { + + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..f94136a18a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-init-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element (nested object pattern) does not support initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...{ x } = []]) { + + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..d72f4adf31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...[x], y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..095c4664ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element (identifier) may not be followed by any element (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...x, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..0841df9c51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...{ x }, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..c93cf6858f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element containing an object binding pattern (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var f; +f = async function*([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..a7d413e7ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest element containing an object binding pattern (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var f; +f = async function*([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f([7, 8, 9]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/browser.js b/js/src/tests/test262/language/expressions/async-generator/dstr/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..2910c7d0ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function*([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..26002b049d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var f = async function*([x, y, z] = [1, 2, 3]) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..7417c77482 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-get-err.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var f = async function*([x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..833b9ce498 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-init-iter-no-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function*([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..a3fb0f3f8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-name-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..9fbd8e825d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..c87c1468e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..e054192528 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function*([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..b4f6260d6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var f; +f = async function*([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..b7975f6bb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var f; +f = async function*([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..0a81ca4b2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var f; +f = async function*([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..249d5d653b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var f; +f = async function*([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..4830799cde --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var f; +f = async function*([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..352174e9de --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Nested array destructuring with a null value (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var f = async function*([[x]] = [null]) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..f31c183bc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..2f076685d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..2dabdf4fdd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..9f18d946c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..e4a6dcf9f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..39bae4bba0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var f; +f = async function*([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..5bfaec83aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer with a "hole" (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..b59d4d5ba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function*([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..5beda66084 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var f = async function*([x = (function() { throw new Test262Error(); })()] = [undefined]) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..e96638c874 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer with an undefined value (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..fd29d3b01b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f = async function*([ x = unresolvableReference ] = []) { + +}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..ea8476aff7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..0395e46437 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..917f389418 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var f = async function*([x] = g) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..c108a49d6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var f; +f = async function*([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..cf7f43d642 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f = async function*([x] = g) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..7547df9678 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..2a7e7c918c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..9d701d0cb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..39aaac977f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..8b50023295 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..d92839c0af --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Nested object destructuring with a null value (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f = async function*([{ x }] = [null]) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..23f9e50f42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f = async function*([{ x }] = []) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..23d7f11e35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Elision accepts exhausted iterator (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var f; +f = async function*([,] = iter) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..91af3f4a52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var f = async function*([,] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..e3030c6fff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-elision.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Elision advances iterator (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function*([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..c13d5103a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-empty.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function*([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..fe32d9fec0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..c8fc278a84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element containing an elision (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function*([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..fb0cd86521 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function*([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..0d5caadf49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element containing a rest element (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function*([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..5eae1b6f9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Lone rest element (direct binding) (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var f; +f = async function*([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..aef4362e8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Rest element following elision elements (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var f = async function*([, ...x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..5c540ce210 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element following elision elements (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var f; +f = async function*([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..b5ed8bba94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var f; +f = async function*([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..7ca7b599e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var f = async function*([...x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..2ddd428cc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f = async function*([...x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..6c7eba3136 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Lone rest element (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function*([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..315022bdb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...[ x ] = []] = []) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..629a101ae8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...x = []] = []) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..e8a3d00057 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...{ x } = []] = []) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..1aa8204c80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..53775afec8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..126f67faf2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function*([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..78bb3714df --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var f; +f = async function*([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..627eb415fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var f; +f = async function*([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-null.js new file mode 100644 index 0000000000..7dd2ae9189 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-null.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f = async function*({} = null) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-undefined.js new file mode 100644 index 0000000000..1a77f81f97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-init-undefined.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f = async function*({} = undefined) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..e8bb916fdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-empty.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var f; +f = async function*({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..90acbe9178 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f = async function*({ poisoned } = poisonedProperty) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..2dfd5f0955 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..0876058218 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..6336e2f23f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..aca89b9fa1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..6cb5124175 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var f; +f = async function*({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..b7eb41b496 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function*({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..125e900d7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f = async function*({ x = thrower() } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..1157b32783 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f = async function*({ x = unresolvableReference } = {}) { + +}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..b716aa978d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function*({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..4a78e90510 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-list-err.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var f = async function*({ a, b = thrower(), c = ++initCount } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..713379e1a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..c9f6024c27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..f264a3207f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f = async function*({ w: [x, y, z] = [4, 5, 6] } = { w: null }) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..26ccfa962e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..3833f98795 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f = async function*({ [thrower()]: x } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..fa06bd0ff5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f = async function*({ poisoned: x = ++initEvalCount } = poisonedProperty) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..a365c90c9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function*({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..b1b612b3dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f = async function*({ x: y = thrower() } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..690abe4d1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f = async function*({ x: y = unresolvableReference } = {}) { + +}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..9a48e10248 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..e4f05cae84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..2849bf8730 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-id.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Binding as specified via property name and identifier (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..e21ac34081 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..fb94ec3a2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f = async function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..c34e69dd2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/async-gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f = async function*({ w: { x, y, z } = undefined } = { }) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..631967b330 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..a997f2e2e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var f; +f = async function*({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..da16d35feb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var f; +f = async function*({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..1a9fd733fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/async-gen-func-expr-dflt.template +/*--- +description: Rest object contains just unextracted data (async generator function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var f; +f = async function*({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-close.js new file mode 100644 index 0000000000..e643fc2117 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function* h([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..e61c4f9fb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Abrupt completion returned by GetIterator (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var f; +f = async function* g([x, y, z]) { + +}; + +assert.throws(TypeError, function() { + f([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err.js new file mode 100644 index 0000000000..3b1ec476c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-get-err.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Abrupt completion returned by GetIterator (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var f; +f = async function* g([x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-no-close.js new file mode 100644 index 0000000000..ea245d046b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-init-iter-no-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function* h([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-name-iter-val.js new file mode 100644 index 0000000000..6d0148d7c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-name-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding with normal value iteration (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..7969a3eca1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..3c57987290 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f([[7, 8, 9]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..7eee91f03b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..f4e5703efc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f([[]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..e2b6dd2eea --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var f; +f = async function* h([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..1006dd8154 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var f; +f = async function* h([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([[23]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..c60c89885d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var f; +f = async function* h([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..984a15e9fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var f; +f = async function* h([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([values]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..66409abe80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Nested array destructuring with a null value (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var f; +f = async function* g([[x]]) { + +}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..8b5f242782 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer with an exhausted iterator (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..454e387c90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding does assign name to arrow functions (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..b1d642afd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..5623c8ad3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..775f3c884f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..54a90d2fda --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var f; +f = async function* h([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..298b9d26a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer with a "hole" (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f([,]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..072a5db935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function* h([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([null, 0, false, '']).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..6ca55f47f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer returns an abrupt completion (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var f; +f = async function* g([x = (function() { throw new Test262Error(); })()]) { + +}; + +assert.throws(Test262Error, function() { + f([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..0e3fc16ad7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer with an undefined value (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([undefined]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..b872cf8984 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function* g([ x = unresolvableReference ]) { + +}; + +assert.throws(ReferenceError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..3eb02deb39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding when value iteration completes (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..901a1ca51f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..f40fab78f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var f; +f = async function* g([x]) { + +}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..c4fbfc407c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var f; +f = async function* h([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..14b3f231cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f; +f = async function* g([x]) { + +}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..3c34d924ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..7c411d6cb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..253bef3b8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-id.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f([{ x: 11, y: 22, z: 33 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..3e4f8eb2d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..6b94949151 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([{ u: 777, w: 888, y: 999 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..eeb42baac0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Nested object destructuring with a null value (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f; +f = async function* g([{ x }]) { + +}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..6ecf1380f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Nested object destructuring with a value of `undefined` (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f; +f = async function* g([{ x }]) { + +}; + +assert.throws(TypeError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..b286785f7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-exhausted.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Elision accepts exhausted iterator (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var f; +f = async function* h([,]) { + + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..6436a3ff45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision-step-err.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Elision advances iterator and forwards abrupt completions (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var f; +f = async function* g([,]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision.js new file mode 100644 index 0000000000..0a798b1113 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-elision.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Elision advances iterator (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-empty.js new file mode 100644 index 0000000000..b064054dea --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-empty.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function* h([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..4c9774e603 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element containing an array BindingElementList pattern (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f([3, 4, 5]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..654351cfce --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element containing an elision (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..632010b46c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element containing an "empty" array pattern (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function* h([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..cfb6f46f72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element containing a rest element (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function* h([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..701fa07dc9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-direct.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Lone rest element (direct binding) (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var f; +f = async function* h([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f([1]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..e9d1335f5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Rest element following elision elements (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var f; +f = async function* g([, ...x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..93215c2509 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-elision.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element following elision elements (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var f; +f = async function* h([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..93753206f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: RestElement applied to an exhausted iterator (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var f; +f = async function* h([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f([1, 2]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..2375a3d3f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var f; +f = async function* g([...x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..21023db9be --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f; +f = async function* g([...x]) { + +}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..41a1db43d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Lone rest element (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function* h([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..4e327b7d22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element (nested array pattern) does not support initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...[ x ] = []]) { + + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..2ec762492c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element (identifier) does not support initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...x = []]) { + + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..fa7d8d369a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-init-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element (nested object pattern) does not support initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...{ x } = []]) { + + callCount = callCount + 1; +}; + +f([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..582a9482ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...[x], y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..6dcef40b7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element (identifier) may not be followed by any element (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...x, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..c82783bab9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...{ x }, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..c9e5949560 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element containing an object binding pattern (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var f; +f = async function* h([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..eeaa2bb073 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest element containing an object binding pattern (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var f; +f = async function* h([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f([7, 8, 9]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..97eed460a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function* h([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..b1c34faf7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var f; +f = async function* h([x, y, z] = [1, 2, 3]) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..3d2e6d697d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-get-err.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var f; +f = async function* h([x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..1312d5b3fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-init-iter-no-close.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var f; +f = async function* h([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..327f9a1b71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-name-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..1e94865542 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..31c99d280e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..f583d14e65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..2ba8f9ff28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..fee07a23e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var f; +f = async function* h([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..66fb127397 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var f; +f = async function* h([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..c9bb825ff7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var f; +f = async function* h([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..bb52e4f49f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var f; +f = async function* h([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..120c6e76bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Nested array destructuring with a null value (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var f; +f = async function* h([[x]] = [null]) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..adeaa103e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..0ac4c493a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..324602ee51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..825c0113fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..f0aa5d2090 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..3ce1c5af16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var f; +f = async function* h([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..23a7f9ffd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer with a "hole" (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..6542568429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function* h([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..2bb0a406b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var f; +f = async function* h([x = (function() { throw new Test262Error(); })()] = [undefined]) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..21afd82d2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer with an undefined value (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..71aca3bb97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function* h([ x = unresolvableReference ] = []) { + +}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..a97fe06963 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..9bbabceafa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..31842304c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var f; +f = async function* h([x] = g) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..6109699b86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var f; +f = async function* h([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..3921b1ca21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f; +f = async function* h([x] = g) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..81c79b9e7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..0ea1e5cbad --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..aaa1578190 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..981296a5d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..25e1a68221 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..bfa0bbce60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Nested object destructuring with a null value (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f; +f = async function* h([{ x }] = [null]) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..bc14482743 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var f; +f = async function* h([{ x }] = []) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..74f6dfb70e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Elision accepts exhausted iterator (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var f; +f = async function* h([,] = iter) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..69240fea46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var f; +f = async function* h([,] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..1d36274ae7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-elision.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Elision advances iterator (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..7aa5bec2a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-empty.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function* h([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..5c7ae5a707 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..6c0da07989 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element containing an elision (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var f; +f = async function* h([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..bf3545990b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var f; +f = async function* h([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..b589d81032 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element containing a rest element (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function* h([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..75851e9fe4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Lone rest element (direct binding) (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var f; +f = async function* h([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..5ed81cbb24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element following elision elements (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var f; +f = async function* h([, ...x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..5a2b9ab978 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element following elision elements (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var f; +f = async function* h([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..fb028857bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var f; +f = async function* h([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..b3e198190c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var f; +f = async function* h([...x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..43f6f6a8bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var f; +f = async function* h([...x] = iter) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..97d6324987 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Lone rest element (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var f; +f = async function* h([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..23d0961319 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...[ x ] = []] = []) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..cf38d6066a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...x = []] = []) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..beb9a382fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...{ x } = []] = []) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..a718a00735 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..e16a19ebef --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..bce88cfda8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var f; +f = async function* h([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..7dab228808 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var f; +f = async function* h([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..cf048a14be --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var f; +f = async function* h([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-null.js new file mode 100644 index 0000000000..bbd8e92f7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-null.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f; +f = async function* h({} = null) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..ab1837b703 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-init-undefined.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f; +f = async function* h({} = undefined) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..4203ec5310 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-empty.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var f; +f = async function* h({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..fedfbe2c13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f; +f = async function* h({ poisoned } = poisonedProperty) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..4f73b0c6b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..d414404cd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..d78ddc2e04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..26d4ecf6aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..f96d35b737 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var f; +f = async function* h({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..f64179e602 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function* h({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..fcefde9ed8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* h({ x = thrower() } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..49b35989f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function* h({ x = unresolvableReference } = {}) { + +}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..a52a41e217 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..dbc65e4f9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-list-err.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* h({ a, b = thrower(), c = ++initCount } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..6d8179c8e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..02fd64f2b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..b3bafbf16e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function* h({ w: [x, y, z] = [4, 5, 6] } = { w: null }) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..91e70485c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..28d659c6fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* h({ [thrower()]: x } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..3111195b04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f; +f = async function* h({ poisoned: x = ++initEvalCount } = poisonedProperty) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..b5a09de042 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function* h({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..7320fb73bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* h({ x: y = thrower() } = {}) { + +}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..aee05d469c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function* h({ x: y = unresolvableReference } = {}) { + +}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..c4f79f4ee8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..d331e19fe6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..d390aaf442 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Binding as specified via property name and identifier (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..02cb6a3f59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..b63dc5ff74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function* h({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..5fb1a5326d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/async-gen-func-named-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function* h({ w: { x, y, z } = undefined } = { }) { + +}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..d7f909c240 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..835028c927 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var f; +f = async function* h({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..436ad98c52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var f; +f = async function* h({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..8e3b2d68d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr-dflt.template +/*--- +description: Rest object contains just unextracted data (async generator named function expression (default parameter)) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + +---*/ + + +var callCount = 0; +var f; +f = async function* h({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-null.js new file mode 100644 index 0000000000..b6064a769c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-null.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f; +f = async function* g({}) { + +}; + +assert.throws(TypeError, function() { + f(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-undefined.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-undefined.js new file mode 100644 index 0000000000..04aa4f1ad3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-init-undefined.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f; +f = async function* g({}) { + +}; + +assert.throws(TypeError, function() { + f(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-empty.js new file mode 100644 index 0000000000..272465447b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-empty.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: No property access occurs for an "empty" object binding pattern (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var f; +f = async function* h({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f(obj).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..2ce4f8cb03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-get-value-err.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f; +f = async function* g({ poisoned }) { + +}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..c1b3726490 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..46bd7d576e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..d5a02c3d37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..5f4250b5c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..af3ec9ce67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var f; +f = async function* h({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..47c7d43e89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-skipped.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function* h({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f({ w: null, x: 0, y: false, z: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..c0ca107850 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-throws.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error thrown when evaluating the initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* g({ x = thrower() }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..e5744abc21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function* g({ x = unresolvableReference }) { + +}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..44d8dec12d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-list-err.js new file mode 100644 index 0000000000..dce2e24d1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-list-err.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* g({ a, b = thrower(), c = ++initCount }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..3d70802764 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..5404707935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f({ x: [45] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..1e62e078ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function* g({ w: [x, y, z] = [4, 5, 6] }) { + +}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..690381f4dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-ary.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: [7, undefined, ] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..67697b9b61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-eval-err.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Evaluation of property name returns an abrupt completion (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* g({ [thrower()]: x }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..8dc3082a20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f; +f = async function* g({ poisoned: x = ++initEvalCount }) { + +}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..4ecda5b046 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function* h({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f({ s: null, u: 0, w: false, y: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..b5a8e64958 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Error thrown when evaluating the initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function* g({ x: y = thrower() }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..933524d160 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function* g({ x: y = unresolvableReference }) { + +}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..330c9c31e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-init.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Binding as specified via property name, identifier, and initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..180b8ad3ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..55a3888db7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-id.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Binding as specified via property name and identifier (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function* h({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..a45c18df19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: undefined }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..0659e717ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function* g({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + +}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..dc7f82ff9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/async-gen-func-named-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function* g({ w: { x, y, z } = undefined }) { + +}; + +assert.throws(TypeError, function() { + f({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..306dab2a35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-prop-obj.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function* h({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: { x: undefined, z: 7 } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..b70ccb3c62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-getter.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var f; +f = async function* h({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({ get v() { count++; return 2; } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..c605036f44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest object doesn't contain non-enumerable properties (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var f; +f = async function* h({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f(o).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..588fc7aa2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/named-obj-ptrn-rest-val-obj.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/async-gen-func-named-expr.template +/*--- +description: Rest object contains just unextracted data (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + +---*/ + + +var callCount = 0; +var f; +f = async function* h({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({x: 1, y: 2, a: 5, b: 3}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-null.js new file mode 100644 index 0000000000..5ee8a4d505 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-null.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f; +f = async function*({}) { + +}; + +assert.throws(TypeError, function() { + f(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-undefined.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-undefined.js new file mode 100644 index 0000000000..68a135e842 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-init-undefined.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var f; +f = async function*({}) { + +}; + +assert.throws(TypeError, function() { + f(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-empty.js new file mode 100644 index 0000000000..77f185ecff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-empty.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: No property access occurs for an "empty" object binding pattern (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var f; +f = async function*({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f(obj).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..d258e6ba13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-get-value-err.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f; +f = async function*({ poisoned }) { + +}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..7fef7c2cfa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..58527f2ae2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b0f0cfc3c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..32dcb5b8af --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var f; +f = async function*({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..af444cc6b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var f; +f = async function*({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..3c3c36ac3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-skipped.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function*({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f({ w: null, x: 0, y: false, z: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..21e1b974c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-throws.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error thrown when evaluating the initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function*({ x = thrower() }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..588d2be359 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function*({ x = unresolvableReference }) { + +}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..2b7e794cf6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-id-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function*({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-list-err.js new file mode 100644 index 0000000000..c8f8712f50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-list-err.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function*({ a, b = thrower(), c = ++initCount }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..57b8569b9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..4f12609b64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f({ x: [45] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..43054ce5d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function*({ w: [x, y, z] = [4, 5, 6] }) { + +}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..5716990e0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-ary.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: [7, undefined, ] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..0f52b003a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-eval-err.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Evaluation of property name returns an abrupt completion (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function*({ [thrower()]: x }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..9e249c829b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var f; +f = async function*({ poisoned: x = ++initEvalCount }) { + +}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..95ac9fcdf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var f; +f = async function*({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f({ s: null, u: 0, w: false, y: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..27cc7c83c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Error thrown when evaluating the initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var f; +f = async function*({ x: y = thrower() }) { + +}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..e900051220 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var f; +f = async function*({ x: y = unresolvableReference }) { + +}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..38fdb10700 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-init.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Binding as specified via property name, identifier, and initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..2ad14b75bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id.js new file mode 100644 index 0000000000..3e3ddef41d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-id.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Binding as specified via property name and identifier (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var f; +f = async function*({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..9e44c37e5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: undefined }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..7d603c62f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + +}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..ea685e7b2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/async-gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var f; +f = async function*({ w: { x, y, z } = undefined }) { + +}; + +assert.throws(TypeError, function() { + f({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..2fb16ded2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-prop-obj.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var f; +f = async function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: { x: undefined, z: 7 } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..207ba7de4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-getter.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var f; +f = async function*({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({ get v() { count++; return 2; } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..0b2a97f109 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest object doesn't contain non-enumerable properties (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var f; +f = async function*({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f(o).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..fd09928e16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/dstr/obj-ptrn-rest-val-obj.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/async-gen-func-expr.template +/*--- +description: Rest object contains just unextracted data (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var f; +f = async function*({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({x: 1, y: 2, a: 5, b: 3}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/dstr/shell.js b/js/src/tests/test262/language/expressions/async-generator/dstr/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-NSPL-with-USD.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-NSPL-with-USD.js new file mode 100644 index 0000000000..f09c58e53e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-NSPL-with-USD.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(x = 1) {"use strict"}); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-arguments-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-arguments-in-formal-parameters-strict.js new file mode 100644 index 0000000000..f6a7b3a300 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-arguments-in-formal-parameters-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a SyntaxError if FormalParameters contains arguments in strict mode. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(arguments) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-await-as-function-binding-identifier.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-await-as-function-binding-identifier.js new file mode 100644 index 0000000000..fc2b60d1f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-await-as-function-binding-identifier.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-identifiers-static-semantics-early-errors +description: > + `await` is not a valid BindingIdentifier for AsyncGeneratorExpressions. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function* await() { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-arguments-strict.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-arguments-strict.js new file mode 100644 index 0000000000..7f9c53b5ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-arguments-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-identifiers-static-semantics-early-errors +description: > + If the source code matching this production is strict code, it is a + Syntax Error if BindingIdentifier is the IdentifierName arguments. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function* arguments() { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-eval-strict.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-eval-strict.js new file mode 100644 index 0000000000..45a8922d7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-binding-identifier-eval-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-identifiers-static-semantics-early-errors +description: > + If the source code matching this production is strict code, it is a + Syntax Error if BindingIdentifier is the IdentifierName eval. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function* eval() { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-call.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-call.js new file mode 100644 index 0000000000..b074cbc7dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-call.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a syntax error if AsyncGeneratorBody contains SuperCall is true. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*() { super(); }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-property.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-property.js new file mode 100644 index 0000000000..a62022973e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-body-contains-super-property.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a syntax error if AsyncGeneratorBody contains SuperProperty is true. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*() { super.prop; }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-eval-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-eval-in-formal-parameters-strict.js new file mode 100644 index 0000000000..cd5284a157 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-eval-in-formal-parameters-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-strict-mode-of-ecmascript +description: > + It is a SyntaxError if FormalParameters contains eval in strict mode. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(eval) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-const.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-const.js new file mode 100644 index 0000000000..9be10e9601 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-const.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a SyntaxError if BoundNames of FormalParameters also occurs in the + LexicallyDeclaredNames of AsyncFunctionBody +info: | + It is a Syntax Error if any element of the BoundNames of FormalParameters + also occurs in the LexicallyDeclaredNames of GeneratorBody. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(a) { const a = 0; }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-let.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-let.js new file mode 100644 index 0000000000..aea4309f8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-body-duplicate-let.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a SyntaxError if BoundNames of FormalParameters also occurs in the + LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(a) { let a; }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js new file mode 100644 index 0000000000..5a6677d8e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await-expr.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a Syntax Error if FormalParameters Contains AwaitExpression is true. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(x = await 1) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await.js new file mode 100644 index 0000000000..9bf880d200 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-await.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-identifiers-static-semantics-early-errors +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as the binding identifier of a parameter. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(await) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js new file mode 100644 index 0000000000..07801e74eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-call.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a syntax error if FormalParameters contains SuperCall is true. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(a = super()) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js new file mode 100644 index 0000000000..344914d8d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-super-property.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a syntax error if FormalParameters contains SuperProperty is true. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(a = super.prop) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js new file mode 100644 index 0000000000..3e24c30203 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield-expr.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + It is a Syntax Error if FormalParameters Contains YieldExpression is true. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(x = yield) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield.js new file mode 100644 index 0000000000..e30271bf70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-formals-contains-yield.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-identifiers-static-semantics-early-errors +description: > + `yield` is a reserved keyword within async generator function bodies and may + not be used as the binding identifier of a parameter. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*(yield) { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-await.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-await.js new file mode 100644 index 0000000000..c19d21c7ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-await.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-identifiers-static-semantics-early-errors +description: > + `await` is a reserved keyword within async generator function bodies and may + not be used as a label. +info: | + BindingIdentifier : await + + It is a Syntax Error if this production has an [Await] parameter. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*() { + await: 1; +}); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-yield.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-yield.js new file mode 100644 index 0000000000..3565f700f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-label-name-yield.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-identifiers-static-semantics-early-errors +description: > + `yield` is a reserved keyword within async generator function bodies and may + not be used as a label. +info: | + BindingIdentifier : Identifier + LabelIdentifier : Identifier + + It is a Syntax Error if this production has an [Await] parameter and + StringValue of Identifier is "await". +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*() { + yield: 1; +}); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-not-simple-assignment-target.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-not-simple-assignment-target.js new file mode 100644 index 0000000000..7f49ef1285 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-not-simple-assignment-target.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: prod-LeftHandSideExpression +description: > + Async generator function expressions are not a simple assignment target. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*() { } = 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-as-function-binding-identifier.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-as-function-binding-identifier.js new file mode 100644 index 0000000000..36a3a63894 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-as-function-binding-identifier.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-async-generator-function-definitions-static-semantics-early-errors +description: > + `yield` is not a valid BindingIdentifier for AsyncGeneratorExpressions. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function* yield() { }); diff --git a/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-star-after-newline.js b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-star-after-newline.js new file mode 100644 index 0000000000..6867a3aa5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/early-errors-expression-yield-star-after-newline.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + A newline may not precede the `*` token in a `yield` expression. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +(async function*() { + yield + * 1; +}); diff --git a/js/src/tests/test262/language/expressions/async-generator/escaped-async.js b/js/src/tests/test262/language/expressions/async-generator/escaped-async.js new file mode 100644 index 0000000000..6d0692ea29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/escaped-async.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `async` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +void \u0061sync function* f(){}; diff --git a/js/src/tests/test262/language/expressions/async-generator/eval-body-proto-realm.js b/js/src/tests/test262/language/expressions/async-generator/eval-body-proto-realm.js new file mode 100644 index 0000000000..1c48e3b768 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/eval-body-proto-realm.js @@ -0,0 +1,54 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-asyncgenerator-definitions-evaluatebody +description: > + Default [[Prototype]] value derived from realm of the async generator function. +info: | + Runtime Semantics: EvaluateBody + + ... + 2. Let generator be ? OrdinaryCreateFromConstructor(functionObject, "%AsyncGeneratorPrototype%", « ... »). + 3. Perform ! AsyncGeneratorStart(generator, FunctionBody). + 4. Return Completion { [[Type]]: return, [[Value]]: generator, [[Target]]: empty }. + + OrdinaryCreateFromConstructor ( constructor, intrinsicDefaultProto [ , internalSlotsList ] ) + + ... + 2. Let proto be ? GetPrototypeFromConstructor(constructor, intrinsicDefaultProto). + 3. Return ObjectCreate(proto, internalSlotsList). + + GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto ) + + ... + 3. Let proto be ? Get(constructor, 'prototype'). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Set proto to realm's intrinsic object named intrinsicDefaultProto. + 5. Return proto. +features: [async-iteration, cross-realm, Symbol] +---*/ + +var other = $262.createRealm().global; +var fn = other.eval('(0, async function* () {})'); +var AsyncGeneratorPrototype = Object.getPrototypeOf(fn.prototype); + +fn.prototype = undefined; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is undefined'); + +fn.prototype = null; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is null'); + +fn.prototype = true; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a Boolean'); + +fn.prototype = 'str'; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a String'); + +fn.prototype = Symbol(); +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a Symbol'); + +fn.prototype = 0; +assert.sameValue(Object.getPrototypeOf(fn()), AsyncGeneratorPrototype, 'fn.prototype is a Number'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-generator/eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..d157cd3e4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/eval-var-scope-syntax-err.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/async-gen-func-expr.template +/*--- +description: sloppy direct eval in params introduces var (async generator function expression in sloppy code) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, noStrict] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + + +var callCount = 0; +var f; +f = async function*(a = eval("var a = 42")) { + + callCount = callCount + 1; +}; + +assert.throws(SyntaxError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/expression-await-as-yield-operand.js b/js/src/tests/test262/language/expressions/async-generator/expression-await-as-yield-operand.js new file mode 100644 index 0000000000..ece1fe83c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/expression-await-as-yield-operand.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +features: [async-iteration] +---*/ + +var iter = (async function*() { + yield await "a"; +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/expression-await-promise-as-yield-operand.js b/js/src/tests/test262/language/expressions/async-generator/expression-await-promise-as-yield-operand.js new file mode 100644 index 0000000000..385b014d44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/expression-await-promise-as-yield-operand.js @@ -0,0 +1,28 @@ +// |reftest| async +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +features: [async-iteration] +---*/ + +var iter = (async function*() { + yield await new Promise(function(resolve) { + resolve("a"); + }); +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/expression-await-thenable-as-yield-operand.js b/js/src/tests/test262/language/expressions/async-generator/expression-await-thenable-as-yield-operand.js new file mode 100644 index 0000000000..37877d4333 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/expression-await-thenable-as-yield-operand.js @@ -0,0 +1,32 @@ +// |reftest| async +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + AwaitExpressions are valid operands to yield expressions. +flags: [async] +features: [async-iteration] +---*/ + +var thenable = { + then: function(resolve, reject) { + resolve("a"); + } +}; + +var iter = (async function*() { + yield await thenable; +})(); + +iter.next().then(function(result) { + assert.sameValue(result.value, "a", 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/expression-yield-as-operand.js b/js/src/tests/test262/language/expressions/async-generator/expression-yield-as-operand.js new file mode 100644 index 0000000000..d64aba1715 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/expression-yield-as-operand.js @@ -0,0 +1,33 @@ +// |reftest| async +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + `yield` expressions may be used as the right-hand-side of other `yield` + expressions. +flags: [async] +features: [async-iteration] +---*/ + +var g = async function*() { + yield yield 1; +}; + +var iter = g(); +iter.next().then(function(result) { + assert.sameValue(result.value, 1, 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, false, 'Second result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Third result `value`'); + assert.sameValue(result.done, true, 'Thid result `done` flag'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/expression-yield-as-statement.js b/js/src/tests/test262/language/expressions/async-generator/expression-yield-as-statement.js new file mode 100644 index 0000000000..9cff52a2af --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/expression-yield-as-statement.js @@ -0,0 +1,43 @@ +// |reftest| async +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + `yield` is a valid statement within async generator function bodies. +flags: [async] +features: [async-iteration] +---*/ + +var g1 = async function*() { yield; }; +var g2 = async function*() { yield 1; }; + +var iter1 = g1(); +iter1.next().then(function(result) { + assert.sameValue( + result.value, undefined, "Without right-hand-side: first result `value`"); + assert.sameValue( + result.done, false, "Without right-hand-side: first result `done` flag"); +}).then(undefined, $DONE); +iter1.next().then(function(result) { + assert.sameValue( + result.value, undefined, "Without right-hand-side: second result `value`"); + assert.sameValue( + result.done, true, "Without right-hand-side: second result `done` flag"); +}).then(undefined, $DONE); + +var iter2 = g2(); +iter2.next().then(function(result) { + assert.sameValue( + result.value, 1, "With right-hand-side: first result `value`"); + assert.sameValue( + result.done, false, "With right-hand-side: first result `done` flag"); +}).then(undefined, $DONE); +iter2.next().then(function(result) { + assert.sameValue( + result.value, undefined, "With right-hand-side: second result `value`"); + assert.sameValue( + result.done, true, "With right-hand-side: second result `done` flag"); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/expression-yield-newline.js b/js/src/tests/test262/language/expressions/async-generator/expression-yield-newline.js new file mode 100644 index 0000000000..541f1a862c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/expression-yield-newline.js @@ -0,0 +1,28 @@ +// |reftest| async +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + Newlines terminate `yield` expressions. +flags: [async] +features: [async-iteration] +---*/ + +var g = async function*() { + yield + 1; +}; + +var iter = g(); +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'First result `value`'); + assert.sameValue(result.done, false, 'First result `done` flag'); +}).then(undefined, $DONE); + +iter.next().then(function(result) { + assert.sameValue(result.value, undefined, 'Second result `value`'); + assert.sameValue(result.done, true, 'Second result `done` flag'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/expression-yield-star-before-newline.js b/js/src/tests/test262/language/expressions/async-generator/expression-yield-star-before-newline.js new file mode 100644 index 0000000000..f5511e44cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/expression-yield-star-before-newline.js @@ -0,0 +1,22 @@ +// |reftest| async +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Caitlin Potter +esid: sec-generator-function-definitions +description: > + The right-hand side of a `yield *` expression may appear on a new line. +flags: [async] +features: [async-iteration] +---*/ + +var g = async function*() {}; + +(async function*() { + yield* + g(); +})().next().then(function(result) { + assert.sameValue(result.value, undefined); + assert.sameValue(result.done, true); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..3695816892 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template +/*--- +description: Forbidden extension, f.arguments (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f; +f = async function*() { + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..4baefa87a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-func-expr-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f; +f = async function*() { + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..01c75de1b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template +/*--- +description: Forbidden extension, f.arguments (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f; +f = async function* g() { + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..939d7cb830 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/async-gen-named-func-expr-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var f; +f = async function* g() { + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..3b1af7907a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function*() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..60f13fe355 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function*() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..e15c292832 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-func-expr-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function*() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..b033e2d359 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function* g() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..fd99288e11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function* g() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..24a7c4f53a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/async-gen-named-func-expr-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template +/*--- +description: Forbidden extension, o.caller (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [arrow-function, async-functions, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var f; +f = async function* g() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + callCount++; +}; + +f().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/async-generator/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/async-generator/generator-created-after-decl-inst.js b/js/src/tests/test262/language/expressions/async-generator/generator-created-after-decl-inst.js new file mode 100644 index 0000000000..9d74e66534 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/generator-created-after-decl-inst.js @@ -0,0 +1,26 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-asyncgenerator-definitions-evaluatebody +description: > + The generator object is created after FunctionDeclarationInstantiation. +info: | + 14.5.10 Runtime Semantics: EvaluateBody + + 1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList). + 2. Let generator be ? OrdinaryCreateFromConstructor(functionObject, "%AsyncGeneratorPrototype%", + « [[AsyncGeneratorState]], [[AsyncGeneratorContext]], [[AsyncGeneratorQueue]] »). + 3. Perform ! AsyncGeneratorStart(generator, FunctionBody). + ... + +features: [async-iteration] +---*/ + +var g = async function*(a = (g.prototype = null)) {} +var oldPrototype = g.prototype; +var it = g(); + +assert.notSameValue(Object.getPrototypeOf(it), oldPrototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/name.js b/js/src/tests/test262/language/expressions/async-generator/name.js new file mode 100644 index 0000000000..4dfd2d458d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/name.js @@ -0,0 +1,38 @@ +// Copyright (C) 2019 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-asyncgenerator-definitions-evaluation +description: Assignment of function `name` attribute +info: | + AsyncGeneratorExpression : async function * ( FormalParameters ) { AsyncGeneratorBody } + + 1. Let scope be the LexicalEnvironment of the running execution context. + 2. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, ""). + ... + 6. Return closure. + + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + 1. Let scope be the running execution context's LexicalEnvironment. + 2. Let funcEnv be ! NewDeclarativeEnvironment(scope). + 3. Let envRec be funcEnv's EnvironmentRecord. + 4. Let name be StringValue of BindingIdentifier. + 5. Perform ! envRec.CreateImmutableBinding(name). + 6. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, name). + ... + 11. Return closure. +includes: [propertyHelper.js] +---*/ + +verifyProperty(async function*() {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(async function* func() {}, "name", { + value: "func", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-generator/named-array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..55d242fd7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-array-destructuring-param-strict-body.js @@ -0,0 +1,113 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-gen-named-func-expr.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +0, async function* g([element]) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..4653cf575e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + var \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier.js new file mode 100644 index 0000000000..cac883210c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-await-as-binding-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + var await; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..b4d9f6e00e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + void \u0061wait; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference.js new file mode 100644 index 0000000000..ebc00efaae --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-await-as-identifier-reference.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + void await; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..e15ea1760c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + \u0061wait: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier.js new file mode 100644 index 0000000000..d189f17d06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-await-as-label-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Await] parameter and + StringValue of Identifier is "await". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + await: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-abrupt.js new file mode 100644 index 0000000000..d3c1e3b4a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-abrupt.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/async-gen-named-func-expr.template +/*--- +description: Abrupt completion returned by evaluation of initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; +var f; +f = async function* g(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; +}; + +assert.throws(Test262Error, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..9599a09907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-not-undefined.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: Use of initializer when argument value is not `undefined` (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..a1822f2d5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-arg-val-undefined.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: Use of initializer when argument value is `undefined` (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-duplicates.js new file mode 100644 index 0000000000..9fd77d7680 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-duplicates.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/async-gen-named-func-expr.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + + +0, async function* g(x = 0, x) { + +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-later.js new file mode 100644 index 0000000000..a57df156aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-later.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/async-gen-named-func-expr.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f; +f = async function* g(x = y, y) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-prior.js new file mode 100644 index 0000000000..6b23c62f38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-prior.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-self.js new file mode 100644 index 0000000000..06abd430c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-ref-self.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/async-gen-named-func-expr.template +/*--- +description: Referencing a parameter from within its own initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var f; +f = async function* g(x = x) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-rest.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-rest.js new file mode 100644 index 0000000000..67e8ee7e84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-rest.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/async-gen-named-func-expr.template +/*--- +description: RestParameter does not support an initializer (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + + +0, async function* g(...x = []) { + +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-trailing-comma.js new file mode 100644 index 0000000000..7697a9613b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-dflt-params-trailing-comma.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/async-generator/named-eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..1f80e5ff9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-eval-var-scope-syntax-err.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/async-gen-named-func-expr.template +/*--- +description: sloppy direct eval in params introduces var (async generator named function expression in sloppy code) +esid: sec-asyncgenerator-definitions-evaluation +features: [default-parameters, async-iteration] +flags: [generated, noStrict] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + + +var callCount = 0; +var f; +f = async function* g(a = eval("var a = 42")) { + + callCount = callCount + 1; +}; + +assert.throws(SyntaxError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-arrow.js b/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-arrow.js new file mode 100644 index 0000000000..27c70d438a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-arrow.js @@ -0,0 +1,31 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async generator named function expression in non-strict mode code) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async, noStrict] +includes: [asyncHelpers.js] +info: | + AsyncGeneratorExpression : + async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function * BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +asyncTest(async () => { + assert.sameValue((await (await ref()).next()).value, ref); + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}); + diff --git a/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-eval.js b/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-eval.js new file mode 100644 index 0000000000..f707a29d64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body-in-eval.js @@ -0,0 +1,29 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async generator named function expression in non-strict mode code) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async, noStrict] +includes: [asyncHelpers.js] +info: | + AsyncGeneratorExpression : + async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function * BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +asyncTest(async () => { + assert.sameValue((await (await ref()).next()).value, ref); + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}); + diff --git a/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body.js b/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body.js new file mode 100644 index 0000000000..2d5733f65a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-no-strict-reassign-fn-name-in-body.js @@ -0,0 +1,29 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/async-gen-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async generator named function expression in non-strict mode code) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async, noStrict] +includes: [asyncHelpers.js] +info: | + AsyncGeneratorExpression : + async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function * BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +asyncTest(async () => { + assert.sameValue((await (await ref()).next()).value, ref); + assert.sameValue(callCount, 1, 'function invoked exactly once'); +}); + diff --git a/js/src/tests/test262/language/expressions/async-generator/named-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-generator/named-object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..1b6d5ef9dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-object-destructuring-param-strict-body.js @@ -0,0 +1,113 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-gen-named-func-expr.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +0, async function* g({property}) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-multiple.js new file mode 100644 index 0000000000..2206c44438 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-multiple.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-single.js new file mode 100644 index 0000000000..30f73b4433 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-params-trailing-comma-single.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-generator/named-rest-param-strict-body.js new file mode 100644 index 0000000000..11675d2870 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-rest-param-strict-body.js @@ -0,0 +1,113 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/async-gen-named-func-expr.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +0, async function* g(a,...rest) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-generator/named-rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..1c760b6354 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-rest-params-trailing-comma-early-error.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/async-gen-named-func-expr.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + + +0, async function* g(...a,) { + +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js b/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js new file mode 100644 index 0000000000..edadb9d94a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js @@ -0,0 +1,39 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/async-gen-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async generator named function expression in strict mode code) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async, onlyStrict] +includes: [asyncHelpers.js] +info: | + AsyncGeneratorExpression : + async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function * BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +asyncTest(async () => { + let catchCount = 0; + try { + (await (await ref()).next()).value + } catch (error) { + catchCount++; + assert(error instanceof TypeError); + } + assert.sameValue(catchCount, 1); + assert.sameValue(callCount, 1); +}); + diff --git a/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js b/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js new file mode 100644 index 0000000000..f59feecf43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js @@ -0,0 +1,37 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/async-gen-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async generator named function expression in strict mode code) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async, onlyStrict] +includes: [asyncHelpers.js] +info: | + AsyncGeneratorExpression : + async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function * BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +asyncTest(async () => { + let catchCount = 0; + try { + (await (await ref()).next()).value + } catch (error) { + catchCount++; + assert(error instanceof TypeError); + } + assert.sameValue(catchCount, 1); + assert.sameValue(callCount, 1); +}); + diff --git a/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-strict.js b/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-strict.js new file mode 100644 index 0000000000..0a2df195c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-strict-error-reassign-fn-name-in-body-strict.js @@ -0,0 +1,37 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/async-gen-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (async generator named function expression in strict mode code) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async, onlyStrict] +includes: [asyncHelpers.js] +info: | + AsyncGeneratorExpression : + async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = async function * BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +asyncTest(async () => { + let catchCount = 0; + try { + (await (await ref()).next()).value + } catch (error) { + catchCount++; + assert(error instanceof TypeError); + } + assert.sameValue(catchCount, 1); + assert.sameValue(callCount, 1); +}); + diff --git a/js/src/tests/test262/language/expressions/async-generator/named-unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-generator/named-unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..f32c2a08de --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-unscopables-with-in-nested-fn.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [globalThis, Symbol.unscopables, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(x) { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-unscopables-with.js b/js/src/tests/test262/language/expressions/async-generator/named-unscopables-with.js new file mode 100644 index 0000000000..1656b3cbc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-unscopables-with.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/async-gen-named-func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async generator named function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [globalThis, Symbol.unscopables, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function* g(x) { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..bc6d428325 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + var yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier.js new file mode 100644 index 0000000000..7c1f9011cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-binding-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + var yield; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..a91e7d984d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + void yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference.js new file mode 100644 index 0000000000..9e03c21bca --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-identifier-reference.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + void yield; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..77e30f2030 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + yi\u0065ld: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier.js new file mode 100644 index 0000000000..b4acf9c3b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-as-label-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier.case +// - src/async-generators/syntax/async-expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *g() { + yield: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-non-strict.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-non-strict.js new file mode 100644 index 0000000000..ac8b2ffa0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-non-strict.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-non-strict.case +// - src/async-generators/non-strict/async-expression-named.template +/*--- +description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator named expression - valid for non-strict only cases) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, noStrict, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + return (function(arg) { + var yield = arg + 1; + return yield; + }(yield)) +}; + +var iter = gen(); + +var item = iter.next(); + +item.then(({ done, value }) => { + assert.sameValue(done, false); + assert.sameValue(value, undefined); +}); + +item = iter.next(42); + +item.then(({ done, value }) => { + assert.sameValue(done, true); + assert.sameValue(value, 43); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-non-strict.js new file mode 100644 index 0000000000..89894af883 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-non-strict.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-non-strict.case +// - src/async-generators/non-strict/async-expression-named.template +/*--- +description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator named expression - valid for non-strict only cases) +esid: prod-AsyncGeneratorExpression +features: [object-spread, Symbol, async-iteration] +flags: [generated, noStrict, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +var s = Symbol('s'); + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield { + ...yield yield, + ...(function(arg) { + var yield = arg; + return {...yield}; + }(yield)), + ...yield, + } +}; + +var iter = gen(); + +var iter = gen(); + +iter.next(); +iter.next(); +iter.next({ x: 10, a: 0, b: 0, [s]: 1 }); +iter.next({ y: 20, a: 1, b: 1, [s]: 42 }); +var item = iter.next({ z: 30, b: 2 }); + +item.then(({ done, value }) => { + assert.sameValue(done, false); + assert.sameValue(value.x, 10); + assert.sameValue(value.y, 20); + assert.sameValue(value.z, 30); + assert.sameValue(value.a, 1); + assert.sameValue(value.b, 2); + assert.sameValue(value[s], 42); + assert.sameValue(Object.keys(value).length, 5); + assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property"); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..1a05d4e18c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-spread-strict-strict.js @@ -0,0 +1,48 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-strict.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [object-spread, async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-strict-strict.js new file mode 100644 index 0000000000..d621ad6e86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-identifier-strict-strict.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-strict.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-catch.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-catch.js new file mode 100644 index 0000000000..4bdac14bff --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-catch.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-catch.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-async-iterator.js new file mode 100644 index 0000000000..0a842022b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-async-iterator.js @@ -0,0 +1,50 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: yield * [Promise.reject(value)] is treated as throw value (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + for await (let line of readFile()) { + yield line; + } +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-sync-iterator.js new file mode 100644 index 0000000000..ff27edf171 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-for-await-of-sync-iterator.js @@ -0,0 +1,49 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: yield Promise.reject(value) in for-await-of is treated as throw value (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + for await (let value of iterable) { + yield value; + } +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-async-iterator.js new file mode 100644 index 0000000000..b1acb22941 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-async-iterator.js @@ -0,0 +1,48 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: yield * (async iterator) is treated as throw value (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield * readFile(); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-sync-iterator.js new file mode 100644 index 0000000000..615c0251b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next-yield-star-sync-iterator.js @@ -0,0 +1,47 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: yield * (async iterator) is treated as throw value (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield * iterable; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next.js new file mode 100644 index 0000000000..85ab17c6cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-promise-reject-next.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-multiple.js new file mode 100644 index 0000000000..ddc969ef1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-multiple.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-multiple.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Use yield value in a array spread position (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield [...yield yield]; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-single.js new file mode 100644 index 0000000000..52db92dd16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-arr-single.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-single.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Use yield value in a array spread position (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield [...yield]; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-obj.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-obj.js new file mode 100644 index 0000000000..3ebc8fa656 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-spread-obj.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-obj.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Use yield value in a object spread position (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [object-spread, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + + +var callCount = 0; + +var gen = async function *g() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-next.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-next.js new file mode 100644 index 0000000000..904c856d7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-next.js @@ -0,0 +1,219 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-next.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Execution order for yield* with async iterator and next() (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-return.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-return.js new file mode 100644 index 0000000000..4c56c20d31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-return.js @@ -0,0 +1,235 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-return.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: execution order for yield* with async iterator and return() (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-throw.js new file mode 100644 index 0000000000..87d3da4090 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-async-throw.js @@ -0,0 +1,243 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-throw.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: execution order for yield* with async iterator and throw() (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-expr-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-expr-abrupt.js new file mode 100644 index 0000000000..4a28cca3db --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-expr-abrupt.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-expr-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Abrupt completion while getting yield* operand (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* abrupt(); + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-get-abrupt.js new file mode 100644 index 0000000000..2d0300fa3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-get-abrupt.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-get-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Abrupt completion while getting [Symbol.asyncIterator] (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-boolean-throw.js new file mode 100644 index 0000000000..931d2763b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-boolean-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-number-throw.js new file mode 100644 index 0000000000..087a62f01e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-number-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-object-throw.js new file mode 100644 index 0000000000..d8dc7764a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-object-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-string-throw.js new file mode 100644 index 0000000000..162bbdd077 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-string-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-symbol-throw.js new file mode 100644 index 0000000000..239b0de71b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-not-callable-symbol-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-null-sync-get-abrupt.js new file mode 100644 index 0000000000..d65a282855 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-null-sync-get-abrupt.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Abrupt completion while getting @@iterator after null @@asyncIterator (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-abrupt.js new file mode 100644 index 0000000000..d210513355 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-abrupt.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Abrupt completion while calling [Symbol.asyncIterator] (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-boolean-throw.js new file mode 100644 index 0000000000..1cd251b3b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-boolean-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - boolean (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-null-throw.js new file mode 100644 index 0000000000..fd65d73653 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-null-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - null (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-number-throw.js new file mode 100644 index 0000000000..2eb11f2b2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-number-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - number (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-string-throw.js new file mode 100644 index 0000000000..76cfafb451 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-string-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - string (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-symbol-throw.js new file mode 100644 index 0000000000..8ea4928706 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-symbol-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - symbol (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-undefined-throw.js new file mode 100644 index 0000000000..5ab7266b49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-returns-undefined-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - undefined (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-undefined-sync-get-abrupt.js new file mode 100644 index 0000000000..25c3966324 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-async-undefined-sync-get-abrupt.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-get-abrupt.js new file mode 100644 index 0000000000..efcfbbf402 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-get-abrupt.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-get-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Abrupt completion while getting [Symbol.iterator] (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-boolean-throw.js new file mode 100644 index 0000000000..48a010d224 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-boolean-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-number-throw.js new file mode 100644 index 0000000000..f987249e10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-number-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-object-throw.js new file mode 100644 index 0000000000..a35d12ecb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-object-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-string-throw.js new file mode 100644 index 0000000000..fb7056aeb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-string-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-symbol-throw.js new file mode 100644 index 0000000000..4aac649946 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-not-callable-symbol-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-abrupt.js new file mode 100644 index 0000000000..9052274aaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-abrupt.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Abrupt completion while calling [Symbol.iterator] (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-boolean-throw.js new file mode 100644 index 0000000000..e4ca23f728 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-boolean-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.iterator]() - boolean (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-null-throw.js new file mode 100644 index 0000000000..f6c22f9aeb --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-null-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.iterator]() - null (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-number-throw.js new file mode 100644 index 0000000000..e9777aa6f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-number-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.iterator]() - number (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-string-throw.js new file mode 100644 index 0000000000..c58d7874f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-string-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.iterator]() - string (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-symbol-throw.js new file mode 100644 index 0000000000..fea53d164b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-symbol-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.iterator]() - symbol (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-undefined-throw.js new file mode 100644 index 0000000000..5c11a72ea0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-getiter-sync-returns-undefined-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Non object returned by [Symbol.iterator]() - undefined (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-done-get-abrupt.js new file mode 100644 index 0000000000..0f111bb149 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-done-get-abrupt.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Abrupt completion while getting done (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-returns-abrupt.js new file mode 100644 index 0000000000..87744633df --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-returns-abrupt.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-returns-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Abrupt completion while calling next (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-value-get-abrupt.js new file mode 100644 index 0000000000..ffc74aec9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-call-value-get-abrupt.js @@ -0,0 +1,75 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Abrupt completion while getting value (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-get-abrupt.js new file mode 100644 index 0000000000..e731e31103 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-get-abrupt.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-get-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Abrupt completion while getting next (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-non-object-ignores-then.js new file mode 100644 index 0000000000..0051905a6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-non-object-ignores-then.js @@ -0,0 +1,85 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: If next() value is not-object, do not access respective then property (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-boolean-throw.js new file mode 100644 index 0000000000..64076a393c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-boolean-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Not-callable next value in a yield star position - boolean (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-null-throw.js new file mode 100644 index 0000000000..f31869aca3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-null-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Not-callable next value in a yield star position - null (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-number-throw.js new file mode 100644 index 0000000000..b94fad4ed0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-number-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Not-callable next value in a yield star position - number (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-object-throw.js new file mode 100644 index 0000000000..3dbcfe3777 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-object-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Not-callable next value in a yield star position - object (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-string-throw.js new file mode 100644 index 0000000000..2374798265 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-string-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Not-callable next value in a yield star position - string (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-symbol-throw.js new file mode 100644 index 0000000000..a93dbe7353 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-symbol-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Not-callable next value in a yield star position - symbol (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-undefined-throw.js new file mode 100644 index 0000000000..78bd90aa14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-not-callable-undefined-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: Not-callable next value in a yield star position - undefined (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-get-abrupt.js new file mode 100644 index 0000000000..ceb021d277 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-get-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-get-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Return abrupt after getting next().then (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-boolean-fulfillpromise.js new file mode 100644 index 0000000000..d077cceb47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-boolean-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: FulfillPromise if next().then is not-callable (boolean) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-null-fulfillpromise.js new file mode 100644 index 0000000000..a05a88a2a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-null-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: FulfillPromise if next().then is not-callable (null) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-number-fulfillpromise.js new file mode 100644 index 0000000000..dc2cfde595 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-number-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: FulfillPromise if next().then is not-callable (number) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-object-fulfillpromise.js new file mode 100644 index 0000000000..9437c9fe3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-object-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: FulfillPromise if next().then is not-callable (object) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-string-fulfillpromise.js new file mode 100644 index 0000000000..160cb63722 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-string-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: FulfillPromise if next().then is not-callable (string) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-symbol-fulfillpromise.js new file mode 100644 index 0000000000..8d2a6446d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-symbol-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: FulfillPromise if next().then is not-callable (symbol) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-undefined-fulfillpromise.js new file mode 100644 index 0000000000..43c41e8349 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-non-callable-undefined-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression-named.template +/*--- +description: FulfillPromise if next().then is not-callable (undefined) (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-returns-abrupt.js new file mode 100644 index 0000000000..405bc63761 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-next-then-returns-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-returns-abrupt.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: Return abrupt after calling next().then (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-next.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-next.js new file mode 100644 index 0000000000..f8e09c51be --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-next.js @@ -0,0 +1,222 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-next.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: execution order for yield* with sync iterator and next() (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-return.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-return.js new file mode 100644 index 0000000000..55f649a41c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-return.js @@ -0,0 +1,197 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-return.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: execution order for yield* with sync iterator and return() (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-throw.js b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-throw.js new file mode 100644 index 0000000000..431199311e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/named-yield-star-sync-throw.js @@ -0,0 +1,203 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-throw.case +// - src/async-generators/default/async-expression-named.template +/*--- +description: execution order for yield* with sync iterator and throw() (Named async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *g() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/async-generator/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..98ffca1da1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/object-destructuring-param-strict-body.js @@ -0,0 +1,113 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-gen-func-expr.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +0, async function*({property}) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..4420b0920c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-multiple.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-single.js new file mode 100644 index 0000000000..9b6b8e373c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/params-trailing-comma-single.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/async-generator/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/async-generator/rest-param-strict-body.js new file mode 100644 index 0000000000..e65fd4f7c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/rest-param-strict-body.js @@ -0,0 +1,113 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/async-gen-func-expr.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +0, async function*(a,...rest) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/async-generator/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..d0ab701557 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/rest-params-trailing-comma-early-error.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/async-gen-func-expr.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + + +0, async function*(...a,) { + +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/shell.js b/js/src/tests/test262/language/expressions/async-generator/shell.js new file mode 100644 index 0000000000..cf5a381e81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/shell.js @@ -0,0 +1,137 @@ +// GENERATED, DO NOT EDIT +// file: asyncHelpers.js +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + A collection of assertion and wrapper functions for testing asynchronous built-ins. +defines: [asyncTest] +---*/ + +function asyncTest(testFunc) { + if (!Object.hasOwn(globalThis, "$DONE")) { + throw new Test262Error("asyncTest called without async flag"); + } + if (typeof testFunc !== "function") { + $DONE(new Test262Error("asyncTest called with non-function argument")); + return; + } + try { + testFunc().then( + function () { + $DONE(); + }, + function (error) { + $DONE(error); + } + ); + } catch (syncError) { + $DONE(syncError); + } +} + +assert.throwsAsync = async function (expectedErrorConstructor, func, message) { + var innerThenable; + if (message === undefined) { + message = ""; + } else { + message += " "; + } + if (typeof func === "function") { + try { + innerThenable = func(); + if ( + innerThenable === null || + typeof innerThenable !== "object" || + typeof innerThenable.then !== "function" + ) { + message += + "Expected to obtain an inner promise that would reject with a" + + expectedErrorConstructor.name + + " but result was not a thenable"; + throw new Test262Error(message); + } + } catch (thrown) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise"; + throw new Test262Error(message); + } + } else { + message += + "assert.throwsAsync called with an argument that is not a function"; + throw new Test262Error(message); + } + + try { + return innerThenable.then( + function () { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but no exception was thrown at all"; + throw new Test262Error(message); + }, + function (thrown) { + var expectedName, actualName; + if (typeof thrown !== "object" || thrown === null) { + message += "Thrown value was not an object!"; + throw new Test262Error(message); + } else if (thrown.constructor !== expectedErrorConstructor) { + expectedName = expectedErrorConstructor.name; + actualName = thrown.constructor.name; + if (expectedName === actualName) { + message += + "Expected a " + + expectedName + + " but got a different error constructor with the same name"; + } else { + message += + "Expected a " + expectedName + " but got a " + actualName; + } + throw new Test262Error(message); + } + } + ); + } catch (thrown) { + if (typeof thrown !== "object" || thrown === null) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object "; + } else { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but a " + + thrown.constructor.name + + " was thrown synchronously"; + } + throw new Test262Error(message); + } +}; + +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +features: [Reflect.construct] +---*/ + +function isConstructor(f) { + if (typeof f !== "function") { + throw new Test262Error("isConstructor invoked with a non-function value"); + } + + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/language/expressions/async-generator/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/async-generator/unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..fb34ee1120 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/unscopables-with-in-nested-fn.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [globalThis, Symbol.unscopables, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(x) { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-generator/unscopables-with.js b/js/src/tests/test262/language/expressions/async-generator/unscopables-with.js new file mode 100644 index 0000000000..c81b74fc1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/unscopables-with.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/async-gen-func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (async generator function expression) +esid: sec-asyncgenerator-definitions-evaluation +features: [globalThis, Symbol.unscopables, async-iteration] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = async function*(x) { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).next().then(() => { + assert.sameValue(callCount, 1, 'generator function invoked exactly once'); +}).then($DONE, $DONE); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..1b7a3d5c70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + var yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier.js new file mode 100644 index 0000000000..b83d30181e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-as-binding-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + var yield; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..f03c691dce --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + void yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference.js new file mode 100644 index 0000000000..3db9c366ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-as-identifier-reference.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + void yield; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..918c83ca7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + yi\u0065ld: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier.js new file mode 100644 index 0000000000..581fd97828 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-as-label-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier.case +// - src/async-generators/syntax/async-expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + + +var gen = async function *() { + yield: ; +}; diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-identifier-non-strict.js b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-non-strict.js new file mode 100644 index 0000000000..6109ef68dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-non-strict.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-non-strict.case +// - src/async-generators/non-strict/async-expression.template +/*--- +description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator expression - valid for non-strict only cases) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, noStrict, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + return (function(arg) { + var yield = arg + 1; + return yield; + }(yield)) +}; + +var iter = gen(); + +var item = iter.next(); + +item.then(({ done, value }) => { + assert.sameValue(done, false); + assert.sameValue(value, undefined); +}); + +item = iter.next(42); + +item.then(({ done, value }) => { + assert.sameValue(done, true); + assert.sameValue(value, 43); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-non-strict.js new file mode 100644 index 0000000000..07db53e691 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-non-strict.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-non-strict.case +// - src/async-generators/non-strict/async-expression.template +/*--- +description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator expression - valid for non-strict only cases) +esid: prod-AsyncGeneratorExpression +features: [object-spread, Symbol, async-iteration] +flags: [generated, noStrict, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +var s = Symbol('s'); + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield { + ...yield yield, + ...(function(arg) { + var yield = arg; + return {...yield}; + }(yield)), + ...yield, + } +}; + +var iter = gen(); + +var iter = gen(); + +iter.next(); +iter.next(); +iter.next({ x: 10, a: 0, b: 0, [s]: 1 }); +iter.next({ y: 20, a: 1, b: 1, [s]: 42 }); +var item = iter.next({ z: 30, b: 2 }); + +item.then(({ done, value }) => { + assert.sameValue(done, false); + assert.sameValue(value.x, 10); + assert.sameValue(value.y, 20); + assert.sameValue(value.z, 30); + assert.sameValue(value.a, 1); + assert.sameValue(value.b, 2); + assert.sameValue(value[s], 42); + assert.sameValue(Object.keys(value).length, 5); + assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property"); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..80d10cb584 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-spread-strict-strict.js @@ -0,0 +1,48 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-strict.case +// - src/async-generators/default/async-expression.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [object-spread, async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..619b331edf --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-identifier-strict-strict.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-strict.case +// - src/async-generators/default/async-expression.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-catch.js new file mode 100644 index 0000000000..c6bc275429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-catch.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-catch.case +// - src/async-generators/default/async-expression.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js new file mode 100644 index 0000000000..b52d02c782 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-async-iterator.js @@ -0,0 +1,50 @@ +// |reftest| async +// 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-expression.template +/*--- +description: yield * [Promise.reject(value)] is treated as throw value (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + for await (let line of readFile()) { + yield line; + } +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js new file mode 100644 index 0000000000..63c5e9d729 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-for-await-of-sync-iterator.js @@ -0,0 +1,49 @@ +// |reftest| async +// 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-expression.template +/*--- +description: yield Promise.reject(value) in for-await-of is treated as throw value (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + for await (let value of iterable) { + yield value; + } +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-async-iterator.js new file mode 100644 index 0000000000..56dbf03163 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-async-iterator.js @@ -0,0 +1,48 @@ +// |reftest| async +// 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-expression.template +/*--- +description: yield * (async iterator) is treated as throw value (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +async function * readFile() { + yield Promise.reject(error); + yield "unreachable"; +} + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield * readFile(); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js new file mode 100644 index 0000000000..4894df5495 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next-yield-star-sync-iterator.js @@ -0,0 +1,47 @@ +// |reftest| async +// 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-expression.template +/*--- +description: yield * (async iterator) is treated as throw value (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); +let iterable = [ + Promise.reject(error), + "unreachable" +]; + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield * iterable; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next.js b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next.js new file mode 100644 index 0000000000..0d1b1e641e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-promise-reject-next.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next.case +// - src/async-generators/default/async-expression.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + +---*/ +let error = new Error(); + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..4dbf565258 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-multiple.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-multiple.case +// - src/async-generators/default/async-expression.template +/*--- +description: Use yield value in a array spread position (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield [...yield yield]; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-single.js new file mode 100644 index 0000000000..fbec5ea757 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-spread-arr-single.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-single.case +// - src/async-generators/default/async-expression.template +/*--- +description: Use yield value in a array spread position (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield [...yield]; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-spread-obj.js b/js/src/tests/test262/language/expressions/async-generator/yield-spread-obj.js new file mode 100644 index 0000000000..d397a95d38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-spread-obj.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-obj.case +// - src/async-generators/default/async-expression.template +/*--- +description: Use yield value in a object spread position (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [object-spread, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + + +var callCount = 0; + +var gen = async function *() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-async-next.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-async-next.js new file mode 100644 index 0000000000..320a642ab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-async-next.js @@ -0,0 +1,219 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-next.case +// - src/async-generators/default/async-expression.template +/*--- +description: Execution order for yield* with async iterator and next() (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-async-return.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-async-return.js new file mode 100644 index 0000000000..f3ffe4fc85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-async-return.js @@ -0,0 +1,235 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-return.case +// - src/async-generators/default/async-expression.template +/*--- +description: execution order for yield* with async iterator and return() (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-async-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-async-throw.js new file mode 100644 index 0000000000..aa6321eec2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-async-throw.js @@ -0,0 +1,243 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-throw.case +// - src/async-generators/default/async-expression.template +/*--- +description: execution order for yield* with async iterator and throw() (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-expr-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-expr-abrupt.js new file mode 100644 index 0000000000..a0ea9df5f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-expr-abrupt.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-expr-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Abrupt completion while getting yield* operand (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* abrupt(); + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-get-abrupt.js new file mode 100644 index 0000000000..680e212d9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-get-abrupt.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-get-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Abrupt completion while getting [Symbol.asyncIterator] (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js new file mode 100644 index 0000000000..91b1890579 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-boolean-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-number-throw.js new file mode 100644 index 0000000000..c9085eccde --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-number-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-object-throw.js new file mode 100644 index 0000000000..87b20d1267 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-object-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-string-throw.js new file mode 100644 index 0000000000..8cea57851b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-string-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js new file mode 100644 index 0000000000..90088427c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-not-callable-symbol-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js new file mode 100644 index 0000000000..9815973073 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-null-sync-get-abrupt.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Abrupt completion while getting @@iterator after null @@asyncIterator (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-return-method-is-null.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-return-method-is-null.js new file mode 100644 index 0000000000..3442f40923 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-return-method-is-null.js @@ -0,0 +1,56 @@ +// |reftest| async +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + If iterator's "return" method is `null`, + received completion is forwarded to the runtime. +info: | + YieldExpression : yield * AssignmentExpression + + [...] + 7. Repeat, + [...] + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). + iii. If return is undefined, then + [...] + 2. Return Completion(received). + + GetMethod ( V, P ) + + [...] + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. +features: [Symbol.asyncIterator, async-iteration] +flags: [async] +---*/ + +var returnGets = 0; +var asyncIterable = { + [Symbol.asyncIterator]: function() { + return this; + }, + next: function() { + return {value: 1, done: false}; + }, + get return() { + returnGets += 1; + return null; + }, +}; + +async function* asyncGenerator() { + yield* asyncIterable; +} + +var asyncIterator = asyncGenerator(); +asyncIterator.next().then(function() { + return asyncIterator.return(2).then(function(result) { + assert.sameValue(result.value, 2); + assert.sameValue(result.done, true); + assert.sameValue(returnGets, 1); + }); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-abrupt.js new file mode 100644 index 0000000000..3375e618d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-abrupt.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Abrupt completion while calling [Symbol.asyncIterator] (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-boolean-throw.js new file mode 100644 index 0000000000..e56a3da991 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-boolean-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - boolean (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-null-throw.js new file mode 100644 index 0000000000..45a5ee2896 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-null-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - null (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-number-throw.js new file mode 100644 index 0000000000..51ce6dc606 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-number-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - number (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-string-throw.js new file mode 100644 index 0000000000..14930e0820 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-string-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - string (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-symbol-throw.js new file mode 100644 index 0000000000..3c507a4c0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-symbol-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - symbol (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-undefined-throw.js new file mode 100644 index 0000000000..9172c549ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-returns-undefined-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - undefined (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-throw-method-is-null.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-throw-method-is-null.js new file mode 100644 index 0000000000..d913b05c5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-throw-method-is-null.js @@ -0,0 +1,73 @@ +// |reftest| async +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + If iterator's "throw" method is `null`, + AsyncIteratorClose is called before rising TypeError. +info: | + YieldExpression : yield * AssignmentExpression + + [...] + 7. Repeat, + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + [...] + iii. Else, + [...] + 3. If generatorKind is async, perform ? AsyncIteratorClose(iteratorRecord, closeCompletion). + [...] + 6. Throw a TypeError exception. + + GetMethod ( V, P ) + + [...] + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + + AsyncIteratorClose ( iteratorRecord, completion ) + + [...] + 4. Let innerResult be GetMethod(iterator, "return"). + 5. If innerResult.[[Type]] is normal, then + a. Let return be innerResult.[[Value]]. + b. If return is undefined, return Completion(completion). +features: [Symbol.asyncIterator, async-iteration] +flags: [async] +---*/ + +var throwGets = 0; +var returnGets = 0; +var asyncIterable = { + [Symbol.asyncIterator]: function() { + return this; + }, + next: function() { + return {value: 1, done: false}; + }, + get throw() { + throwGets += 1; + return null; + }, + get return() { + returnGets += 1; + }, +}; + +async function* asyncGenerator() { + yield* asyncIterable; +} + +var asyncIterator = asyncGenerator(); +asyncIterator.next().then(function() { + return asyncIterator.throw(); +}).then(function(result) { + throw new Test262Error("Promise should be rejected, got: " + result.value); +}, function(err) { + assert.sameValue(err.constructor, TypeError); + assert.sameValue(throwGets, 1); + assert.sameValue(returnGets, 1); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js new file mode 100644 index 0000000000..b23681d778 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-async-undefined-sync-get-abrupt.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-get-abrupt.js new file mode 100644 index 0000000000..654bfb3e2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-get-abrupt.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-get-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Abrupt completion while getting [Symbol.iterator] (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js new file mode 100644 index 0000000000..d14d4869c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-boolean-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-number-throw.js new file mode 100644 index 0000000000..094a4f23e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-number-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-object-throw.js new file mode 100644 index 0000000000..6bff6abde4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-object-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-string-throw.js new file mode 100644 index 0000000000..bbf7743722 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-string-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js new file mode 100644 index 0000000000..dd005edf1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-not-callable-symbol-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-abrupt.js new file mode 100644 index 0000000000..6dbd5d7c24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-abrupt.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Abrupt completion while calling [Symbol.iterator] (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-boolean-throw.js new file mode 100644 index 0000000000..488e1c77e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-boolean-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.iterator]() - boolean (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-null-throw.js new file mode 100644 index 0000000000..1d4d0bdfc9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-null-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.iterator]() - null (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-number-throw.js new file mode 100644 index 0000000000..67753254d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-number-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.iterator]() - number (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-string-throw.js new file mode 100644 index 0000000000..184d6ecc6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-string-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.iterator]() - string (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-symbol-throw.js new file mode 100644 index 0000000000..eaee7c8cf4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-symbol-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.iterator]() - symbol (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-undefined-throw.js new file mode 100644 index 0000000000..21e957e81c --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-getiter-sync-returns-undefined-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Non object returned by [Symbol.iterator]() - undefined (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-done-get-abrupt.js new file mode 100644 index 0000000000..f622c3c399 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-done-get-abrupt.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Abrupt completion while getting done (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-returns-abrupt.js new file mode 100644 index 0000000000..252379d854 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-returns-abrupt.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-returns-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Abrupt completion while calling next (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-value-get-abrupt.js new file mode 100644 index 0000000000..99ac29bdac --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-call-value-get-abrupt.js @@ -0,0 +1,75 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Abrupt completion while getting value (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-get-abrupt.js new file mode 100644 index 0000000000..5d9a7c5f45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-get-abrupt.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-get-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Abrupt completion while getting next (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-non-object-ignores-then.js new file mode 100644 index 0000000000..63eef6716e --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-non-object-ignores-then.js @@ -0,0 +1,85 @@ +// |reftest| async +// 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-expression.template +/*--- +description: If next() value is not-object, do not access respective then property (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-boolean-throw.js new file mode 100644 index 0000000000..20193e3f47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-boolean-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Not-callable next value in a yield star position - boolean (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-null-throw.js new file mode 100644 index 0000000000..8bf77f19a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-null-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Not-callable next value in a yield star position - null (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-number-throw.js new file mode 100644 index 0000000000..9d9301be19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-number-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Not-callable next value in a yield star position - number (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-object-throw.js new file mode 100644 index 0000000000..cc1572642f --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-object-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Not-callable next value in a yield star position - object (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-string-throw.js new file mode 100644 index 0000000000..e22a643088 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-string-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Not-callable next value in a yield star position - string (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-symbol-throw.js new file mode 100644 index 0000000000..4818e841ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-symbol-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Not-callable next value in a yield star position - symbol (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-undefined-throw.js new file mode 100644 index 0000000000..012882909b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-not-callable-undefined-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-expression.template +/*--- +description: Not-callable next value in a yield star position - undefined (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-get-abrupt.js new file mode 100644 index 0000000000..9b17fc3c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-get-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-get-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Return abrupt after getting next().then (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js new file mode 100644 index 0000000000..d9ff3991a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-boolean-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression.template +/*--- +description: FulfillPromise if next().then is not-callable (boolean) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js new file mode 100644 index 0000000000..d74800050b --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-null-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression.template +/*--- +description: FulfillPromise if next().then is not-callable (null) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js new file mode 100644 index 0000000000..25b5c37d4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-number-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression.template +/*--- +description: FulfillPromise if next().then is not-callable (number) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js new file mode 100644 index 0000000000..d6357f39bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-object-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression.template +/*--- +description: FulfillPromise if next().then is not-callable (object) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js new file mode 100644 index 0000000000..91eb7c35a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-string-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression.template +/*--- +description: FulfillPromise if next().then is not-callable (string) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js new file mode 100644 index 0000000000..e1377fab5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-symbol-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression.template +/*--- +description: FulfillPromise if next().then is not-callable (symbol) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js new file mode 100644 index 0000000000..6513d7bbce --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-non-callable-undefined-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-expression.template +/*--- +description: FulfillPromise if next().then is not-callable (undefined) (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + +}; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-returns-abrupt.js new file mode 100644 index 0000000000..dc842b3e16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-next-then-returns-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-returns-abrupt.case +// - src/async-generators/default/async-expression.template +/*--- +description: Return abrupt after calling next().then (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-next.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-next.js new file mode 100644 index 0000000000..226e16aed7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-next.js @@ -0,0 +1,222 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-next.case +// - src/async-generators/default/async-expression.template +/*--- +description: execution order for yield* with sync iterator and next() (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-return.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-return.js new file mode 100644 index 0000000000..d516923f24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-return.js @@ -0,0 +1,197 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-return.case +// - src/async-generators/default/async-expression.template +/*--- +description: execution order for yield* with sync iterator and return() (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-throw.js b/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-throw.js new file mode 100644 index 0000000000..b84a1ebd79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-star-sync-throw.js @@ -0,0 +1,203 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-throw.case +// - src/async-generators/default/async-expression.template +/*--- +description: execution order for yield* with sync iterator and throw() (Unnamed async generator expression) +esid: prod-AsyncGeneratorExpression +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorExpression : + async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { + 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 gen = async function *() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + +}; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-reject.js b/js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-reject.js new file mode 100644 index 0000000000..1acb66a6f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-reject.js @@ -0,0 +1,75 @@ +// |reftest| async +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + `reject` is anonymous built-in function with length of 1. +info: | + YieldExpression : yield AssignmentExpression + + [...] + 4. If generatorKind is async, then return ? AsyncGeneratorYield(value). + + AsyncGeneratorYield ( value ) + + [...] + 5. Set value to ? Await(value). + [...] + 9. Return ! AsyncGeneratorResolve(generator, value, false). + + Await + + [...] + 2. Let promise be ? PromiseResolve(%Promise%, value). + [...] + + PromiseResolve ( C, x ) + + [...] + 3. Let promiseCapability be ? NewPromiseCapability(C). + 4. Perform ? Call(promiseCapability.[[Resolve]], undefined, « x »). + 5. Return promiseCapability.[[Promise]]. + + NewPromiseCapability ( C ) + + [...] + 7. Let promise be ? Construct(C, « executor »). + [...] + 11. Return promiseCapability. + + Promise ( executor ) + + [...] + 8. Let resolvingFunctions be CreateResolvingFunctions(promise). + [...] + 11. Return promise. + + CreateResolvingFunctions ( promise ) + + [...] + 7. Let reject be ! CreateBuiltinFunction(stepsReject, « [[Promise]], [[AlreadyResolved]] »). + [...] + 10. Return the Record { [[Resolve]]: resolve, [[Reject]]: reject }. +flags: [async] +features: [async-iteration, Reflect.construct] +includes: [isConstructor.js] +---*/ + +var thenable = { + then: function(resolve, reject) { + resolve(reject); + }, +}; + +var iter = (async function*() { + yield thenable; +}()); + +iter.next().then(function(result) { + var reject = result.value; + assert(!isConstructor(reject)); + assert.sameValue(reject.length, 1); + assert.sameValue(reject.name, ''); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-resolve.js b/js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-resolve.js new file mode 100644 index 0000000000..543b17c9f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/async-generator/yield-thenable-create-resolving-functions-resolve.js @@ -0,0 +1,75 @@ +// |reftest| async +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + `resolve` is anonymous built-in function with length of 1. +info: | + YieldExpression : yield AssignmentExpression + + [...] + 4. If generatorKind is async, then return ? AsyncGeneratorYield(value). + + AsyncGeneratorYield ( value ) + + [...] + 5. Set value to ? Await(value). + [...] + 9. Return ! AsyncGeneratorResolve(generator, value, false). + + Await + + [...] + 2. Let promise be ? PromiseResolve(%Promise%, value). + [...] + + PromiseResolve ( C, x ) + + [...] + 3. Let promiseCapability be ? NewPromiseCapability(C). + 4. Perform ? Call(promiseCapability.[[Resolve]], undefined, « x »). + 5. Return promiseCapability.[[Promise]]. + + NewPromiseCapability ( C ) + + [...] + 7. Let promise be ? Construct(C, « executor »). + [...] + 11. Return promiseCapability. + + Promise ( executor ) + + [...] + 8. Let resolvingFunctions be CreateResolvingFunctions(promise). + [...] + 11. Return promise. + + CreateResolvingFunctions ( promise ) + + [...] + 3. Let resolve be ! CreateBuiltinFunction(stepsResolve, « [[Promise]], [[AlreadyResolved]] »). + [...] + 10. Return the Record { [[Resolve]]: resolve, [[Reject]]: reject }. +flags: [async] +features: [async-iteration, Reflect.construct] +includes: [isConstructor.js] +---*/ + +var thenable = { + then: function(resolve) { + resolve(resolve); + }, +}; + +var iter = (async function*() { + yield thenable; +}()); + +iter.next().then(function(result) { + var resolve = result.value; + assert(!isConstructor(resolve)); + assert.sameValue(resolve.length, 1); + assert.sameValue(resolve.name, ''); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/await/async-await-interleaved.js b/js/src/tests/test262/language/expressions/await/async-await-interleaved.js new file mode 100644 index 0000000000..16ef6cad4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/async-await-interleaved.js @@ -0,0 +1,45 @@ +// |reftest| async +// Copyright 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Maya Lekova +esid: await +description: > + Await on async functions and builtin Promises are properly interleaved, + meaning await takes only 1 tick on the microtask queue. +flags: [async] +features: [async-functions] +includes: [compareArray.js] +---*/ + +const actual = []; +const expected = [ + 'Await: 1', + 'Promise: 1', + 'Await: 2', + 'Promise: 2' +]; + +async function pushAwait(value) { + actual.push('Await: ' + value); +} + +async function callAsync() { + await pushAwait(1); + await pushAwait(2); +} + +function checkAssertions() { + assert.compareArray(actual, expected, + 'Async/await and promises should be interleaved'); +} + +callAsync(); + +new Promise(function (resolve) { + actual.push('Promise: 1'); + resolve(); +}).then(function () { + actual.push('Promise: 2'); +}).then(checkAssertions).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/await/async-generator-interleaved.js b/js/src/tests/test262/language/expressions/await/async-generator-interleaved.js new file mode 100644 index 0000000000..d19d7dbacf --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/async-generator-interleaved.js @@ -0,0 +1,43 @@ +// |reftest| async +// Copyright 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Maya Lekova +esid: await +description: > + Await on async generator functions and builtin Promises are properly + interleaved, meaning await takes only 1 tick on the microtask queue. +flags: [async] +features: [async-functions, async-iteration] +includes: [compareArray.js] +---*/ + +const actual = []; +const expected = [ 'await', 1, 'await', 2 ]; +const iterations = 2; + +async function pushAwait() { + actual.push('await'); +} + +async function* callAsync() { + for (let i = 0; i < iterations; i++) { + await pushAwait(); + } + return 0; +} + +function checkAssertions() { + assert.compareArray(actual, expected, + 'Async/await and promises should be interleaved'); +} + +callAsync().next(); + +new Promise(function (resolve) { + actual.push(1); + resolve(); +}).then(function () { + actual.push(2); +}).then(checkAssertions).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/await/await-BindingIdentifier-in-global.js b/js/src/tests/test262/language/expressions/await/await-BindingIdentifier-in-global.js new file mode 100644 index 0000000000..2fb4088b44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-BindingIdentifier-in-global.js @@ -0,0 +1,15 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await is allowed as a binding identifier in global scope +---*/ + +async function await() { return 1 } +assert(await instanceof Function); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/await/await-BindingIdentifier-nested.js b/js/src/tests/test262/language/expressions/await/await-BindingIdentifier-nested.js new file mode 100644 index 0000000000..b2cb7179f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-BindingIdentifier-nested.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await is not allowed as an identifier in functions nested in async functions +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async function foo() { + function await() { + } +} diff --git a/js/src/tests/test262/language/expressions/await/await-awaits-thenable-not-callable.js b/js/src/tests/test262/language/expressions/await/await-awaits-thenable-not-callable.js new file mode 100644 index 0000000000..ac41188431 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-awaits-thenable-not-callable.js @@ -0,0 +1,22 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await can await any thenable. If the thenable's then is not callable, + await evaluates to the thenable +flags: [async] +includes: [asyncHelpers.js] +---*/ + +async function foo() { + var thenable = { then: 42 }; + var res = await thenable; + assert.sameValue(res, thenable); +} + +asyncTest(foo); + diff --git a/js/src/tests/test262/language/expressions/await/await-awaits-thenables-that-throw.js b/js/src/tests/test262/language/expressions/await/await-awaits-thenables-that-throw.js new file mode 100644 index 0000000000..b1060d5632 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-awaits-thenables-that-throw.js @@ -0,0 +1,33 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await can await any thenable. +flags: [async] +includes: [asyncHelpers.js] +---*/ + +var error = {}; +var thenable = { + then: function (resolve, reject) { + throw error; + } +} +async function foo() { + var caught = false; + try { + await thenable; + } catch(e) { + caught = true; + assert.sameValue(e, error); + } + + assert(caught); +} + +asyncTest(foo); + diff --git a/js/src/tests/test262/language/expressions/await/await-awaits-thenables.js b/js/src/tests/test262/language/expressions/await/await-awaits-thenables.js new file mode 100644 index 0000000000..ab9de6170e --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-awaits-thenables.js @@ -0,0 +1,23 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await can await any thenable. +flags: [async] +includes: [asyncHelpers.js] +---*/ + +var thenable = { + then: function (resolve, reject) { + resolve(42); + } +} +async function foo() { + assert.sameValue(await thenable, 42); +} + +asyncTest(foo); diff --git a/js/src/tests/test262/language/expressions/await/await-in-function.js b/js/src/tests/test262/language/expressions/await/await-in-function.js new file mode 100644 index 0000000000..7a083e16ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-in-function.js @@ -0,0 +1,14 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await is an identifier in a function +---*/ + +function foo(await) { return await; } +assert.sameValue(foo(1), 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/await/await-in-generator.js b/js/src/tests/test262/language/expressions/await/await-in-generator.js new file mode 100644 index 0000000000..67995f7b70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-in-generator.js @@ -0,0 +1,15 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await in a generator is an identifier +features: [generators] +---*/ + +function* foo(await) { yield await; }; +assert.sameValue(foo(1).next().value, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/await/await-in-global.js b/js/src/tests/test262/language/expressions/await/await-in-global.js new file mode 100644 index 0000000000..675e63a1d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-in-global.js @@ -0,0 +1,14 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await is an identifier in global scope +---*/ + +var await = 1; +assert.sameValue(await, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/await/await-in-nested-function.js b/js/src/tests/test262/language/expressions/await/await-in-nested-function.js new file mode 100644 index 0000000000..0d2151bd81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-in-nested-function.js @@ -0,0 +1,22 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await is allowed as an identifier in functions nested in async functions +---*/ + +var await; +async function foo() { + function bar() { + await = 1; + } + bar(); +} +foo(); + +assert.sameValue(await, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/await/await-in-nested-generator.js b/js/src/tests/test262/language/expressions/await/await-in-nested-generator.js new file mode 100644 index 0000000000..41197fbffe --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-in-nested-generator.js @@ -0,0 +1,23 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await is allowed as an identifier in generator functions nested in async functions +features: [generators] +---*/ + +var await; +async function foo() { + function* bar() { + await = 1; + } + bar().next(); +} +foo(); + +assert.sameValue(await, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/await/await-monkey-patched-promise.js b/js/src/tests/test262/language/expressions/await/await-monkey-patched-promise.js new file mode 100644 index 0000000000..0ac7415bf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-monkey-patched-promise.js @@ -0,0 +1,51 @@ +// |reftest| async +// Copyright 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Maya Lekova +esid: await +description: > + This test demonstrates that monkey-patched "then" on native promises will + not get called. Adapted from example by Kevin Smith: + https://github.com/tc39/ecma262/pull/1250#issuecomment-401082195 +flags: [async] +features: [async-functions] +includes: [compareArray.js] +---*/ + +let thenCallCount = 0; +const value = 42; + +const actual = []; +const expected = [ + 'Promise: 1', + 'Await: ' + value, + 'Promise: 2', +]; + +const patched = Promise.resolve(value); +patched.then = function(...args) { + thenCallCount++; + Promise.prototype.then.apply(this, args); +}; + +async function trigger() { + actual.push('Await: ' + await patched); +} + +function checkAssertions() { + assert.compareArray(actual, expected, + 'Async/await and promises should be interleaved'); + assert.sameValue(thenCallCount, 0, + 'Monkey-patched "then" on native promises should not be called.') +} + +trigger().then(checkAssertions).then($DONE, $DONE); + +new Promise(function (resolve) { + actual.push('Promise: 1'); + resolve(); +}).then(function () { + actual.push('Promise: 2'); +}); diff --git a/js/src/tests/test262/language/expressions/await/await-non-promise-thenable.js b/js/src/tests/test262/language/expressions/await/await-non-promise-thenable.js new file mode 100644 index 0000000000..bad7cc6776 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-non-promise-thenable.js @@ -0,0 +1,57 @@ +// |reftest| async +// Copyright 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Maya Lekova +esid: await +description: > + This test demonstrates that "then" on a non-native promise + will still get called. +flags: [async] +features: [async-functions] +includes: [compareArray.js] +---*/ + +let thenCallCount = 0; + +const actual = []; +const expected = [ + 'Promise: 1', + 'Promise: 2', + 'Await: 1', + 'Promise: 3', + 'Promise: 4', + 'Await: 2', +]; + +const patched = {}; +patched.then = function(fulfill, reject) { + thenCallCount++; + fulfill(thenCallCount); +}; + +async function trigger() { + actual.push('Await: ' + await patched); + actual.push('Await: ' + await patched); +} + +function checkAssertions() { + assert.compareArray(actual, expected, + 'Async/await and promises should be interleaved'); + assert.sameValue(thenCallCount, 2, + '"then" on non-native promises should be called.'); +} + +trigger().then(checkAssertions).then($DONE, $DONE); + +new Promise(function (resolve) { + actual.push('Promise: 1'); + resolve(); +}).then(function () { + actual.push('Promise: 2'); +}).then(function () { + actual.push('Promise: 3'); +}).then(function () { + actual.push('Promise: 4'); +}); diff --git a/js/src/tests/test262/language/expressions/await/await-non-promise.js b/js/src/tests/test262/language/expressions/await/await-non-promise.js new file mode 100644 index 0000000000..1aaf1094a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-non-promise.js @@ -0,0 +1,45 @@ +// |reftest| async +// Copyright 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Maya Lekova +esid: await +description: > + This test demonstrates that "then" on a non-native promise + will still get called. +flags: [async] +features: [async-functions] +includes: [compareArray.js] +---*/ + +const value = 1; + +const actual = []; +const expected = [ + 'Await: 1', + 'Promise: 1', + 'Promise: 2', +]; + +function pushAwaitSync(value) { + actual.push('Await: ' + value); +} + +async function trigger() { + await pushAwaitSync(value); +} + +function checkAssertions() { + assert.compareArray(actual, expected, + 'Async/await and promises should be interleaved'); +} + +trigger().then(checkAssertions).then($DONE, $DONE); + +new Promise(function (resolve) { + actual.push('Promise: 1'); + resolve(); +}).then(function () { + actual.push('Promise: 2'); +}); diff --git a/js/src/tests/test262/language/expressions/await/await-throws-rejections.js b/js/src/tests/test262/language/expressions/await/await-throws-rejections.js new file mode 100644 index 0000000000..175211b1cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/await-throws-rejections.js @@ -0,0 +1,27 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await throws errors from rejected promises +flags: [async] +includes: [asyncHelpers.js] +---*/ + +async function foo() { + var err = {}; + var caught = false; + try { + await Promise.reject(err); + } catch(e) { + caught = true; + assert.sameValue(e, err); + } + + assert(caught); +} + +asyncTest(foo); diff --git a/js/src/tests/test262/language/expressions/await/browser.js b/js/src/tests/test262/language/expressions/await/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/await/early-errors-await-not-simple-assignment-target.js b/js/src/tests/test262/language/expressions/await/early-errors-await-not-simple-assignment-target.js new file mode 100644 index 0000000000..27416be4f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/early-errors-await-not-simple-assignment-target.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + await is not a simple assignment target and cannot be assigned to. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async function foo() { + (await 1) = 1; +} diff --git a/js/src/tests/test262/language/expressions/await/for-await-of-interleaved.js b/js/src/tests/test262/language/expressions/await/for-await-of-interleaved.js new file mode 100644 index 0000000000..39bcda612e --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/for-await-of-interleaved.js @@ -0,0 +1,59 @@ +// |reftest| async +// Copyright 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Maya Lekova +esid: await +description: > + for-await-of iteration and builtin Promises are properly interleaved, + meaning await in for-of loop takes only 1 tick on the microtask queue. +flags: [async] +features: [async-functions, async-iteration, generators] +includes: [compareArray.js] +---*/ + +const actual = []; +const expected = [ + 'Promise: 6', + 'Promise: 5', + 'Await: 3', + 'Promise: 4', + 'Promise: 3', + 'Await: 2', + 'Promise: 2', + 'Promise: 1', + 'Await: 1', + 'Promise: 0' +]; +const iterations = 3; + +async function* naturalNumbers(start) { + let current = start; + while (current > 0) { + yield Promise.resolve(current--); + } +} + +async function trigger() { + for await (const num of naturalNumbers(iterations)) { + actual.push('Await: ' + num); + } +} + +async function checkAssertions() { + assert.compareArray(actual, expected, + 'Async/await and promises should be interleaved'); +} + +function countdown(counter) { + actual.push('Promise: ' + counter); + if (counter > 0) { + return Promise.resolve(counter - 1).then(countdown); + } else { + checkAssertions().then($DONE, $DONE); + } +} + +trigger(); +countdown(iterations * 2); diff --git a/js/src/tests/test262/language/expressions/await/no-operand.js b/js/src/tests/test262/language/expressions/await/no-operand.js new file mode 100644 index 0000000000..cecd869687 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/no-operand.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + await requries an operand. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +async function foo() { + await; +} diff --git a/js/src/tests/test262/language/expressions/await/shell.js b/js/src/tests/test262/language/expressions/await/shell.js new file mode 100644 index 0000000000..ae18ad584d --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/shell.js @@ -0,0 +1,113 @@ +// GENERATED, DO NOT EDIT +// file: asyncHelpers.js +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + A collection of assertion and wrapper functions for testing asynchronous built-ins. +defines: [asyncTest] +---*/ + +function asyncTest(testFunc) { + if (!Object.hasOwn(globalThis, "$DONE")) { + throw new Test262Error("asyncTest called without async flag"); + } + if (typeof testFunc !== "function") { + $DONE(new Test262Error("asyncTest called with non-function argument")); + return; + } + try { + testFunc().then( + function () { + $DONE(); + }, + function (error) { + $DONE(error); + } + ); + } catch (syncError) { + $DONE(syncError); + } +} + +assert.throwsAsync = async function (expectedErrorConstructor, func, message) { + var innerThenable; + if (message === undefined) { + message = ""; + } else { + message += " "; + } + if (typeof func === "function") { + try { + innerThenable = func(); + if ( + innerThenable === null || + typeof innerThenable !== "object" || + typeof innerThenable.then !== "function" + ) { + message += + "Expected to obtain an inner promise that would reject with a" + + expectedErrorConstructor.name + + " but result was not a thenable"; + throw new Test262Error(message); + } + } catch (thrown) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise"; + throw new Test262Error(message); + } + } else { + message += + "assert.throwsAsync called with an argument that is not a function"; + throw new Test262Error(message); + } + + try { + return innerThenable.then( + function () { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but no exception was thrown at all"; + throw new Test262Error(message); + }, + function (thrown) { + var expectedName, actualName; + if (typeof thrown !== "object" || thrown === null) { + message += "Thrown value was not an object!"; + throw new Test262Error(message); + } else if (thrown.constructor !== expectedErrorConstructor) { + expectedName = expectedErrorConstructor.name; + actualName = thrown.constructor.name; + if (expectedName === actualName) { + message += + "Expected a " + + expectedName + + " but got a different error constructor with the same name"; + } else { + message += + "Expected a " + expectedName + " but got a " + actualName; + } + throw new Test262Error(message); + } + } + ); + } catch (thrown) { + if (typeof thrown !== "object" || thrown === null) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object "; + } else { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but a " + + thrown.constructor.name + + " was thrown synchronously"; + } + throw new Test262Error(message); + } +}; diff --git a/js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js b/js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js new file mode 100644 index 0000000000..b9af142520 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression-with-MultiplicativeExpression.js @@ -0,0 +1,19 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await's operand is a UnaryExpression +flags: [async] +includes: [asyncHelpers.js] +---*/ + +async function foo() { + let x = 2; + let y = await Promise.resolve(2) * x + assert.sameValue(y, 4); +} +asyncTest(foo); diff --git a/js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression.js b/js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression.js new file mode 100644 index 0000000000..464d9b5c14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/await/syntax-await-has-UnaryExpression.js @@ -0,0 +1,20 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Await's operand is a UnaryExpression +flags: [async] +includes: [asyncHelpers.js] +---*/ + +async function foo() { + let x = 1; + let y = await x++; + assert.sameValue(y, 1); + assert.sameValue(x, 2); +} +asyncTest(foo); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js new file mode 100644 index 0000000000..b9aa7e624c --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between BitwiseANDExpression and "&" or + between "&" and EqualityExpression are allowed +es5id: 11.10.1_A1 +description: Checking uses eval +---*/ + +//CHECK#1 +if ((eval("1\u0009&\u00091")) !== 1) { + throw new Test262Error('#1: (1\\u0009&\\u00091) === 1'); +} + +//CHECK#2 +if ((eval("1\u000B&\u000B1")) !== 1) { + throw new Test262Error('#2: (1\\u000B&\\u000B1) === 1'); +} + +//CHECK#3 +if ((eval("1\u000C&\u000C1")) !== 1) { + throw new Test262Error('#3: (1\\u000C&\\u000C1) === 1'); +} + +//CHECK#4 +if ((eval("1\u0020&\u00201")) !== 1) { + throw new Test262Error('#4: (1\\u0020&\\u00201) === 1'); +} + +//CHECK#5 +if ((eval("1\u00A0&\u00A01")) !== 1) { + throw new Test262Error('#5: (1\\u00A0&\\u00A01) === 1'); +} + +//CHECK#6 +if ((eval("1\u000A&\u000A1")) !== 1) { + throw new Test262Error('#6: (1\\u000A&\\u000A1) === 1'); +} + +//CHECK#7 +if ((eval("1\u000D&\u000D1")) !== 1) { + throw new Test262Error('#7: (1\\u000D&\\u000D1) === 1'); +} + +//CHECK#8 +if ((eval("1\u2028&\u20281")) !== 1) { + throw new Test262Error('#8: (1\\u2028&\\u20281) === 1'); +} + +//CHECK#9 +if ((eval("1\u2029&\u20291")) !== 1) { + throw new Test262Error('#9: (1\\u2029&\\u20291) === 1'); +} + + +//CHECK#10 +if ((eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029&\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 1) { + throw new Test262Error('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029&\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js new file mode 100644 index 0000000000..73f8709fc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y uses GetValue +es5id: 11.10.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((1 & 1) !== 1) { + throw new Test262Error('#1: (1 & 1) === 1. Actual: ' + ((1 & 1))); +} + +//CHECK#2 +var x = 1; +if ((x & 1) !== 1) { + throw new Test262Error('#2: var x = 1; (x & 1) === 1. Actual: ' + ((x & 1))); +} + +//CHECK#3 +var y = 1; +if ((1 & y) !== 1) { + throw new Test262Error('#3: var y = 1; (1 & y) === 1. Actual: ' + ((1 & y))); +} + +//CHECK#4 +var x = 1; +var y = 1; +if ((x & y) !== 1) { + throw new Test262Error('#4: var x = 1; var y = 1; (x & y) === 1. Actual: ' + ((x & y))); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if ((objectx.prop & objecty.prop) !== 1) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; (objectx.prop & objecty.prop) === 1. Actual: ' + ((objectx.prop & objecty.prop))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js new file mode 100644 index 0000000000..a085abc1ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y uses GetValue +es5id: 11.10.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x & 1; + throw new Test262Error('#1.1: x & 1 throw ReferenceError. Actual: ' + (x & 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x & 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js new file mode 100644 index 0000000000..ab8735b901 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y uses GetValue +es5id: 11.10.1_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 & y; + throw new Test262Error('#1.1: 1 & y throw ReferenceError. Actual: ' + (1 & y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 & y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js new file mode 100644 index 0000000000..11f34a0121 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y uses [[Default Value]] +es5id: 11.10.1_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if (({valueOf: function() {return 1}} & 1) !== 1) { + throw new Test262Error('#1: ({valueOf: function() {return 1}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}} & 1))); +} + +//CHECK#2 +if (({valueOf: function() {return 1}, toString: function() {return 0}} & 1) !== 1) { + throw new Test262Error('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return 0}} & 1))); +} + +//CHECK#3 +if (({valueOf: function() {return 1}, toString: function() {return {}}} & 1) !== 1) { + throw new Test262Error('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return {}}} & 1))); +} + +//CHECK#4 +try { + if (({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) !== 1) { + throw new Test262Error('#4.1: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1))); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) not throw "error"'); + } else { + throw new Test262Error('#4.3: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if ((1 & {toString: function() {return 1}}) !== 1) { + throw new Test262Error('#5.1: (1 & {toString: function() {return 1}}) === 1. Actual: ' + ((1 & {toString: function() {return 1}}))); +} + +//CHECK#6 +if ((1 & {valueOf: function() {return {}}, toString: function() {return 1}}) !== 1) { + throw new Test262Error('#6: (1 & {valueOf: function() {return {}}, toString: function() {return 1}}) === 1. Actual: ' + ((1 & {valueOf: function() {return {}}, toString: function() {return 1}}))); +} + +//CHECK#7 +try { + 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 & {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 & {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 & {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 & {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 & {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js new file mode 100644 index 0000000000..b3ddbf11cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToInt32(first expression) is called first, and then ToInt32(second + expression) +es5id: 11.10.1_A2.3_T1 +description: Checking by using "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x & y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x & y throw "x". Actual: ' + (x & y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToInt32(first expression) is called first, and then ToInt32(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x & y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js new file mode 100644 index 0000000000..14807c25f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if (((x = 1) & x) !== 1) { + throw new Test262Error('#1: var x = 0; ((x = 1) & x) === 1. Actual: ' + (((x = 1) & x))); +} + +//CHECK#2 +var x = 0; +if ((x & (x = 1)) !== 0) { + throw new Test262Error('#2: var x = 0; (x & (x = 1)) === 0. Actual: ' + ((x & (x = 1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js new file mode 100644 index 0000000000..2f6201a800 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() & y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() & y() throw "x". Actual: ' + (x() & y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() & y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js new file mode 100644 index 0000000000..11178c0efb --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.1_A2.4_T3 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +try { + x & (x = 1); + throw new Test262Error('#1.1: x & (x = 1) throw ReferenceError. Actual: ' + (x & (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x & (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if (((y = 1) & y) !== 1) { + throw new Test262Error('#2: ((y = 1) & y) === 1. Actual: ' + (((y = 1) & y))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js new file mode 100644 index 0000000000..30041b9ee1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T1.1 +description: Type(x) and Type(y) are primitive boolean and Boolean object +---*/ + +//CHECK#1 +if ((true & true) !== 1) { + throw new Test262Error('#1: (true & true) === 1. Actual: ' + ((true & true))); +} + +//CHECK#2 +if ((new Boolean(true) & true) !== 1) { + throw new Test262Error('#2: (new Boolean(true) & true) === 1. Actual: ' + ((new Boolean(true) & true))); +} + +//CHECK#3 +if ((true & new Boolean(true)) !== 1) { + throw new Test262Error('#3: (true & new Boolean(true)) === 1. Actual: ' + ((true & new Boolean(true)))); +} + +//CHECK#4 +if ((new Boolean(true) & new Boolean(true)) !== 1) { + throw new Test262Error('#4: (new Boolean(true) & new Boolean(true)) === 1. Actual: ' + ((new Boolean(true) & new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js new file mode 100644 index 0000000000..0324bb47be --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T1.2 +description: Type(x) and Type(y) are primitive number and Number object +---*/ + +//CHECK#1 +if ((1 & 1) !== 1) { + throw new Test262Error('#1: (1 & 1) === 1. Actual: ' + ((1 & 1))); +} + +//CHECK#2 +if ((new Number(1) & 1) !== 1) { + throw new Test262Error('#2: (new Number(1) & 1) === 1. Actual: ' + ((new Number(1) & 1))); +} + +//CHECK#3 +if ((1 & new Number(1)) !== 1) { + throw new Test262Error('#3: (1 & new Number(1)) === 1. Actual: ' + ((1 & new Number(1)))); +} + +//CHECK#4 +if ((new Number(1) & new Number(1)) !== 1) { + throw new Test262Error('#4: (new Number(1) & new Number(1)) === 1. Actual: ' + ((new Number(1) & new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js new file mode 100644 index 0000000000..78b0d17e07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T1.3 +description: Type(x) and Type(y) are primitive string and String object +---*/ + +//CHECK#1 +if (("1" & "1") !== 1) { + throw new Test262Error('#1: ("1" & "1") === 1. Actual: ' + (("1" & "1"))); +} + +//CHECK#2 +if ((new String("1") & "1") !== 1) { + throw new Test262Error('#2: (new String("1") & "1") === 1. Actual: ' + ((new String("1") & "1"))); +} + +//CHECK#3 +if (("1" & new String("1")) !== 1) { + throw new Test262Error('#3: ("1" & new String("1")) === 1. Actual: ' + (("1" & new String("1")))); +} + +//CHECK#4 +if ((new String("1") & new String("1")) !== 1) { + throw new Test262Error('#4: (new String("1") & new String("1")) === 1. Actual: ' + ((new String("1") & new String("1")))); +} + +//CHECK#5 +if (("x" & "1") !== 0) { + throw new Test262Error('#5: ("x" & "1") === 0. Actual: ' + (("x" & "1"))); +} + +//CHECK#6 +if (("1" & "x") !== 0) { + throw new Test262Error('#6: ("1" & "x") === 0. Actual: ' + (("1" & "x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js new file mode 100644 index 0000000000..915deadf16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T1.4 +description: Type(x) and Type(y) are null and undefined +---*/ + +//CHECK#1 +if ((null & undefined) !== 0) { + throw new Test262Error('#1: (null & undefined) === 0. Actual: ' + ((null & undefined))); +} + +//CHECK#2 +if ((undefined & null) !== 0) { + throw new Test262Error('#2: (undefined & null) === 0. Actual: ' + ((undefined & null))); +} + +//CHECK#3 +if ((undefined & undefined) !== 0) { + throw new Test262Error('#3: (undefined & undefined) === 0. Actual: ' + ((undefined & undefined))); +} + +//CHECK#4 +if ((null & null) !== 0) { + throw new Test262Error('#4: (null & null) === 0. Actual: ' + ((null & null))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js new file mode 100644 index 0000000000..519552149b --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T1.5 +description: Type(x) and Type(y) are Object object and Function object +---*/ + +//CHECK#1 +if (({} & function(){return 1}) !== 0) { + throw new Test262Error('#1: ({} & function(){return 1}) === 0. Actual: ' + (({} & function(){return 1}))); +} + +//CHECK#2 +if ((function(){return 1} & {}) !== 0) { + throw new Test262Error('#2: (function(){return 1} & {}) === 0. Actual: ' + ((function(){return 1} & {}))); +} + +//CHECK#3 +if ((function(){return 1} & function(){return 1}) !== 0) { + throw new Test262Error('#3: (function(){return 1} & function(){return 1}) === 0. Actual: ' + ((function(){return 1} & function(){return 1}))); +} + +//CHECK#4 +if (({} & {}) !== 0) { + throw new Test262Error('#4: ({} & {}) === 0. Actual: ' + (({} & {}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js new file mode 100644 index 0000000000..8526ac73d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if ((true & 1) !== 1) { + throw new Test262Error('#1: (true & 1) === 1. Actual: ' + ((true & 1))); +} + +//CHECK#2 +if ((1 & true) !== 1) { + throw new Test262Error('#2: (1 & true) === 1. Actual: ' + ((1 & true))); +} + +//CHECK#3 +if ((new Boolean(true) & 1) !== 1) { + throw new Test262Error('#3: (new Boolean(true) & 1) === 1. Actual: ' + ((new Boolean(true) & 1))); +} + +//CHECK#4 +if ((1 & new Boolean(true)) !== 1) { + throw new Test262Error('#4: (1 & new Boolean(true)) === 1. Actual: ' + ((1 & new Boolean(true)))); +} + +//CHECK#5 +if ((true & new Number(1)) !== 1) { + throw new Test262Error('#5: (true & new Number(1)) === 1. Actual: ' + ((true & new Number(1)))); +} + +//CHECK#6 +if ((new Number(1) & true) !== 1) { + throw new Test262Error('#6: (new Number(1) & true) === 1. Actual: ' + ((new Number(1) & true))); +} + +//CHECK#7 +if ((new Boolean(true) & new Number(1)) !== 1) { + throw new Test262Error('#7: (new Boolean(true) & new Number(1)) === 1. Actual: ' + ((new Boolean(true) & new Number(1)))); +} + +//CHECK#8 +if ((new Number(1) & new Boolean(true)) !== 1) { + throw new Test262Error('#8: (new Number(1) & new Boolean(true)) === 1. Actual: ' + ((new Number(1) & new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js new file mode 100644 index 0000000000..ad84b94a9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if (("1" & 1) !== 1) { + throw new Test262Error('#1: ("1" & 1) === 1. Actual: ' + (("1" & 1))); +} + +//CHECK#2 +if ((1 & "1") !== 1) { + throw new Test262Error('#2: (1 & "1") === 1. Actual: ' + ((1 & "1"))); +} + +//CHECK#3 +if ((new String("1") & 1) !== 1) { + throw new Test262Error('#3: (new String("1") & 1) === 1. Actual: ' + ((new String("1") & 1))); +} + +//CHECK#4 +if ((1 & new String("1")) !== 1) { + throw new Test262Error('#4: (1 & new String("1")) === 1. Actual: ' + ((1 & new String("1")))); +} + +//CHECK#5 +if (("1" & new Number(1)) !== 1) { + throw new Test262Error('#5: ("1" & new Number(1)) === 1. Actual: ' + (("1" & new Number(1)))); +} + +//CHECK#6 +if ((new Number(1) & "1") !== 1) { + throw new Test262Error('#6: (new Number(1) & "1") === 1. Actual: ' + ((new Number(1) & "1"))); +} + +//CHECK#7 +if ((new String("1") & new Number(1)) !== 1) { + throw new Test262Error('#7: (new String("1") & new Number(1)) === 1. Actual: ' + ((new String("1") & new Number(1)))); +} + +//CHECK#8 +if ((new Number(1) & new String("1")) !== 1) { + throw new Test262Error('#8: (new Number(1) & new String("1")) === 1. Actual: ' + ((new Number(1) & new String("1")))); +} + +//CHECK#9 +if (("x" & 1) !== 0) { + throw new Test262Error('#9: ("x" & 1) === 0. Actual: ' + (("x" & 1))); +} + +//CHECK#10 +if ((1 & "x") !== 0) { + throw new Test262Error('#10: (1 & "x") === 0. Actual: ' + ((1 & "x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js new file mode 100644 index 0000000000..b8f3364c0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if ((1 & null) !== 0) { + throw new Test262Error('#1: (1 & null) === 0. Actual: ' + ((1 & null))); +} + +//CHECK#2 +if ((null & 1) !== 0) { + throw new Test262Error('#2: (null & 1) === 0. Actual: ' + ((null & 1))); +} + +//CHECK#3 +if ((new Number(1) & null) !== 0) { + throw new Test262Error('#3: (new Number(1) & null) === 0. Actual: ' + ((new Number(1) & null))); +} + +//CHECK#4 +if ((null & new Number(1)) !== 0) { + throw new Test262Error('#4: (null & new Number(1)) === 0. Actual: ' + ((null & new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js new file mode 100644 index 0000000000..58246c2cf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ((1 & undefined) !== 0) { + throw new Test262Error('#1: (1 & undefined) === 0. Actual: ' + ((1 & undefined))); +} + +//CHECK#2 +if ((undefined & 1) !== 0) { + throw new Test262Error('#2: (undefined & 1) === 0. Actual: ' + ((undefined & 1))); +} + +//CHECK#3 +if ((new Number(1) & undefined) !== 0) { + throw new Test262Error('#3: (new Number(1) & undefined) === 0. Actual: ' + ((new Number(1) & undefined))); +} + +//CHECK#4 +if ((undefined & new Number(1)) !== 0) { + throw new Test262Error('#4: (undefined & new Number(1)) === 0. Actual: ' + ((undefined & new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js new file mode 100644 index 0000000000..009bd234c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.5 +description: > + Type(x) us different from Type(y) and both types are String + (primitive or object) or Boolean (primitive and object) +---*/ + +//CHECK#1 +if ((true & "1") !== 1) { + throw new Test262Error('#1: (true & "1") === 1. Actual: ' + ((true & "1"))); +} + +//CHECK#2 +if (("1" & true) !== 1) { + throw new Test262Error('#2: ("1" & true) === 1. Actual: ' + (("1" & true))); +} + +//CHECK#3 +if ((new Boolean(true) & "1") !== 1) { + throw new Test262Error('#3: (new Boolean(true) & "1") === 1. Actual: ' + ((new Boolean(true) & "1"))); +} + +//CHECK#4 +if (("1" & new Boolean(true)) !== 1) { + throw new Test262Error('#4: ("1" & new Boolean(true)) === 1. Actual: ' + (("1" & new Boolean(true)))); +} + +//CHECK#5 +if ((true & new String("1")) !== 1) { + throw new Test262Error('#5: (true & new String("1")) === 1. Actual: ' + ((true & new String("1")))); +} + +//CHECK#6 +if ((new String("1") & true) !== 1) { + throw new Test262Error('#6: (new String("1") & true) === 1. Actual: ' + ((new String("1") & true))); +} + +//CHECK#7 +if ((new Boolean(true) & new String("1")) !== 1) { + throw new Test262Error('#7: (new Boolean(true) & new String("1")) === 1. Actual: ' + ((new Boolean(true) & new String("1")))); +} + +//CHECK#8 +if ((new String("1") & new Boolean(true)) !== 1) { + throw new Test262Error('#8: (new String("1") & new Boolean(true)) === 1. Actual: ' + ((new String("1") & new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js new file mode 100644 index 0000000000..03dd622b91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (("1" & undefined) !== 0) { + throw new Test262Error('#1: ("1" & undefined) === 0. Actual: ' + (("1" & undefined))); +} + +//CHECK#2 +if ((undefined & "1") !== 0) { + throw new Test262Error('#2: (undefined & "1") === 0. Actual: ' + ((undefined & "1"))); +} + +//CHECK#3 +if ((new String("1") & undefined) !== 0) { + throw new Test262Error('#3: (new String("1") & undefined) === 0. Actual: ' + ((new String("1") & undefined))); +} + +//CHECK#4 +if ((undefined & new String("1")) !== 0) { + throw new Test262Error('#4: (undefined & new String("1")) === 0. Actual: ' + ((undefined & new String("1")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js new file mode 100644 index 0000000000..63acb37e83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if (("1" & null) !== 0) { + throw new Test262Error('#1: ("1" & null) === 0. Actual: ' + (("1" & null))); +} + +//CHECK#2 +if ((null & "1") !== 0) { + throw new Test262Error('#2: (null & "1") === 0. Actual: ' + ((null & "1"))); +} + +//CHECK#3 +if ((new String("1") & null) !== 0) { + throw new Test262Error('#3: (new String("1") & null) === 0. Actual: ' + ((new String("1") & null))); +} + +//CHECK#4 +if ((null & new String("1")) !== 0) { + throw new Test262Error('#4: (null & new String("1")) === 0. Actual: ' + ((null & new String("1")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js new file mode 100644 index 0000000000..06245a96b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ((true & undefined) !== 0) { + throw new Test262Error('#1: (true & undefined) === 0. Actual: ' + ((true & undefined))); +} + +//CHECK#2 +if ((undefined & true) !== 0) { + throw new Test262Error('#2: (undefined & true) === 0. Actual: ' + ((undefined & true))); +} + +//CHECK#3 +if ((new Boolean(true) & undefined) !== 0) { + throw new Test262Error('#3: (new Boolean(true) & undefined) === 0. Actual: ' + ((new Boolean(true) & undefined))); +} + +//CHECK#4 +if ((undefined & new Boolean(true)) !== 0) { + throw new Test262Error('#4: (undefined & new Boolean(true)) === 0. Actual: ' + ((undefined & new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js new file mode 100644 index 0000000000..c457285973 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x & y returns ToNumber(x) & ToNumber(y) +es5id: 11.10.1_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if ((true & null) !== 0) { + throw new Test262Error('#1: (true & null) === 0. Actual: ' + ((true & null))); +} + +//CHECK#2 +if ((null & true) !== 0) { + throw new Test262Error('#2: (null & true) === 0. Actual: ' + ((null & true))); +} + +//CHECK#3 +if ((new Boolean(true) & null) !== 0) { + throw new Test262Error('#3: (new Boolean(true) & null) === 0. Actual: ' + ((new Boolean(true) & null))); +} + +//CHECK#4 +if ((null & new Boolean(true)) !== 0) { + throw new Test262Error('#4: (null & new Boolean(true)) === 0. Actual: ' + ((null & new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js new file mode 100644 index 0000000000..3703caf8ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for bitwise-and operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n & 1; +}, '1n & 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 & 1n; +}, '1 & 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) & 1; +}, 'Object(1n) & 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 & Object(1n); +}, '1 & Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n & Object(1); +}, '1n & Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) & 1n; +}, 'Object(1) & 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) & Object(1); +}, 'Object(1n) & Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) & Object(1n); +}, 'Object(1) & Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n & NaN; +}, '1n & NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN & 1n; +}, 'NaN & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & Infinity; +}, '1n & Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity & 1n; +}, 'Infinity & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & true; +}, '1n & true throws TypeError'); + +assert.throws(TypeError, function() { + true & 1n; +}, 'true & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & '1'; +}, '1n & "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' & 1n; +}, '"1" & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & null; +}, '1n & null throws TypeError'); + +assert.throws(TypeError, function() { + null & 1n; +}, 'null & 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n & undefined; +}, '1n & undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined & 1n; +}, 'undefined & 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js new file mode 100644 index 0000000000..9341e3a8de --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-and operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') & 0n; +}, 'Symbol("1") & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & Symbol('1'); +}, '0n & Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) & 0n; +}, 'Object(Symbol("1")) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & Object(Symbol('1')); +}, '0n & Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) & 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n & {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) & 0n; +}, '({valueOf: function() {return Symbol("1");}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n & {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) & 0n; +}, '({toString: function() {return Symbol("1");}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + toString: function() { + return Symbol('1'); + } + }; +}, '0n & {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js new file mode 100644 index 0000000000..13c93a087c --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js @@ -0,0 +1,83 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Bitwise AND for BigInt non-primitive values +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +info: | + 5. Let lnum be ? ToNumeric(lval). + 6. Let rnum be ? ToNumeric(rval). + ... + 8. Let T be Type(lnum). + 9. If @ is &, return T::bitwiseAND(lnum, rnum). + +features: [BigInt] +---*/ +assert.sameValue( + Object(0b101n) & 0b011n, + 0b001n, + 'The result of (Object(0b101n) & 0b011n) is 0b001n' +); + +assert.sameValue( + 0b011n & Object(0b101n), + 0b001n, + 'The result of (0b011n & Object(0b101n)) is 0b001n' +); + +assert.sameValue( + Object(0b101n) & Object(0b011n), + 0b001n, + 'The result of (Object(0b101n) & Object(0b011n)) is 0b001n' +); + +function err() { + throw new Test262Error(); +} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} & 0b011n, 0b001n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) & 0b011n) is 0b001n'); + +assert.sameValue(0b011n & { + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +}, 0b001n, 'The result of (0b011n & {[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) is 0b001n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} & 0b011n, 0b001n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) & 0b011n) is 0b001n'); + +assert.sameValue(0b011n & { + valueOf: function() { + return 0b101n; + }, + + toString: err +}, 0b001n, 'The result of (0b011n & {valueOf: function() {return 0b101n;}, toString: err}) is 0b001n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} & 0b011n, 0b001n, 'The result of (({toString: function() {return 0b101n;}}) & 0b011n) is 0b001n'); + +assert.sameValue(0b011n & { + toString: function() { + return 0b101n; + } +}, 0b001n, 'The result of (0b011n & {toString: function() {return 0b101n;}}) is 0b001n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js new file mode 100644 index 0000000000..ddaa6e406e --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-and operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) & 3n) is 2n'); + +assert.sameValue(3n & { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 2n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} & 3n, 2n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) & 3n) is 2n'); + +assert.sameValue(3n & { + valueOf: function() { + return 2n; + }, + + toString: err +}, 2n, 'The result of (3n & {valueOf: function() {return 2n;}, toString: err}) is 2n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({toString: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + toString: function() { + return 2n; + } +}, 2n, 'The result of (3n & {toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + valueOf: null, + + toString: function() { + return 2n; + } +}, 2n, 'The result of (3n & {valueOf: null, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 2n, 'The result of (3n & {valueOf: 1, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 2n, 'The result of (3n & {valueOf: {}, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 2n, 'The result of (3n & {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 2n, 'The result of (3n & {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 2n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) & 0n; +}, '({[Symbol.toPrimitive]: 1}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + [Symbol.toPrimitive]: 1 + }; +}, '0n & {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) & 0n; +}, '({[Symbol.toPrimitive]: {}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + [Symbol.toPrimitive]: {} + }; +}, '0n & {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) & 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n & {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) & 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n & {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) & 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) & 0n throws MyError'); + +assert.throws(MyError, function() { + 0n & { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n & {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) & 0n; +}, '({valueOf: function() {throw new MyError();}}) & 0n throws MyError'); + +assert.throws(MyError, function() { + 0n & { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n & {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) & 0n; +}, '({toString: function() {throw new MyError();}}) & 0n throws MyError'); + +assert.throws(MyError, function() { + 0n & { + toString: function() { + throw new MyError(); + } + }; +}, '0n & {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) & 0n; +}, '({valueOf: null, toString: null}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + valueOf: null, + toString: null + }; +}, '0n & {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) & 0n; +}, '({valueOf: 1, toString: 1}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + valueOf: 1, + toString: 1 + }; +}, '0n & {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) & 0n; +}, '({valueOf: {}, toString: {}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + valueOf: {}, + toString: {} + }; +}, '0n & {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) & 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n & {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) & 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) & 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n & { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n & {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js new file mode 100644 index 0000000000..f8cb905f64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-and operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) & 3n, 2n, 'The result of (Object(2n) & 3n) is 2n'); +assert.sameValue(3n & Object(2n), 2n, 'The result of (3n & Object(2n)) is 2n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({valueOf: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + valueOf: function() { + return 2n; + } +}, 2n, 'The result of (3n & {valueOf: function() {return 2n;}}) is 2n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} & 3n, 2n, 'The result of (({toString: function() {return 2n;}}) & 3n) is 2n'); + +assert.sameValue(3n & { + toString: function() { + return 2n; + } +}, 2n, 'The result of (3n & {toString: function() {return 2n;}}) is 2n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint.js new file mode 100644 index 0000000000..0b6c9fe48d --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint.js @@ -0,0 +1,109 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Bitwise AND for BigInt values +esid: sec-bitwise-op +info: | + BitwiseOp(op, x, y) + + 1. Let result be 0. + 2. Let shift be 0. + 3. Repeat, until (x = 0 or x = -1) and (y = 0 or y = -1), + a. Let xDigit be x modulo 2. + b. Let yDigit be y modulo 2. + c. Let result be result + 2**shift * op(xDigit, yDigit) + d. Let shift be shift + 1. + e. Let x be (x - xDigit) / 2. + f. Let y be (y - yDigit) / 2. + 4. If op(x modulo 2, y modulo 2) ≠ 0, + a. Let result be result - 2**shift. NOTE: This extends the sign. + 5. Return result. + +features: [BigInt] +---*/ + +assert.sameValue(0b00n & 0b00n, 0b00n, "0b00n & 0b00n === 0b00n"); +assert.sameValue(0b00n & 0b01n, 0b00n, "0b00n & 0b01n === 0b00n"); +assert.sameValue(0b01n & 0b00n, 0b00n, "0b01n & 0b00n === 0b00n"); +assert.sameValue(0b00n & 0b10n, 0b00n, "0b00n & 0b10n === 0b00n"); +assert.sameValue(0b10n & 0b00n, 0b00n, "0b10n & 0b00n === 0b00n"); +assert.sameValue(0b00n & 0b11n, 0b00n, "0b00n & 0b11n === 0b00n"); +assert.sameValue(0b11n & 0b00n, 0b00n, "0b11n & 0b00n === 0b00n"); +assert.sameValue(0b01n & 0b01n, 0b01n, "0b01n & 0b01n === 0b01n"); +assert.sameValue(0b01n & 0b10n, 0b00n, "0b01n & 0b10n === 0b00n"); +assert.sameValue(0b10n & 0b01n, 0b00n, "0b10n & 0b01n === 0b00n"); +assert.sameValue(0b01n & 0b11n, 0b01n, "0b01n & 0b11n === 0b01n"); +assert.sameValue(0b11n & 0b01n, 0b01n, "0b11n & 0b01n === 0b01n"); +assert.sameValue(0b10n & 0b10n, 0b10n, "0b10n & 0b10n === 0b10n"); +assert.sameValue(0b10n & 0b11n, 0b10n, "0b10n & 0b11n === 0b10n"); +assert.sameValue(0b11n & 0b10n, 0b10n, "0b11n & 0b10n === 0b10n"); +assert.sameValue(0xffffffffn & 0n, 0n, "0xffffffffn & 0n === 0n"); +assert.sameValue(0n & 0xffffffffn, 0n, "0n & 0xffffffffn === 0n"); +assert.sameValue(0xffffffffn & 0xffffffffn, 0xffffffffn, "0xffffffffn & 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffffffffffn & 0n, 0n, "0xffffffffffffffffn & 0n === 0n"); +assert.sameValue(0n & 0xffffffffffffffffn, 0n, "0n & 0xffffffffffffffffn === 0n"); +assert.sameValue(0xffffffffffffffffn & 0xffffffffn, 0xffffffffn, "0xffffffffffffffffn & 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffn & 0xffffffffffffffffn, 0xffffffffn, "0xffffffffn & 0xffffffffffffffffn === 0xffffffffn"); +assert.sameValue( + 0xffffffffffffffffn & 0xffffffffffffffffn, 0xffffffffffffffffn, + "0xffffffffffffffffn & 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n, 0x42092803008e813400181700n, + "0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n === 0x42092803008e813400181700n"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n, 0x42092803008e813400181700n, + "0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n === 0x42092803008e813400181700n"); +assert.sameValue(0n & -1n, 0n, "0n & -1n === 0n"); +assert.sameValue(-1n & 0n, 0n, "-1n & 0n === 0n"); +assert.sameValue(0n & -2n, 0n, "0n & -2n === 0n"); +assert.sameValue(-2n & 0n, 0n, "-2n & 0n === 0n"); +assert.sameValue(1n & -2n, 0n, "1n & -2n === 0n"); +assert.sameValue(-2n & 1n, 0n, "-2n & 1n === 0n"); +assert.sameValue(2n & -2n, 2n, "2n & -2n === 2n"); +assert.sameValue(-2n & 2n, 2n, "-2n & 2n === 2n"); +assert.sameValue(2n & -3n, 0n, "2n & -3n === 0n"); +assert.sameValue(-3n & 2n, 0n, "-3n & 2n === 0n"); +assert.sameValue(-1n & -2n, -2n, "-1n & -2n === -2n"); +assert.sameValue(-2n & -1n, -2n, "-2n & -1n === -2n"); +assert.sameValue(-2n & -2n, -2n, "-2n & -2n === -2n"); +assert.sameValue(-2n & -3n, -4n, "-2n & -3n === -4n"); +assert.sameValue(-3n & -2n, -4n, "-3n & -2n === -4n"); +assert.sameValue(0xffffffffn & -1n, 0xffffffffn, "0xffffffffn & -1n === 0xffffffffn"); +assert.sameValue(-1n & 0xffffffffn, 0xffffffffn, "-1n & 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffffffffffn & -1n, 0xffffffffffffffffn, "0xffffffffffffffffn & -1n === 0xffffffffffffffffn"); +assert.sameValue(-1n & 0xffffffffffffffffn, 0xffffffffffffffffn, "-1n & 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n, 0xbf2ed51fb554100cd330000ac6004080n, + "0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n === 0xbf2ed51fb554100cd330000ac6004080n"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fb554100cd330000ac6004080n, + "-0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fb554100cd330000ac6004080n"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n, 0x8a2c72024405ec138670800n, + "-0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n === 0x8a2c72024405ec138670800n"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n, 0x8a2c72024405ec138670800n, + "0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n === 0x8a2c72024405ec138670800n"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n, -0xbf2ed51fffffff2ff7fedffffe7f5f80n, + "-0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n === -0xbf2ed51fffffff2ff7fedffffe7f5f80n"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fffffff2ff7fedffffe7f5f80n, + "-0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fffffff2ff7fedffffe7f5f80n"); +assert.sameValue(-0xffffffffn & 0n, 0n, "-0xffffffffn & 0n === 0n"); +assert.sameValue(0n & -0xffffffffn, 0n, "0n & -0xffffffffn === 0n"); +assert.sameValue( + -0xffffffffffffffffn & 0x10000000000000000n, 0x10000000000000000n, + "-0xffffffffffffffffn & 0x10000000000000000n === 0x10000000000000000n"); +assert.sameValue( + 0x10000000000000000n & -0xffffffffffffffffn, 0x10000000000000000n, + "0x10000000000000000n & -0xffffffffffffffffn === 0x10000000000000000n"); +assert.sameValue( + -0xffffffffffffffffffffffffn & 0x10000000000000000n, 0n, + "-0xffffffffffffffffffffffffn & 0x10000000000000000n === 0n"); +assert.sameValue( + 0x10000000000000000n & -0xffffffffffffffffffffffffn, 0n, + "0x10000000000000000n & -0xffffffffffffffffffffffffn === 0n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/browser.js b/js/src/tests/test262/language/expressions/bitwise-and/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js b/js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js new file mode 100644 index 0000000000..cde0cee550 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +description: Type coercion order of operations for bitwise-and operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() & (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() & (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() & (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() & (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() & (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() & (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-and/shell.js b/js/src/tests/test262/language/expressions/bitwise-and/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A1.js new file mode 100644 index 0000000000..19c27ca132 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "~" and UnaryExpression are + allowed +es5id: 11.4.8_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("~\u00090") !== -1) { + throw new Test262Error('#0: ~\\u00090 === -1'); +} + +//CHECK#2 +if (eval("~\u000B0") !== -1) { + throw new Test262Error('#2: ~\\u000B0 === -1'); +} + +//CHECK#3 +if (eval("~\u000C0") !== -1) { + throw new Test262Error('#3: ~\\u000C0 === -1'); +} + +//CHECK#4 +if (eval("~\u00200") !== -1) { + throw new Test262Error('#4: ~\\u0020 === -1'); +} + +//CHECK#5 +if (eval("~\u00A00") !== -1) { + throw new Test262Error('#5: ~\\u00A00 === -1'); +} + +//CHECK#6 +if (eval("~\u000A0") !== -1) { + throw new Test262Error('#6: ~\\u000A0 === -1'); +} + +//CHECK#7 +if (eval("~\u000D0") !== -1) { + throw new Test262Error('#7: ~\\u000D0 === -1'); +} + +//CHECK#8 +if (eval("~\u20280") !== -1) { + throw new Test262Error('#8: ~\\u20280 === -1'); +} + +//CHECK#9 +if (eval("~\u20290") !== -1) { + throw new Test262Error('#9: ~\\u20290 === -1'); +} + +//CHECK#10 +if (eval("~\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== -1) { + throw new Test262Error('#10: ~\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === -1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js new file mode 100644 index 0000000000..5f26d221af --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x uses GetValue +es5id: 11.4.8_A2.1_T1 +description: Either Type(x) is not Reference or GetBase(x) is not null +---*/ + +//CHECK#1 +if (~0 !== -1) { + throw new Test262Error('#1: ~0 === -1. Actual: ' + (~0)); +} + +//CHECK#2 +if (~(~0) !== 0) { + throw new Test262Error('#2: ~(~0) === 0. Actual: ' + (~(~0))); +} + +//CHECK#3 +var x = 0; +if (~x !== -1) { + throw new Test262Error('#3: var x = 0; ~x === -1. Actual: ' + (~x)); +} + +//CHECK#4 +var x = 0; +if (~(~x) !== 0) { + throw new Test262Error('#4: var x = 0; ~(~x) === 0. Actual: ' + (~(~x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 0; +if (~object.prop !== -1) { + throw new Test262Error('#5: var object = new Object(); object.prop = 0; ~object.prop === -1. Actual: ' + (~object.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js new file mode 100644 index 0000000000..cd3b575b95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x uses GetValue +es5id: 11.4.8_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + ~x; + throw new Test262Error('#1.1: ~x throw ReferenceError. Actual: ' + (~x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: ~x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.js new file mode 100644 index 0000000000..071b40bf97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A2.2_T1.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x uses [[Default Value]] +es5id: 11.4.8_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (~object !== -2) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (~object !== -2) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (~object !== -2) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (~object !== -2) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object === -2. Actual: ' + (~object)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (~object !== -2) { + throw new Test262Error('#5: var object = {toString: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (~object !== -2) { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ~object === -2. Actual: ' + (~object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ~object; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (~object)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + ~object; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (~object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js new file mode 100644 index 0000000000..49090c06ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x returns ~ToInt32(x) +es5id: 11.4.8_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +if (~false !== -1) { + throw new Test262Error('#1: ~false === -1. Actual: ' + (~false)); +} + +//CHECK#2 +if (~new Boolean(true) !== -2) { + throw new Test262Error('#2: ~new Boolean(true) === -2. Actual: ' + (~new Boolean(true))); +} + +//CHECK#3 +if (~new Boolean(false) !== -1) { + throw new Test262Error('#3: ~new Boolean(false) === -1. Actual: ' + (~new Boolean(false))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.js new file mode 100644 index 0000000000..3ca85f4de2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T2.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x returns ~ToInt32(x) +es5id: 11.4.8_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +if (~0.1 !== -1) { + throw new Test262Error('#1: ~0.1 === -1. Actual: ' + (~0.1)); +} + +//CHECK#2 +if (~new Number(-0.1) !== -1) { + throw new Test262Error('#2: ~new Number(-0.1) === -1. Actual: ' + (~new Number(-0.1))); +} + +//CHECK#3 +if (~NaN !== -1) { + throw new Test262Error('#3: ~NaN === -1. Actual: ' + (~NaN)); +} + +//CHECK#4 +if (~new Number(NaN) !== -1) { + throw new Test262Error('#4: ~new Number(NaN) === -1. Actual: ' + (~new Number(NaN))); +} + +//CHECK#5 +if (~1 !== -2) { + throw new Test262Error('#5: ~1 === -2. Actual: ' + (~1)); +} + +//CHECK#6 +if (~new Number(-2) !== 1) { + throw new Test262Error('#6: ~new Number(-2) === 1. Actual: ' + (~new Number(-2))); +} + +//CHECK#7 +if (~Infinity !== -1) { + throw new Test262Error('#7: ~Infinity === -1. Actual: ' + (~Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js new file mode 100644 index 0000000000..75493ea1af --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T3.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x returns ~ToInt32(x) +es5id: 11.4.8_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +if (~"1" !== -2) { + throw new Test262Error('#1: ~"1" === -2. Actual: ' + (~"1")); +} + +//CHECK#2 +if (~new String("0") !== -1) { + throw new Test262Error('#2: ~new String("0") === -1. Actual: ' + (~new String("0"))); +} + +//CHECK#3 +if (~"x" !== -1) { + throw new Test262Error('#3: ~"x" === -1. Actual: ' + (~"x")); +} + +//CHECK#4 +if (~"" !== -1) { + throw new Test262Error('#4: ~"" === -1. Actual: ' + (~"")); +} + +//CHECK#5 +if (~new String("-2") !== 1) { + throw new Test262Error('#5: ~new String("-2") === 1. Actual: ' + (~new String("-2"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.js new file mode 100644 index 0000000000..8add192f48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x returns ~ToInt32(x) +es5id: 11.4.8_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +if (~void 0 !== -1) { + throw new Test262Error('#1: ~void 0 === -1. Actual: ' + (~void 0)); +} + +//CHECK#2 +if (~null !== -1) { + throw new Test262Error('#2: ~null === -1. Actual: ' + (~null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.js b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.js new file mode 100644 index 0000000000..0a62304c8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S11.4.8_A3_T5.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ~x returns ~ToInt32(x) +es5id: 11.4.8_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +if (~({}) !== -1) { + throw new Test262Error('#1: ~({}) === -1. Actual: ' + (~({}))); +} + +//CHECK#2 +if (~(function(){return 1}) !== -1) { + throw new Test262Error('#2: ~(function(){return 1}) === -1. Actual: ' + (~(function(){return 1}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js new file mode 100644 index 0000000000..7f6e38f7d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.1_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: ToInt32 returns values between -2^31 and 2^31-1 +es5id: 9.5_A2.1_T2 +description: > + Converting some numbers, which are in\outside of Int32 scopes, + with ~ operator +---*/ + +// CHECK#1 +if (~-2147483649 !== ~2147483647) { + throw new Test262Error('#1: ~-2147483649 === ~2147483647'); +} + +// CHECK#2 +if (~-4294967296 !== ~0) { + throw new Test262Error('#2: ~-4294967296 === ~0'); +} + +// CHECK#3 +if (~2147483648 !== ~-2147483648) { + throw new Test262Error('#3: ~2147483648 === ~-2147483648'); +} + +// CHECK#4 +if (~4294967296 !== ~0) { + throw new Test262Error('#4: ~4294967296 === ~0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.js new file mode 100644 index 0000000000..350efec0a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.2_T2.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compute result modulo 2^32 +es5id: 9.5_A2.2_T2 +description: Use operator ~ +---*/ + +// CHECK#1 +if (~-2147483647 !== 2147483646) { + throw new Test262Error('#1: ~-2147483647 === 2147483646)'); +} + +// CHECK#2 +if (~-2147483648 !== ~-2147483648) { + throw new Test262Error('#2: ~-2147483648 ==== ~-2147483648)'); +} + +// CHECK#3 +if (~-2147483649 !== ~2147483647) { + throw new Test262Error('#3: ~-2147483649 ==== ~2147483647)'); +} + +// CHECK#4 +if ((~4294967295 << 0) !== ~-1) { + throw new Test262Error('#4: (~4294967295 << 0) === ~-1)'); +} + +// CHECK#5 +if ((~4294967296 << 0) !== ~0) { + throw new Test262Error('#5: (~4294967296 << 0) === ~0)'); +} + +// CHECK#6 +if ((~4294967297 << 0) !== ~1) { + throw new Test262Error('#6: (~4294967297 << 0) === ~1)'); +} + +// CHECK#7 +if ((~-4294967295 << 0) !== ~1) { + throw new Test262Error('#7: (~-4294967295 << 0) === ~1)'); +} + +// CHECK#8 +if ((~-4294967296 << 0) !== ~0) { + throw new Test262Error('#8: (~-4294967296 << 0) === ~0)'); +} + +// CHECK#9 +if ((~-4294967297 << 0) !== ~-1) { + throw new Test262Error('#9: (~-4294967297 << 0) === ~-1)'); +} + +// CHECK#10 +if ((~8589934591 << 0) !== ~-1) { + throw new Test262Error('#10: (~8589934591 << 0) === ~-1)'); +} + +// CHECK#11 +if ((~8589934592 << 0) !== ~0) { + throw new Test262Error('#11: (~8589934592 << 0) === ~0)'); +} + +// CHECK#12 +if ((~8589934593 << 0) !== ~1) { + throw new Test262Error('#12: (~8589934593 << 0) === ~1)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.js new file mode 100644 index 0000000000..ab7fa0716f --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A2.3_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If result is greater than or equal to 2^31, return result -2^32 +es5id: 9.5_A2.3_T2 +description: Use operator ~ +---*/ + +// CHECK#1 +if (~2147483647 !== -2147483648) { + throw new Test262Error('#1: ~2147483647 ==== -2147483648)'); +} + +// CHECK#2 +if (~2147483648 !== ~-2147483648) { + throw new Test262Error('#2: ~2147483648 ==== ~-2147483648)'); +} + +// CHECK#3 +if (~2147483649 !== ~-2147483647) { + throw new Test262Error('#3: ~2147483649 ==== ~-2147483647)'); +} + +// CHECK#4 +if (~4294967295 !== ~-1) { + throw new Test262Error('#4: ~4294967295 ==== ~-1)'); +} + +// CHECK#5 +if (~4294967296 !== ~0) { + throw new Test262Error('#5: ~4294967296 ==== ~0)'); +} + +// CHECK#6 +if (~4294967297 !== ~1) { + throw new Test262Error('#6: ~4294967297 ==== ~1)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.1_T4.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.1_T4.js new file mode 100644 index 0000000000..cc7f3bebb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.1_T4.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.5_A3.1_T4 +description: Type(x) is Object +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (~object !== ~1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; ~object === ~1'); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (~object !== ~1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ~object === ~1'); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (~object !== ~1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ~object === ~1'); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (~object !== ~1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object === ~1'); + } +} +catch (e) { + if (e === ~"error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ~object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (~object !== ~1) { + throw new Test262Error('#5: var object = {toString: function() {return 1}}; ~object === ~1'); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (~object !== ~1) { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ~object === ~1'); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ~object; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (~object)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ~object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + ~object; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (~object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ~object throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_T2.js b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_T2.js new file mode 100644 index 0000000000..d6b206c072 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/S9.5_A3.2_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses floor, abs +es5id: 9.5_A3.2_T2 +description: Use operator ~ +---*/ + +// CHECK#1 +if (~1.2345 !== ~1) { + throw new Test262Error('#1: ~1.2345 === ~1)'); +} + +// CHECK#2 +if (~-5.4321 !== ~-5) { + throw new Test262Error('#2: ~-5.4321 === ~-5)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js new file mode 100644 index 0000000000..b5ddf6a2fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/bigint-non-primitive.js @@ -0,0 +1,46 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Bitwise NOT for BigInt object wrappers +esid: sec-bitwise-not-operator-runtime-semantics-evaluation +info: | + Runtime Semantics: Evaluation + UnaryExpression : ~ UnaryExpression + + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ? ToNumeric(? GetValue(expr)). + 3. Let T be Type(oldValue). + 4. Return ? T::bitwiseNOT(oldValue). + +features: [BigInt, Symbol.toPrimitive] +---*/ +assert.sameValue(~Object(1n), -2n, 'The value of ~Object(1n) is -2n'); + +function err() { + throw new Test262Error(); +} + +assert.sameValue(~{ + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err +}, -2n, 'The value of ~{[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err} is -2n'); + +assert.sameValue(~{ + valueOf: function() { + return 1n; + }, + + toString: err +}, -2n, 'The value of ~{valueOf: function() {return 1n;}, toString: err} is -2n'); + +assert.sameValue(~{ + toString: function() { + return 1n; + } +}, -2n, 'The value of ~{toString: function() {return 1n;}} is -2n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/bigint.js b/js/src/tests/test262/language/expressions/bitwise-not/bigint.js new file mode 100644 index 0000000000..dd1a896882 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-not/bigint.js @@ -0,0 +1,39 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Bitwise NOT for BigInt values +esid: sec-numeric-types-bigint-bitwiseNOT +info: | + BigInt::bitwiseNOT (x) + + The abstract operation BigInt::bitwiseNOT with an argument x of BigInt type returns the one's complement of x; that is, -x - 1. + +features: [BigInt] +---*/ + +assert.sameValue(~0n, -1n, "~0n === -1n"); +assert.sameValue(~(0n), -1n, "~(0n) === -1n"); +assert.sameValue(~1n, -2n, "~1n === -2n"); +assert.sameValue(~-1n, 0n, "~-1n === 0n"); +assert.sameValue(~(-1n), 0n, "~(-1n) === 0n"); +assert.sameValue(~~1n, 1n, "~~1n === 1n"); +assert.sameValue(~0x5an, -0x5bn, "~0x5an === -0x5bn"); +assert.sameValue(~-0x5an, 0x59n, "~-0x5an === 0x59n"); +assert.sameValue(~0xffn, -0x100n, "~0xffn === -0x100n"); +assert.sameValue(~-0xffn, 0xfen, "~-0xffn === 0xfen"); +assert.sameValue(~0xffffn, -0x10000n, "~0xffffn === -0x10000n"); +assert.sameValue(~-0xffffn, 0xfffen, "~-0xffffn === 0xfffen"); +assert.sameValue(~0xffffffffn, -0x100000000n, "~0xffffffffn === -0x100000000n"); +assert.sameValue(~-0xffffffffn, 0xfffffffen, "~-0xffffffffn === 0xfffffffen"); +assert.sameValue( + ~0xffffffffffffffffn, -0x10000000000000000n, + "~0xffffffffffffffffn === -0x10000000000000000n"); +assert.sameValue( + ~-0xffffffffffffffffn, 0xfffffffffffffffen, + "~-0xffffffffffffffffn === 0xfffffffffffffffen"); +assert.sameValue( + ~0x123456789abcdef0fedcba9876543210n, -0x123456789abcdef0fedcba9876543211n, + "~0x123456789abcdef0fedcba9876543210n === -0x123456789abcdef0fedcba9876543211n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-not/browser.js b/js/src/tests/test262/language/expressions/bitwise-not/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/bitwise-not/shell.js b/js/src/tests/test262/language/expressions/bitwise-not/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A1.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A1.js new file mode 100644 index 0000000000..f1ebc1afce --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between BitwiseORExpression and "|" or + between "|" and BitwiseXORExpression are allowed +es5id: 11.10.3_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if ((eval("0\u0009|\u00091")) !== 1) { + throw new Test262Error('#1: (0\\u0009|\\u00091) === 1'); +} + +//CHECK#2 +if ((eval("0\u000B|\u000B1")) !== 1) { + throw new Test262Error('#2: (0\\u000B|\\u000B1) === 1'); +} + +//CHECK#3 +if ((eval("0\u000C|\u000C1")) !== 1) { + throw new Test262Error('#3: (0\\u000C|\\u000C1) === 1'); +} + +//CHECK#4 +if ((eval("0\u0020|\u00201")) !== 1) { + throw new Test262Error('#4: (0\\u0020|\\u00201) === 1'); +} + +//CHECK#5 +if ((eval("0\u00A0|\u00A01")) !== 1) { + throw new Test262Error('#5: (0\\u00A0|\\u00A01) === 1'); +} + +//CHECK#6 +if ((eval("0\u000A|\u000A1")) !== 1) { + throw new Test262Error('#6: (0\\u000A|\\u000A1) === 1'); +} + +//CHECK#7 +if ((eval("0\u000D|\u000D1")) !== 1) { + throw new Test262Error('#7: (0\\u000D|\\u000D1) === 1'); +} + +//CHECK#8 +if ((eval("0\u2028|\u20281")) !== 1) { + throw new Test262Error('#8: (0\\u2028|\\u20281) === 1'); +} + +//CHECK#9 +if ((eval("0\u2029|\u20291")) !== 1) { + throw new Test262Error('#9: (0\\u2029|\\u20291) === 1'); +} + + +//CHECK#10 +if ((eval("0\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029|\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 1) { + throw new Test262Error('#10: (0\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029|\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T1.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T1.js new file mode 100644 index 0000000000..1f48e2669e --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y uses GetValue +es5id: 11.10.3_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((1 | 0) !== 1) { + throw new Test262Error('#1: (1 | 0) === 1. Actual: ' + ((1 | 0))); +} + +//CHECK#2 +var x = 1; +if ((x | 0) !== 1) { + throw new Test262Error('#2: var x = 1; (x | 0) === 1. Actual: ' + ((x | 0))); +} + +//CHECK#3 +var y = 0; +if ((1 | y) !== 1) { + throw new Test262Error('#3: var y = 0; (1 | y) === 1. Actual: ' + ((1 | y))); +} + +//CHECK#4 +var x = 1; +var y = 0; +if ((x | y) !== 1) { + throw new Test262Error('#4: var x = 1; var y = 0; (x | y) === 1. Actual: ' + ((x | y))); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 0; +if ((objectx.prop | objecty.prop) !== 1) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 0; (objectx.prop | objecty.prop) === 1. Actual: ' + ((objectx.prop | objecty.prop))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T2.js new file mode 100644 index 0000000000..5b81155722 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y uses GetValue +es5id: 11.10.3_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x | 1; + throw new Test262Error('#1.1: x | 1 throw ReferenceError. Actual: ' + (x | 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x | 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T3.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T3.js new file mode 100644 index 0000000000..f8c859e516 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y uses GetValue +es5id: 11.10.3_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 | y; + throw new Test262Error('#1.1: 1 | y throw ReferenceError. Actual: ' + (1 | y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 | y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.2_T1.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.2_T1.js new file mode 100644 index 0000000000..3fa228fcd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y uses [[Default Value]] +es5id: 11.10.3_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if (({valueOf: function() {return 1}} | 0) !== 1) { + throw new Test262Error('#1: ({valueOf: function() {return 1}} | 0) === 1. Actual: ' + (({valueOf: function() {return 1}} | 0))); +} + +//CHECK#2 +if (({valueOf: function() {return 1}, toString: function() {return 0}} | 0) !== 1) { + throw new Test262Error('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} | 0) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return 0}} | 0))); +} + +//CHECK#3 +if (({valueOf: function() {return 1}, toString: function() {return {}}} | 0) !== 1) { + throw new Test262Error('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} | 0) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return {}}} | 0))); +} + +//CHECK#4 +try { + if (({valueOf: function() {return 1}, toString: function() {throw "error"}} | 0) !== 1) { + throw new Test262Error('#4.1: ({valueOf: function() {return 1}, toString: function() {throw "error"}} | 0) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {throw "error"}} | 0))); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: ({valueOf: function() {return 1}, toString: function() {throw "error"}} | 0) not throw "error"'); + } else { + throw new Test262Error('#4.3: ({valueOf: function() {return 1}, toString: function() {throw "error"}} | 0) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if ((0 | {toString: function() {return 1}}) !== 1) { + throw new Test262Error('#5: (0 | {toString: function() {return 1}}) === 1. Actual: ' + ((0 | {toString: function() {return 1}}))); +} + +//CHECK#6 +if ((0 | {valueOf: function() {return {}}, toString: function() {return 1}}) !== 1) { + throw new Test262Error('#6: (0 | {valueOf: function() {return {}}, toString: function() {return 1}}) === 1. Actual: ' + ((0 | {valueOf: function() {return {}}, toString: function() {return 1}}))); +} + +//CHECK#7 +try { + 0 | {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 0 | {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (0 | {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 0 | {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 0 | {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 0 | {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (0 | {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 0 | {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.3_T1.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.3_T1.js new file mode 100644 index 0000000000..9cffacea98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToInt32(first expression) is called first, and then ToInt32(second + expression) +es5id: 11.10.3_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x | y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x | y throw "x". Actual: ' + (x | y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToInt32(first expression) is called first, and then ToInt32(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x | y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T1.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T1.js new file mode 100644 index 0000000000..620837f4cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.3_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 1; +if (((x = 0) | x) !== 0) { + throw new Test262Error('#1: var x = 1; ((x = 0) | x) === 0. Actual: ' + (((x = 0) | x))); +} + +//CHECK#2 +var x = 1; +if ((x | (x = 0)) !== 1) { + throw new Test262Error('#2: var x = 1; (x | (x = 0)) === 1. Actual: ' + ((x | (x = 0)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T2.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T2.js new file mode 100644 index 0000000000..366d1ba230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.3_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() | y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() | y() throw "x". Actual: ' + (x() | y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() | y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T3.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T3.js new file mode 100644 index 0000000000..4f4a56cc21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.3_A2.4_T3 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +try { + x | (x = 1); + throw new Test262Error('#1.1: x | (x = 1) throw ReferenceError. Actual: ' + (x | (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x | (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if (((y = 1) | y) !== 1) { + throw new Test262Error('#2: ((y = 1) | y) === 1. Actual: ' + (((y = 1) | y))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.1.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.1.js new file mode 100644 index 0000000000..5dc167dd68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if ((true | true) !== 1) { + throw new Test262Error('#1: (true | true) === 1. Actual: ' + ((true | true))); +} + +//CHECK#2 +if ((new Boolean(true) | true) !== 1) { + throw new Test262Error('#2: (new Boolean(true) | true) === 1. Actual: ' + ((new Boolean(true) | true))); +} + +//CHECK#3 +if ((true | new Boolean(true)) !== 1) { + throw new Test262Error('#3: (true | new Boolean(true)) === 1. Actual: ' + ((true | new Boolean(true)))); +} + +//CHECK#4 +if ((new Boolean(true) | new Boolean(true)) !== 1) { + throw new Test262Error('#4: (new Boolean(true) | new Boolean(true)) === 1. Actual: ' + ((new Boolean(true) | new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.2.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.2.js new file mode 100644 index 0000000000..051575ce0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((1 | 1) !== 1) { + throw new Test262Error('#1: (1 | 1) === 1. Actual: ' + ((1 | 1))); +} + +//CHECK#2 +if ((new Number(1) | 1) !== 1) { + throw new Test262Error('#2: (new Number(1) | 1) === 1. Actual: ' + ((new Number(1) | 1))); +} + +//CHECK#3 +if ((1 | new Number(1)) !== 1) { + throw new Test262Error('#3: (1 | new Number(1)) === 1. Actual: ' + ((1 | new Number(1)))); +} + +//CHECK#4 +if ((new Number(1) | new Number(1)) !== 1) { + throw new Test262Error('#4: (new Number(1) | new Number(1)) === 1. Actual: ' + ((new Number(1) | new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.3.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.3.js new file mode 100644 index 0000000000..9879cfedb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("1" | "1") !== 1) { + throw new Test262Error('#1: ("1" | "1") === 1. Actual: ' + (("1" | "1"))); +} + +//CHECK#2 +if ((new String("1") | "1") !== 1) { + throw new Test262Error('#2: (new String("1") | "1") === 1. Actual: ' + ((new String("1") | "1"))); +} + +//CHECK#3 +if (("1" | new String("1")) !== 1) { + throw new Test262Error('#3: ("1" | new String("1")) === 1. Actual: ' + (("1" | new String("1")))); +} + +//CHECK#4 +if ((new String("1") | new String("1")) !== 1) { + throw new Test262Error('#4: (new String("1") | new String("1")) === 1. Actual: ' + ((new String("1") | new String("1")))); +} + +//CHECK#5 +if (("x" | "1") !== 1) { + throw new Test262Error('#5: ("x" | "1") === 1. Actual: ' + (("x" | "1"))); +} + +//CHECK#6 +if (("1" | "x") !== 1) { + throw new Test262Error('#6: ("1" | "x") === 1. Actual: ' + (("1" | "x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.4.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.4.js new file mode 100644 index 0000000000..af5c57c61d --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if ((null | undefined) !== 0) { + throw new Test262Error('#1: (null | undefined) === 0. Actual: ' + ((null | undefined))); +} + +//CHECK#2 +if ((undefined | null) !== 0) { + throw new Test262Error('#2: (undefined | null) === 0. Actual: ' + ((undefined | null))); +} + +//CHECK#3 +if ((undefined | undefined) !== 0) { + throw new Test262Error('#3: (undefined | undefined) === 0. Actual: ' + ((undefined | undefined))); +} + +//CHECK#4 +if ((null | null) !== 0) { + throw new Test262Error('#4: (null | null) === 0. Actual: ' + ((null | null))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.5.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.5.js new file mode 100644 index 0000000000..55365591b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (({} | function(){return 1}) !== 0) { + throw new Test262Error('#1: ({} | function(){return 1}) === 0. Actual: ' + (({} | function(){return 1}))); +} + +//CHECK#2 +if ((function(){return 1} | {}) !== 0) { + throw new Test262Error('#2: (function(){return 1} | {}) === 0. Actual: ' + ((function(){return 1} | {}))); +} + +//CHECK#3 +if ((function(){return 1} | function(){return 1}) !== 0) { + throw new Test262Error('#3: (function(){return 1} | function(){return 1}) === 0. Actual: ' + ((function(){return 1} | function(){return 1}))); +} + +//CHECK#4 +if (({} | {}) !== 0) { + throw new Test262Error('#4: ({} | {}) === 0. Actual: ' + (({} | {}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.1.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.1.js new file mode 100644 index 0000000000..8052b54a81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if ((true | 1) !== 1) { + throw new Test262Error('#1: (true | 1) === 1. Actual: ' + ((true | 1))); +} + +//CHECK#2 +if ((1 | true) !== 1) { + throw new Test262Error('#2: (1 | true) === 1. Actual: ' + ((1 | true))); +} + +//CHECK#3 +if ((new Boolean(true) | 1) !== 1) { + throw new Test262Error('#3: (new Boolean(true) | 1) === 1. Actual: ' + ((new Boolean(true) | 1))); +} + +//CHECK#4 +if ((1 | new Boolean(true)) !== 1) { + throw new Test262Error('#4: (1 | new Boolean(true)) === 1. Actual: ' + ((1 | new Boolean(true)))); +} + +//CHECK#5 +if ((true | new Number(1)) !== 1) { + throw new Test262Error('#5: (true | new Number(1)) === 1. Actual: ' + ((true | new Number(1)))); +} + +//CHECK#6 +if ((new Number(1) | true) !== 1) { + throw new Test262Error('#6: (new Number(1) | true) === 1. Actual: ' + ((new Number(1) | true))); +} + +//CHECK#7 +if ((new Boolean(true) | new Number(1)) !== 1) { + throw new Test262Error('#7: (new Boolean(true) | new Number(1)) === 1. Actual: ' + ((new Boolean(true) | new Number(1)))); +} + +//CHECK#8 +if ((new Number(1) | new Boolean(true)) !== 1) { + throw new Test262Error('#8: (new Number(1) | new Boolean(true)) === 1. Actual: ' + ((new Number(1) | new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.2.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.2.js new file mode 100644 index 0000000000..35a43313c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if (("1" | 1) !== 1) { + throw new Test262Error('#1: ("1" | 1) === 1. Actual: ' + (("1" | 1))); +} + +//CHECK#2 +if ((1 | "1") !== 1) { + throw new Test262Error('#2: (1 | "1") === 1. Actual: ' + ((1 | "1"))); +} + +//CHECK#3 +if ((new String("1") | 1) !== 1) { + throw new Test262Error('#3: (new String("1") | 1) === 1. Actual: ' + ((new String("1") | 1))); +} + +//CHECK#4 +if ((1 | new String("1")) !== 1) { + throw new Test262Error('#4: (1 | new String("1")) === 1. Actual: ' + ((1 | new String("1")))); +} + +//CHECK#5 +if (("1" | new Number(1)) !== 1) { + throw new Test262Error('#5: ("1" | new Number(1)) === 1. Actual: ' + (("1" | new Number(1)))); +} + +//CHECK#6 +if ((new Number(1) | "1") !== 1) { + throw new Test262Error('#6: (new Number(1) | "1") === 1. Actual: ' + ((new Number(1) | "1"))); +} + +//CHECK#7 +if ((new String("1") | new Number(1)) !== 1) { + throw new Test262Error('#7: (new String("1") | new Number(1)) === 1. Actual: ' + ((new String("1") | new Number(1)))); +} + +//CHECK#8 +if ((new Number(1) | new String("1")) !== 1) { + throw new Test262Error('#8: (new Number(1) | new String("1")) === 1. Actual: ' + ((new Number(1) | new String("1")))); +} + +//CHECK#9 +if (("x" | 1) !== 1) { + throw new Test262Error('#9: ("x" | 1) === 1. Actual: ' + (("x" | 1))); +} + +//CHECK#10 +if ((1 | "x") !== 1) { + throw new Test262Error('#10: (1 | "x") === 1. Actual: ' + ((1 | "x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.3.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.3.js new file mode 100644 index 0000000000..1df415a894 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if ((1 | null) !== 1) { + throw new Test262Error('#1: (1 | null) === 1. Actual: ' + ((1 | null))); +} + +//CHECK#2 +if ((null | 1) !== 1) { + throw new Test262Error('#2: (null | 1) === 1. Actual: ' + ((null | 1))); +} + +//CHECK#3 +if ((new Number(1) | null) !== 1) { + throw new Test262Error('#3: (new Number(1) | null) === 1. Actual: ' + ((new Number(1) | null))); +} + +//CHECK#4 +if ((null | new Number(1)) !== 1) { + throw new Test262Error('#4: (null | new Number(1)) === 1. Actual: ' + ((null | new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.4.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.4.js new file mode 100644 index 0000000000..4699e648c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ((1 | undefined) !== 1) { + throw new Test262Error('#1: (1 | undefined) === 1. Actual: ' + ((1 | undefined))); +} + +//CHECK#2 +if ((undefined | 1) !== 1) { + throw new Test262Error('#2: (undefined | 1) === 1. Actual: ' + ((undefined | 1))); +} + +//CHECK#3 +if ((new Number(1) | undefined) !== 1) { + throw new Test262Error('#3: (new Number(1) | undefined) === 1. Actual: ' + ((new Number(1) | undefined))); +} + +//CHECK#4 +if ((undefined | new Number(1)) !== 1) { + throw new Test262Error('#4: (undefined | new Number(1)) === 1. Actual: ' + ((undefined | new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.5.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.5.js new file mode 100644 index 0000000000..f582497aa6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if ((true | "1") !== 1) { + throw new Test262Error('#1: (true | "1") === 1. Actual: ' + ((true | "1"))); +} + +//CHECK#2 +if (("1" | true) !== 1) { + throw new Test262Error('#2: ("1" | true) === 1. Actual: ' + (("1" | true))); +} + +//CHECK#3 +if ((new Boolean(true) | "1") !== 1) { + throw new Test262Error('#3: (new Boolean(true) | "1") === 1. Actual: ' + ((new Boolean(true) | "1"))); +} + +//CHECK#4 +if (("1" | new Boolean(true)) !== 1) { + throw new Test262Error('#4: ("1" | new Boolean(true)) === 1. Actual: ' + (("1" | new Boolean(true)))); +} + +//CHECK#5 +if ((true | new String("1")) !== 1) { + throw new Test262Error('#5: (true | new String("1")) === 1. Actual: ' + ((true | new String("1")))); +} + +//CHECK#6 +if ((new String("1") | true) !== 1) { + throw new Test262Error('#6: (new String("1") | true) === 1. Actual: ' + ((new String("1") | true))); +} + +//CHECK#7 +if ((new Boolean(true) | new String("1")) !== 1) { + throw new Test262Error('#7: (new Boolean(true) | new String("1")) === 1. Actual: ' + ((new Boolean(true) | new String("1")))); +} + +//CHECK#8 +if ((new String("1") | new Boolean(true)) !== 1) { + throw new Test262Error('#8: (new String("1") | new Boolean(true)) === 1. Actual: ' + ((new String("1") | new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.6.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.6.js new file mode 100644 index 0000000000..9be67e6c55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (("1" | undefined) !== 1) { + throw new Test262Error('#1: ("1" | undefined) === 1. Actual: ' + (("1" | undefined))); +} + +//CHECK#2 +if ((undefined | "1") !== 1) { + throw new Test262Error('#2: (undefined | "1") === 1. Actual: ' + ((undefined | "1"))); +} + +//CHECK#3 +if ((new String("1") | undefined) !== 1) { + throw new Test262Error('#3: (new String("1") | undefined) === 1. Actual: ' + ((new String("1") | undefined))); +} + +//CHECK#4 +if ((undefined | new String("1")) !== 1) { + throw new Test262Error('#4: (undefined | new String("1")) === 1. Actual: ' + ((undefined | new String("1")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.7.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.7.js new file mode 100644 index 0000000000..88181c979e --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if (("1" | null) !== 1) { + throw new Test262Error('#1: ("1" | null) === 1. Actual: ' + (("1" | null))); +} + +//CHECK#2 +if ((null | "1") !== 1) { + throw new Test262Error('#2: (null | "1") === 1. Actual: ' + ((null | "1"))); +} + +//CHECK#3 +if ((new String("1") | null) !== 1) { + throw new Test262Error('#3: (new String("1") | null) === 1. Actual: ' + ((new String("1") | null))); +} + +//CHECK#4 +if ((null | new String("1")) !== 1) { + throw new Test262Error('#4: (null | new String("1")) === 1. Actual: ' + ((null | new String("1")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.8.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.8.js new file mode 100644 index 0000000000..a7705db831 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ((true | undefined) !== 1) { + throw new Test262Error('#1: (true | undefined) === 1. Actual: ' + ((true | undefined))); +} + +//CHECK#2 +if ((undefined | true) !== 1) { + throw new Test262Error('#2: (undefined | true) === 1. Actual: ' + ((undefined | true))); +} + +//CHECK#3 +if ((new Boolean(true) | undefined) !== 1) { + throw new Test262Error('#3: (new Boolean(true) | undefined) === 1. Actual: ' + ((new Boolean(true) | undefined))); +} + +//CHECK#4 +if ((undefined | new Boolean(true)) !== 1) { + throw new Test262Error('#4: (undefined | new Boolean(true)) === 1. Actual: ' + ((undefined | new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.9.js b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.9.js new file mode 100644 index 0000000000..8c357a814c --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/S11.10.3_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x | y returns ToNumber(x) | ToNumber(y) +es5id: 11.10.3_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if ((true | null) !== 1) { + throw new Test262Error('#1: (true | null) === 1. Actual: ' + ((true | null))); +} + +//CHECK#2 +if ((null | true) !== 1) { + throw new Test262Error('#2: (null | true) === 1. Actual: ' + ((null | true))); +} + +//CHECK#3 +if ((new Boolean(true) | null) !== 1) { + throw new Test262Error('#3: (new Boolean(true) | null) === 1. Actual: ' + ((new Boolean(true) | null))); +} + +//CHECK#4 +if ((null | new Boolean(true)) !== 1) { + throw new Test262Error('#4: (null | new Boolean(true)) === 1. Actual: ' + ((null | new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/bigint-and-number.js b/js/src/tests/test262/language/expressions/bitwise-or/bigint-and-number.js new file mode 100644 index 0000000000..80b71bc6a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for bitwise-or operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n | 1; +}, '1n | 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 | 1n; +}, '1 | 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) | 1; +}, 'Object(1n) | 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 | Object(1n); +}, '1 | Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n | Object(1); +}, '1n | Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) | 1n; +}, 'Object(1) | 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) | Object(1); +}, 'Object(1n) | Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) | Object(1n); +}, 'Object(1) | Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n | NaN; +}, '1n | NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN | 1n; +}, 'NaN | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | Infinity; +}, '1n | Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity | 1n; +}, 'Infinity | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | true; +}, '1n | true throws TypeError'); + +assert.throws(TypeError, function() { + true | 1n; +}, 'true | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | '1'; +}, '1n | "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' | 1n; +}, '"1" | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | null; +}, '1n | null throws TypeError'); + +assert.throws(TypeError, function() { + null | 1n; +}, 'null | 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n | undefined; +}, '1n | undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined | 1n; +}, 'undefined | 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/bigint-errors.js b/js/src/tests/test262/language/expressions/bitwise-or/bigint-errors.js new file mode 100644 index 0000000000..fb46c1f423 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-or operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') | 0n; +}, 'Symbol("1") | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | Symbol('1'); +}, '0n | Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) | 0n; +}, 'Object(Symbol("1")) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | Object(Symbol('1')); +}, '0n | Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) | 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n | {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) | 0n; +}, '({valueOf: function() {return Symbol("1");}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n | {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) | 0n; +}, '({toString: function() {return Symbol("1");}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + toString: function() { + return Symbol('1'); + } + }; +}, '0n | {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/bitwise-or/bigint-non-primitive.js new file mode 100644 index 0000000000..e5b792c960 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/bigint-non-primitive.js @@ -0,0 +1,84 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Bitwise OR for BigInt non-primitive values +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +info: | + 5. Let lnum be ? ToNumeric(lval). + 6. Let rnum be ? ToNumeric(rval). + ... + 8. Let T be Type(lnum). + ... + 10. If @ is |, return T::bitwiseOR(lnum, rnum). + +features: [BigInt] +---*/ +assert.sameValue( + Object(0b101n) | 0b011n, + 0b111n, + 'The result of (Object(0b101n) | 0b011n) is 0b111n' +); + +assert.sameValue( + 0b011n | Object(0b101n), + 0b111n, + 'The result of (0b011n | Object(0b101n)) is 0b111n' +); + +assert.sameValue( + Object(0b101n) | Object(0b011n), + 0b111n, + 'The result of (Object(0b101n) | Object(0b011n)) is 0b111n' +); + +function err() { + throw new Test262Error(); +} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} | 0b011n, 0b111n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) | 0b011n) is 0b111n'); + +assert.sameValue(0b011n | { + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +}, 0b111n, 'The result of (0b011n | {[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) is 0b111n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} | 0b011n, 0b111n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) | 0b011n) is 0b111n'); + +assert.sameValue(0b011n | { + valueOf: function() { + return 0b101n; + }, + + toString: err +}, 0b111n, 'The result of (0b011n | {valueOf: function() {return 0b101n;}, toString: err}) is 0b111n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} | 0b011n, 0b111n, 'The result of (({toString: function() {return 0b101n;}}) | 0b011n) is 0b111n'); + +assert.sameValue(0b011n | { + toString: function() { + return 0b101n; + } +}, 0b111n, 'The result of (0b011n | {toString: function() {return 0b101n;}}) is 0b111n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/bitwise-or/bigint-toprimitive.js new file mode 100644 index 0000000000..02e77ebbd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-or operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) | 1n) is 3n'); + +assert.sameValue(1n | { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} | 1n, 3n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) | 1n) is 3n'); + +assert.sameValue(1n | { + valueOf: function() { + return 2n; + }, + + toString: err +}, 3n, 'The result of (1n | {valueOf: function() {return 2n;}, toString: err}) is 3n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({toString: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n | {toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + valueOf: null, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n | {valueOf: null, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n | {valueOf: 1, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n | {valueOf: {}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n | {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n | {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 3n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) | 0n; +}, '({[Symbol.toPrimitive]: 1}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + [Symbol.toPrimitive]: 1 + }; +}, '0n | {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) | 0n; +}, '({[Symbol.toPrimitive]: {}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + [Symbol.toPrimitive]: {} + }; +}, '0n | {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) | 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n | {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) | 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n | {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) | 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) | 0n throws MyError'); + +assert.throws(MyError, function() { + 0n | { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n | {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) | 0n; +}, '({valueOf: function() {throw new MyError();}}) | 0n throws MyError'); + +assert.throws(MyError, function() { + 0n | { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n | {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) | 0n; +}, '({toString: function() {throw new MyError();}}) | 0n throws MyError'); + +assert.throws(MyError, function() { + 0n | { + toString: function() { + throw new MyError(); + } + }; +}, '0n | {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) | 0n; +}, '({valueOf: null, toString: null}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + valueOf: null, + toString: null + }; +}, '0n | {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) | 0n; +}, '({valueOf: 1, toString: 1}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + valueOf: 1, + toString: 1 + }; +}, '0n | {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) | 0n; +}, '({valueOf: {}, toString: {}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + valueOf: {}, + toString: {} + }; +}, '0n | {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) | 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n | {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) | 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) | 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n | { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n | {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/bitwise-or/bigint-wrapped-values.js new file mode 100644 index 0000000000..6bcc92bf9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-or operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) | 1n, 3n, 'The result of (Object(2n) | 1n) is 3n'); +assert.sameValue(1n | Object(2n), 3n, 'The result of (1n | Object(2n)) is 3n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 3n, 'The result of (1n | {[Symbol.toPrimitive]: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({valueOf: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + valueOf: function() { + return 2n; + } +}, 3n, 'The result of (1n | {valueOf: function() {return 2n;}}) is 3n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} | 1n, 3n, 'The result of (({toString: function() {return 2n;}}) | 1n) is 3n'); + +assert.sameValue(1n | { + toString: function() { + return 2n; + } +}, 3n, 'The result of (1n | {toString: function() {return 2n;}}) is 3n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/bigint.js b/js/src/tests/test262/language/expressions/bitwise-or/bigint.js new file mode 100644 index 0000000000..27177bf628 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/bigint.js @@ -0,0 +1,109 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Bitwise OR for BigInt values +esid: sec-bitwise-op +info: | + BitwiseOp(op, x, y) + + 1. Let result be 0. + 2. Let shift be 0. + 3. Repeat, until (x = 0 or x = -1) and (y = 0 or y = -1), + a. Let xDigit be x modulo 2. + b. Let yDigit be y modulo 2. + c. Let result be result + 2**shift * op(xDigit, yDigit) + d. Let shift be shift + 1. + e. Let x be (x - xDigit) / 2. + f. Let y be (y - yDigit) / 2. + 4. If op(x modulo 2, y modulo 2) ≠ 0, + a. Let result be result - 2**shift. NOTE: This extends the sign. + 5. Return result. + +features: [BigInt] +---*/ + +assert.sameValue(0b00n | 0b00n, 0b00n, "0b00n | 0b00n === 0b00n"); +assert.sameValue(0b00n | 0b01n, 0b01n, "0b00n | 0b01n === 0b01n"); +assert.sameValue(0b01n | 0b00n, 0b01n, "0b01n | 0b00n === 0b01n"); +assert.sameValue(0b00n | 0b10n, 0b10n, "0b00n | 0b10n === 0b10n"); +assert.sameValue(0b10n | 0b00n, 0b10n, "0b10n | 0b00n === 0b10n"); +assert.sameValue(0b00n | 0b11n, 0b11n, "0b00n | 0b11n === 0b11n"); +assert.sameValue(0b11n | 0b00n, 0b11n, "0b11n | 0b00n === 0b11n"); +assert.sameValue(0b01n | 0b01n, 0b01n, "0b01n | 0b01n === 0b01n"); +assert.sameValue(0b01n | 0b10n, 0b11n, "0b01n | 0b10n === 0b11n"); +assert.sameValue(0b10n | 0b01n, 0b11n, "0b10n | 0b01n === 0b11n"); +assert.sameValue(0b01n | 0b11n, 0b11n, "0b01n | 0b11n === 0b11n"); +assert.sameValue(0b11n | 0b01n, 0b11n, "0b11n | 0b01n === 0b11n"); +assert.sameValue(0b10n | 0b10n, 0b10n, "0b10n | 0b10n === 0b10n"); +assert.sameValue(0b10n | 0b11n, 0b11n, "0b10n | 0b11n === 0b11n"); +assert.sameValue(0b11n | 0b10n, 0b11n, "0b11n | 0b10n === 0b11n"); +assert.sameValue(0xffffffffn | 0n, 0xffffffffn, "0xffffffffn | 0n === 0xffffffffn"); +assert.sameValue(0n | 0xffffffffn, 0xffffffffn, "0n | 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffn | 0xffffffffn, 0xffffffffn, "0xffffffffn | 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffffffffffn | 0n, 0xffffffffffffffffn, "0xffffffffffffffffn | 0n === 0xffffffffffffffffn"); +assert.sameValue(0n | 0xffffffffffffffffn, 0xffffffffffffffffn, "0n | 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue(0xffffffffffffffffn | 0xffffffffn, 0xffffffffffffffffn, "0xffffffffffffffffn | 0xffffffffn === 0xffffffffffffffffn"); +assert.sameValue(0xffffffffn | 0xffffffffffffffffn, 0xffffffffffffffffn, "0xffffffffn | 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue( + 0xffffffffffffffffn | 0xffffffffffffffffn, 0xffffffffffffffffn, + "0xffffffffffffffffn | 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n | 0x4aabef2324cedff5387f1f65n, 0xbf2ed51fffffff2ff7fedffffe7f5fe5n, + "0xbf2ed51ff75d380fd3be813ec6185780n | 0x4aabef2324cedff5387f1f65n === 0xbf2ed51fffffff2ff7fedffffe7f5fe5n"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n | 0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fffffff2ff7fedffffe7f5fe5n, + "0x4aabef2324cedff5387f1f65n | 0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fffffff2ff7fedffffe7f5fe5n"); +assert.sameValue(0n | -1n, -1n, "0n | -1n === -1n"); +assert.sameValue(-1n | 0n, -1n, "-1n | 0n === -1n"); +assert.sameValue(0n | -2n, -2n, "0n | -2n === -2n"); +assert.sameValue(-2n | 0n, -2n, "-2n | 0n === -2n"); +assert.sameValue(1n | -2n, -1n, "1n | -2n === -1n"); +assert.sameValue(-2n | 1n, -1n, "-2n | 1n === -1n"); +assert.sameValue(2n | -2n, -2n, "2n | -2n === -2n"); +assert.sameValue(-2n | 2n, -2n, "-2n | 2n === -2n"); +assert.sameValue(2n | -3n, -1n, "2n | -3n === -1n"); +assert.sameValue(-3n | 2n, -1n, "-3n | 2n === -1n"); +assert.sameValue(-1n | -2n, -1n, "-1n | -2n === -1n"); +assert.sameValue(-2n | -1n, -1n, "-2n | -1n === -1n"); +assert.sameValue(-2n | -2n, -2n, "-2n | -2n === -2n"); +assert.sameValue(-2n | -3n, -1n, "-2n | -3n === -1n"); +assert.sameValue(-3n | -2n, -1n, "-3n | -2n === -1n"); +assert.sameValue(0xffffffffn | -1n, -1n, "0xffffffffn | -1n === -1n"); +assert.sameValue(-1n | 0xffffffffn, -1n, "-1n | 0xffffffffn === -1n"); +assert.sameValue(0xffffffffffffffffn | -1n, -1n, "0xffffffffffffffffn | -1n === -1n"); +assert.sameValue(-1n | 0xffffffffffffffffn, -1n, "-1n | 0xffffffffffffffffn === -1n"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n | -0x4aabef2324cedff5387f1f65n, -0x8a2c72024405ec138670865n, + "0xbf2ed51ff75d380fd3be813ec6185780n | -0x4aabef2324cedff5387f1f65n === -0x8a2c72024405ec138670865n"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n | 0xbf2ed51ff75d380fd3be813ec6185780n, -0x8a2c72024405ec138670865n, + "-0x4aabef2324cedff5387f1f65n | 0xbf2ed51ff75d380fd3be813ec6185780n === -0x8a2c72024405ec138670865n"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n | 0x4aabef2324cedff5387f1f65n, -0xbf2ed51fb554100cd330000ac600401bn, + "-0xbf2ed51ff75d380fd3be813ec6185780n | 0x4aabef2324cedff5387f1f65n === -0xbf2ed51fb554100cd330000ac600401bn"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n | -0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fb554100cd330000ac600401bn, + "0x4aabef2324cedff5387f1f65n | -0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fb554100cd330000ac600401bn"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n | -0x4aabef2324cedff5387f1f65n, -0x42092803008e813400181765n, + "-0xbf2ed51ff75d380fd3be813ec6185780n | -0x4aabef2324cedff5387f1f65n === -0x42092803008e813400181765n"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n | -0xbf2ed51ff75d380fd3be813ec6185780n, -0x42092803008e813400181765n, + "-0x4aabef2324cedff5387f1f65n | -0xbf2ed51ff75d380fd3be813ec6185780n === -0x42092803008e813400181765n"); +assert.sameValue(-0xffffffffn | 0n, -0xffffffffn, "-0xffffffffn | 0n === -0xffffffffn"); +assert.sameValue(0n | -0xffffffffn, -0xffffffffn, "0n | -0xffffffffn === -0xffffffffn"); +assert.sameValue( + -0xffffffffffffffffn | 0x10000000000000000n, -0xffffffffffffffffn, + "-0xffffffffffffffffn | 0x10000000000000000n === -0xffffffffffffffffn"); +assert.sameValue( + 0x10000000000000000n | -0xffffffffffffffffn, -0xffffffffffffffffn, + "0x10000000000000000n | -0xffffffffffffffffn === -0xffffffffffffffffn"); +assert.sameValue( + -0xffffffffffffffffffffffffn | 0x10000000000000000n, -0xfffffffeffffffffffffffffn, + "-0xffffffffffffffffffffffffn | 0x10000000000000000n === -0xfffffffeffffffffffffffffn"); +assert.sameValue( + 0x10000000000000000n | -0xffffffffffffffffffffffffn, -0xfffffffeffffffffffffffffn, + "0x10000000000000000n | -0xffffffffffffffffffffffffn === -0xfffffffeffffffffffffffffn"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/browser.js b/js/src/tests/test262/language/expressions/bitwise-or/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/bitwise-or/order-of-evaluation.js b/js/src/tests/test262/language/expressions/bitwise-or/order-of-evaluation.js new file mode 100644 index 0000000000..ab9b32016c --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-or/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +description: Type coercion order of operations for bitwise-or operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() | (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() | (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() | (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() | (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() | (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() | (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-or/shell.js b/js/src/tests/test262/language/expressions/bitwise-or/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A1.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A1.js new file mode 100644 index 0000000000..4d1def061e --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between BitwiseXORExpression and "^" or + between "^" and BitwiseANDExpression are allowed +es5id: 11.10.2_A1 +description: The check uses eval +---*/ + +//CHECK#1 +if ((eval("1\u0009^\u00091")) !== 0) { + throw new Test262Error('#1: (1\\u0009^\\u00091) === 0'); +} + +//CHECK#2 +if ((eval("1\u000B^\u000B1")) !== 0) { + throw new Test262Error('#2: (1\\u000B^\\u000B1) === 0'); +} + +//CHECK#3 +if ((eval("1\u000C^\u000C1")) !== 0) { + throw new Test262Error('#3: (1\\u000C^\\u000C1) === 0'); +} + +//CHECK#4 +if ((eval("1\u0020^\u00201")) !== 0) { + throw new Test262Error('#4: (1\\u0020^\\u00201) === 0'); +} + +//CHECK#5 +if ((eval("1\u00A0^\u00A01")) !== 0) { + throw new Test262Error('#5: (1\\u00A0^\\u00A01) === 0'); +} + +//CHECK#6 +if ((eval("1\u000A^\u000A1")) !== 0) { + throw new Test262Error('#6: (1\\u000A^\\u000A1) === 0'); +} + +//CHECK#7 +if ((eval("1\u000D^\u000D1")) !== 0) { + throw new Test262Error('#7: (1\\u000D^\\u000D1) === 0'); +} + +//CHECK#8 +if ((eval("1\u2028^\u20281")) !== 0) { + throw new Test262Error('#8: (1\\u2028^\\u20281) === 0'); +} + +//CHECK#9 +if ((eval("1\u2029^\u20291")) !== 0) { + throw new Test262Error('#9: (1\\u2029^\\u20291) === 0'); +} + + +//CHECK#10 +if ((eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029^\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 0) { + throw new Test262Error('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029^\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T1.js new file mode 100644 index 0000000000..1fac055f02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y uses GetValue +es5id: 11.10.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((1 ^ 1) !== 0) { + throw new Test262Error('#1: (1 ^ 1) === 0. Actual: ' + ((1 ^ 1))); +} + +//CHECK#2 +var x = 1; +if ((x ^ 1) !== 0) { + throw new Test262Error('#2: var x = 1; (x ^ 1) === 0. Actual: ' + ((x ^ 1))); +} + +//CHECK#3 +var y = 1; +if ((1 ^ y) !== 0) { + throw new Test262Error('#3: var y = 1; (1 ^ y) === 0. Actual: ' + ((1 ^ y))); +} + +//CHECK#4 +var x = 1; +var y = 1; +if ((x ^ y) !== 0) { + throw new Test262Error('#4: var x = 1; var y = 1; (x ^ y) === 0. Actual: ' + ((x ^ y))); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if ((objectx.prop ^ objecty.prop) !== 0) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; (objectx.prop ^ objecty.prop) === 0. Actual: ' + ((objectx.prop ^ objecty.prop))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T2.js new file mode 100644 index 0000000000..19645c7b8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y uses GetValue +es5id: 11.10.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x ^ 1; + throw new Test262Error('#1.1: x ^ 1 throw ReferenceError. Actual: ' + (x ^ 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x ^ 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T3.js new file mode 100644 index 0000000000..c34475bdf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y uses GetValue +es5id: 11.10.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 ^ y; + throw new Test262Error('#1.1: 1 ^ y throw ReferenceError. Actual: ' + (1 ^ y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 ^ y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.2_T1.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.2_T1.js new file mode 100644 index 0000000000..a709632fec --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y uses [[Default Value]] +es5id: 11.10.2_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if (({valueOf: function() {return 1}} ^ 1) !== 0) { + throw new Test262Error('#1: ({valueOf: function() {return 1}} ^ 1) === 0. Actual: ' + (({valueOf: function() {return 1}} ^ 1))); +} + +//CHECK#2 +if (({valueOf: function() {return 1}, toString: function() {return 0}} ^ 1) !== 0) { + throw new Test262Error('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} ^ 1) === 0. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return 0}} ^ 1))); +} + +//CHECK#3 +if (({valueOf: function() {return 1}, toString: function() {return {}}} ^ 1) !== 0) { + throw new Test262Error('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} ^ 1) === 0. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return {}}} ^ 1))); +} + +//CHECK#4 +try { + if (({valueOf: function() {return 1}, toString: function() {throw "error"}} ^ 1) !== 0) { + throw new Test262Error('#4.1: ({valueOf: function() {return 1}, toString: function() {throw "error"}} ^ 1) === 0. Actual: ' + (({valueOf: function() {return 1}, toString: function() {throw "error"}} ^ 1))); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: ({valueOf: function() {return 1}, toString: function() {throw "error"}} ^ 1) not throw "error"'); + } else { + throw new Test262Error('#4.3: ({valueOf: function() {return 1}, toString: function() {throw "error"}} ^ 1) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if ((1 ^ {toString: function() {return 1}}) !== 0) { + throw new Test262Error('#5: (1 ^ {toString: function() {return 1}}) === 0. Actual: ' + ((1 ^ {toString: function() {return 1}}))); +} + +//CHECK#6 +if ((1 ^ {valueOf: function() {return {}}, toString: function() {return 1}}) !== 0) { + throw new Test262Error('#6: (1 ^ {valueOf: function() {return {}}, toString: function() {return 1}}) === 0. Actual: ' + ((1 ^ {valueOf: function() {return {}}, toString: function() {return 1}}))); +} + +//CHECK#7 +try { + 1 ^ {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 1 ^ {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 ^ {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 ^ {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 ^ {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 ^ {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 ^ {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 ^ {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.3_T1.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.3_T1.js new file mode 100644 index 0000000000..bc1316245f --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToInt32(first expression) is called first, and then ToInt32(second + expression) +es5id: 11.10.2_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x ^ y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x ^ y throw "x". Actual: ' + (x ^ y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToInt32(first expression) is called first, and then ToInt32(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x ^ y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T1.js new file mode 100644 index 0000000000..9f3d5c54bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 1; +if (((x = 0) ^ x) !== 0) { + throw new Test262Error('#1: var x = 0; ((x = 1) ^ x) === 0. Actual: ' + (((x = 1) ^ x))); +} + +//CHECK#2 +var x = 0; +if ((x ^ (x = 1)) !== 1) { + throw new Test262Error('#2: var x = 0; (x ^ (x = 1)) === 1. Actual: ' + ((x ^ (x = 1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T2.js new file mode 100644 index 0000000000..d4fbee6d5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() ^ y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() ^ y() throw "x". Actual: ' + (x() ^ y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() ^ y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T3.js new file mode 100644 index 0000000000..e12fc1353c --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.10.2_A2.4_T3 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +try { + x ^ (x = 1); + throw new Test262Error('#1.1: x ^ (x = 1) throw ReferenceError. Actual: ' + (x ^ (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x ^ (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if (((y = 1) ^ y) !== 0) { + throw new Test262Error('#2: ((y = 1) ^ y) === 0. Actual: ' + (((y = 1) ^ y))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.1.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.1.js new file mode 100644 index 0000000000..2a9c0355dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T1.1 +description: Type(x) and Type(y) are primitive boolean and Boolean object +---*/ + +//CHECK#1 +if ((true ^ true) !== 0) { + throw new Test262Error('#1: (true ^ true) === 0. Actual: ' + ((true ^ true))); +} + +//CHECK#2 +if ((new Boolean(true) ^ true) !== 0) { + throw new Test262Error('#2: (new Boolean(true) ^ true) === 0. Actual: ' + ((new Boolean(true) ^ true))); +} + +//CHECK#3 +if ((true ^ new Boolean(true)) !== 0) { + throw new Test262Error('#3: (true ^ new Boolean(true)) === 0. Actual: ' + ((true ^ new Boolean(true)))); +} + +//CHECK#4 +if ((new Boolean(true) ^ new Boolean(true)) !== 0) { + throw new Test262Error('#4: (new Boolean(true) ^ new Boolean(true)) === 0. Actual: ' + ((new Boolean(true) ^ new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.2.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.2.js new file mode 100644 index 0000000000..5546dd09b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T1.2 +description: Type(x) and Type(y) are primitive number and Number object +---*/ + +//CHECK#1 +if ((1 ^ 1) !== 0) { + throw new Test262Error('#1: (1 ^ 1) === 0. Actual: ' + ((1 ^ 1))); +} + +//CHECK#2 +if ((new Number(1) ^ 1) !== 0) { + throw new Test262Error('#2: (new Number(1) ^ 1) === 0. Actual: ' + ((new Number(1) ^ 1))); +} + +//CHECK#3 +if ((1 ^ new Number(1)) !== 0) { + throw new Test262Error('#3: (1 ^ new Number(1)) === 0. Actual: ' + ((1 ^ new Number(1)))); +} + +//CHECK#4 +if ((new Number(1) ^ new Number(1)) !== 0) { + throw new Test262Error('#4: (new Number(1) ^ new Number(1)) === 0. Actual: ' + ((new Number(1) ^ new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.3.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.3.js new file mode 100644 index 0000000000..1c5d24324f --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T1.3 +description: Type(x) and Type(y) are primitive string and String object +---*/ + +//CHECK#1 +if (("1" ^ "1") !== 0) { + throw new Test262Error('#1: ("1" ^ "1") === 0. Actual: ' + (("1" ^ "1"))); +} + +//CHECK#2 +if ((new String("1") ^ "1") !== 0) { + throw new Test262Error('#2: (new String("1") ^ "1") === 0. Actual: ' + ((new String("1") ^ "1"))); +} + +//CHECK#3 +if (("1" ^ new String("1")) !== 0) { + throw new Test262Error('#3: ("1" ^ new String("1")) === 0. Actual: ' + (("1" ^ new String("1")))); +} + +//CHECK#4 +if ((new String("1") ^ new String("1")) !== 0) { + throw new Test262Error('#4: (new String("1") ^ new String("1")) === 0. Actual: ' + ((new String("1") ^ new String("1")))); +} + +//CHECK#5 +if (("x" ^ "1") !== 1) { + throw new Test262Error('#5: ("x" ^ "1") === 1. Actual: ' + (("x" ^ "1"))); +} + +//CHECK#6 +if (("1" ^ "x") !== 1) { + throw new Test262Error('#6: ("1" ^ "x") === 1. Actual: ' + (("1" ^ "x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.4.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.4.js new file mode 100644 index 0000000000..3382a66f45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T1.4 +description: Type(x) and Type(y) are null and undefined +---*/ + +//CHECK#1 +if ((null ^ undefined) !== 0) { + throw new Test262Error('#1: (null ^ undefined) === 0. Actual: ' + ((null ^ undefined))); +} + +//CHECK#2 +if ((undefined ^ null) !== 0) { + throw new Test262Error('#2: (undefined ^ null) === 0. Actual: ' + ((undefined ^ null))); +} + +//CHECK#3 +if ((undefined ^ undefined) !== 0) { + throw new Test262Error('#3: (undefined ^ undefined) === 0. Actual: ' + ((undefined ^ undefined))); +} + +//CHECK#4 +if ((null ^ null) !== 0) { + throw new Test262Error('#4: (null ^ null) === 0. Actual: ' + ((null ^ null))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.5.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.5.js new file mode 100644 index 0000000000..a890e098b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T1.5 +description: Type(x) and Type(y) are Object object and Function object +---*/ + +//CHECK#1 +if (({} ^ function(){return 1}) !== 0) { + throw new Test262Error('#1: ({} ^ function(){return 1}) === 0. Actual: ' + (({} ^ function(){return 1}))); +} + +//CHECK#2 +if ((function(){return 1} ^ {}) !== 0) { + throw new Test262Error('#2: (function(){return 1} ^ {}) === 0. Actual: ' + ((function(){return 1} ^ {}))); +} + +//CHECK#3 +if ((function(){return 1} ^ function(){return 1}) !== 0) { + throw new Test262Error('#3: (function(){return 1} ^ function(){return 1}) === 0. Actual: ' + ((function(){return 1} ^ function(){return 1}))); +} + +//CHECK#4 +if (({} ^ {}) !== 0) { + throw new Test262Error('#4: ({} ^ {}) === 0. Actual: ' + (({} ^ {}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.1.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.1.js new file mode 100644 index 0000000000..2c7f2dcbdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if ((true ^ 1) !== 0) { + throw new Test262Error('#1: (true ^ 1) === 0. Actual: ' + ((true ^ 1))); +} + +//CHECK#2 +if ((1 ^ true) !== 0) { + throw new Test262Error('#2: (1 ^ true) === 0. Actual: ' + ((1 ^ true))); +} + +//CHECK#3 +if ((new Boolean(true) ^ 1) !== 0) { + throw new Test262Error('#3: (new Boolean(true) ^ 1) === 0. Actual: ' + ((new Boolean(true) ^ 1))); +} + +//CHECK#4 +if ((1 ^ new Boolean(true)) !== 0) { + throw new Test262Error('#4: (1 ^ new Boolean(true)) === 0. Actual: ' + ((1 ^ new Boolean(true)))); +} + +//CHECK#5 +if ((true ^ new Number(1)) !== 0) { + throw new Test262Error('#5: (true ^ new Number(1)) === 0. Actual: ' + ((true ^ new Number(1)))); +} + +//CHECK#6 +if ((new Number(1) ^ true) !== 0) { + throw new Test262Error('#6: (new Number(1) ^ true) === 0. Actual: ' + ((new Number(1) ^ true))); +} + +//CHECK#7 +if ((new Boolean(true) ^ new Number(1)) !== 0) { + throw new Test262Error('#7: (new Boolean(true) ^ new Number(1)) === 0. Actual: ' + ((new Boolean(true) ^ new Number(1)))); +} + +//CHECK#8 +if ((new Number(1) ^ new Boolean(true)) !== 0) { + throw new Test262Error('#8: (new Number(1) ^ new Boolean(true)) === 0. Actual: ' + ((new Number(1) ^ new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.2.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.2.js new file mode 100644 index 0000000000..a806f6b8a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if (("1" ^ 1) !== 0) { + throw new Test262Error('#1: ("1" ^ 1) === 0. Actual: ' + (("1" ^ 1))); +} + +//CHECK#2 +if ((1 ^ "1") !== 0) { + throw new Test262Error('#2: (1 ^ "1") === 0. Actual: ' + ((1 ^ "1"))); +} + +//CHECK#3 +if ((new String("1") ^ 1) !== 0) { + throw new Test262Error('#3: (new String("1") ^ 1) === 0. Actual: ' + ((new String("1") ^ 1))); +} + +//CHECK#4 +if ((1 ^ new String("1")) !== 0) { + throw new Test262Error('#4: (1 ^ new String("1")) === 0. Actual: ' + ((1 ^ new String("1")))); +} + +//CHECK#5 +if (("1" ^ new Number(1)) !== 0) { + throw new Test262Error('#5: ("1" ^ new Number(1)) === 0. Actual: ' + (("1" ^ new Number(1)))); +} + +//CHECK#6 +if ((new Number(1) ^ "1") !== 0) { + throw new Test262Error('#6: (new Number(1) ^ "1") === 0. Actual: ' + ((new Number(1) ^ "1"))); +} + +//CHECK#7 +if ((new String("1") ^ new Number(1)) !== 0) { + throw new Test262Error('#7: (new String("1") ^ new Number(1)) === 0. Actual: ' + ((new String("1") ^ new Number(1)))); +} + +//CHECK#8 +if ((new Number(1) ^ new String("1")) !== 0) { + throw new Test262Error('#8: (new Number(1) ^ new String("1")) === 0. Actual: ' + ((new Number(1) ^ new String("1")))); +} + +//CHECK#9 +if (("x" ^ 1) !== 1) { + throw new Test262Error('#9: ("x" ^ 1) === 1. Actual: ' + (("x" ^ 1))); +} + +//CHECK#10 +if ((1 ^ "x") !== 1) { + throw new Test262Error('#10: (1 ^ "x") === 1. Actual: ' + ((1 ^ "x"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.3.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.3.js new file mode 100644 index 0000000000..863b255aae --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if ((1 ^ null) !== 1) { + throw new Test262Error('#1: (1 ^ null) === 1. Actual: ' + ((1 ^ null))); +} + +//CHECK#2 +if ((null ^ 1) !== 1) { + throw new Test262Error('#2: (null ^ 1) === 1. Actual: ' + ((null ^ 1))); +} + +//CHECK#3 +if ((new Number(1) ^ null) !== 1) { + throw new Test262Error('#3: (new Number(1) ^ null) === 1. Actual: ' + ((new Number(1) ^ null))); +} + +//CHECK#4 +if ((null ^ new Number(1)) !== 1) { + throw new Test262Error('#4: (null ^ new Number(1)) === 1. Actual: ' + ((null ^ new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.4.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.4.js new file mode 100644 index 0000000000..948e81fef0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ((1 ^ undefined) !== 1) { + throw new Test262Error('#1: (1 ^ undefined) === 1. Actual: ' + ((1 ^ undefined))); +} + +//CHECK#2 +if ((undefined ^ 1) !== 1) { + throw new Test262Error('#2: (undefined ^ 1) === 1. Actual: ' + ((undefined ^ 1))); +} + +//CHECK#3 +if ((new Number(1) ^ undefined) !== 1) { + throw new Test262Error('#3: (new Number(1) ^ undefined) === 1. Actual: ' + ((new Number(1) ^ undefined))); +} + +//CHECK#4 +if ((undefined ^ new Number(1)) !== 1) { + throw new Test262Error('#4: (undefined ^ new Number(1)) === 1. Actual: ' + ((undefined ^ new Number(1)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.5.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.5.js new file mode 100644 index 0000000000..b2c59ab572 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if ((true ^ "1") !== 0) { + throw new Test262Error('#1: (true ^ "1") === 0. Actual: ' + ((true ^ "1"))); +} + +//CHECK#2 +if (("1" ^ true) !== 0) { + throw new Test262Error('#2: ("1" ^ true) === 0. Actual: ' + (("1" ^ true))); +} + +//CHECK#3 +if ((new Boolean(true) ^ "1") !== 0) { + throw new Test262Error('#3: (new Boolean(true) ^ "1") === 0. Actual: ' + ((new Boolean(true) ^ "1"))); +} + +//CHECK#4 +if (("1" ^ new Boolean(true)) !== 0) { + throw new Test262Error('#4: ("1" ^ new Boolean(true)) === 0. Actual: ' + (("1" ^ new Boolean(true)))); +} + +//CHECK#5 +if ((true ^ new String("1")) !== 0) { + throw new Test262Error('#5: (true ^ new String("1")) === 0. Actual: ' + ((true ^ new String("1")))); +} + +//CHECK#6 +if ((new String("1") ^ true) !== 0) { + throw new Test262Error('#6: (new String("1") ^ true) === 0. Actual: ' + ((new String("1") ^ true))); +} + +//CHECK#7 +if ((new Boolean(true) ^ new String("1")) !== 0) { + throw new Test262Error('#7: (new Boolean(true) ^ new String("1")) === 0. Actual: ' + ((new Boolean(true) ^ new String("1")))); +} + +//CHECK#8 +if ((new String("1") ^ new Boolean(true)) !== 0) { + throw new Test262Error('#8: (new String("1") ^ new Boolean(true)) === 0. Actual: ' + ((new String("1") ^ new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.6.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.6.js new file mode 100644 index 0000000000..0d9e8dc0bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (("1" ^ undefined) !== 1) { + throw new Test262Error('#1: ("1" ^ undefined) === 1. Actual: ' + (("1" ^ undefined))); +} + +//CHECK#2 +if ((undefined ^ "1") !== 1) { + throw new Test262Error('#2: (undefined ^ "1") === 1. Actual: ' + ((undefined ^ "1"))); +} + +//CHECK#3 +if ((new String("1") ^ undefined) !== 1) { + throw new Test262Error('#3: (new String("1") ^ undefined) === 1. Actual: ' + ((new String("1") ^ undefined))); +} + +//CHECK#4 +if ((undefined ^ new String("1")) !== 1) { + throw new Test262Error('#4: (undefined ^ new String("1")) === 1. Actual: ' + ((undefined ^ new String("1")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.7.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.7.js new file mode 100644 index 0000000000..b8caa5d232 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if (("1" ^ null) !== 1) { + throw new Test262Error('#1: ("1" ^ null) === 1. Actual: ' + (("1" ^ null))); +} + +//CHECK#2 +if ((null ^ "1") !== 1) { + throw new Test262Error('#2: (null ^ "1") === 1. Actual: ' + ((null ^ "1"))); +} + +//CHECK#3 +if ((new String("1") ^ null) !== 1) { + throw new Test262Error('#3: (new String("1") ^ null) === 1. Actual: ' + ((new String("1") ^ null))); +} + +//CHECK#4 +if ((null ^ new String("1")) !== 1) { + throw new Test262Error('#4: (null ^ new String("1")) === 1. Actual: ' + ((null ^ new String("1")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.8.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.8.js new file mode 100644 index 0000000000..25f1a5507e --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ((true ^ undefined) !== 1) { + throw new Test262Error('#1: (true ^ undefined) === 1. Actual: ' + ((true ^ undefined))); +} + +//CHECK#2 +if ((undefined ^ true) !== 1) { + throw new Test262Error('#2: (undefined ^ true) === 1. Actual: ' + ((undefined ^ true))); +} + +//CHECK#3 +if ((new Boolean(true) ^ undefined) !== 1) { + throw new Test262Error('#3: (new Boolean(true) ^ undefined) === 1. Actual: ' + ((new Boolean(true) ^ undefined))); +} + +//CHECK#4 +if ((undefined ^ new Boolean(true)) !== 1) { + throw new Test262Error('#4: (undefined ^ new Boolean(true)) === 1. Actual: ' + ((undefined ^ new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.9.js b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.9.js new file mode 100644 index 0000000000..62926b04aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/S11.10.2_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x ^ y returns ToNumber(x) ^ ToNumber(y) +es5id: 11.10.2_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if ((true ^ null) !== 1) { + throw new Test262Error('#1: (true ^ null) === 1. Actual: ' + ((true ^ null))); +} + +//CHECK#2 +if ((null ^ true) !== 1) { + throw new Test262Error('#2: (null ^ true) === 1. Actual: ' + ((null ^ true))); +} + +//CHECK#3 +if ((new Boolean(true) ^ null) !== 1) { + throw new Test262Error('#3: (new Boolean(true) ^ null) === 1. Actual: ' + ((new Boolean(true) ^ null))); +} + +//CHECK#4 +if ((null ^ new Boolean(true)) !== 1) { + throw new Test262Error('#4: (null ^ new Boolean(true)) === 1. Actual: ' + ((null ^ new Boolean(true)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/bigint-and-number.js b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-and-number.js new file mode 100644 index 0000000000..7e313c53cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for bitwise-xor operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n ^ 1; +}, '1n ^ 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 ^ 1n; +}, '1 ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ^ 1; +}, 'Object(1n) ^ 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 ^ Object(1n); +}, '1 ^ Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ Object(1); +}, '1n ^ Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ^ 1n; +}, 'Object(1) ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ^ Object(1); +}, 'Object(1n) ^ Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ^ Object(1n); +}, 'Object(1) ^ Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ NaN; +}, '1n ^ NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN ^ 1n; +}, 'NaN ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ Infinity; +}, '1n ^ Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity ^ 1n; +}, 'Infinity ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ true; +}, '1n ^ true throws TypeError'); + +assert.throws(TypeError, function() { + true ^ 1n; +}, 'true ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ '1'; +}, '1n ^ "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' ^ 1n; +}, '"1" ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ null; +}, '1n ^ null throws TypeError'); + +assert.throws(TypeError, function() { + null ^ 1n; +}, 'null ^ 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ^ undefined; +}, '1n ^ undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined ^ 1n; +}, 'undefined ^ 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/bigint-errors.js b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-errors.js new file mode 100644 index 0000000000..0681bb50e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-xor operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') ^ 0n; +}, 'Symbol("1") ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ Symbol('1'); +}, '0n ^ Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) ^ 0n; +}, 'Object(Symbol("1")) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ Object(Symbol('1')); +}, '0n ^ Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) ^ 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n ^ {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) ^ 0n; +}, '({valueOf: function() {return Symbol("1");}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n ^ {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) ^ 0n; +}, '({toString: function() {return Symbol("1");}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + toString: function() { + return Symbol('1'); + } + }; +}, '0n ^ {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-non-primitive.js new file mode 100644 index 0000000000..9d421fc66e --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-non-primitive.js @@ -0,0 +1,84 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Bitwise XOR for BigInt non-primitive values +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +info: | + 5. Let lnum be ? ToNumeric(lval). + 6. Let rnum be ? ToNumeric(rval). + ... + 8. Let T be Type(lnum). + ... + 11. Otherwise, @ is ^; return T::bitwiseXOR(lnum, rnum). + +features: [BigInt] +---*/ +assert.sameValue( + Object(0b101n) ^ 0b011n, + 0b110n, + 'The result of (Object(0b101n) ^ 0b011n) is 0b110n' +); + +assert.sameValue( + 0b011n ^ Object(0b101n), + 0b110n, + 'The result of (0b011n ^ Object(0b101n)) is 0b110n' +); + +assert.sameValue( + Object(0b101n) ^ Object(0b011n), + 0b110n, + 'The result of (Object(0b101n) ^ Object(0b011n)) is 0b110n' +); + +function err() { + throw new Test262Error(); +} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} ^ 0b011n, 0b110n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) ^ 0b011n) is 0b110n'); + +assert.sameValue(0b011n ^ { + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +}, 0b110n, 'The result of (0b011n ^ {[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) is 0b110n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} ^ 0b011n, 0b110n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) ^ 0b011n) is 0b110n'); + +assert.sameValue(0b011n ^ { + valueOf: function() { + return 0b101n; + }, + + toString: err +}, 0b110n, 'The result of (0b011n ^ {valueOf: function() {return 0b101n;}, toString: err}) is 0b110n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} ^ 0b011n, 0b110n, 'The result of (({toString: function() {return 0b101n;}}) ^ 0b011n) is 0b110n'); + +assert.sameValue(0b011n ^ { + toString: function() { + return 0b101n; + } +}, 0b110n, 'The result of (0b011n ^ {toString: function() {return 0b101n;}}) is 0b110n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-toprimitive.js new file mode 100644 index 0000000000..e42e9b4837 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-xor operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} ^ 3n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + valueOf: function() { + return 2n; + }, + + toString: err +}, 1n, 'The result of (3n ^ {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({toString: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + valueOf: null, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) ^ 0n; +}, '({[Symbol.toPrimitive]: 1}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + [Symbol.toPrimitive]: 1 + }; +}, '0n ^ {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) ^ 0n; +}, '({[Symbol.toPrimitive]: {}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + [Symbol.toPrimitive]: {} + }; +}, '0n ^ {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) ^ 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n ^ {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) ^ 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n ^ {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) ^ 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) ^ 0n throws MyError'); + +assert.throws(MyError, function() { + 0n ^ { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n ^ {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) ^ 0n; +}, '({valueOf: function() {throw new MyError();}}) ^ 0n throws MyError'); + +assert.throws(MyError, function() { + 0n ^ { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n ^ {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) ^ 0n; +}, '({toString: function() {throw new MyError();}}) ^ 0n throws MyError'); + +assert.throws(MyError, function() { + 0n ^ { + toString: function() { + throw new MyError(); + } + }; +}, '0n ^ {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) ^ 0n; +}, '({valueOf: null, toString: null}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + valueOf: null, + toString: null + }; +}, '0n ^ {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) ^ 0n; +}, '({valueOf: 1, toString: 1}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + valueOf: 1, + toString: 1 + }; +}, '0n ^ {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) ^ 0n; +}, '({valueOf: {}, toString: {}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + valueOf: {}, + toString: {} + }; +}, '0n ^ {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) ^ 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n ^ {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) ^ 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) ^ 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ^ { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n ^ {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-wrapped-values.js new file mode 100644 index 0000000000..853b67f60d --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: bitwise-xor operator ToNumeric with BigInt operands +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) ^ 3n, 1n, 'The result of (Object(2n) ^ 3n) is 1n'); +assert.sameValue(3n ^ Object(2n), 1n, 'The result of (3n ^ Object(2n)) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({valueOf: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} ^ 3n, 1n, 'The result of (({toString: function() {return 2n;}}) ^ 3n) is 1n'); + +assert.sameValue(3n ^ { + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n ^ {toString: function() {return 2n;}}) is 1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/bigint.js b/js/src/tests/test262/language/expressions/bitwise-xor/bigint.js new file mode 100644 index 0000000000..b1d513c95f --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/bigint.js @@ -0,0 +1,109 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Bitwise XOR for BigInt values +esid: sec-bitwise-op +info: | + BitwiseOp(op, x, y) + + 1. Let result be 0. + 2. Let shift be 0. + 3. Repeat, until (x = 0 or x = -1) and (y = 0 or y = -1), + a. Let xDigit be x modulo 2. + b. Let yDigit be y modulo 2. + c. Let result be result + 2**shift * op(xDigit, yDigit) + d. Let shift be shift + 1. + e. Let x be (x - xDigit) / 2. + f. Let y be (y - yDigit) / 2. + 4. If op(x modulo 2, y modulo 2) ≠ 0, + a. Let result be result - 2**shift. NOTE: This extends the sign. + 5. Return result. + +features: [BigInt] +---*/ + +assert.sameValue(0b00n ^ 0b00n, 0b00n, "0b00n ^ 0b00n === 0b00n"); +assert.sameValue(0b00n ^ 0b01n, 0b01n, "0b00n ^ 0b01n === 0b01n"); +assert.sameValue(0b01n ^ 0b00n, 0b01n, "0b01n ^ 0b00n === 0b01n"); +assert.sameValue(0b00n ^ 0b10n, 0b10n, "0b00n ^ 0b10n === 0b10n"); +assert.sameValue(0b10n ^ 0b00n, 0b10n, "0b10n ^ 0b00n === 0b10n"); +assert.sameValue(0b00n ^ 0b11n, 0b11n, "0b00n ^ 0b11n === 0b11n"); +assert.sameValue(0b11n ^ 0b00n, 0b11n, "0b11n ^ 0b00n === 0b11n"); +assert.sameValue(0b01n ^ 0b01n, 0b00n, "0b01n ^ 0b01n === 0b00n"); +assert.sameValue(0b01n ^ 0b10n, 0b11n, "0b01n ^ 0b10n === 0b11n"); +assert.sameValue(0b10n ^ 0b01n, 0b11n, "0b10n ^ 0b01n === 0b11n"); +assert.sameValue(0b01n ^ 0b11n, 0b10n, "0b01n ^ 0b11n === 0b10n"); +assert.sameValue(0b11n ^ 0b01n, 0b10n, "0b11n ^ 0b01n === 0b10n"); +assert.sameValue(0b10n ^ 0b10n, 0b00n, "0b10n ^ 0b10n === 0b00n"); +assert.sameValue(0b10n ^ 0b11n, 0b01n, "0b10n ^ 0b11n === 0b01n"); +assert.sameValue(0b11n ^ 0b10n, 0b01n, "0b11n ^ 0b10n === 0b01n"); +assert.sameValue(0xffffffffn ^ 0n, 0xffffffffn, "0xffffffffn ^ 0n === 0xffffffffn"); +assert.sameValue(0n ^ 0xffffffffn, 0xffffffffn, "0n ^ 0xffffffffn === 0xffffffffn"); +assert.sameValue(0xffffffffn ^ 0xffffffffn, 0n, "0xffffffffn ^ 0xffffffffn === 0n"); +assert.sameValue(0xffffffffffffffffn ^ 0n, 0xffffffffffffffffn, "0xffffffffffffffffn ^ 0n === 0xffffffffffffffffn"); +assert.sameValue(0n ^ 0xffffffffffffffffn, 0xffffffffffffffffn, "0n ^ 0xffffffffffffffffn === 0xffffffffffffffffn"); +assert.sameValue(0xffffffffffffffffn ^ 0xffffffffn, 0xffffffff00000000n, "0xffffffffffffffffn ^ 0xffffffffn === 0xffffffff00000000n"); +assert.sameValue(0xffffffffn ^ 0xffffffffffffffffn, 0xffffffff00000000n, "0xffffffffn ^ 0xffffffffffffffffn === 0xffffffff00000000n"); +assert.sameValue( + 0xffffffffffffffffn ^ 0xffffffffffffffffn, 0n, + "0xffffffffffffffffn ^ 0xffffffffffffffffn === 0n"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n, 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n, + "0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n === 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n, + "0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fbdf6d72cf7705ecbfe6748e5n"); +assert.sameValue(0n ^ -1n, -1n, "0n ^ -1n === -1n"); +assert.sameValue(-1n ^ 0n, -1n, "-1n ^ 0n === -1n"); +assert.sameValue(0n ^ -2n, -2n, "0n ^ -2n === -2n"); +assert.sameValue(-2n ^ 0n, -2n, "-2n ^ 0n === -2n"); +assert.sameValue(1n ^ -2n, -1n, "1n ^ -2n === -1n"); +assert.sameValue(-2n ^ 1n, -1n, "-2n ^ 1n === -1n"); +assert.sameValue(2n ^ -2n, -4n, "2n ^ -2n === -4n"); +assert.sameValue(-2n ^ 2n, -4n, "-2n ^ 2n === -4n"); +assert.sameValue(2n ^ -3n, -1n, "2n ^ -3n === -1n"); +assert.sameValue(-3n ^ 2n, -1n, "-3n ^ 2n === -1n"); +assert.sameValue(-1n ^ -2n, 1n, "-1n ^ -2n === 1n"); +assert.sameValue(-2n ^ -1n, 1n, "-2n ^ -1n === 1n"); +assert.sameValue(-2n ^ -2n, 0n, "-2n ^ -2n === 0n"); +assert.sameValue(-2n ^ -3n, 3n, "-2n ^ -3n === 3n"); +assert.sameValue(-3n ^ -2n, 3n, "-3n ^ -2n === 3n"); +assert.sameValue(0xffffffffn ^ -1n, -0x100000000n, "0xffffffffn ^ -1n === -0x100000000n"); +assert.sameValue(-1n ^ 0xffffffffn, -0x100000000n, "-1n ^ 0xffffffffn === -0x100000000n"); +assert.sameValue(0xffffffffffffffffn ^ -1n, -0x10000000000000000n, "0xffffffffffffffffn ^ -1n === -0x10000000000000000n"); +assert.sameValue(-1n ^ 0xffffffffffffffffn, -0x10000000000000000n, "-1n ^ 0xffffffffffffffffn === -0x10000000000000000n"); +assert.sameValue( + 0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n, -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n, + "0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n === -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n, + "-0x4aabef2324cedff5387f1f65n ^ 0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fbdf6d72cf7705ecbfe6748e5n"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n, -0xbf2ed51fbdf6d72cf7705ecbfe67481bn, + "-0xbf2ed51ff75d380fd3be813ec6185780n ^ 0x4aabef2324cedff5387f1f65n === -0xbf2ed51fbdf6d72cf7705ecbfe67481bn"); +assert.sameValue( + 0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fbdf6d72cf7705ecbfe67481bn, + "0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fbdf6d72cf7705ecbfe67481bn"); +assert.sameValue( + -0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n, 0xbf2ed51fbdf6d72cf7705ecbfe67481bn, + "-0xbf2ed51ff75d380fd3be813ec6185780n ^ -0x4aabef2324cedff5387f1f65n === 0xbf2ed51fbdf6d72cf7705ecbfe67481bn"); +assert.sameValue( + -0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fbdf6d72cf7705ecbfe67481bn, + "-0x4aabef2324cedff5387f1f65n ^ -0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fbdf6d72cf7705ecbfe67481bn"); +assert.sameValue(-0xffffffffn ^ 0n, -0xffffffffn, "-0xffffffffn ^ 0n === -0xffffffffn"); +assert.sameValue(0n ^ -0xffffffffn, -0xffffffffn, "0n ^ -0xffffffffn === -0xffffffffn"); +assert.sameValue( + -0xffffffffffffffffn ^ 0x10000000000000000n, -0x1ffffffffffffffffn, + "-0xffffffffffffffffn ^ 0x10000000000000000n === -0x1ffffffffffffffffn"); +assert.sameValue( + 0x10000000000000000n ^ -0xffffffffffffffffn, -0x1ffffffffffffffffn, + "0x10000000000000000n ^ -0xffffffffffffffffn === -0x1ffffffffffffffffn"); +assert.sameValue( + -0xffffffffffffffffffffffffn ^ 0x10000000000000000n, -0xfffffffeffffffffffffffffn, + "-0xffffffffffffffffffffffffn ^ 0x10000000000000000n === -0xfffffffeffffffffffffffffn"); +assert.sameValue( + 0x10000000000000000n ^ -0xffffffffffffffffffffffffn, -0xfffffffeffffffffffffffffn, + "0x10000000000000000n ^ -0xffffffffffffffffffffffffn === -0xfffffffeffffffffffffffffn"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/browser.js b/js/src/tests/test262/language/expressions/bitwise-xor/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/order-of-evaluation.js b/js/src/tests/test262/language/expressions/bitwise-xor/order-of-evaluation.js new file mode 100644 index 0000000000..90ed1c0519 --- /dev/null +++ b/js/src/tests/test262/language/expressions/bitwise-xor/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-binary-bitwise-operators-runtime-semantics-evaluation +description: Type coercion order of operations for bitwise-xor operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() ^ (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() ^ (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() ^ (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() ^ (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() ^ (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() ^ (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/bitwise-xor/shell.js b/js/src/tests/test262/language/expressions/bitwise-xor/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/browser.js b/js/src/tests/test262/language/expressions/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_1.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_1.js new file mode 100644 index 0000000000..df9bdcc505 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_1.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_1 +description: > + Call arguments are evaluated before the check is made to see if + the object is actually callable (FunctionDeclaration) +---*/ + + var fooCalled = false; + function foo(){ fooCalled = true; } + + var o = { }; +assert.throws(TypeError, function() { + o.bar( foo() ); + throw new Test262Error("o.bar does not exist!"); +}); +assert.sameValue(fooCalled, true, 'fooCalled'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_2.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_2.js new file mode 100644 index 0000000000..1468481a32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_2.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_2 +description: > + Call arguments are evaluated before the check is made to see if + the object is actually callable (FunctionExpression) +---*/ + + var fooCalled = false; + var foo = function (){ fooCalled = true; } + + var o = { }; +assert.throws(TypeError, function() { + o.bar( foo() ); + throw new Test262Error("o.bar does not exist!"); +}); +assert.sameValue(fooCalled, true, 'fooCalled'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_3.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_3.js new file mode 100644 index 0000000000..eef2ae8d5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_3.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_3 +description: > + Call arguments are not evaluated before the check is made to see + if the object is actually callable (undefined member) +---*/ + + var fooCalled = false; + function foo(){ fooCalled = true; } + + var o = { }; +assert.throws(TypeError, function() { + o.bar.gar( foo() ); + throw new Test262Error("o.bar does not exist!"); +}); +assert.sameValue(fooCalled, false, 'fooCalled'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_4.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_4.js new file mode 100644 index 0000000000..7dae3a8724 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_4.js @@ -0,0 +1,25 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_4 +description: > + Call arguments are evaluated before the check is made to see if + the object is actually callable (property) +---*/ + + var fooCalled = false; + function foo(){ fooCalled = true; } + + var o = { }; + Object.defineProperty(o, "bar", {get: function() {this.barGetter = true; return 42;}, + set: function(x) {this.barSetter = true; }}); +assert.throws(TypeError, function() { + o.bar( foo() ); + throw new Test262Error("o.bar does not exist!"); +}); +assert.sameValue(fooCalled, true, 'fooCalled'); +assert.sameValue(o.barGetter, true, 'o.barGetter'); +assert.sameValue(o.barSetter, undefined, 'o.barSetter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_5.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_5.js new file mode 100644 index 0000000000..e985aa7043 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_5.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_5 +description: > + Call arguments are evaluated before the check is made to see if + the object is actually callable (eval'ed) +---*/ + + var fooCalled = false; + function foo(){ fooCalled = true; } + + var o = { }; +assert.throws(TypeError, function() { + eval("o.bar( foo() );"); + throw new Test262Error("o.bar does not exist!"); +}); +assert.sameValue(fooCalled, true, 'fooCalled'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_6.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_6.js new file mode 100644 index 0000000000..e9899d94b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_6.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_6 +description: > + Call arguments are evaluated before the check is made to see if + the object is actually callable (getter called) +---*/ + + var o = { }; + Object.defineProperty(o, "bar", {get: function() {this.barGetter = true; return 42;}, + set: function(x) {this.barSetter = true; }}); +assert.throws(TypeError, function() { + o.foo( o.bar ); + throw new Test262Error("o.foo does not exist!"); +}); +assert.sameValue(o.barGetter, true, 'o.barGetter'); +assert.sameValue(o.barSetter, undefined, 'o.barSetter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_7.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_7.js new file mode 100644 index 0000000000..24e16f351d --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_7.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_7 +description: > + Call arguments are evaluated before the check is made to see if + the object is actually callable (getter called as indexed property) +---*/ + + var o = { }; + Object.defineProperty(o, "bar", {get: function() {this.barGetter = true; return 42;}, + set: function(x) {this.barSetter = true; }}); +assert.throws(TypeError, function() { + o.foo( o["bar"] ); + throw new Test262Error("o.foo does not exist!"); +}); +assert.sameValue(o.barGetter, true, 'o.barGetter'); +assert.sameValue(o.barSetter, undefined, 'o.barSetter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/11.2.3-3_8.js b/js/src/tests/test262/language/expressions/call/11.2.3-3_8.js new file mode 100644 index 0000000000..2058665d46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/11.2.3-3_8.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.2.3-3_8 +description: > + Call arguments are evaluated before the check is made to see if + the object is actually callable (global object) +flags: [noStrict] +---*/ + + var fooCalled = false; + function foo(){ fooCalled = true; } +assert.throws(TypeError, function() { + this.bar( foo() ); + throw new Test262Error("this.bar does not exist!"); +}); +assert.sameValue(fooCalled, true, 'fooCalled'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A1.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A1.js new file mode 100644 index 0000000000..db5f3e00c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between MemberExpression and Arguments + are allowed +es5id: 11.2.3_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("Number\u0009()") !== 0) { + throw new Test262Error('#1: Number\\u0009() === 0'); +} + +//CHECK#2 +if (eval("Number\u000B()") !== 0) { + throw new Test262Error('#2: Number\\u000B() === 0'); +} + +//CHECK#3 +if (eval("Number\u000C()") !== 0) { + throw new Test262Error('#3: Number\\u000C() === 0'); +} + +//CHECK#4 +if (eval("Number\u0020()") !== 0) { + throw new Test262Error('#4: Number\\u0020 === 0'); +} + +//CHECK#5 +if (eval("Number\u00A0()") !== 0) { + throw new Test262Error('#5: Number\\u00A0() === 0'); +} + +//CHECK#6 +if (eval("Number\u000A()") !== 0) { + throw new Test262Error('#6: Number\\u000A() === 0'); +} + +//CHECK#7 +if (eval("Number\u000D()") !== 0) { + throw new Test262Error('#7: Number\\u000D() === 0'); +} + +//CHECK#8 +if (eval("Number\u2028()") !== 0) { + throw new Test262Error('#8: Number\\u2028() === 0'); +} + +//CHECK#9 +if (eval("Number\u2029()") !== 0) { + throw new Test262Error('#9: Number\\u2029() === 0'); +} + +//CHECK#10 +if (eval("Number\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029()") !== 0) { + throw new Test262Error('#10: Number\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029() === 0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A2.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A2.js new file mode 100644 index 0000000000..8e788cac6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "CallExpression : MemberExpression Arguments uses GetValue" +es5id: 11.2.3_A2 +description: If GetBase(MemberExpression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x(); + throw new Test262Error('#1.1: x() throw ReferenceError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x() throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + x(1,2,3); + throw new Test262Error('#2.1: x(1,2,3) throw ReferenceError. Actual: ' + (x(1,2,3))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#2.2: x(1,2,3) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T1.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T1.js new file mode 100644 index 0000000000..4a50f27899 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If MemberExpression is not Object, throw TypeError +es5id: 11.2.3_A3_T1 +description: Checking "boolean primitive" case +---*/ + +//CHECK#1 +try { + true(); + throw new Test262Error('#1.1: true() throw TypeError. Actual: ' + (true())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: true() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = true; + x(); + throw new Test262Error('#2.1: var x = true; x() throw TypeError. Actual: ' + (x())) +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = true; x() throw TypeError. Actual: ' + (e)) + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T2.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T2.js new file mode 100644 index 0000000000..25d3d27693 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If MemberExpression is not Object, throw TypeError +es5id: 11.2.3_A3_T2 +description: Checking "number primitive" case +---*/ + +//CHECK#1 +try { + 1(); + throw new Test262Error('#1.1: 1() throw TypeError. Actual: ' + (1())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: 1() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = 1; + x(); + throw new Test262Error('#2.1: var x = 1; x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = 1; x() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T3.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T3.js new file mode 100644 index 0000000000..a955322d11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T3.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If MemberExpression is not Object, throw TypeError +es5id: 11.2.3_A3_T3 +description: Checking "string primitive" case +---*/ + +//CHECK#1 +try { + "1"(); + throw new Test262Error('#1.1: "1"() throw TypeError. Actual: ' + ("1"())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: "1"() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = "1"; + x(); + throw new Test262Error('#2.1: var x = "1"; x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = "1"; x() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T4.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T4.js new file mode 100644 index 0000000000..f4794ae619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T4.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If MemberExpression is not Object, throw TypeError +es5id: 11.2.3_A3_T4 +description: Checking "undefined" case +---*/ + +//CHECK#1 +try { + undefined(); + throw new Test262Error('#1.1: undefined() throw TypeError. Actual: ' + (e)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: undefined() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = undefined; + x(); + throw new Test262Error('#2.1: var x = undefined; x() throw TypeError. Actual: ' + (e)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = undefined; x() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T5.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T5.js new file mode 100644 index 0000000000..426efcf6b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A3_T5.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If MemberExpression is not Object, throw TypeError +es5id: 11.2.3_A3_T5 +description: Checking "null" case +---*/ + +//CHECK#1 +try { + null(); + throw new Test262Error('#1.1: null() throw TypeError. Actual: ' + (null())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: null() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = null; + x(); + throw new Test262Error('#2.1: var x = null; x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = null; x() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T1.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T1.js new file mode 100644 index 0000000000..ddcac453c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If MemberExpression does not implement the internal [[Call]] method, + throw TypeError +es5id: 11.2.3_A4_T1 +description: Checking Boolean object case +---*/ + +//CHECK#1 +try { + new Boolean(true)(); + throw new Test262Error('#1.1: new Boolean(true)() throw TypeError. Actual: ' + (new Boolean(true)())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: new Boolean(true)() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = new Boolean(true); + x(); + throw new Test262Error('#2.1: var x = new Boolean(true); x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = new Boolean(true); x() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T2.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T2.js new file mode 100644 index 0000000000..99214a9a3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If MemberExpression does not implement the internal [[Call]] method, + throw TypeError +es5id: 11.2.3_A4_T2 +description: Checking Number object case +---*/ + +//CHECK#1 +try { + new Number(1)(); + throw new Test262Error('#1.1: new Number(1)() throw TypeError. Actual: ' + (new Number(1)())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: new Number(1)() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = new Number(1); + x(); + throw new Test262Error('#2.1: var x = new Number(1); x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = new Number(1); x() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T3.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T3.js new file mode 100644 index 0000000000..f643c22127 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T3.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If MemberExpression does not implement the internal [[Call]] method, + throw TypeError +es5id: 11.2.3_A4_T3 +description: Checking String object case +---*/ + +//CHECK#1 +try { + new String("1")(); + throw new Test262Error('#1.1: new String("1")() throw TypeError. Actual: ' + (new String("1")())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: new String("1")() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + var x = new String("1"); + x(); + throw new Test262Error('#2.1: var x = new String("1"); x() throw TypeError. Actual: ' + (x())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: var x = new String("1"); x() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T4.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T4.js new file mode 100644 index 0000000000..466eac6e8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T4.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If MemberExpression does not implement the internal [[Call]] method, + throw TypeError +es5id: 11.2.3_A4_T4 +description: Checking Global object case +---*/ + +//CHECK#1 +try { + this(); + throw new Test262Error('#1.1: this() throw TypeError. Actual: ' + (this())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: this() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T5.js b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T5.js new file mode 100644 index 0000000000..c49f9edd12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.3_A4_T5.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If MemberExpression does not implement the internal [[Call]] method, + throw TypeError +es5id: 11.2.3_A4_T5 +description: Checking Math object case +---*/ + +//CHECK#1 +try { + Math(); + throw new Test262Error('#1.1: Math() throw TypeError. Actual: ' + (Math())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: Math() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T1.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T1.js new file mode 100644 index 0000000000..92031d3756 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : ()" +es5id: 11.2.4_A1.1_T1 +description: Function is declared with no FormalParameterList +---*/ + +function f_arg() { + return arguments; +} + +//CHECK#1 +if (f_arg().length !== 0) { + throw new Test262Error('#1: function f_arg() {return arguments;} f_arg().length === 0. Actual: ' + (f_arg().length)); +} + +//CHECK#2 +if (f_arg()[0] !== undefined) { + throw new Test262Error('#2: function f_arg() {return arguments;} f_arg()[0] === undefined. Actual: ' + (f_arg()[0])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T2.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T2.js new file mode 100644 index 0000000000..755fc4d844 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.1_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : ()" +es5id: 11.2.4_A1.1_T2 +description: Function is declared with FormalParameterList +---*/ + +function f_arg(x,y) { + return arguments; +} + +//CHECK#1 +if (f_arg().length !== 0) { + throw new Test262Error('#1: function f_arg(x,y) {return arguments;} f_arg().length === 0. Actual: ' + (f_arg().length)); +} + +//CHECK#2 +if (f_arg()[0] !== undefined) { + throw new Test262Error('#2: function f_arg(x,y) {return arguments;} f_arg()[0] === undefined. Actual: ' + (f_arg()[0])); +} + +//CHECK#3 +if (f_arg.length !== 2) { + throw new Test262Error('#3: function f_arg(x,y) {return arguments;} f_arg.length === 2. Actual: ' + (f_arg.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T1.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T1.js new file mode 100644 index 0000000000..2d1403fe4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : (ArgumentList)" +es5id: 11.2.4_A1.2_T1 +description: Function is declared with no FormalParameterList +---*/ + +var f_arg = function() { + return arguments; +} + +//CHECK#1 +if (f_arg(1,2,3).length !== 3) { + throw new Test262Error('#1: f_arg = function()() {return arguments;} f_arg(1,2,3).length === 3. Actual: ' + (f_arg(1,2,3).length)); +} + +//CHECK#2 +if (f_arg(1,2,3)[0] !== 1) { + throw new Test262Error('#1: f_arg = function()() {return arguments;} f_arg(1,2,3)[0] === 1. Actual: ' + (f_arg(1,2,3)[0])); +} + +//CHECK#3 +if (f_arg(1,2,3)[1] !== 2) { + throw new Test262Error('#3: f_arg = function()() {return arguments;} f_arg(1,2,3)[1] === 2. Actual: ' + (f_arg(1,2,3)[1])); +} + +//CHECK#4 +if (f_arg(1,2,3)[2] !== 3) { + throw new Test262Error('#4: f_arg = function()() {return arguments;} f_arg(1,2,3)[2] === 3. Actual: ' + (f_arg(1,2,3)[2])); +} + +//CHECK#5 +if (f_arg(1,2,3)[3] !== undefined) { + throw new Test262Error('#5: f_arg = function()() {return arguments;} f_arg(1,2,3)[3] === undefined. Actual: ' + (f_arg(1,2,3)[3])); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T2.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T2.js new file mode 100644 index 0000000000..d4301f9cc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.2_T2.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : (ArgumentList)" +es5id: 11.2.4_A1.2_T2 +description: Function is declared with FormalParameterList +---*/ + +var f_arg = function(x,y) { + return arguments; +} + +//CHECK#1 +if (f_arg(1,2,3).length !== 3) { + throw new Test262Error('#1: f_arg = function(x,y) {return arguments;} f_arg(1,2,3).length === 3. Actual: ' + (f_arg(1,2,3).length)); +} + +//CHECK#2 +if (f_arg(1)[0] !== 1) { + throw new Test262Error('#1: f_arg = function(x,y) {return arguments;} f_arg(1)[0] === 1. Actual: ' + (f_arg(1)[0])); +} + +//CHECK#3 +if (f_arg(1,2)[1] !== 2) { + throw new Test262Error('#3: f_arg = function(x,y) {return arguments;} f_arg(1,2)[1] === 2. Actual: ' + (f_arg(1,2)[1])); +} + +//CHECK#4 +if (f_arg(1,2,3)[2] !== 3) { + throw new Test262Error('#4: f_arg = function(x,y) {return arguments;} f_arg(1,2,3)[2] === 3. Actual: ' + (f_arg(1,2,3)[2])); +} + +//CHECK#5 +if (f_arg(1,2,3)[3] !== undefined) { + throw new Test262Error('#5: f_arg = function(x,y) {return arguments;} f_arg(1,2,3)[3] === undefined. Actual: ' + (f_arg(1,2,3)[3])); +} + +//CHECK#6 +if (f_arg.length !== 2) { + throw new Test262Error('#6: f_arg = function(x,y) {return arguments;} f_arg.length === 2. Actual: ' + (f_arg.length)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.3_T1.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.3_T1.js new file mode 100644 index 0000000000..a894cdfac7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.3_T1.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Arguments : (ArgumentList : ArgumentList,, AssignmentExpression) is a bad + syntax +es5id: 11.2.4_A1.3_T1 +description: incorrect syntax +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function f_arg() { +} + +f_arg(1,,2); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T1.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T1.js new file mode 100644 index 0000000000..5b48bfc64a --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : (ArgumentList : ArgumentList, AssignmentExpression)" +es5id: 11.2.4_A1.4_T1 +description: > + Return an internal list whose length is one greater than the + length of ArgumentList and whose items are the items of + ArgumentList, in order, followed at the end by + GetValue(AssignmentExpression), which is the last item of the new + list +flags: [noStrict] +---*/ + +function f_arg() { +} + +//CHECK#1 +f_arg(x=1,x); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T2.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T2.js new file mode 100644 index 0000000000..59e8029b32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : (ArgumentList : ArgumentList, AssignmentExpression)" +es5id: 11.2.4_A1.4_T2 +description: > + Return an internal list whose length is one greater than the + length of ArgumentList and whose items are the items of + ArgumentList, in order, followed at the end by + GetValue(AssignmentExpression), which is the last item of the new + list +---*/ + +function f_arg() { +} + +//CHECK#1 +try { + f_arg(x,x=1); + throw new Test262Error('#1.1: function f_arg() {} f_arg(x,x=1) throw ReferenceError. Actual: ' + (f_arg(x,x=1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: function f_arg() {} f_arg(x,x=1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T3.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T3.js new file mode 100644 index 0000000000..48b59cb038 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : (ArgumentList : ArgumentList, AssignmentExpression)" +es5id: 11.2.4_A1.4_T3 +description: > + Return an internal list whose length is one greater than the + length of ArgumentList and whose items are the items of + ArgumentList, in order, followed at the end by + GetValue(AssignmentExpression), which is the last item of the new + list +flags: [noStrict] +---*/ + +function f_arg(x,y,z) { + return z; +} + +//CHECK#1 +if (f_arg(x=1,y=x,x+y) !== 2) { + throw new Test262Error('#1: function f_arg(x,y,z) {return z;} f_arg(x=1,y=x,x+y) === 2. Actual: ' + (f_arg(x=1,y=x,x+y))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T4.js b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T4.js new file mode 100644 index 0000000000..c99e5f0f17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/S11.2.4_A1.4_T4.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Arguments : (ArgumentList : ArgumentList, AssignmentExpression)" +es5id: 11.2.4_A1.4_T4 +description: > + Return an internal list whose length is one greater than the + length of ArgumentList and whose items are the items of + ArgumentList, in order, followed at the end by + GetValue(AssignmentExpression), which is the last item of the new + list +---*/ + +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; + +function f_arg() { +} + +//CHECK#1 +try { + f_arg(x(),y()); + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; function f_arg() {} f_arg(x(),y()) throw "x". Actual: ' + (f_arg(x(),y()))); +} +catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First argument is evaluated first, and then second argument'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; function f_arg() {} f_arg(x(),y()) throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/browser.js b/js/src/tests/test262/language/expressions/call/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/call/eval-err-args.js b/js/src/tests/test262/language/expressions/call/eval-err-args.js new file mode 100644 index 0000000000..503c3d833b --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-err-args.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Error evaluating arguments list for direct eval +esid: sec-function-calls-runtime-semantics-evaluation +info: | + [...] + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + i. Let argList be ? ArgumentListEvaluation(Arguments). + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : AssignmentExpression + + 1. Let ref be the result of evaluating AssignmentExpression. + 2. Let arg be ? GetValue(ref). +---*/ + +assert.throws(ReferenceError, function() { + eval(unresolvable); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-first-arg.js b/js/src/tests/test262/language/expressions/call/eval-first-arg.js new file mode 100644 index 0000000000..35ddaa7b30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-first-arg.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If the eval function is called with some argument, then use a first + argument +es5id: 15.1.2.1_A1.2_T1 +description: eval("x = 1", "x = 2"), x equal 1, not 2 +---*/ + +//CHECK#1 +var x; +eval("x = 1", "x = 2"); +if (x !== 1) { + throw new Test262Error('#1: eval("x = 1", "x = 2"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-no-args.js b/js/src/tests/test262/language/expressions/call/eval-no-args.js new file mode 100644 index 0000000000..b6b39ff9cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-no-args.js @@ -0,0 +1,17 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Error evaluating arguments list for direct eval +esid: sec-function-calls-runtime-semantics-evaluation +info: | + [...] + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + i. Let argList be ? ArgumentListEvaluation(Arguments). + ii. If argList has no elements, return undefined. +---*/ + +assert.sameValue(eval(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-realm-indirect.js b/js/src/tests/test262/language/expressions/call/eval-realm-indirect.js new file mode 100644 index 0000000000..d2aed13a29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-realm-indirect.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +es6id: 12.3.4.1 +description: > + An eval function from another realm is not a candidate for direct eval +info: | + [...] + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + [...] +flags: [noStrict] +features: [cross-realm] +---*/ + +var x = 'outside'; +var result; + +(function() { + var eval = $262.createRealm().global.eval; + + eval('var x = "inside";'); + + result = x; +}()); + +assert.sameValue(result, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-spread-empty-leading.js b/js/src/tests/test262/language/expressions/call/eval-spread-empty-leading.js new file mode 100644 index 0000000000..e3170f8ad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-spread-empty-leading.js @@ -0,0 +1,43 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Direct eval call with empty leading spread. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + i. Let argList be ? ArgumentListEvaluation(Arguments). + ii. If argList has no elements, return undefined. + iii. Let evalText be the first element of argList. + ... + +features: [Symbol.iterator] +---*/ + +var nextCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + var i = nextCount++; + return {done: true, value: undefined}; + } + }; +}; + +var x = "global"; + +(function() { + var x = "local"; + eval(...iter, "x = 0;"); + assert.sameValue(x, 0); +})(); + +assert.sameValue(x, "global"); +assert.sameValue(nextCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-spread-empty-trailing.js b/js/src/tests/test262/language/expressions/call/eval-spread-empty-trailing.js new file mode 100644 index 0000000000..6827e2fc10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-spread-empty-trailing.js @@ -0,0 +1,43 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Direct eval call with empty trailing spread. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + i. Let argList be ? ArgumentListEvaluation(Arguments). + ii. If argList has no elements, return undefined. + iii. Let evalText be the first element of argList. + ... + +features: [Symbol.iterator] +---*/ + +var nextCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + var i = nextCount++; + return {done: true, value: undefined}; + } + }; +}; + +var x = "global"; + +(function() { + var x = "local"; + eval("x = 0;", ...iter); + assert.sameValue(x, 0); +})(); + +assert.sameValue(x, "global"); +assert.sameValue(nextCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-spread-empty.js b/js/src/tests/test262/language/expressions/call/eval-spread-empty.js new file mode 100644 index 0000000000..e2c513b11b --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-spread-empty.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Direct eval call with empty spread. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + i. Let argList be ? ArgumentListEvaluation(Arguments). + ii. If argList has no elements, return undefined. + ... + +features: [Symbol.iterator] +---*/ + +var nextCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + var i = nextCount++; + return {done: true, value: undefined}; + } + }; +}; + +var result = eval(...iter); + +assert.sameValue(result, undefined); +assert.sameValue(nextCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-spread.js b/js/src/tests/test262/language/expressions/call/eval-spread.js new file mode 100644 index 0000000000..dda111785a --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-spread.js @@ -0,0 +1,51 @@ +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Direct eval call with spread. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + i. Let argList be ? ArgumentListEvaluation(Arguments). + ii. If argList has no elements, return undefined. + iii. Let evalText be the first element of argList. + ... + +features: [Symbol.iterator] +---*/ + +var elements = [ + "x = 1;", + "x = 2;", +]; + +var nextCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + var i = nextCount++; + if (i < elements.length) { + return {done: false, value: elements[i]}; + } + return {done: true, value: undefined}; + } + }; +}; + +var x = "global"; + +(function() { + var x = "local"; + eval(...iter); + assert.sameValue(x, 1); +})(); + +assert.sameValue(x, "global"); +assert.sameValue(nextCount, 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-strictness-inherit-non-strict.js b/js/src/tests/test262/language/expressions/call/eval-strictness-inherit-non-strict.js new file mode 100644 index 0000000000..a2d6eef814 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-strictness-inherit-non-strict.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Evaluated code honors the strictness of the calling context +esid: sec-function-calls-runtime-semantics-evaluation +info: | + [...] + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + [...] + iv. If the source code matching this CallExpression is strict code, + let strictCaller be true. Otherwise let strictCaller be false. + [...] +flags: [noStrict] +---*/ + +var count = 0; + +eval('var static; count += 1;'); + +assert.sameValue(count, 1); + +eval('with ({}) {} count += 1;'); + +assert.sameValue(count, 2); + +eval('unresolvable = null; count += 1;'); + +assert.sameValue(count, 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/eval-strictness-inherit-strict-strict.js b/js/src/tests/test262/language/expressions/call/eval-strictness-inherit-strict-strict.js new file mode 100644 index 0000000000..ef5e77f992 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/eval-strictness-inherit-strict-strict.js @@ -0,0 +1,31 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Evaluated code honors the strictness of the calling context +esid: sec-function-calls-runtime-semantics-evaluation +info: | + [...] + 3. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + [...] + iv. If the source code matching this CallExpression is strict code, + let strictCaller be true. Otherwise let strictCaller be false. + [...] +flags: [onlyStrict] +---*/ + +assert.throws(SyntaxError, function() { + eval('var static;'); +}); + +assert.throws(SyntaxError, function() { + eval('with ({}) {}'); +}); + +assert.throws(ReferenceError, function() { + eval('unresolvable = null;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/scope-lex-close.js b/js/src/tests/test262/language/expressions/call/scope-lex-close.js new file mode 100644 index 0000000000..a8d3e0ec67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/scope-lex-close.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-ecmascript-function-objects-call-thisargument-argumentslist +description: > + Removal of lexical environment for the function parameters and body +info: | + [...] + 3. Let callerContext be the running execution context. + [...] + 8. Remove calleeContext from the execution context stack and restore + callerContext as the running execution context. + [...] +features: [let] +---*/ + +var probe; + +// This test intentionally elides parameter expressions because their presence +// triggers the creation of an additional LexicalEnvironment dedicated to the +// function body (see sec-functiondeclarationinstantiation) +(function() { + let x = 'inside'; + probe = function() { return x; }; +}()); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/scope-lex-open.js b/js/src/tests/test262/language/expressions/call/scope-lex-open.js new file mode 100644 index 0000000000..3000974cfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/scope-lex-open.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-ecmascript-function-objects-call-thisargument-argumentslist +description: > + Creation of new variable environment for the function parameters and body + (as distinct from that for the function's BindingIdentifier) +info: | + [...] + 3. Let callerContext be the running execution context. + 4. Let calleeContext be PrepareForOrdinaryCall(F, undefined). + [...] + + 9.2.1.1 PrepareForOrdinaryCall + + [...] + 8. Let localEnv be NewFunctionEnvironment(F, newTarget). + 9. Set the LexicalEnvironment of calleeContext to localEnv. + 10. Set the VariableEnvironment of calleeContext to localEnv. + [...] +features: [let] +---*/ + +var n = 'outside'; +var probeBefore = function() { return n; }; +var probeInside; + +// This test intentionally elides parameter expressions because their presence +// triggers the creation of an additional LexicalEnvironment dedicated to the +// function body (see sec-functiondeclarationinstantiation) +var func = function n() { + let n = 'inside'; + probeInside = function() { return n; }; +}; + +func(); + +assert.sameValue(probeBefore(), 'outside'); +assert.sameValue(probeInside(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/scope-var-close.js b/js/src/tests/test262/language/expressions/call/scope-var-close.js new file mode 100644 index 0000000000..a909c50c38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/scope-var-close.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-prepareforordinarycall +description: > + Removal of variable environment for the function parameters and body +info: | + [...] + 3. Let callerContext be the running execution context. + [...] + 8. Remove calleeContext from the execution context stack and restore + callerContext as the running execution context. + [...] +---*/ + +var probe; + +// This test intentionally elides parameter expressions because their presence +// triggers the creation of an additional LexicalEnvironment dedicated to the +// function body (see sec-functiondeclarationinstantiation) +(function() { + var x = 'inside'; + probe = function() { return x; }; +}()); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/scope-var-open.js b/js/src/tests/test262/language/expressions/call/scope-var-open.js new file mode 100644 index 0000000000..6bb7923874 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/scope-var-open.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-prepareforordinarycall +description: > + Creation of new variable environment for the function parameters and body + (as distinct from that for the function's BindingIdentifier) +info: | + [...] + 3. Let callerContext be the running execution context. + 4. Let calleeContext be PrepareForOrdinaryCall(F, undefined). + [...] + + 9.2.1.1 PrepareForOrdinaryCall + + [...] + 8. Let localEnv be NewFunctionEnvironment(F, newTarget). + 9. Set the LexicalEnvironment of calleeContext to localEnv. + 10. Set the VariableEnvironment of calleeContext to localEnv. + [...] +---*/ + +var n = 'outside'; +var probeBefore = function() { return n; }; +var probeBody; + +// This test intentionally elides parameter expressions because their presence +// triggers the creation of an additional LexicalEnvironment dedicated to the +// function body (see sec-functiondeclarationinstantiation) +var func = function n() { + // The initializer is intentionally omitted from the following + // VariableStatement in order to demonstrate that a new binding is created + // (and not simply re-used from the FunctionExpression's BindingIdentifier). + var n; + probeBody = function() { return n; }; +}; + +func(); + +assert.sameValue(probeBefore(), 'outside'); +assert.sameValue(probeBody(), undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/shell.js b/js/src/tests/test262/language/expressions/call/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-expr-throws.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-expr-throws.js new file mode 100644 index 0000000000..e42e013412 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-expr-throws.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-expr-throws.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator following other arguments when evaluation throws (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + +---*/ + +assert.throws(Test262Error, function() { + (function() {}(0, ...function*() { throw new Test262Error(); }())); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-iter-get-value.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-iter-get-value.js new file mode 100644 index 0000000000..eda037f6e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-iter-get-value.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-iter-get-value.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + return null; + } +}); + +assert.throws(TypeError, function() { + (function() {}(0, ...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-call.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-call.js new file mode 100644 index 0000000000..d7a7771faf --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-call.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-call.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + (function() {}(0, ...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-get.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-get.js new file mode 100644 index 0000000000..4ca69e16c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-get-get.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-get.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + (function() {}(0, ...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-step.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-step.js new file mode 100644 index 0000000000..636f5ffef0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-step.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-step.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator following other arguments when IteratorStep fails (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + (function() {}(0, ...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-value.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-value.js new file mode 100644 index 0000000000..394b332c21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-itr-value.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-value.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator following other arguments when IteratorValue fails (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +assert.throws(Test262Error, function() { + (function() {}(0, ...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-obj-unresolvable.js new file mode 100644 index 0000000000..1bc06fba13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-obj-unresolvable.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-obj-unresolvable.case +// - src/spread/error/call-expr.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +assert.throws(ReferenceError, function() { + (function() {}({a: 0, ...unresolvableReference})); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-mult-err-unresolvable.js b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-unresolvable.js new file mode 100644 index 0000000000..308d9e9e98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-mult-err-unresolvable.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-unresolvable.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator following other arguments when reference is unresolvable (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +assert.throws(ReferenceError, function() { + (function() {}(0, ...unresolvableReference)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-expr-throws.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-expr-throws.js new file mode 100644 index 0000000000..a049c7fe9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-expr-throws.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-expr-throws.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator applied to the only argument when evaluation throws (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). +---*/ + +assert.throws(Test262Error, function() { + (function() {}(...function*() { throw new Test262Error(); }())); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-call.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-call.js new file mode 100644 index 0000000000..7dccf2c30d --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-call.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-call.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + (function() {}(...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-get.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-get.js new file mode 100644 index 0000000000..4ecbb002f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-get.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-get.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + (function() {}(...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-value.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-value.js new file mode 100644 index 0000000000..11f19b5cb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-get-value.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-value.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return null; +}; + +assert.throws(TypeError, function() { + (function() {}(...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-step.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-step.js new file mode 100644 index 0000000000..63c664c851 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-step.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-step.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator applied to the only argument when IteratorStep fails (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + (function() {}(...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-value.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-value.js new file mode 100644 index 0000000000..7081c47341 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-itr-value.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-value.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator applied to the only argument when IteratorValue fails (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +assert.throws(Test262Error, function() { + (function() {}(...iter)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-obj-unresolvable.js new file mode 100644 index 0000000000..7bc51739c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-obj-unresolvable.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-obj-unresolvable.case +// - src/spread/error/call-expr.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +assert.throws(ReferenceError, function() { + (function() {}({...unresolvableReference})); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-unresolvable.js b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-unresolvable.js new file mode 100644 index 0000000000..a60fbc21fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-err-sngl-err-unresolvable.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-unresolvable.case +// - src/spread/error/call-expr.template +/*--- +description: Spread operator applied to the only argument when reference is unresolvable (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +assert.throws(ReferenceError, function() { + (function() {}(...unresolvableReference)); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-mult-empty.js b/js/src/tests/test262/language/expressions/call/spread-mult-empty.js new file mode 100644 index 0000000000..861d8693de --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-mult-empty.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-empty.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator following other arguments when no iteration occurs (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + callCount += 1; +}(1, 2, 3, ...[])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-mult-expr.js b/js/src/tests/test262/language/expressions/call/spread-mult-expr.js new file mode 100644 index 0000000000..798995f0d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-mult-expr.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-expr.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ +var source = [3, 4, 5]; +var target; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + assert.sameValue(target, source); + callCount += 1; +}(1, 2, ...target = source)); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-mult-iter.js b/js/src/tests/test262/language/expressions/call/spread-mult-iter.js new file mode 100644 index 0000000000..5d18397928 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-mult-iter.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-iter.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator following other arguments with a valid iterator (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 3; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 6, value: nextCount }; + } + }; +}; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + callCount += 1; +}(1, 2, 3, ...iter)); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-mult-literal.js b/js/src/tests/test262/language/expressions/call/spread-mult-literal.js new file mode 100644 index 0000000000..df90339f58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-mult-literal.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-literal.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 5); + assert.sameValue(arguments[1], 6); + assert.sameValue(arguments[2], 7); + assert.sameValue(arguments[3], 8); + assert.sameValue(arguments[4], 9); + callCount += 1; +}(5, ...[6, 7, 8], 9)); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-mult-obj-ident.js b/js/src/tests/test262/language/expressions/call/spread-mult-obj-ident.js new file mode 100644 index 0000000000..96c427788c --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-mult-obj-ident.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-ident.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread operator following other properties (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 4); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; +}({a: 1, b: 2, ...o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-mult-obj-null.js b/js/src/tests/test262/language/expressions/call/spread-mult-obj-null.js new file mode 100644 index 0000000000..f4e6d6205e --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-mult-obj-null.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-null.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread operator following other arguments with null value (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}({a: 1, b: 2, ...null})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-mult-obj-undefined.js b/js/src/tests/test262/language/expressions/call/spread-mult-obj-undefined.js new file mode 100644 index 0000000000..5f11f31fc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-mult-obj-undefined.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-undefined.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread operator following other arguments with undefined (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}({a: 1, b: 2, ...undefined})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-getter-descriptor.js b/js/src/tests/test262/language/expressions/call/spread-obj-getter-descriptor.js new file mode 100644 index 0000000000..f031a17353 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-getter-descriptor.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-descriptor.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operation with getter results in data property descriptor (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = { + get a() { + return 42; + } +}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 42 + }); + callCount += 1; +}({...o, c: 4, d: 5})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-getter-init.js b/js/src/tests/test262/language/expressions/call/spread-obj-getter-init.js new file mode 100644 index 0000000000..b27f475c55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-getter-init.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-init.case +// - src/spread/default/call-expr.template +/*--- +description: Getter in object literal is not evaluated (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] +---*/ + +let o = {a: 2, b: 3}; +let executedGetter = false; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(executedGetter, false) + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...o, get c() { executedGetter = true; }})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-manipulate-outter-obj-in-getter.js b/js/src/tests/test262/language/expressions/call/spread-obj-manipulate-outter-obj-in-getter.js new file mode 100644 index 0000000000..1b100cfcd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-manipulate-outter-obj-in-getter.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-manipulate-outter-obj-in-getter.case +// - src/spread/default/call-expr.template +/*--- +description: Getter manipulates outter object before it's spread operation (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var o = { a: 0, b: 1 }; +var cthulhu = { get x() { + delete o.a; + o.b = 42; + o.c = "ni"; +}}; + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.hasOwnProperty("a"), false); + assert.sameValue(obj.b, 42); + assert.sameValue(obj.c, "ni"); + assert(obj.hasOwnProperty("x")); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...cthulhu, ...o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-mult-spread-getter.js b/js/src/tests/test262/language/expressions/call/spread-obj-mult-spread-getter.js new file mode 100644 index 0000000000..8969cdbacd --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-mult-spread-getter.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread-getter.case +// - src/spread/default/call-expr.template +/*--- +description: Multiple Object Spread usage calls getter multiple times (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let getterCallCount = 0; +let o = { + get a() { + return ++getterCallCount; + } +}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...o, c: 4, d: 5, a: 42, ...o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-mult-spread.js b/js/src/tests/test262/language/expressions/call/spread-obj-mult-spread.js new file mode 100644 index 0000000000..7b2f403475 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-mult-spread.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread.case +// - src/spread/default/call-expr.template +/*--- +description: Multiple Object Spread operation (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +let o = {a: 2, b: 3}; +let o2 = {c: 4, d: 5}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 4); + callCount += 1; +}({...o, ...o2})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-null.js b/js/src/tests/test262/language/expressions/call/spread-obj-null.js new file mode 100644 index 0000000000..d4c262d21f --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-null.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-null.case +// - src/spread/default/call-expr.template +/*--- +description: Null Object Spread is ignored (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}({...null})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-override-immutable.js b/js/src/tests/test262/language/expressions/call/spread-obj-override-immutable.js new file mode 100644 index 0000000000..1b2a9ea4e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-override-immutable.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-override-immutable.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread overriding immutable properties (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] +---*/ + +let o = {b: 2}; +Object.defineProperty(o, "a", {value: 1, enumerable: true, writable: false, configurable: true}); + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 3) + assert.sameValue(obj.b, 2); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount += 1; +}({...o, a: 3})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-overrides-prev-properties.js b/js/src/tests/test262/language/expressions/call/spread-obj-overrides-prev-properties.js new file mode 100644 index 0000000000..691d5250a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-overrides-prev-properties.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-overrides-prev-properties.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread properties overrides previous definitions (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(Object.keys(obj).length, 2); + assert.sameValue(o.a, 2); + assert.sameValue(o.b, 3); + callCount += 1; +}({a: 1, b: 7, ...o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/call/spread-obj-skip-non-enumerable.js new file mode 100644 index 0000000000..4db7f6215d --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-skip-non-enumerable.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-skip-non-enumerable.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread doesn't copy non-enumerable properties (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] +---*/ + +let o = {}; +Object.defineProperty(o, "b", {value: 3, enumerable: false}); + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.hasOwnProperty("b"), false) + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}({...o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-spread-order.js b/js/src/tests/test262/language/expressions/call/spread-obj-spread-order.js new file mode 100644 index 0000000000..e0136c6593 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-spread-order.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-spread-order.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operation follows [[OwnPropertyKeys]] order (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol, object-spread] +flags: [generated] +includes: [compareArray.js] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var calls = []; +var o = { get z() { calls.push('z') }, get a() { calls.push('a') } }; +Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true }); +Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true }); + + +var callCount = 0; + +(function(obj) { + assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-symbol-property.js b/js/src/tests/test262/language/expressions/call/spread-obj-symbol-property.js new file mode 100644 index 0000000000..c762f28ebe --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-symbol-property.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-symbol-property.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operation where source object contains Symbol properties (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol, object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let symbol = Symbol('foo'); +let o = {}; +o[symbol] = 1; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj[symbol], 1); + assert(Object.prototype.hasOwnProperty.call(obj, symbol), "symbol is an own property"); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}({...o, c: 4, d: 5})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-undefined.js b/js/src/tests/test262/language/expressions/call/spread-obj-undefined.js new file mode 100644 index 0000000000..34dd799ef5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-undefined.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-undefined.case +// - src/spread/default/call-expr.template +/*--- +description: Undefined Object Spread is ignored (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}({...undefined})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-obj-with-overrides.js b/js/src/tests/test262/language/expressions/call/spread-obj-with-overrides.js new file mode 100644 index 0000000000..cfb06917cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-obj-with-overrides.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-with-overrides.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread properties being overriden (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol, object-spread] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3, c: 4, e: undefined, f: null, g: false}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 7); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert(obj.hasOwnProperty("e")); + assert.sameValue(obj.f, null); + assert.sameValue(obj.g, false); + assert.sameValue(obj.h, -0); + assert.sameValue(obj.i.toString(), "Symbol(foo)"); + assert(Object.is(obj.j, o)); + assert.sameValue(Object.keys(obj).length, 10); + callCount += 1; +}({...o, a: 1, b: 7, d: 5, h: -0, i: Symbol("foo"), j: o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-sngl-empty.js b/js/src/tests/test262/language/expressions/call/spread-sngl-empty.js new file mode 100644 index 0000000000..e0c749c760 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-sngl-empty.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-empty.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator applied to the only argument when no iteration occurs (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + [...] +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 0); + callCount += 1; +}(...[])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-sngl-expr.js b/js/src/tests/test262/language/expressions/call/spread-sngl-expr.js new file mode 100644 index 0000000000..1d5d2f409e --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-sngl-expr.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-expr.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator applied to AssignmentExpression as only element (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var source = [2, 3, 4]; +var target; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 2); + assert.sameValue(arguments[1], 3); + assert.sameValue(arguments[2], 4); + assert.sameValue(target, source); + callCount += 1; +}(...target = source)); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-sngl-iter.js b/js/src/tests/test262/language/expressions/call/spread-sngl-iter.js new file mode 100644 index 0000000000..2902597cf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-sngl-iter.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-iter.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator applied to the only argument with a valid iterator (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 0; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 3, value: nextCount }; + } + }; +}; + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + callCount += 1; +}(...iter)); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-sngl-literal.js b/js/src/tests/test262/language/expressions/call/spread-sngl-literal.js new file mode 100644 index 0000000000..57b9cc418b --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-sngl-literal.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-literal.case +// - src/spread/default/call-expr.template +/*--- +description: Spread operator applied to array literal as only element (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +flags: [generated] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ + +var callCount = 0; + +(function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 3); + assert.sameValue(arguments[1], 4); + assert.sameValue(arguments[2], 5); + callCount += 1; +}(...[3, 4, 5])); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/spread-sngl-obj-ident.js b/js/src/tests/test262/language/expressions/call/spread-sngl-obj-ident.js new file mode 100644 index 0000000000..994dab059d --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/spread-sngl-obj-ident.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-obj-ident.case +// - src/spread/default/call-expr.template +/*--- +description: Object Spread operator without other arguments (CallExpression) +esid: sec-function-calls-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + CallExpression : MemberExpression Arguments + + [...] + 9. Return EvaluateDirectCall(func, thisValue, Arguments, tailCall). + + 12.3.4.3 Runtime Semantics: EvaluateDirectCall + + 1. Let argList be ArgumentListEvaluation(arguments). + [...] + 6. Let result be Call(func, thisValue, argList). + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +(function(obj) { + assert.sameValue(Object.keys(obj).length, 2); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; +}({...o})); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/tco-call-args-strict.js b/js/src/tests/test262/language/expressions/call/tco-call-args-strict.js new file mode 100644 index 0000000000..0cfa383888 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/tco-call-args-strict.js @@ -0,0 +1,24 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + function getF() { return f; } + return getF()(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/tco-member-args-strict.js b/js/src/tests/test262/language/expressions/call/tco-member-args-strict.js new file mode 100644 index 0000000000..46490813ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/tco-member-args-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/tco-non-eval-function-dynamic.js b/js/src/tests/test262/language/expressions/call/tco-non-eval-function-dynamic.js new file mode 100644 index 0000000000..55d442a5b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/tco-non-eval-function-dynamic.js @@ -0,0 +1,47 @@ +// |reftest| skip -- tail-call-optimization is not supported +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Tail-call with identifier named "eval" in function environment, local "eval" binding dynamically added. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 6. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + ... + ... + 9. Return ? EvaluateCall(func, ref, arguments, tailCall). + + 12.3.4.2 Runtime Semantics: EvaluateCall( func, ref, arguments, tailPosition ) + ... + 7. If tailPosition is true, perform PrepareForTailCall(). + 8. Let result be Call(func, thisValue, argList). + ... + +flags: [noStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; + +(function() { + function f(n) { + "use strict"; + if (n === 0) { + callCount += 1 + return; + } + return eval(n - 1); + } + eval("var eval = f;"); + f($MAX_ITERATIONS); +})(); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/tco-non-eval-function.js b/js/src/tests/test262/language/expressions/call/tco-non-eval-function.js new file mode 100644 index 0000000000..1d704f4494 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/tco-non-eval-function.js @@ -0,0 +1,47 @@ +// |reftest| skip -- tail-call-optimization is not supported +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Tail-call with identifier named "eval" in function environment. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 6. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + ... + ... + 9. Return ? EvaluateCall(func, ref, arguments, tailCall). + + 12.3.4.2 Runtime Semantics: EvaluateCall( func, ref, arguments, tailPosition ) + ... + 7. If tailPosition is true, perform PrepareForTailCall(). + 8. Let result be Call(func, thisValue, argList). + ... + +flags: [noStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; + +(function() { + function f(n) { + "use strict"; + if (n === 0) { + callCount += 1 + return; + } + return eval(n - 1); + } + var eval = f; + f($MAX_ITERATIONS); +})(); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/tco-non-eval-global.js b/js/src/tests/test262/language/expressions/call/tco-non-eval-global.js new file mode 100644 index 0000000000..9587c817b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/tco-non-eval-global.js @@ -0,0 +1,46 @@ +// |reftest| skip -- tail-call-optimization is not supported +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Tail-call with identifier named "eval" in global environment. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 6. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + ... + ... + 9. Return ? EvaluateCall(func, ref, arguments, tailCall). + + 12.3.4.2 Runtime Semantics: EvaluateCall( func, ref, arguments, tailPosition ) + ... + 7. If tailPosition is true, perform PrepareForTailCall(). + 8. Let result be Call(func, thisValue, argList). + ... + +flags: [noStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; + +function f(n) { + "use strict"; + if (n === 0) { + callCount += 1 + return; + } + return eval(n - 1); +} +eval = f; + +f($MAX_ITERATIONS); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/tco-non-eval-with.js b/js/src/tests/test262/language/expressions/call/tco-non-eval-with.js new file mode 100644 index 0000000000..3535cc7a33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/tco-non-eval-with.js @@ -0,0 +1,49 @@ +// |reftest| skip -- tail-call-optimization is not supported +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +description: > + Tail-call with identifier named "eval" in object environment. +info: | + 12.3.4.1 Runtime Semantics: Evaluation + ... + 6. If Type(ref) is Reference and IsPropertyReference(ref) is false and + GetReferencedName(ref) is "eval", then + a. If SameValue(func, %eval%) is true, then + ... + ... + 9. Return ? EvaluateCall(func, ref, arguments, tailCall). + + 12.3.4.2 Runtime Semantics: EvaluateCall( func, ref, arguments, tailPosition ) + ... + 7. If tailPosition is true, perform PrepareForTailCall(). + 8. Let result be Call(func, thisValue, argList). + ... + +flags: [noStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; + +var f, scope = {}; +with (scope) { + f = function (n) { + "use strict"; + if (n === 0) { + callCount += 1 + return; + } + return eval(n - 1); + } +} +scope.eval = f; + +f($MAX_ITERATIONS); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/trailing-comma.js b/js/src/tests/test262/language/expressions/call/trailing-comma.js new file mode 100644 index 0000000000..17ef0b1e46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/trailing-comma.js @@ -0,0 +1,14 @@ +// Copyright (C) 2016 Jeff Morrison. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Check that trailing commas are permitted after spread arguments + in a call expression. +info: http://jeffmo.github.io/es-trailing-function-commas/ +author: Jeff Morrison +---*/ + +function foo() {} +foo(...[],); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/call/with-base-obj.js b/js/src/tests/test262/language/expressions/call/with-base-obj.js new file mode 100644 index 0000000000..7997271ae5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/call/with-base-obj.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +es6id: 12.3.4.1 +description: Correct retrieval of environment's "with" base object +info: | + 4. If Type(ref) is Reference, then + a. If IsPropertyReference(ref) is true, then + [...] + b. Else the base of ref is an Environment Record, + i. Let refEnv be GetBase(ref). + ii. Let thisValue be refEnv.WithBaseObject(). + [...] + 8. Return ? EvaluateDirectCall(func, thisValue, Arguments, tailCall). +flags: [noStrict] +---*/ + +var viaMember, viaCall; +var obj = { + method: function() { + viaCall = this; + }, + get attribute() { + viaMember = this; + } +}; + +with (obj) { + method(); + attribute; +} + +assert.sameValue(viaCall, obj, 'via CallExpression'); +assert.sameValue(viaMember, obj, 'via MemberExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-in.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-in.js new file mode 100644 index 0000000000..1d482fbc9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-in.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +description: > + AssignmentExpression may contain `in` keyword regardless of outer context +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var empty = Object.create(null); +var C, value; + +for (C = class { get ['x' in empty]() { return 'via get'; } }; ; ) { + value = C.prototype.false; + break; +} + +assert.sameValue(value, 'via get'); + +for (C = class { set ['x' in empty](param) { value = param; } }; ; ) { + C.prototype.false = 'via set'; + break; +} + +assert.sameValue(value, 'via set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-yield-expr.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-yield-expr.js new file mode 100644 index 0000000000..f0eb25c066 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst-computed-yield-expr.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +description: > + The `yield` keyword behaves as a YieldExpression within a generator function +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +features: [generators] +---*/ + +var yieldSet, C, iter; +function* g() { + C = class { + get [yield]() { return 'get yield'; } + set [yield](param) { yieldSet = param; } + }; +} + +iter = g(); + +iter.next(); +iter.next('first'); +iter.next('second'); + +assert.sameValue(C.prototype.first, 'get yield'); + +C.prototype.second = 'set yield'; + +assert.sameValue(yieldSet, 'set yield'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/browser.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-evaluation.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-evaluation.js new file mode 100644 index 0000000000..a5c92a62db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-evaluation.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/cls-expr-inst.template +/*--- +description: Abrupt completion when evaluating expression (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ +var thrower = function() { + throw new Test262Error(); +}; + + +assert.throws(Test262Error, function() { + 0, class { + get [thrower()]() {} + }; +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + 0, class { + set [thrower()](_) {} + }; +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-to-prop-key.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-to-prop-key.js new file mode 100644 index 0000000000..c9ccf2ef2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-to-prop-key.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/cls-expr-inst.template +/*--- +description: Abrupt completion when coercing to property key value (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + + 7.1.14 ToPropertyKey + + 1. Let key be ? ToPrimitive(argument, hint String). + + 7.1.1 ToPrimitive + + [...] + 7. Return ? OrdinaryToPrimitive(input, hint). + + 7.1.1.1 OrdinaryToPrimitive + + 5. For each name in methodNames in List order, do + [...] + 6. Throw a TypeError exception. +---*/ +var badKey = Object.create(null); + + +assert.throws(TypeError, function() { + 0, class { + get [badKey]() {} + }; +}, '`get` accessor'); + +assert.throws(TypeError, function() { + 0, class { + set [badKey](_) {} + }; +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-unresolvable.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-unresolvable.js new file mode 100644 index 0000000000..e9666db9a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed-err-unresolvable.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/cls-expr-inst.template +/*--- +description: Abrupt completion when resolving reference value (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ + +assert.throws(ReferenceError, function() { + 0, class { + get [test262unresolvable]() {} + }; +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + 0, class { + set [test262unresolvable](_) {} + }; +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed.js new file mode 100644 index 0000000000..84f5de3e68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/computed.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 _; + + +var stringSet; + +var C = class { + get [_ = 'str' + 'ing']() { return 'get string'; } + set [_ = 'str' + 'ing'](param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['string'], 'get string'); + +C.prototype['string'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-binary.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-binary.js new file mode 100644 index 0000000000..837494e06e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-binary.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 0b10() { return 'get string'; } + set 0b10(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['2'], 'get string'); + +C.prototype['2'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-exponent.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-exponent.js new file mode 100644 index 0000000000..0196f964f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-exponent.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 1E+9() { return 'get string'; } + set 1E+9(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['1000000000'], 'get string'); + +C.prototype['1000000000'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-hex.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-hex.js new file mode 100644 index 0000000000..1a41d78eb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-hex.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 0x10() { return 'get string'; } + set 0x10(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['16'], 'get string'); + +C.prototype['16'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-leading-decimal.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..d43f586e60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-leading-decimal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get .1() { return 'get string'; } + set .1(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['0.1'], 'get string'); + +C.prototype['0.1'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-non-canonical.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-non-canonical.js new file mode 100644 index 0000000000..4ea405007c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-non-canonical.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 0.0000001() { return 'get string'; } + set 0.0000001(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['1e-7'], 'get string'); + +C.prototype['1e-7'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-octal.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-octal.js new file mode 100644 index 0000000000..dca95a346b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-octal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 0o10() { return 'get string'; } + set 0o10(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['8'], 'get string'); + +C.prototype['8'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-zero.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-zero.js new file mode 100644 index 0000000000..36c157b521 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-numeric-zero.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 0() { return 'get string'; } + set 0(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['0'], 'get string'); + +C.prototype['0'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-char-escape.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-char-escape.js new file mode 100644 index 0000000000..db660915bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-char-escape.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'character\tescape'() { return 'get string'; } + set 'character\tescape'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['character escape'], 'get string'); + +C.prototype['character escape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped-ext.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped-ext.js new file mode 100644 index 0000000000..453676688d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped-ext.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped-ext.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal 'default' w/ extended escape) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'def\u{61}ult'() { return 'get string'; } + set 'def\u{61}ult'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['default'], 'get string'); + +C.prototype['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped.js new file mode 100644 index 0000000000..bb01927558 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default-escaped.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal 'default' escaped) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'def\u0061ult'() { return 'get string'; } + set 'def\u0061ult'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['default'], 'get string'); + +C.prototype['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default.js new file mode 100644 index 0000000000..aac5cbfa61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-default.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal 'default') (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'default'() { return 'get string'; } + set 'default'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['default'], 'get string'); + +C.prototype['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-double-quote.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-double-quote.js new file mode 100644 index 0000000000..08de7faca5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-double-quote.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get "doubleQuote"() { return 'get string'; } + set "doubleQuote"(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype["doubleQuote"], 'get string'); + +C.prototype["doubleQuote"] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-empty.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-empty.js new file mode 100644 index 0000000000..3175f424b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-empty.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get ''() { return 'get string'; } + set ''(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype[''], 'get string'); + +C.prototype[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-hex-escape.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-hex-escape.js new file mode 100644 index 0000000000..ee2668caaa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-hex-escape.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'hex\x45scape'() { return 'get string'; } + set 'hex\x45scape'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['hexEscape'], 'get string'); + +C.prototype['hexEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-line-continuation.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-line-continuation.js new file mode 100644 index 0000000000..ce0813bade --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-line-continuation.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-line-continuation.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal containing LineContinuation) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'line\ +Continuation'() { return 'get string'; } + set 'line\ +Continuation'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['lineContinuation'], 'get string'); + +C.prototype['lineContinuation'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-single-quote.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-single-quote.js new file mode 100644 index 0000000000..6fdd147d90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-single-quote.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'singleQuote'() { return 'get string'; } + set 'singleQuote'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['singleQuote'], 'get string'); + +C.prototype['singleQuote'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-unicode-escape.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-unicode-escape.js new file mode 100644 index 0000000000..21a232d122 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-inst/literal-string-unicode-escape.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/cls-expr-inst.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class expression, instance method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments proto and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + get 'unicod\u{000065}Escape'() { return 'get string'; } + set 'unicod\u{000065}Escape'(param) { stringSet = param; } +}; + +assert.sameValue(C.prototype['unicodeEscape'], 'get string'); + +C.prototype['unicodeEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-inst/shell.js b/js/src/tests/test262/language/expressions/class/accessor-name-inst/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static-computed-in.js b/js/src/tests/test262/language/expressions/class/accessor-name-static-computed-in.js new file mode 100644 index 0000000000..445fb6ddf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static-computed-in.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +description: > + AssignmentExpression may contain `in` keyword regardless of outer context +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +---*/ + +var empty = Object.create(null); +var C, value; + +for (C = class { static get ['x' in empty]() { return 'via get'; } }; ; ) { + value = C.false; + break; +} + +assert.sameValue(value, 'via get'); + +for (C = class { static set ['x' in empty](param) { value = param; } }; ; ) { + C.false = 'via set'; + break; +} + +assert.sameValue(value, 'via set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static-computed-yield-expr.js b/js/src/tests/test262/language/expressions/class/accessor-name-static-computed-yield-expr.js new file mode 100644 index 0000000000..b6e45a59a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static-computed-yield-expr.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +description: > + The `yield` keyword behaves as a YieldExpression within a generator function +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +features: [generators] +---*/ + +var yieldSet, C, iter; +function* g() { + C = class { + static get [yield]() { return 'get yield'; } + static set [yield](param) { yieldSet = param; } + }; +} + +iter = g(); + +iter.next(); +iter.next('first'); +iter.next('second'); + +assert.sameValue(C.first, 'get yield'); + +C.second = 'set yield'; + +assert.sameValue(yieldSet, 'set yield'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/browser.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-evaluation.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-evaluation.js new file mode 100644 index 0000000000..670eca7bb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-evaluation.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/cls-expr-static.template +/*--- +description: Abrupt completion when evaluating expression (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ +var thrower = function() { + throw new Test262Error(); +}; + + +assert.throws(Test262Error, function() { + 0, class { + static get [thrower()]() {} + }; +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + 0, class { + static set [thrower()](_) {} + }; +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-to-prop-key.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-to-prop-key.js new file mode 100644 index 0000000000..f3e8425e42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-to-prop-key.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/cls-expr-static.template +/*--- +description: Abrupt completion when coercing to property key value (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + + 7.1.14 ToPropertyKey + + 1. Let key be ? ToPrimitive(argument, hint String). + + 7.1.1 ToPrimitive + + [...] + 7. Return ? OrdinaryToPrimitive(input, hint). + + 7.1.1.1 OrdinaryToPrimitive + + 5. For each name in methodNames in List order, do + [...] + 6. Throw a TypeError exception. +---*/ +var badKey = Object.create(null); + + +assert.throws(TypeError, function() { + 0, class { + static get [badKey]() {} + }; +}, '`get` accessor'); + +assert.throws(TypeError, function() { + 0, class { + static set [badKey](_) {} + }; +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-unresolvable.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-unresolvable.js new file mode 100644 index 0000000000..228eb04357 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed-err-unresolvable.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/cls-expr-static.template +/*--- +description: Abrupt completion when resolving reference value (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ + +assert.throws(ReferenceError, function() { + 0, class { + static get [test262unresolvable]() {} + }; +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + 0, class { + static set [test262unresolvable](_) {} + }; +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/computed.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed.js new file mode 100644 index 0000000000..ec951995c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/computed.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 _; + + +var stringSet; + +var C = class { + static get [_ = 'str' + 'ing']() { return 'get string'; } + static set [_ = 'str' + 'ing'](param) { stringSet = param; } +}; + +assert.sameValue(C['string'], 'get string'); + +C['string'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-binary.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-binary.js new file mode 100644 index 0000000000..c3ba7f2960 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-binary.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 0b10() { return 'get string'; } + static set 0b10(param) { stringSet = param; } +}; + +assert.sameValue(C['2'], 'get string'); + +C['2'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-exponent.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-exponent.js new file mode 100644 index 0000000000..32357b4e1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-exponent.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 1E+9() { return 'get string'; } + static set 1E+9(param) { stringSet = param; } +}; + +assert.sameValue(C['1000000000'], 'get string'); + +C['1000000000'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-hex.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-hex.js new file mode 100644 index 0000000000..f026315b35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-hex.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 0x10() { return 'get string'; } + static set 0x10(param) { stringSet = param; } +}; + +assert.sameValue(C['16'], 'get string'); + +C['16'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-leading-decimal.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..cc08f3ddca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-leading-decimal.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get .1() { return 'get string'; } + static set .1(param) { stringSet = param; } +}; + +assert.sameValue(C['0.1'], 'get string'); + +C['0.1'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-non-canonical.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-non-canonical.js new file mode 100644 index 0000000000..39e47c1181 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-non-canonical.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 0.0000001() { return 'get string'; } + static set 0.0000001(param) { stringSet = param; } +}; + +assert.sameValue(C['1e-7'], 'get string'); + +C['1e-7'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-octal.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-octal.js new file mode 100644 index 0000000000..b2c7ca1f1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-octal.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 0o10() { return 'get string'; } + static set 0o10(param) { stringSet = param; } +}; + +assert.sameValue(C['8'], 'get string'); + +C['8'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-zero.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-zero.js new file mode 100644 index 0000000000..9c35644e70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-numeric-zero.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 0() { return 'get string'; } + static set 0(param) { stringSet = param; } +}; + +assert.sameValue(C['0'], 'get string'); + +C['0'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-char-escape.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-char-escape.js new file mode 100644 index 0000000000..a06309695b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-char-escape.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'character\tescape'() { return 'get string'; } + static set 'character\tescape'(param) { stringSet = param; } +}; + +assert.sameValue(C['character escape'], 'get string'); + +C['character escape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped-ext.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped-ext.js new file mode 100644 index 0000000000..ed289ed715 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped-ext.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped-ext.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal 'default' w/ extended escape) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'def\u{61}ult'() { return 'get string'; } + static set 'def\u{61}ult'(param) { stringSet = param; } +}; + +assert.sameValue(C['default'], 'get string'); + +C['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped.js new file mode 100644 index 0000000000..23d77c253e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default-escaped.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal 'default' escaped) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'def\u0061ult'() { return 'get string'; } + static set 'def\u0061ult'(param) { stringSet = param; } +}; + +assert.sameValue(C['default'], 'get string'); + +C['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default.js new file mode 100644 index 0000000000..84a06533f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-default.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal 'default') (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'default'() { return 'get string'; } + static set 'default'(param) { stringSet = param; } +}; + +assert.sameValue(C['default'], 'get string'); + +C['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-double-quote.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-double-quote.js new file mode 100644 index 0000000000..c3a526570b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-double-quote.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get "doubleQuote"() { return 'get string'; } + static set "doubleQuote"(param) { stringSet = param; } +}; + +assert.sameValue(C["doubleQuote"], 'get string'); + +C["doubleQuote"] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-empty.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-empty.js new file mode 100644 index 0000000000..3feec726a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-empty.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get ''() { return 'get string'; } + static set ''(param) { stringSet = param; } +}; + +assert.sameValue(C[''], 'get string'); + +C[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-hex-escape.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-hex-escape.js new file mode 100644 index 0000000000..beec9cf6d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-hex-escape.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'hex\x45scape'() { return 'get string'; } + static set 'hex\x45scape'(param) { stringSet = param; } +}; + +assert.sameValue(C['hexEscape'], 'get string'); + +C['hexEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-line-continuation.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-line-continuation.js new file mode 100644 index 0000000000..9d31f74baa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-line-continuation.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-line-continuation.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal containing LineContinuation) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'line\ +Continuation'() { return 'get string'; } + static set 'line\ +Continuation'(param) { stringSet = param; } +}; + +assert.sameValue(C['lineContinuation'], 'get string'); + +C['lineContinuation'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-single-quote.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-single-quote.js new file mode 100644 index 0000000000..a96110be21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-single-quote.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'singleQuote'() { return 'get string'; } + static set 'singleQuote'(param) { stringSet = param; } +}; + +assert.sameValue(C['singleQuote'], 'get string'); + +C['singleQuote'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-unicode-escape.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-unicode-escape.js new file mode 100644 index 0000000000..848763813d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/accessor-name-static/literal-string-unicode-escape.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/cls-expr-static.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Class expression, static method) +esid: sec-runtime-semantics-classdefinitionevaluation +features: [class] +flags: [generated] +info: | + [...] + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + [...] + b. Else, + a. Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + + + 12.2.6.7 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 stringSet; + +var C = class { + static get 'unicod\u{000065}Escape'() { return 'get string'; } + static set 'unicod\u{000065}Escape'(param) { stringSet = param; } +}; + +assert.sameValue(C['unicodeEscape'], 'get string'); + +C['unicodeEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/accessor-name-static/shell.js b/js/src/tests/test262/language/expressions/class/accessor-name-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..18d651813a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/array-destructuring-param-strict-body.js @@ -0,0 +1,138 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-gen-meth-static.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static async *method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..cb0dbc30ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-binding-identifier.js new file mode 100644 index 0000000000..e3e77ae799 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..41b8c7147b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-identifier-reference.js new file mode 100644 index 0000000000..b23a831929 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..41a12db02a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-label-identifier.js new file mode 100644 index 0000000000..06d3af15ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/await-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-abrupt.js new file mode 100644 index 0000000000..f17f3d275b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-abrupt.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-async-gen-meth-static.template +/*--- +description: Abrupt completion returned by evaluation of initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var C = class { + static async *method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..2a3a5562f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,92 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-async-gen-meth-static.template +/*--- +description: Use of initializer when argument value is not `undefined` (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + static async *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(false, '', NaN, 0, null, obj).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..ef1e1a2b32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-arg-val-undefined.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-async-gen-meth-static.template +/*--- +description: Use of initializer when argument value is `undefined` (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + static async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(undefined, void 0).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-duplicates.js new file mode 100644 index 0000000000..65abb8af33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-duplicates.js @@ -0,0 +1,67 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-async-gen-meth-static.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, class { + static async *method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-later.js new file mode 100644 index 0000000000..6d665d047a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-later.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-async-gen-meth-static.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static async *method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-prior.js new file mode 100644 index 0000000000..8e6e10f9e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-prior.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-async-gen-meth-static.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static async *method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(3).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-self.js new file mode 100644 index 0000000000..740bb85ea7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-ref-self.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-async-gen-meth-static.template +/*--- +description: Referencing a parameter from within its own initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static async *method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-rest.js new file mode 100644 index 0000000000..cfd765922b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-rest.js @@ -0,0 +1,71 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-async-gen-meth-static.template +/*--- +description: RestParameter does not support an initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, class { + static async *method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..517ec7a733 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/dflt-params-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static async *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, undefined, 1).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..2ec73b6b23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template +/*--- +description: Forbidden extension, f.arguments (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + static async *method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..ece619e5c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/cls-expr-async-gen-meth-static-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + static async *method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..7c220efb23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static async *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..dda9f82e82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static async *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..81fab0dc85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/cls-expr-async-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static async *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..2467a34a7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/object-destructuring-param-strict-body.js @@ -0,0 +1,138 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-gen-meth-static.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static async *method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..ca607f5a4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-multiple.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static async *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, 39, 1).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-single.js new file mode 100644 index 0000000000..a3b75af329 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/params-trailing-comma-single.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-async-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static async *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, 39).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-param-strict-body.js new file mode 100644 index 0000000000..cf706d7220 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-param-strict-body.js @@ -0,0 +1,138 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-gen-meth-static.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static async *method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..e71309571f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/rest-params-trailing-comma-early-error.js @@ -0,0 +1,64 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-async-gen-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, class { + static async *method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..848d6e2303 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-binding-identifier.js new file mode 100644 index 0000000000..675f2b0765 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..985f0c11aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-identifier-reference.js new file mode 100644 index 0000000000..20327d4b46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..3e5569fd45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-label-identifier.js new file mode 100644 index 0000000000..c73d866f7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-gen-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..2915340212 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-identifier-spread-strict-strict.js @@ -0,0 +1,55 @@ +// |reftest| error:SyntaxError +'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-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-AsyncGeneratorMethod +features: [object-spread, async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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(); + }()), + } +}} + +var gen = C.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..2fd9c7eeae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-identifier-strict-strict.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +'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-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-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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(); + }()) +}} + +var gen = C.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-catch.js new file mode 100644 index 0000000000..5c1e7f40ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-catch.js @@ -0,0 +1,51 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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"; +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js new file mode 100644 index 0000000000..0ddf0f91eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-async-iterator.js @@ -0,0 +1,57 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield * [Promise.reject(value)] is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; + } +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js new file mode 100644 index 0000000000..ba8aa62ef4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-for-await-of-sync-iterator.js @@ -0,0 +1,56 @@ +// |reftest| async +// 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-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-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; + } +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js new file mode 100644 index 0000000000..f15658c275 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-async-iterator.js @@ -0,0 +1,55 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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(); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js new file mode 100644 index 0000000000..ca4525ad9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next-yield-star-sync-iterator.js @@ -0,0 +1,54 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next.js new file mode 100644 index 0000000000..c27d2c7d36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-promise-reject-next.js @@ -0,0 +1,51 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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"; +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..5b3687ddad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-multiple.js @@ -0,0 +1,57 @@ +// |reftest| async +// 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-method.template +/*--- +description: Use yield value in a array spread position (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassElement : + static MethodDefinition + + 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]; +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-single.js new file mode 100644 index 0000000000..f0559193f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-arr-single.js @@ -0,0 +1,56 @@ +// |reftest| async +// 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-method.template +/*--- +description: Use yield value in a array spread position (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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]; +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-obj.js new file mode 100644 index 0000000000..73e7b5d674 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-spread-obj.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-obj.case +// - src/async-generators/default/async-class-expr-static-method.template +/*--- +description: Use yield value in a object spread position (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [object-spread, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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, + }; +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-next.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-next.js new file mode 100644 index 0000000000..77006a1cce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-next.js @@ -0,0 +1,226 @@ +// |reftest| async +// 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-method.template +/*--- +description: Execution order for yield* with async iterator and next() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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"; + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-return.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-return.js new file mode 100644 index 0000000000..2516c2a72e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-return.js @@ -0,0 +1,242 @@ +// |reftest| async +// 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-method.template +/*--- +description: execution order for yield* with async iterator and return() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-throw.js new file mode 100644 index 0000000000..0d6cdc421e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-async-throw.js @@ -0,0 +1,250 @@ +// |reftest| async +// 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-method.template +/*--- +description: execution order for yield* with async iterator and throw() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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"; + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-expr-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-expr-abrupt.js new file mode 100644 index 0000000000..ab36902e14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-expr-abrupt.js @@ -0,0 +1,61 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting yield* operand (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js new file mode 100644 index 0000000000..8423d139da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-get-abrupt.js @@ -0,0 +1,81 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting [Symbol.asyncIterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js new file mode 100644 index 0000000000..0bea4fb881 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-boolean-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js new file mode 100644 index 0000000000..d639f47d22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-number-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js new file mode 100644 index 0000000000..70dd974ccb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-object-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js new file mode 100644 index 0000000000..c929f3f8ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-string-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js new file mode 100644 index 0000000000..50c5f612ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-not-callable-symbol-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js new file mode 100644 index 0000000000..f9e4844ad7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-null-sync-get-abrupt.js @@ -0,0 +1,86 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting @@iterator after null @@asyncIterator (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js new file mode 100644 index 0000000000..dc07a3ab87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-abrupt.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while calling [Symbol.asyncIterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js new file mode 100644 index 0000000000..1a595bfff9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-boolean-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - boolean (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js new file mode 100644 index 0000000000..a0e258e425 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-null-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - null (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js new file mode 100644 index 0000000000..5f1e760494 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-number-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - number (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js new file mode 100644 index 0000000000..8b72208062 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-string-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - string (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js new file mode 100644 index 0000000000..ccd4dd4443 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-symbol-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - symbol (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js new file mode 100644 index 0000000000..9454e665eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-returns-undefined-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - undefined (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js new file mode 100644 index 0000000000..8c361b1ede --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-async-undefined-sync-get-abrupt.js @@ -0,0 +1,86 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js new file mode 100644 index 0000000000..c4db55c988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-get-abrupt.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting [Symbol.iterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js new file mode 100644 index 0000000000..2f35228833 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-boolean-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js new file mode 100644 index 0000000000..87ce580b29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-number-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js new file mode 100644 index 0000000000..05bd91d537 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-object-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js new file mode 100644 index 0000000000..c79a527bdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-string-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js new file mode 100644 index 0000000000..944bd7b03b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-not-callable-symbol-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js new file mode 100644 index 0000000000..7b1224fcb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-abrupt.js @@ -0,0 +1,74 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while calling [Symbol.iterator] (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js new file mode 100644 index 0000000000..dcc5671a33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-boolean-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - boolean (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js new file mode 100644 index 0000000000..15a42cb2f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-null-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - null (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js new file mode 100644 index 0000000000..95b9e5b0fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-number-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - number (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js new file mode 100644 index 0000000000..ab2651614a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-string-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - string (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js new file mode 100644 index 0000000000..e9398720b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-symbol-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - symbol (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js new file mode 100644 index 0000000000..d2a4b81361 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-getiter-sync-returns-undefined-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - undefined (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js new file mode 100644 index 0000000000..0ecfce6ee1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-done-get-abrupt.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting done (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js new file mode 100644 index 0000000000..34327e9c8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-returns-abrupt.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while calling next (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js new file mode 100644 index 0000000000..12bcdc3a53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-call-value-get-abrupt.js @@ -0,0 +1,82 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting value (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-get-abrupt.js new file mode 100644 index 0000000000..cbfd49c469 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-get-abrupt.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting next (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js new file mode 100644 index 0000000000..d3b19be4ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-non-object-ignores-then.js @@ -0,0 +1,92 @@ +// |reftest| async +// 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-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-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js new file mode 100644 index 0000000000..0debc00d3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-boolean-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - boolean (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js new file mode 100644 index 0000000000..d4fa526281 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-null-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - null (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js new file mode 100644 index 0000000000..9534329e08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-number-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - number (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js new file mode 100644 index 0000000000..f8f3f30d4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-object-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - object (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js new file mode 100644 index 0000000000..cd023a3cb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-string-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - string (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js new file mode 100644 index 0000000000..8b32699f31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-symbol-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - symbol (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js new file mode 100644 index 0000000000..7ac924904b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-not-callable-undefined-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - undefined (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-get-abrupt.js new file mode 100644 index 0000000000..b2ff498c30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-get-abrupt.js @@ -0,0 +1,96 @@ +// |reftest| async +// 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-method.template +/*--- +description: Return abrupt after getting next().then (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js new file mode 100644 index 0000000000..37ad663120 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-boolean-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (boolean) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js new file mode 100644 index 0000000000..13d0bea58f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-null-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (null) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js new file mode 100644 index 0000000000..cf43777058 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-number-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (number) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js new file mode 100644 index 0000000000..9ae9c7c066 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-object-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (object) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js new file mode 100644 index 0000000000..b2698f6372 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-string-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (string) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js new file mode 100644 index 0000000000..9a207839b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-symbol-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (symbol) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js new file mode 100644 index 0000000000..233e347afe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-non-callable-undefined-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (undefined) (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js new file mode 100644 index 0000000000..1f779ab5d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-next-then-returns-abrupt.js @@ -0,0 +1,96 @@ +// |reftest| async +// 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-method.template +/*--- +description: Return abrupt after calling next().then (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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'); + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-next.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-next.js new file mode 100644 index 0000000000..81133c9bf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-next.js @@ -0,0 +1,229 @@ +// |reftest| async +// 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-method.template +/*--- +description: execution order for yield* with sync iterator and next() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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"; + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-return.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-return.js new file mode 100644 index 0000000000..4d531aa88b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-return.js @@ -0,0 +1,204 @@ +// |reftest| async +// 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-method.template +/*--- +description: execution order for yield* with sync iterator and return() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-throw.js new file mode 100644 index 0000000000..14af8af227 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method-static/yield-star-sync-throw.js @@ -0,0 +1,210 @@ +// |reftest| async +// 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-method.template +/*--- +description: execution order for yield* with sync iterator and throw() (Static async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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"; + +}} + +var gen = C.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-gen-method/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..c16ca08978 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/array-destructuring-param-strict-body.js @@ -0,0 +1,138 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-gen-meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + async *method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..e22f72fdbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-binding-identifier.js new file mode 100644 index 0000000000..8bf28e111d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier.case +// - src/async-generators/syntax/async-class-expr-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..f3a30e134b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-identifier-reference.js new file mode 100644 index 0000000000..259c5176a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference.case +// - src/async-generators/syntax/async-class-expr-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..8dd16b35de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-label-identifier.js new file mode 100644 index 0000000000..6f1c9dbbc5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/await-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier.case +// - src/async-generators/syntax/async-class-expr-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-abrupt.js new file mode 100644 index 0000000000..c10b79e716 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-abrupt.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-async-gen-meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var C = class { + async *method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..6bb0b08cfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,93 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-async-gen-meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + async *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(false, '', NaN, 0, null, obj).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..d8a13acfce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-arg-val-undefined.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-async-gen-meth.template +/*--- +description: Use of initializer when argument value is `undefined` (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(undefined, void 0).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-duplicates.js new file mode 100644 index 0000000000..004c935066 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-duplicates.js @@ -0,0 +1,67 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-async-gen-meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, class { + async *method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-later.js new file mode 100644 index 0000000000..1a285cb39e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-later.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-async-gen-meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + async *method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-prior.js new file mode 100644 index 0000000000..16a012d9b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-prior.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-async-gen-meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + async *method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(3).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-self.js new file mode 100644 index 0000000000..a3eaebb636 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-ref-self.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-async-gen-meth.template +/*--- +description: Referencing a parameter from within its own initializer (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + async *method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-rest.js new file mode 100644 index 0000000000..2f348a7ada --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-rest.js @@ -0,0 +1,71 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-async-gen-meth.template +/*--- +description: RestParameter does not support an initializer (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, class { + async *method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..52c4d3287d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/dflt-params-trailing-comma.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + async *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, undefined, 1).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..53f4575bfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template +/*--- +description: Forbidden extension, f.arguments (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + async *method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.prototype.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..92118097dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/cls-expr-async-gen-meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + async *method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.prototype.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..ab7c5b0f39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + async *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.prototype.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..233678f3ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + async *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.prototype.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..6d823b39f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/cls-expr-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, async-iteration, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + async *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.prototype.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-gen-method/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..b647a0b0b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/object-destructuring-param-strict-body.js @@ -0,0 +1,138 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-gen-meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + async *method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..dbd51bef6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-multiple.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + async *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, 39, 1).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-single.js new file mode 100644 index 0000000000..29b2e9692a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/params-trailing-comma-single.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-async-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + async *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, 39).next().then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-gen-method/rest-param-strict-body.js new file mode 100644 index 0000000000..40c6345951 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/rest-param-strict-body.js @@ -0,0 +1,138 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-gen-meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + async *method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/async-gen-method/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..dfdccd7ef6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/rest-params-trailing-comma-early-error.js @@ -0,0 +1,64 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-async-gen-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, class { + async *method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/shell.js b/js/src/tests/test262/language/expressions/class/async-gen-method/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..0109b987e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-binding-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-binding-identifier.js new file mode 100644 index 0000000000..bf0f427bff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-binding-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier.case +// - src/async-generators/syntax/async-class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..09ad53238d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-identifier-reference-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-identifier-reference.js new file mode 100644 index 0000000000..c86954afe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-identifier-reference.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference.case +// - src/async-generators/syntax/async-class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..a7c727dd3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-label-identifier-escaped.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-label-identifier.js new file mode 100644 index 0000000000..5db2d93e23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-as-label-identifier.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier.case +// - src/async-generators/syntax/async-class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-gen-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..def949e744 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-identifier-spread-strict-strict.js @@ -0,0 +1,55 @@ +// |reftest| error:SyntaxError +'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-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-AsyncGeneratorMethod +features: [object-spread, async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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(); + }()), + } +}} + +var gen = C.prototype.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..ae695c0bb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-identifier-strict-strict.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +'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-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-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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(); + }()) +}} + +var gen = C.prototype.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-catch.js new file mode 100644 index 0000000000..8fa4477142 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-catch.js @@ -0,0 +1,51 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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"; +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js new file mode 100644 index 0000000000..aee7324045 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js @@ -0,0 +1,57 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield * [Promise.reject(value)] is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; + } +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js new file mode 100644 index 0000000000..2720fce01d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js @@ -0,0 +1,56 @@ +// |reftest| async +// 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-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-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; + } +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js new file mode 100644 index 0000000000..787c3a5a40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js @@ -0,0 +1,55 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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(); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js new file mode 100644 index 0000000000..7aa5a731f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js @@ -0,0 +1,54 @@ +// |reftest| async +// 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-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next.js new file mode 100644 index 0000000000..33ce752493 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-promise-reject-next.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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"; +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..142075c441 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-multiple.js @@ -0,0 +1,57 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-multiple.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: Use yield value in a array spread position (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassElement : + MethodDefinition + + 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]; +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-single.js new file mode 100644 index 0000000000..837de17674 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-arr-single.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-single.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: Use yield value in a array spread position (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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]; +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-obj.js new file mode 100644 index 0000000000..4d167a826c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-spread-obj.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-obj.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: Use yield value in a object spread position (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [object-spread, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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, + }; +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-next.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-next.js new file mode 100644 index 0000000000..b7ea728c98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-next.js @@ -0,0 +1,226 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-next.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: Execution order for yield* with async iterator and next() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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"; + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-return.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-return.js new file mode 100644 index 0000000000..7576248cba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-return.js @@ -0,0 +1,242 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-return.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: execution order for yield* with async iterator and return() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-throw.js new file mode 100644 index 0000000000..5bd4d4cc46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-async-throw.js @@ -0,0 +1,250 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-throw.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: execution order for yield* with async iterator and throw() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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"; + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-expr-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-expr-abrupt.js new file mode 100644 index 0000000000..3a61489670 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-expr-abrupt.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-expr-abrupt.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: Abrupt completion while getting yield* operand (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-get-abrupt.js new file mode 100644 index 0000000000..81387bf277 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-get-abrupt.js @@ -0,0 +1,81 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting [Symbol.asyncIterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js new file mode 100644 index 0000000000..a498a74010 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js new file mode 100644 index 0000000000..0e58048378 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js new file mode 100644 index 0000000000..7d495eb60f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js new file mode 100644 index 0000000000..1d6ba763a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js new file mode 100644 index 0000000000..cb72ada25c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js new file mode 100644 index 0000000000..8c8c0c4427 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js @@ -0,0 +1,86 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js new file mode 100644 index 0000000000..22b3c7baa8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while calling [Symbol.asyncIterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js new file mode 100644 index 0000000000..f79209c84d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - boolean (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js new file mode 100644 index 0000000000..a4f4769014 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - null (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js new file mode 100644 index 0000000000..39acd5c11f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - number (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js new file mode 100644 index 0000000000..fe4731d99b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - string (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js new file mode 100644 index 0000000000..8d92764f68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - symbol (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js new file mode 100644 index 0000000000..ce9b638b74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - undefined (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js new file mode 100644 index 0000000000..2f6e003ed0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js @@ -0,0 +1,86 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js new file mode 100644 index 0000000000..f9b78d9c22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting [Symbol.iterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js new file mode 100644 index 0000000000..f060398336 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js new file mode 100644 index 0000000000..c51cf5d66b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js new file mode 100644 index 0000000000..89b2b3f481 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js new file mode 100644 index 0000000000..a90d40a75e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js new file mode 100644 index 0000000000..624f8b6290 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js new file mode 100644 index 0000000000..fa37104bd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js @@ -0,0 +1,74 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while calling [Symbol.iterator] (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js new file mode 100644 index 0000000000..ef6e916a0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - boolean (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js new file mode 100644 index 0000000000..4129a2a373 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - null (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js new file mode 100644 index 0000000000..48fc0e55b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - number (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js new file mode 100644 index 0000000000..b3503d3a59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - string (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js new file mode 100644 index 0000000000..c7182fe198 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - symbol (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js new file mode 100644 index 0000000000..ffff1ae489 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - undefined (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-done-get-abrupt.js new file mode 100644 index 0000000000..dedd64f520 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-done-get-abrupt.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting done (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-returns-abrupt.js new file mode 100644 index 0000000000..a88d30d709 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-returns-abrupt.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while calling next (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-value-get-abrupt.js new file mode 100644 index 0000000000..4e7160fb48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-call-value-get-abrupt.js @@ -0,0 +1,82 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting value (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-get-abrupt.js new file mode 100644 index 0000000000..d3d80b214d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-get-abrupt.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-method.template +/*--- +description: Abrupt completion while getting next (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-non-object-ignores-then.js new file mode 100644 index 0000000000..0f1633f1a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-non-object-ignores-then.js @@ -0,0 +1,92 @@ +// |reftest| async +// 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-method.template +/*--- +description: If next() value is not-object, do not access respective then property (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js new file mode 100644 index 0000000000..415b3e8d08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - boolean (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-null-throw.js new file mode 100644 index 0000000000..54fa6eb903 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-null-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - null (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-number-throw.js new file mode 100644 index 0000000000..e14b5344d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-number-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - number (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-object-throw.js new file mode 100644 index 0000000000..27e2884d58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-object-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - object (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-string-throw.js new file mode 100644 index 0000000000..619c164853 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-string-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - string (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js new file mode 100644 index 0000000000..0d7b32db5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - symbol (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js new file mode 100644 index 0000000000..36f13ff0f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js @@ -0,0 +1,69 @@ +// |reftest| async +// 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-method.template +/*--- +description: Not-callable next value in a yield star position - undefined (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-get-abrupt.js new file mode 100644 index 0000000000..3706079765 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-get-abrupt.js @@ -0,0 +1,96 @@ +// |reftest| async +// 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-method.template +/*--- +description: Return abrupt after getting next().then (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js new file mode 100644 index 0000000000..7dce6f24e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (boolean) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js new file mode 100644 index 0000000000..38c9568bdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (null) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js new file mode 100644 index 0000000000..02f3c40744 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (number) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js new file mode 100644 index 0000000000..ad2d5a8392 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (object) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js new file mode 100644 index 0000000000..62b8e3c3ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (string) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js new file mode 100644 index 0000000000..bf2fcff99f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (symbol) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js new file mode 100644 index 0000000000..96e88bd897 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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-method.template +/*--- +description: FulfillPromise if next().then is not-callable (undefined) (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-returns-abrupt.js new file mode 100644 index 0000000000..f034530c28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-next-then-returns-abrupt.js @@ -0,0 +1,96 @@ +// |reftest| async +// 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-method.template +/*--- +description: Return abrupt after calling next().then (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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'); + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-next.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-next.js new file mode 100644 index 0000000000..7c22dc28a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-next.js @@ -0,0 +1,229 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-next.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: execution order for yield* with sync iterator and next() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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"; + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-return.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-return.js new file mode 100644 index 0000000000..bb82e74a88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-return.js @@ -0,0 +1,204 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-return.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: execution order for yield* with sync iterator and return() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-throw.js b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-throw.js new file mode 100644 index 0000000000..a810a2cb18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-gen-method/yield-star-sync-throw.js @@ -0,0 +1,210 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-throw.case +// - src/async-generators/default/async-class-expr-method.template +/*--- +description: execution order for yield* with sync iterator and throw() (Async generator method as a ClassExpression element) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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"; + +}} + +var gen = C.prototype.gen; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-method-static/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..8f77cfc9cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/array-destructuring-param-strict-body.js @@ -0,0 +1,136 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-meth-static.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..80550b48a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-binding-identifier-escaped.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-method-static/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-binding-identifier.js new file mode 100644 index 0000000000..d09801447c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-binding-identifier.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-method-static/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..2c80f653fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-identifier-reference-escaped.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-method-static/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-identifier-reference.js new file mode 100644 index 0000000000..259d8880c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-identifier-reference.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-method-static/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..c7a17cb1f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-label-identifier-escaped.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-method-static/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-label-identifier.js new file mode 100644 index 0000000000..518a5ac331 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/await-as-label-identifier.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/async-method-static/browser.js b/js/src/tests/test262/language/expressions/class/async-method-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-abrupt.js new file mode 100644 index 0000000000..22b35a0196 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-abrupt.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-async-meth-static.template +/*--- +description: Abrupt completion returned by evaluation of initializer (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; + +var C = class { + static async method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +C.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, Test262Error)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..32116025b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,90 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-async-meth-static.template +/*--- +description: Use of initializer when argument value is not `undefined` (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + static async method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(false, '', NaN, 0, null, obj).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..ae581db2e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-arg-val-undefined.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-async-meth-static.template +/*--- +description: Use of initializer when argument value is `undefined` (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + static async method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(undefined, void 0).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-duplicates.js new file mode 100644 index 0000000000..10bcbf3660 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-duplicates.js @@ -0,0 +1,65 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-async-meth-static.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-later.js new file mode 100644 index 0000000000..fdbfb6e6a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-later.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-async-meth-static.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; + +var C = class { + static async method(x = y, y) { + + callCount = callCount + 1; + } +}; + +C.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-prior.js new file mode 100644 index 0000000000..2369313da7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-prior.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-async-meth-static.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static async method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(3).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-self.js new file mode 100644 index 0000000000..4106664cbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-ref-self.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-async-meth-static.template +/*--- +description: Referencing a parameter from within its own initializer (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; + +var C = class { + static async method(x = x) { + + callCount = callCount + 1; + } +}; + +C.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-rest.js new file mode 100644 index 0000000000..892b04cd31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-rest.js @@ -0,0 +1,69 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-async-meth-static.template +/*--- +description: RestParameter does not support an initializer (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..a678481d43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/dflt-params-trailing-comma.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-async-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static async method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, undefined, 1).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..c849102c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template +/*--- +description: Forbidden extension, f.arguments (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; + +var C = class { + static async method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..bed6c42916 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/cls-expr-async-meth-static-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; + +var C = class { + static async method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..f1e9a83ec7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; + +var C = class { + static async method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..39d3ed26e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; + +var C = class { + static async method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..2000c1018f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/cls-expr-async-meth-static-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; + +var C = class { + static async method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/async-method-static/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-method-static/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..ebee36b3e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/object-destructuring-param-strict-body.js @@ -0,0 +1,136 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-meth-static.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..9245a36899 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-multiple.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-async-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static async method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, 39, 1).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-single.js new file mode 100644 index 0000000000..5589610434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/params-trailing-comma-single.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-async-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static async method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +ref(42, 39).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-method-static/rest-param-strict-body.js new file mode 100644 index 0000000000..438c8cd629 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/rest-param-strict-body.js @@ -0,0 +1,136 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-meth-static.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/async-method-static/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..a3d2b167d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/rest-params-trailing-comma-early-error.js @@ -0,0 +1,61 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-async-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js new file mode 100644 index 0000000000..0bbe6ede08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow-returns-arguments-from-parent-function.js @@ -0,0 +1,41 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method; + +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/async-method-static/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow-returns-newtarget.js new file mode 100644 index 0000000000..a7895ab6bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow-returns-newtarget.js @@ -0,0 +1,40 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method; + +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/async-method-static/returns-async-arrow.js b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow.js new file mode 100644 index 0000000000..42514c802f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-arrow.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow.case +// - src/async-functions/evaluation/async-class-expr-static-method.template +/*--- +description: Async function returns an async function. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method; + +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/async-method-static/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function-returns-arguments-from-own-function.js new file mode 100644 index 0000000000..50c0bba57b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function-returns-arguments-from-own-function.js @@ -0,0 +1,41 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; }; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method; + +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/async-method-static/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function-returns-newtarget.js new file mode 100644 index 0000000000..dc0d0bbc0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function-returns-newtarget.js @@ -0,0 +1,40 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; }; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method; + +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/async-method-static/returns-async-function.js b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function.js new file mode 100644 index 0000000000..f33b386a7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method-static/returns-async-function.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function.case +// - src/async-functions/evaluation/async-class-expr-static-method.template +/*--- +description: Async function returns an async function. (Static async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + static MethodDefinition + + 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; }; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = C.method; + +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/async-method-static/shell.js b/js/src/tests/test262/language/expressions/class/async-method-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-method/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..b7af647a66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/array-destructuring-param-strict-body.js @@ -0,0 +1,136 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-method/await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..8b1ce1abc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/await-as-binding-identifier-escaped.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-method/await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/async-method/await-as-binding-identifier.js new file mode 100644 index 0000000000..18245342bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/await-as-binding-identifier.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier.case +// - src/async-functions/syntax/async-class-expr-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/async-method/await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..6b4d3299cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/await-as-identifier-reference-escaped.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-method/await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/async-method/await-as-identifier-reference.js new file mode 100644 index 0000000000..54e6da546d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/await-as-identifier-reference.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference.case +// - src/async-functions/syntax/async-class-expr-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/async-method/await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..208d403ff3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/await-as-label-identifier-escaped.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// 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-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-method/await-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/async-method/await-as-label-identifier.js new file mode 100644 index 0000000000..16b07d02fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/await-as-label-identifier.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier.case +// - src/async-functions/syntax/async-class-expr-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/async-method/browser.js b/js/src/tests/test262/language/expressions/class/async-method/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-abrupt.js new file mode 100644 index 0000000000..b49a7a666a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-abrupt.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-async-meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; +var C = class { + async method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +C.prototype.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, Test262Error)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..b76112ea38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,90 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-async-meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + async method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(false, '', NaN, 0, null, obj).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..72a0151adb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-arg-val-undefined.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-async-meth.template +/*--- +description: Use of initializer when argument value is `undefined` (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + async method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(undefined, void 0).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-duplicates.js new file mode 100644 index 0000000000..eacab00cef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-duplicates.js @@ -0,0 +1,65 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-async-meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-later.js new file mode 100644 index 0000000000..5b2e2ace41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-later.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-async-meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var C = class { + async method(x = y, y) { + + callCount = callCount + 1; + } +}; + +C.prototype.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-prior.js new file mode 100644 index 0000000000..1cbbad4cf2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-prior.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-async-meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + async method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(3).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-self.js new file mode 100644 index 0000000000..56c75ea73e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-ref-self.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-async-meth.template +/*--- +description: Referencing a parameter from within its own initializer (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var C = class { + async method(x = x) { + + callCount = callCount + 1; + } +}; + +C.prototype.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-rest.js new file mode 100644 index 0000000000..06a5ef0c87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-rest.js @@ -0,0 +1,69 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-async-meth.template +/*--- +description: RestParameter does not support an initializer (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..814e03ac10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/dflt-params-trailing-comma.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-async-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + async method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, undefined, 1).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..408fd2c230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template +/*--- +description: Forbidden extension, f.arguments (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var C = class { + async method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.prototype.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..3523c1ef45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/cls-expr-async-meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; +var C = class { + async method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.prototype.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..4607ba6fb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var C = class { + async method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.prototype.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..242ff4e296 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var C = class { + async method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.prototype.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..ae362e3dfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/cls-expr-async-meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template +/*--- +description: Forbidden extension, o.caller (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [arrow-function, async-functions, class] +flags: [generated, noStrict, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; +var C = class { + async method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.prototype.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/async-method/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/async-method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-method/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..2979b86fdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/object-destructuring-param-strict-body.js @@ -0,0 +1,136 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..e9c1b0f949 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-multiple.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-async-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + async method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, 39, 1).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-single.js new file mode 100644 index 0000000000..7faeb4c183 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/params-trailing-comma-single.js @@ -0,0 +1,64 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-async-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-functions] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + async method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +ref(42, 39).then(() => { + assert.sameValue(callCount, 1, 'method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/class/async-method/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/async-method/rest-param-strict-body.js new file mode 100644 index 0000000000..98b538a8e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/rest-param-strict-body.js @@ -0,0 +1,136 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-async-meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/async-method/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..9f74868b17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/rest-params-trailing-comma-early-error.js @@ -0,0 +1,61 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-async-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression async method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise + let strict be false. + 4. Let scope be the LexicalEnvironment of the running execution context. + 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, + scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +var C = class { + static async method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js new file mode 100644 index 0000000000..d330274e5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow-returns-arguments-from-parent-function.js @@ -0,0 +1,42 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; + } +}; +// 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/async-method/returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow-returns-newtarget.js new file mode 100644 index 0000000000..4ae8b1dcaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow-returns-newtarget.js @@ -0,0 +1,41 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; + } +}; +// 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/async-method/returns-async-arrow.js b/js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow.js new file mode 100644 index 0000000000..850f97912a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/returns-async-arrow.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow.case +// - src/async-functions/evaluation/async-class-expr-method.template +/*--- +description: Async function returns an async function. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; + } +}; +// 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/async-method/returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/expressions/class/async-method/returns-async-function-returns-arguments-from-own-function.js new file mode 100644 index 0000000000..592cfd9dd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/returns-async-function-returns-arguments-from-own-function.js @@ -0,0 +1,42 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; }; + } +}; +// 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/async-method/returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/expressions/class/async-method/returns-async-function-returns-newtarget.js new file mode 100644 index 0000000000..46733654f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/returns-async-function-returns-newtarget.js @@ -0,0 +1,41 @@ +// |reftest| async +// 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-method.template +/*--- +description: Async function returns an async function. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; }; + } +}; +// 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/async-method/returns-async-function.js b/js/src/tests/test262/language/expressions/class/async-method/returns-async-function.js new file mode 100644 index 0000000000..a5b3e51d1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/async-method/returns-async-function.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function.case +// - src/async-functions/evaluation/async-class-expr-method.template +/*--- +description: Async function returns an async function. (Async method as a ClassExpression element) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + ClassElement : + MethodDefinition + + 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; }; + } +}; +// 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/async-method/shell.js b/js/src/tests/test262/language/expressions/class/async-method/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/browser.js b/js/src/tests/test262/language/expressions/class/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped-module.js b/js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped-module.js new file mode 100644 index 0000000000..c415466c7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped-module.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `await` with escape sequence is a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + Identifier : IdentifierName but not ReservedWord + + It is a Syntax Error if the goal symbol of the syntactic grammar is Module + and the StringValue of IdentifierName is "await". +negative: + phase: parse + type: SyntaxError +flags: [module] +---*/ + +$DONOTEVALUATE(); + +var C = class aw\u0061it {}; diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped.js b/js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped.js new file mode 100644 index 0000000000..c00751058e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-await-escaped.js @@ -0,0 +1,19 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `await` with escape sequence is a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + Identifier : IdentifierName but not ReservedWord + + It is a Syntax Error if the goal symbol of the syntactic grammar is Module + and the StringValue of IdentifierName is "await". +---*/ + +var C = class aw\u0061it {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-await-module.js b/js/src/tests/test262/language/expressions/class/class-name-ident-await-module.js new file mode 100644 index 0000000000..ff38027189 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-await-module.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `await` is a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + IdentifierReference : yield + + It is a Syntax Error if the goal symbol of the syntactic grammar is Module. +negative: + phase: parse + type: SyntaxError +flags: [module] +---*/ + +$DONOTEVALUATE(); + +var C = class await {}; diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-await.js b/js/src/tests/test262/language/expressions/class/class-name-ident-await.js new file mode 100644 index 0000000000..648334a6db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-await.js @@ -0,0 +1,18 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `await` is a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + IdentifierReference : yield + + It is a Syntax Error if the goal symbol of the syntactic grammar is Module. +---*/ + +var C = class await {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-let-escaped.js b/js/src/tests/test262/language/expressions/class/class-name-ident-let-escaped.js new file mode 100644 index 0000000000..6722efe6bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-let-escaped.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `let` with escape sequence is not a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + Identifier : IdentifierName but not ReservedWord + + It is a Syntax Error if this phrase is contained in strict mode code and the + StringValue of IdentifierName is: "implements", "interface", "let", "package", + "private", "protected", "public", "static", or "yield". + + 10.2.1 Strict Mode Code + + All parts of a ClassDeclaration or a ClassExpression are strict mode code. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class l\u0065t {}; diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-let.js b/js/src/tests/test262/language/expressions/class/class-name-ident-let.js new file mode 100644 index 0000000000..5d4978aab8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-let.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `let` is not a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + Identifier : IdentifierName but not ReservedWord + + It is a Syntax Error if this phrase is contained in strict mode code and the + StringValue of IdentifierName is: "implements", "interface", "let", "package", + "private", "protected", "public", "static", or "yield". + + 10.2.1 Strict Mode Code + + All parts of a ClassDeclaration or a ClassExpression are strict mode code. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class let {}; diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-static-escaped.js b/js/src/tests/test262/language/expressions/class/class-name-ident-static-escaped.js new file mode 100644 index 0000000000..6f7b69d2b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-static-escaped.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `static` with escape sequence is not a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + Identifier : IdentifierName but not ReservedWord + + It is a Syntax Error if this phrase is contained in strict mode code and the + StringValue of IdentifierName is: "implements", "interface", "let", "package", + "private", "protected", "public", "static", or "yield". + + 10.2.1 Strict Mode Code + + All parts of a ClassDeclaration or a ClassExpression are strict mode code. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class st\u0061tic {}; diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-static.js b/js/src/tests/test262/language/expressions/class/class-name-ident-static.js new file mode 100644 index 0000000000..9dafac4fd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-static.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `static` is not a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + Identifier : IdentifierName but not ReservedWord + + It is a Syntax Error if this phrase is contained in strict mode code and the + StringValue of IdentifierName is: "implements", "interface", "let", "package", + "private", "protected", "public", "static", or "yield". + + 10.2.1 Strict Mode Code + + All parts of a ClassDeclaration or a ClassExpression are strict mode code. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class static {}; diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-yield-escaped.js b/js/src/tests/test262/language/expressions/class/class-name-ident-yield-escaped.js new file mode 100644 index 0000000000..19d27ec86c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-yield-escaped.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `yield` with escape sequence is not a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + Identifier : IdentifierName but not ReservedWord + + It is a Syntax Error if this phrase is contained in strict mode code and the + StringValue of IdentifierName is: "implements", "interface", "let", "package", + "private", "protected", "public", "static", or "yield". + + 10.2.1 Strict Mode Code + + All parts of a ClassDeclaration or a ClassExpression are strict mode code. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class yi\u0065ld {}; diff --git a/js/src/tests/test262/language/expressions/class/class-name-ident-yield.js b/js/src/tests/test262/language/expressions/class/class-name-ident-yield.js new file mode 100644 index 0000000000..fd7264a75b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/class-name-ident-yield.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions +description: > + `yield` is not a valid class-name identifier. +info: | + 12.1.1 Static Semantics: Early Errors + + IdentifierReference : yield + + It is a Syntax Error if the code matched by this production is contained in strict mode code. + + 10.2.1 Strict Mode Code + + All parts of a ClassDeclaration or a ClassExpression are strict mode code. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var C = class yield {}; diff --git a/js/src/tests/test262/language/expressions/class/constructor-this-tdz-during-initializers.js b/js/src/tests/test262/language/expressions/class/constructor-this-tdz-during-initializers.js new file mode 100644 index 0000000000..65a4dd0e7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/constructor-this-tdz-during-initializers.js @@ -0,0 +1,45 @@ +// 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: > + `this` is bound in the constructor of derived classes immediately before running initializers +info: | + [...] + 6. Let result be ? Construct(func, argList, newTarget). + [...] + 10. Perform ? thisER.BindThisValue(result). + 11. Perform ? InitializeInstanceFields(result, F). + [...] +features: [class-fields-public] +---*/ + + +var probeCtorThis; +var thisDuringField; +var thisFromProbe; +var thisDuringCtor; + +class Base { + constructor() { + assert.throws(ReferenceError, probeCtorThis); + } +} + +var C = class extends Base { + field = (thisDuringField = this, thisFromProbe = probeCtorThis()); + constructor() { + probeCtorThis = () => this; + assert.throws(ReferenceError, probeCtorThis); + super(); + thisDuringCtor = this; + } +}; + +var instance = new C(); + +assert.sameValue(thisDuringField, instance); +assert.sameValue(thisFromProbe, instance); +assert.sameValue(thisDuringCtor, instance); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-add.js new file mode 100644 index 0000000000..cad3fa9558 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-add.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-add.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from additive expression "add" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1 + 1]() { + return 2; + } + + set [1 + 1](v) { + return 2; + } + + static get [1 + 1]() { + return 2; + } + + static set [1 + 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 + 1], + 2 +); +assert.sameValue( + c[1 + 1] = 2, + 2 +); + +assert.sameValue( + C[1 + 1], + 2 +); +assert.sameValue( + C[1 + 1] = 2, + 2 +); +assert.sameValue( + c[String(1 + 1)], + 2 +); +assert.sameValue( + c[String(1 + 1)] = 2, + 2 +); + +assert.sameValue( + C[String(1 + 1)], + 2 +); +assert.sameValue( + C[String(1 + 1)] = 2, + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-subtract.js new file mode 100644 index 0000000000..8b3a6539bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-additive-expression-subtract.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1 - 1]() { + return 0; + } + + set [1 - 1](v) { + return 0; + } + + static get [1 - 1]() { + return 0; + } + + static set [1 - 1](v) { + return 0; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 - 1], + 0 +); +assert.sameValue( + c[1 - 1] = 0, + 0 +); + +assert.sameValue( + C[1 - 1], + 0 +); +assert.sameValue( + C[1 - 1] = 0, + 0 +); +assert.sameValue( + c[String(1 - 1)], + 0 +); +assert.sameValue( + c[String(1 - 1)] = 0, + 0 +); + +assert.sameValue( + C[String(1 - 1)], + 0 +); +assert.sameValue( + C[String(1 - 1)] = 0, + 0 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-arrow-function-expression.js new file mode 100644 index 0000000000..1dbc5ad5a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-arrow-function-expression.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from arrow function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [() => { }]() { + return 1; + } + + set [() => { }](v) { + return 1; + } + + static get [() => { }]() { + return 1; + } + + static set [() => { }](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[() => { }], + 1 +); +assert.sameValue( + c[() => { }] = 1, + 1 +); + +assert.sameValue( + C[() => { }], + 1 +); +assert.sameValue( + C[() => { }] = 1, + 1 +); +assert.sameValue( + c[String(() => { })], + 1 +); +assert.sameValue( + c[String(() => { })] = 1, + 1 +); + +assert.sameValue( + C[String(() => { })], + 1 +); +assert.sameValue( + C[String(() => { })] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-assignment.js new file mode 100644 index 0000000000..39a00589d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-assignment.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from assignment expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + get [x = 1]() { + return 2; + } + + set [x = 1](v) { + return 2; + } + + static get [x = 1]() { + return 2; + } + + static set [x = 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x = 1], + 2 +); +assert.sameValue( + c[x = 1] = 2, + 2 +); + +assert.sameValue( + C[x = 1], + 2 +); +assert.sameValue( + C[x = 1] = 2, + 2 +); +assert.sameValue( + c[String(x = 1)], + 2 +); +assert.sameValue( + c[String(x = 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x = 1)], + 2 +); +assert.sameValue( + C[String(x = 1)] = 2, + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-bitwise-or.js new file mode 100644 index 0000000000..b7e140ffe2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-bitwise-or.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + get [x |= 1]() { + return 2; + } + + set [x |= 1](v) { + return 2; + } + + static get [x |= 1]() { + return 2; + } + + static set [x |= 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x |= 1], + 2 +); +assert.sameValue( + c[x |= 1] = 2, + 2 +); + +assert.sameValue( + C[x |= 1], + 2 +); +assert.sameValue( + C[x |= 1] = 2, + 2 +); +assert.sameValue( + c[String(x |= 1)], + 2 +); +assert.sameValue( + c[String(x |= 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x |= 1)], + 2 +); +assert.sameValue( + C[String(x |= 1)] = 2, + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-coalesce.js new file mode 100644 index 0000000000..d71ffc2e2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-coalesce.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = null; + + +let C = class { + get [x ??= 1]() { + return 2; + } + + set [x ??= 1](v) { + return 2; + } + + static get [x ??= 1]() { + return 2; + } + + static set [x ??= 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x ??= 1], + 2 +); +assert.sameValue( + c[x ??= 1] = 2, + 2 +); + +assert.sameValue( + C[x ??= 1], + 2 +); +assert.sameValue( + C[x ??= 1] = 2, + 2 +); +assert.sameValue( + c[String(x ??= 1)], + 2 +); +assert.sameValue( + c[String(x ??= 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x ??= 1)], + 2 +); +assert.sameValue( + C[String(x ??= 1)] = 2, + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-and.js new file mode 100644 index 0000000000..56bb7711f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-and.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + get [x &&= 1]() { + return 2; + } + + set [x &&= 1](v) { + return 2; + } + + static get [x &&= 1]() { + return 2; + } + + static set [x &&= 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x &&= 1], + 2 +); +assert.sameValue( + c[x &&= 1] = 2, + 2 +); + +assert.sameValue( + C[x &&= 1], + 2 +); +assert.sameValue( + C[x &&= 1] = 2, + 2 +); +assert.sameValue( + c[String(x &&= 1)], + 2 +); +assert.sameValue( + c[String(x &&= 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x &&= 1)], + 2 +); +assert.sameValue( + C[String(x &&= 1)] = 2, + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-or.js new file mode 100644 index 0000000000..9905fadac2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-assignment-expression-logical-or.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + get [x ||= 1]() { + return 2; + } + + set [x ||= 1](v) { + return 2; + } + + static get [x ||= 1]() { + return 2; + } + + static set [x ||= 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x ||= 1], + 2 +); +assert.sameValue( + c[x ||= 1] = 2, + 2 +); + +assert.sameValue( + C[x ||= 1], + 2 +); +assert.sameValue( + C[x ||= 1] = 2, + 2 +); +assert.sameValue( + c[String(x ||= 1)], + 2 +); +assert.sameValue( + c[String(x ||= 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x ||= 1)], + 2 +); +assert.sameValue( + C[String(x ||= 1)] = 2, + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-async-arrow-function-expression.js new file mode 100644 index 0000000000..b13dcd3423 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-async-arrow-function-expression.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [async () => {}]() { + return 1; + } + + set [async () => {}](v) { + return 1; + } + + static get [async () => {}]() { + return 1; + } + + static set [async () => {}](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[async () => {}], + 1 +); +assert.sameValue( + c[async () => {}] = 1, + 1 +); + +assert.sameValue( + C[async () => {}], + 1 +); +assert.sameValue( + C[async () => {}] = 1, + 1 +); +assert.sameValue( + c[String(async () => {})], + 1 +); +assert.sameValue( + c[String(async () => {})] = 1, + 1 +); + +assert.sameValue( + C[String(async () => {})], + 1 +); +assert.sameValue( + C[String(async () => {})] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-await-expression.js new file mode 100644 index 0000000000..030ba3bde0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-await-expression.js @@ -0,0 +1,98 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-await-expression.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, top-level-await] +flags: [generated, async, module] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +try { + + +let C = class { + get [await 9]() { + return 9; + } + + set [await 9](v) { + return 9; + } + + static get [await 9]() { + return 9; + } + + static set [await 9](v) { + return 9; + } +}; + +let c = new C(); + +assert.sameValue( + c[await 9], + 9 +); +assert.sameValue( + c[await 9] = 9, + 9 +); + +assert.sameValue( + C[await 9], + 9 +); +assert.sameValue( + C[await 9] = 9, + 9 +); +assert.sameValue( + c[String(await 9)], + 9 +); +assert.sameValue( + c[String(await 9)] = 9, + 9 +); + +assert.sameValue( + C[String(await 9)], + 9 +); +assert.sameValue( + C[String(await 9)] = 9, + 9 +); + +} catch (e) { + $DONE(e); +} +$DONE(); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-false.js new file mode 100644 index 0000000000..9f1a2b3688 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-false.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-false.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [false ? 1 : 2]() { + return 1; + } + + set [false ? 1 : 2](v) { + return 1; + } + + static get [false ? 1 : 2]() { + return 1; + } + + static set [false ? 1 : 2](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[false ? 1 : 2], + 1 +); +assert.sameValue( + c[false ? 1 : 2] = 1, + 1 +); + +assert.sameValue( + C[false ? 1 : 2], + 1 +); +assert.sameValue( + C[false ? 1 : 2] = 1, + 1 +); +assert.sameValue( + c[String(false ? 1 : 2)], + 1 +); +assert.sameValue( + c[String(false ? 1 : 2)] = 1, + 1 +); + +assert.sameValue( + C[String(false ? 1 : 2)], + 1 +); +assert.sameValue( + C[String(false ? 1 : 2)] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-true.js new file mode 100644 index 0000000000..8d4558ef2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-condition-expression-true.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-true.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [true ? 1 : 2]() { + return 2; + } + + set [true ? 1 : 2](v) { + return 2; + } + + static get [true ? 1 : 2]() { + return 2; + } + + static set [true ? 1 : 2](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[true ? 1 : 2], + 2 +); +assert.sameValue( + c[true ? 1 : 2] = 2, + 2 +); + +assert.sameValue( + C[true ? 1 : 2], + 2 +); +assert.sameValue( + C[true ? 1 : 2] = 2, + 2 +); +assert.sameValue( + c[String(true ? 1 : 2)], + 2 +); +assert.sameValue( + c[String(true ? 1 : 2)] = 2, + 2 +); + +assert.sameValue( + C[String(true ? 1 : 2)], + 2 +); +assert.sameValue( + C[String(true ? 1 : 2)] = 2, + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-e-notational-literal.js new file mode 100644 index 0000000000..5f803ff042 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-e-notational-literal.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1.e1]() { + return 2; + } + + set [1.e1](v) { + return 2; + } + + static get [1.e1]() { + return 2; + } + + static set [1.e1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1.e1], + 2 +); +assert.sameValue( + c[1.e1] = 2, + 2 +); + +assert.sameValue( + C[1.e1], + 2 +); +assert.sameValue( + C[1.e1] = 2, + 2 +); +assert.sameValue( + c[String(1.e1)], + 2 +); +assert.sameValue( + c[String(1.e1)] = 2, + 2 +); + +assert.sameValue( + C[String(1.e1)], + 2 +); +assert.sameValue( + C[String(1.e1)] = 2, + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-literal.js new file mode 100644 index 0000000000..09aa45c82f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-decimal-literal.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-literal.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from decimal literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1.1]() { + return 2; + } + + set [1.1](v) { + return 2; + } + + static get [1.1]() { + return 2; + } + + static set [1.1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1.1], + 2 +); +assert.sameValue( + c[1.1] = 2, + 2 +); + +assert.sameValue( + C[1.1], + 2 +); +assert.sameValue( + C[1.1] = 2, + 2 +); +assert.sameValue( + c[String(1.1)], + 2 +); +assert.sameValue( + c[String(1.1)] = 2, + 2 +); + +assert.sameValue( + C[String(1.1)], + 2 +); +assert.sameValue( + C[String(1.1)] = 2, + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-exponetiation-expression.js new file mode 100644 index 0000000000..f1622bc932 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-exponetiation-expression.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from exponentiation expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [2 ** 2]() { + return 4; + } + + set [2 ** 2](v) { + return 4; + } + + static get [2 ** 2]() { + return 4; + } + + static set [2 ** 2](v) { + return 4; + } +}; + +let c = new C(); + +assert.sameValue( + c[2 ** 2], + 4 +); +assert.sameValue( + c[2 ** 2] = 4, + 4 +); + +assert.sameValue( + C[2 ** 2], + 4 +); +assert.sameValue( + C[2 ** 2] = 4, + 4 +); +assert.sameValue( + c[String(2 ** 2)], + 4 +); +assert.sameValue( + c[String(2 ** 2)] = 4, + 4 +); + +assert.sameValue( + C[String(2 ** 2)], + 4 +); +assert.sameValue( + C[String(2 ** 2)] = 4, + 4 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-coalesce.js new file mode 100644 index 0000000000..9891658650 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-coalesce.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x; + + +let C = class { + get [x ?? 1]() { + return 2; + } + + set [x ?? 1](v) { + return 2; + } + + static get [x ?? 1]() { + return 2; + } + + static set [x ?? 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x ?? 1], + 2 +); +assert.sameValue( + c[x ?? 1] = 2, + 2 +); + +assert.sameValue( + C[x ?? 1], + 2 +); +assert.sameValue( + C[x ?? 1] = 2, + 2 +); +assert.sameValue( + c[String(x ?? 1)], + 2 +); +assert.sameValue( + c[String(x ?? 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x ?? 1)], + 2 +); +assert.sameValue( + C[String(x ?? 1)] = 2, + 2 +); + +assert.sameValue(x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-and.js new file mode 100644 index 0000000000..b65b5b52d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-and.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + get [x && 1]() { + return 2; + } + + set [x && 1](v) { + return 2; + } + + static get [x && 1]() { + return 2; + } + + static set [x && 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x && 1], + 2 +); +assert.sameValue( + c[x && 1] = 2, + 2 +); + +assert.sameValue( + C[x && 1], + 2 +); +assert.sameValue( + C[x && 1] = 2, + 2 +); +assert.sameValue( + c[String(x && 1)], + 2 +); +assert.sameValue( + c[String(x && 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x && 1)], + 2 +); +assert.sameValue( + C[String(x && 1)] = 2, + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-or.js new file mode 100644 index 0000000000..75ef13c9cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-expression-logical-or.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + get [x || 1]() { + return 2; + } + + set [x || 1](v) { + return 2; + } + + static get [x || 1]() { + return 2; + } + + static set [x || 1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x || 1], + 2 +); +assert.sameValue( + c[x || 1] = 2, + 2 +); + +assert.sameValue( + C[x || 1], + 2 +); +assert.sameValue( + C[x || 1] = 2, + 2 +); +assert.sameValue( + c[String(x || 1)], + 2 +); +assert.sameValue( + c[String(x || 1)] = 2, + 2 +); + +assert.sameValue( + C[String(x || 1)], + 2 +); +assert.sameValue( + C[String(x || 1)] = 2, + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-declaration.js new file mode 100644 index 0000000000..5428d230ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-declaration.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-declaration.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function f() {} + + +let C = class { + get [f()]() { + return 1; + } + + set [f()](v) { + return 1; + } + + static get [f()]() { + return 1; + } + + static set [f()](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[f()], + 1 +); +assert.sameValue( + c[f()] = 1, + 1 +); + +assert.sameValue( + C[f()], + 1 +); +assert.sameValue( + C[f()] = 1, + 1 +); +assert.sameValue( + c[String(f())], + 1 +); +assert.sameValue( + c[String(f())] = 1, + 1 +); + +assert.sameValue( + C[String(f())], + 1 +); +assert.sameValue( + C[String(f())] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-expression.js new file mode 100644 index 0000000000..465c48a11c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-function-expression.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-expression.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [function () {}]() { + return 1; + } + + set [function () {}](v) { + return 1; + } + + static get [function () {}]() { + return 1; + } + + static set [function () {}](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[function () {}], + 1 +); +assert.sameValue( + c[function () {}] = 1, + 1 +); + +assert.sameValue( + C[function () {}], + 1 +); +assert.sameValue( + C[function () {}] = 1, + 1 +); +assert.sameValue( + c[String(function () {})], + 1 +); +assert.sameValue( + c[String(function () {})] = 1, + 1 +); + +assert.sameValue( + C[String(function () {})], + 1 +); +assert.sameValue( + C[String(function () {})] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-generator-function-declaration.js new file mode 100644 index 0000000000..1cc99c7ca7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-generator-function-declaration.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from generator function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { return 1; } + + +let C = class { + get [g()]() { + return 1; + } + + set [g()](v) { + return 1; + } + + static get [g()]() { + return 1; + } + + static set [g()](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[g()], + 1 +); +assert.sameValue( + c[g()] = 1, + 1 +); + +assert.sameValue( + C[g()], + 1 +); +assert.sameValue( + C[g()] = 1, + 1 +); +assert.sameValue( + c[String(g())], + 1 +); +assert.sameValue( + c[String(g())] = 1, + 1 +); + +assert.sameValue( + C[String(g())], + 1 +); +assert.sameValue( + C[String(g())] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-identifier.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-identifier.js new file mode 100644 index 0000000000..bebf3d4980 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-identifier.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-identifier.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 1; + + + +let C = class { + get [x]() { + return '2'; + } + + set [x](v) { + return '2'; + } + + static get [x]() { + return '2'; + } + + static set [x](v) { + return '2'; + } +}; + +let c = new C(); + +assert.sameValue( + c[x], + '2' +); +assert.sameValue( + c[x] = '2', + '2' +); + +assert.sameValue( + C[x], + '2' +); +assert.sameValue( + C[x] = '2', + '2' +); +assert.sameValue( + c[String(x)], + '2' +); +assert.sameValue( + c[String(x)] = '2', + '2' +); + +assert.sameValue( + C[String(x)], + '2' +); +assert.sameValue( + C[String(x)] = '2', + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-e-notational-literal.js new file mode 100644 index 0000000000..78cf62812d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-e-notational-literal.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1]() { + return 2; + } + + set [1](v) { + return 2; + } + + static get [1]() { + return 2; + } + + static set [1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1], + 2 +); +assert.sameValue( + c[1] = 2, + 2 +); + +assert.sameValue( + C[1], + 2 +); +assert.sameValue( + C[1] = 2, + 2 +); +assert.sameValue( + c[String(1)], + 2 +); +assert.sameValue( + c[String(1)] = 2, + 2 +); + +assert.sameValue( + C[String(1)], + 2 +); +assert.sameValue( + C[String(1)] = 2, + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-separators.js new file mode 100644 index 0000000000..15232db802 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-integer-separators.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-separators.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from integer with separators (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1_2_3_4_5_6_7_8]() { + return 1_2_3_4_5_6_7_8; + } + + set [1_2_3_4_5_6_7_8](v) { + return 1_2_3_4_5_6_7_8; + } + + static get [1_2_3_4_5_6_7_8]() { + return 1_2_3_4_5_6_7_8; + } + + static set [1_2_3_4_5_6_7_8](v) { + return 1_2_3_4_5_6_7_8; + } +}; + +let c = new C(); + +assert.sameValue( + c[1_2_3_4_5_6_7_8], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + c[1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8, + 1_2_3_4_5_6_7_8 +); + +assert.sameValue( + C[1_2_3_4_5_6_7_8], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8, + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + c[String(1_2_3_4_5_6_7_8)], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + c[String(1_2_3_4_5_6_7_8)] = 1_2_3_4_5_6_7_8, + 1_2_3_4_5_6_7_8 +); + +assert.sameValue( + C[String(1_2_3_4_5_6_7_8)], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[String(1_2_3_4_5_6_7_8)] = 1_2_3_4_5_6_7_8, + 1_2_3_4_5_6_7_8 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-math.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-math.js new file mode 100644 index 0000000000..c52e448e06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-math.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-math.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from math (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1 + 2 - 3 * 4 / 5 ** 6]() { + return 2.999232; + } + + set [1 + 2 - 3 * 4 / 5 ** 6](v) { + return 2.999232; + } + + static get [1 + 2 - 3 * 4 / 5 ** 6]() { + return 2.999232; + } + + static set [1 + 2 - 3 * 4 / 5 ** 6](v) { + return 2.999232; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 + 2 - 3 * 4 / 5 ** 6], + 2.999232 +); +assert.sameValue( + c[1 + 2 - 3 * 4 / 5 ** 6] = 2.999232, + 2.999232 +); + +assert.sameValue( + C[1 + 2 - 3 * 4 / 5 ** 6], + 2.999232 +); +assert.sameValue( + C[1 + 2 - 3 * 4 / 5 ** 6] = 2.999232, + 2.999232 +); +assert.sameValue( + c[String(1 + 2 - 3 * 4 / 5 ** 6)], + 2.999232 +); +assert.sameValue( + c[String(1 + 2 - 3 * 4 / 5 ** 6)] = 2.999232, + 2.999232 +); + +assert.sameValue( + C[String(1 + 2 - 3 * 4 / 5 ** 6)], + 2.999232 +); +assert.sameValue( + C[String(1 + 2 - 3 * 4 / 5 ** 6)] = 2.999232, + 2.999232 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-div.js new file mode 100644 index 0000000000..058d62a4aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-div.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1 / 1]() { + return 1; + } + + set [1 / 1](v) { + return 1; + } + + static get [1 / 1]() { + return 1; + } + + static set [1 / 1](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 / 1], + 1 +); +assert.sameValue( + c[1 / 1] = 1, + 1 +); + +assert.sameValue( + C[1 / 1], + 1 +); +assert.sameValue( + C[1 / 1] = 1, + 1 +); +assert.sameValue( + c[String(1 / 1)], + 1 +); +assert.sameValue( + c[String(1 / 1)] = 1, + 1 +); + +assert.sameValue( + C[String(1 / 1)], + 1 +); +assert.sameValue( + C[String(1 / 1)] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-mult.js new file mode 100644 index 0000000000..98e3b23fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-multiplicative-expression-mult.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1 * 1]() { + return 1; + } + + set [1 * 1](v) { + return 1; + } + + static get [1 * 1]() { + return 1; + } + + static set [1 * 1](v) { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 * 1], + 1 +); +assert.sameValue( + c[1 * 1] = 1, + 1 +); + +assert.sameValue( + C[1 * 1], + 1 +); +assert.sameValue( + C[1 * 1] = 1, + 1 +); +assert.sameValue( + c[String(1 * 1)], + 1 +); +assert.sameValue( + c[String(1 * 1)] = 1, + 1 +); + +assert.sameValue( + C[String(1 * 1)], + 1 +); +assert.sameValue( + C[String(1 * 1)] = 1, + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-null.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-null.js new file mode 100644 index 0000000000..1e99677ef3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-null.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-null.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [null]() { + return null; + } + + set [null](v) { + return null; + } + + static get [null]() { + return null; + } + + static set [null](v) { + return null; + } +}; + +let c = new C(); + +assert.sameValue( + c[null], + null +); +assert.sameValue( + c[null] = null, + null +); + +assert.sameValue( + C[null], + null +); +assert.sameValue( + C[null] = null, + null +); +assert.sameValue( + c[String(null)], + null +); +assert.sameValue( + c[String(null)] = null, + null +); + +assert.sameValue( + C[String(null)], + null +); +assert.sameValue( + C[String(null)] = null, + null +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-numeric-literal.js new file mode 100644 index 0000000000..f5dfd70d29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-numeric-literal.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-numeric-literal.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get [1]() { + return 2; + } + + set [1](v) { + return 2; + } + + static get [1]() { + return 2; + } + + static set [1](v) { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1], + 2 +); +assert.sameValue( + c[1] = 2, + 2 +); + +assert.sameValue( + C[1], + 2 +); +assert.sameValue( + C[1] = 2, + 2 +); +assert.sameValue( + c[String(1)], + 2 +); +assert.sameValue( + c[String(1)] = 2, + 2 +); + +assert.sameValue( + C[String(1)], + 2 +); +assert.sameValue( + C[String(1)] = 2, + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-string-literal.js new file mode 100644 index 0000000000..838a6d9878 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-string-literal.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-string-literal.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + get ['1']() { + return '2'; + } + + set ['1'](v) { + return '2'; + } + + static get ['1']() { + return '2'; + } + + static set ['1'](v) { + return '2'; + } +}; + +let c = new C(); + +assert.sameValue( + c['1'], + '2' +); +assert.sameValue( + c['1'] = '2', + '2' +); + +assert.sameValue( + C['1'], + '2' +); +assert.sameValue( + C['1'] = '2', + '2' +); +assert.sameValue( + c[String('1')], + '2' +); +assert.sameValue( + c[String('1')] = '2', + '2' +); + +assert.sameValue( + C[String('1')], + '2' +); +assert.sameValue( + C[String('1')] = '2', + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-yield-expression.js new file mode 100644 index 0000000000..16f20273dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-accessors-computed-property-name-from-yield-expression.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-yield-expression.case +// - src/computed-property-names/evaluation/class-expression-accessors.template +/*--- +description: Computed property name from yield expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { + + +let C = class { + get [yield 9]() { + return 9; + } + + set [yield 9](v) { + return 9; + } + + static get [yield 9]() { + return 9; + } + + static set [yield 9](v) { + return 9; + } +}; + +let c = new C(); + +assert.sameValue( + c[yield 9], + 9 +); +assert.sameValue( + c[yield 9] = 9, + 9 +); + +assert.sameValue( + C[yield 9], + 9 +); +assert.sameValue( + C[yield 9] = 9, + 9 +); +assert.sameValue( + c[String(yield 9)], + 9 +); +assert.sameValue( + c[String(yield 9)] = 9, + 9 +); + +assert.sameValue( + C[String(yield 9)], + 9 +); +assert.sameValue( + C[String(yield 9)] = 9, + 9 +); + +} +var iter = g(); +while (iter.next().done === false) ; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-add.js new file mode 100644 index 0000000000..32507b3d9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-add.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-add.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from additive expression "add" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 + 1]() { + return 2; + } + static [1 + 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 + 1](), + 2 +); +assert.sameValue( + C[1 + 1](), + 2 +); +assert.sameValue( + c[String(1 + 1)](), + 2 +); +assert.sameValue( + C[String(1 + 1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-subtract.js new file mode 100644 index 0000000000..7339113312 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-additive-expression-subtract.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 - 1]() { + return 0; + } + static [1 - 1]() { + return 0; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 - 1](), + 0 +); +assert.sameValue( + C[1 - 1](), + 0 +); +assert.sameValue( + c[String(1 - 1)](), + 0 +); +assert.sameValue( + C[String(1 - 1)](), + 0 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-arrow-function-expression.js new file mode 100644 index 0000000000..d72ea03384 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-arrow-function-expression.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from arrow function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [() => { }]() { + return 1; + } + static [() => { }]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[() => { }](), + 1 +); +assert.sameValue( + C[() => { }](), + 1 +); +assert.sameValue( + c[String(() => { })](), + 1 +); +assert.sameValue( + C[String(() => { })](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-assignment.js new file mode 100644 index 0000000000..338cf06696 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-assignment.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from assignment expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x = 1]() { + return 2; + } + static [x = 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x = 1](), + 2 +); +assert.sameValue( + C[x = 1](), + 2 +); +assert.sameValue( + c[String(x = 1)](), + 2 +); +assert.sameValue( + C[String(x = 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-bitwise-or.js new file mode 100644 index 0000000000..b04b5a821c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-bitwise-or.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x |= 1]() { + return 2; + } + static [x |= 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x |= 1](), + 2 +); +assert.sameValue( + C[x |= 1](), + 2 +); +assert.sameValue( + c[String(x |= 1)](), + 2 +); +assert.sameValue( + C[String(x |= 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-coalesce.js new file mode 100644 index 0000000000..5ef5ba0b7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-coalesce.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = null; + + +let C = class { + [x ??= 1]() { + return 2; + } + static [x ??= 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x ??= 1](), + 2 +); +assert.sameValue( + C[x ??= 1](), + 2 +); +assert.sameValue( + c[String(x ??= 1)](), + 2 +); +assert.sameValue( + C[String(x ??= 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-and.js new file mode 100644 index 0000000000..7b989a77cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-and.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x &&= 1]() { + return 2; + } + static [x &&= 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x &&= 1](), + 2 +); +assert.sameValue( + C[x &&= 1](), + 2 +); +assert.sameValue( + c[String(x &&= 1)](), + 2 +); +assert.sameValue( + C[String(x &&= 1)](), + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-or.js new file mode 100644 index 0000000000..a12ad1b16e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-assignment-expression-logical-or.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x ||= 1]() { + return 2; + } + static [x ||= 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x ||= 1](), + 2 +); +assert.sameValue( + C[x ||= 1](), + 2 +); +assert.sameValue( + c[String(x ||= 1)](), + 2 +); +assert.sameValue( + C[String(x ||= 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-async-arrow-function-expression.js new file mode 100644 index 0000000000..3f78c77cc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-async-arrow-function-expression.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [async () => {}]() { + return 1; + } + static [async () => {}]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[async () => {}](), + 1 +); +assert.sameValue( + C[async () => {}](), + 1 +); +assert.sameValue( + c[String(async () => {})](), + 1 +); +assert.sameValue( + C[String(async () => {})](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-await-expression.js new file mode 100644 index 0000000000..5228718199 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-await-expression.js @@ -0,0 +1,71 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-await-expression.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, top-level-await] +flags: [generated, async, module] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +try { + + +let C = class { + [await 9]() { + return 9; + } + static [await 9]() { + return 9; + } +}; + +let c = new C(); + +assert.sameValue( + c[await 9](), + 9 +); +assert.sameValue( + C[await 9](), + 9 +); +assert.sameValue( + c[String(await 9)](), + 9 +); +assert.sameValue( + C[String(await 9)](), + 9 +); + +} catch (e) { + $DONE(e); +} +$DONE(); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-false.js new file mode 100644 index 0000000000..f56c4284ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-false.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-false.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [false ? 1 : 2]() { + return 1; + } + static [false ? 1 : 2]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[false ? 1 : 2](), + 1 +); +assert.sameValue( + C[false ? 1 : 2](), + 1 +); +assert.sameValue( + c[String(false ? 1 : 2)](), + 1 +); +assert.sameValue( + C[String(false ? 1 : 2)](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-true.js new file mode 100644 index 0000000000..059a06c9d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-condition-expression-true.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-true.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [true ? 1 : 2]() { + return 2; + } + static [true ? 1 : 2]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[true ? 1 : 2](), + 2 +); +assert.sameValue( + C[true ? 1 : 2](), + 2 +); +assert.sameValue( + c[String(true ? 1 : 2)](), + 2 +); +assert.sameValue( + C[String(true ? 1 : 2)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-e-notational-literal.js new file mode 100644 index 0000000000..676eaf3381 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-e-notational-literal.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1.e1]() { + return 2; + } + static [1.e1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1.e1](), + 2 +); +assert.sameValue( + C[1.e1](), + 2 +); +assert.sameValue( + c[String(1.e1)](), + 2 +); +assert.sameValue( + C[String(1.e1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-literal.js new file mode 100644 index 0000000000..3b1dcf9b4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-decimal-literal.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-literal.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from decimal literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1.1]() { + return 2; + } + static [1.1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1.1](), + 2 +); +assert.sameValue( + C[1.1](), + 2 +); +assert.sameValue( + c[String(1.1)](), + 2 +); +assert.sameValue( + C[String(1.1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-exponetiation-expression.js new file mode 100644 index 0000000000..1e1ee5dbbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-exponetiation-expression.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from exponentiation expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [2 ** 2]() { + return 4; + } + static [2 ** 2]() { + return 4; + } +}; + +let c = new C(); + +assert.sameValue( + c[2 ** 2](), + 4 +); +assert.sameValue( + C[2 ** 2](), + 4 +); +assert.sameValue( + c[String(2 ** 2)](), + 4 +); +assert.sameValue( + C[String(2 ** 2)](), + 4 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-coalesce.js new file mode 100644 index 0000000000..37c4aa2c1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-coalesce.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x; + + +let C = class { + [x ?? 1]() { + return 2; + } + static [x ?? 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x ?? 1](), + 2 +); +assert.sameValue( + C[x ?? 1](), + 2 +); +assert.sameValue( + c[String(x ?? 1)](), + 2 +); +assert.sameValue( + C[String(x ?? 1)](), + 2 +); + +assert.sameValue(x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-and.js new file mode 100644 index 0000000000..2f28795886 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-and.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x && 1]() { + return 2; + } + static [x && 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x && 1](), + 2 +); +assert.sameValue( + C[x && 1](), + 2 +); +assert.sameValue( + c[String(x && 1)](), + 2 +); +assert.sameValue( + C[String(x && 1)](), + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-or.js new file mode 100644 index 0000000000..a227327d49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-expression-logical-or.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x || 1]() { + return 2; + } + static [x || 1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[x || 1](), + 2 +); +assert.sameValue( + C[x || 1](), + 2 +); +assert.sameValue( + c[String(x || 1)](), + 2 +); +assert.sameValue( + C[String(x || 1)](), + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-declaration.js new file mode 100644 index 0000000000..e19d9f710a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-declaration.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-declaration.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function f() {} + + +let C = class { + [f()]() { + return 1; + } + static [f()]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[f()](), + 1 +); +assert.sameValue( + C[f()](), + 1 +); +assert.sameValue( + c[String(f())](), + 1 +); +assert.sameValue( + C[String(f())](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-expression.js new file mode 100644 index 0000000000..1db086873e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-function-expression.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-expression.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [function () {}]() { + return 1; + } + static [function () {}]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[function () {}](), + 1 +); +assert.sameValue( + C[function () {}](), + 1 +); +assert.sameValue( + c[String(function () {})](), + 1 +); +assert.sameValue( + C[String(function () {})](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-generator-function-declaration.js new file mode 100644 index 0000000000..c22bb8d401 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-generator-function-declaration.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from generator function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { return 1; } + + +let C = class { + [g()]() { + return 1; + } + static [g()]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[g()](), + 1 +); +assert.sameValue( + C[g()](), + 1 +); +assert.sameValue( + c[String(g())](), + 1 +); +assert.sameValue( + C[String(g())](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-identifier.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-identifier.js new file mode 100644 index 0000000000..3ad568777a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-identifier.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-identifier.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 1; + + + +let C = class { + [x]() { + return '2'; + } + static [x]() { + return '2'; + } +}; + +let c = new C(); + +assert.sameValue( + c[x](), + '2' +); +assert.sameValue( + C[x](), + '2' +); +assert.sameValue( + c[String(x)](), + '2' +); +assert.sameValue( + C[String(x)](), + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-e-notational-literal.js new file mode 100644 index 0000000000..e264963316 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-e-notational-literal.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1]() { + return 2; + } + static [1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1](), + 2 +); +assert.sameValue( + C[1](), + 2 +); +assert.sameValue( + c[String(1)](), + 2 +); +assert.sameValue( + C[String(1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-separators.js new file mode 100644 index 0000000000..f02e174591 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-integer-separators.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-separators.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from integer with separators (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1_2_3_4_5_6_7_8]() { + return 1_2_3_4_5_6_7_8; + } + static [1_2_3_4_5_6_7_8]() { + return 1_2_3_4_5_6_7_8; + } +}; + +let c = new C(); + +assert.sameValue( + c[1_2_3_4_5_6_7_8](), + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[1_2_3_4_5_6_7_8](), + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + c[String(1_2_3_4_5_6_7_8)](), + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[String(1_2_3_4_5_6_7_8)](), + 1_2_3_4_5_6_7_8 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-math.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-math.js new file mode 100644 index 0000000000..9d6a4495d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-math.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-math.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from math (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 + 2 - 3 * 4 / 5 ** 6]() { + return 2.999232; + } + static [1 + 2 - 3 * 4 / 5 ** 6]() { + return 2.999232; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 + 2 - 3 * 4 / 5 ** 6](), + 2.999232 +); +assert.sameValue( + C[1 + 2 - 3 * 4 / 5 ** 6](), + 2.999232 +); +assert.sameValue( + c[String(1 + 2 - 3 * 4 / 5 ** 6)](), + 2.999232 +); +assert.sameValue( + C[String(1 + 2 - 3 * 4 / 5 ** 6)](), + 2.999232 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-div.js new file mode 100644 index 0000000000..440768f97c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-div.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 / 1]() { + return 1; + } + static [1 / 1]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 / 1](), + 1 +); +assert.sameValue( + C[1 / 1](), + 1 +); +assert.sameValue( + c[String(1 / 1)](), + 1 +); +assert.sameValue( + C[String(1 / 1)](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-mult.js new file mode 100644 index 0000000000..8b7b7ace37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-multiplicative-expression-mult.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 * 1]() { + return 1; + } + static [1 * 1]() { + return 1; + } +}; + +let c = new C(); + +assert.sameValue( + c[1 * 1](), + 1 +); +assert.sameValue( + C[1 * 1](), + 1 +); +assert.sameValue( + c[String(1 * 1)](), + 1 +); +assert.sameValue( + C[String(1 * 1)](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-null.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-null.js new file mode 100644 index 0000000000..5ea2af315c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-null.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [null]() { + return null; + } + static [null]() { + return null; + } +}; + +let c = new C(); + +assert.sameValue( + c[null](), + null +); +assert.sameValue( + C[null](), + null +); +assert.sameValue( + c[String(null)](), + null +); +assert.sameValue( + C[String(null)](), + null +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-numeric-literal.js new file mode 100644 index 0000000000..443e05cba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-numeric-literal.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-numeric-literal.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1]() { + return 2; + } + static [1]() { + return 2; + } +}; + +let c = new C(); + +assert.sameValue( + c[1](), + 2 +); +assert.sameValue( + C[1](), + 2 +); +assert.sameValue( + c[String(1)](), + 2 +); +assert.sameValue( + C[String(1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-string-literal.js new file mode 100644 index 0000000000..8e1497d162 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-string-literal.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-string-literal.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + ['1']() { + return '2'; + } + static ['1']() { + return '2'; + } +}; + +let c = new C(); + +assert.sameValue( + c['1'](), + '2' +); +assert.sameValue( + C['1'](), + '2' +); +assert.sameValue( + c[String('1')](), + '2' +); +assert.sameValue( + C[String('1')](), + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-yield-expression.js new file mode 100644 index 0000000000..95a9f1a3b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-computed-property-name-from-yield-expression.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-yield-expression.case +// - src/computed-property-names/evaluation/class-expression.template +/*--- +description: Computed property name from yield expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { + + +let C = class { + [yield 9]() { + return 9; + } + static [yield 9]() { + return 9; + } +}; + +let c = new C(); + +assert.sameValue( + c[yield 9](), + 9 +); +assert.sameValue( + C[yield 9](), + 9 +); +assert.sameValue( + c[String(yield 9)](), + 9 +); +assert.sameValue( + C[String(yield 9)](), + 9 +); + +} +var iter = g(); +while (iter.next().done === false) ; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-add.js new file mode 100644 index 0000000000..2bf2ac51c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-add.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-add.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from additive expression "add" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 + 1] = 2; + + static [1 + 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[1 + 1], + 2 +); +assert.sameValue( + C[1 + 1], + 2 +); +assert.sameValue( + c[String(1 + 1)], + 2 +); +assert.sameValue( + C[String(1 + 1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-subtract.js new file mode 100644 index 0000000000..492b73ef19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-additive-expression-subtract.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 - 1] = 0; + + static [1 - 1] = 0; +}; + +let c = new C(); + +assert.sameValue( + c[1 - 1], + 0 +); +assert.sameValue( + C[1 - 1], + 0 +); +assert.sameValue( + c[String(1 - 1)], + 0 +); +assert.sameValue( + C[String(1 - 1)], + 0 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-arrow-function-expression.js new file mode 100644 index 0000000000..6af478d2d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-arrow-function-expression.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from arrow function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [() => { }] = 1; + + static [() => { }] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[() => { }], + 1 +); +assert.sameValue( + C[() => { }], + 1 +); +assert.sameValue( + c[String(() => { })], + 1 +); +assert.sameValue( + C[String(() => { })], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-assignment.js new file mode 100644 index 0000000000..edb9dd5d0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-assignment.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from assignment expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x = 1] = 2; + + static [x = 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x = 1], + 2 +); +assert.sameValue( + C[x = 1], + 2 +); +assert.sameValue( + c[String(x = 1)], + 2 +); +assert.sameValue( + C[String(x = 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-bitwise-or.js new file mode 100644 index 0000000000..13029cd9ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-bitwise-or.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x |= 1] = 2; + + static [x |= 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x |= 1], + 2 +); +assert.sameValue( + C[x |= 1], + 2 +); +assert.sameValue( + c[String(x |= 1)], + 2 +); +assert.sameValue( + C[String(x |= 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-coalesce.js new file mode 100644 index 0000000000..0fd1ec8b87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-coalesce.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = null; + + +let C = class { + [x ??= 1] = 2; + + static [x ??= 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x ??= 1], + 2 +); +assert.sameValue( + C[x ??= 1], + 2 +); +assert.sameValue( + c[String(x ??= 1)], + 2 +); +assert.sameValue( + C[String(x ??= 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-and.js new file mode 100644 index 0000000000..d517e2d8e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-and.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x &&= 1] = 2; + + static [x &&= 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x &&= 1], + 2 +); +assert.sameValue( + C[x &&= 1], + 2 +); +assert.sameValue( + c[String(x &&= 1)], + 2 +); +assert.sameValue( + C[String(x &&= 1)], + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-or.js new file mode 100644 index 0000000000..9708b849c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-assignment-expression-logical-or.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x ||= 1] = 2; + + static [x ||= 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x ||= 1], + 2 +); +assert.sameValue( + C[x ||= 1], + 2 +); +assert.sameValue( + c[String(x ||= 1)], + 2 +); +assert.sameValue( + C[String(x ||= 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-async-arrow-function-expression.js new file mode 100644 index 0000000000..243fc29867 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-async-arrow-function-expression.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [async () => {}] = 1; + + static [async () => {}] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[async () => {}], + 1 +); +assert.sameValue( + C[async () => {}], + 1 +); +assert.sameValue( + c[String(async () => {})], + 1 +); +assert.sameValue( + C[String(async () => {})], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-await-expression.js new file mode 100644 index 0000000000..180fb5d566 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-await-expression.js @@ -0,0 +1,68 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-await-expression.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, top-level-await, class-fields-public, class-static-fields-public] +flags: [generated, async, module] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +try { + + +let C = class { + [await 9] = 9; + + static [await 9] = 9; +}; + +let c = new C(); + +assert.sameValue( + c[await 9], + 9 +); +assert.sameValue( + C[await 9], + 9 +); +assert.sameValue( + c[String(await 9)], + 9 +); +assert.sameValue( + C[String(await 9)], + 9 +); + +} catch (e) { + $DONE(e); +} +$DONE(); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-false.js new file mode 100644 index 0000000000..a11f7edbac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-false.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-false.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [false ? 1 : 2] = 1; + + static [false ? 1 : 2] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[false ? 1 : 2], + 1 +); +assert.sameValue( + C[false ? 1 : 2], + 1 +); +assert.sameValue( + c[String(false ? 1 : 2)], + 1 +); +assert.sameValue( + C[String(false ? 1 : 2)], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-true.js new file mode 100644 index 0000000000..2f63cf80d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-condition-expression-true.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-true.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [true ? 1 : 2] = 2; + + static [true ? 1 : 2] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[true ? 1 : 2], + 2 +); +assert.sameValue( + C[true ? 1 : 2], + 2 +); +assert.sameValue( + c[String(true ? 1 : 2)], + 2 +); +assert.sameValue( + C[String(true ? 1 : 2)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-e-notational-literal.js new file mode 100644 index 0000000000..591bc11d40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-e-notational-literal.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1.e1] = 2; + + static [1.e1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[1.e1], + 2 +); +assert.sameValue( + C[1.e1], + 2 +); +assert.sameValue( + c[String(1.e1)], + 2 +); +assert.sameValue( + C[String(1.e1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-literal.js new file mode 100644 index 0000000000..3b77383ce4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-decimal-literal.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-literal.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from decimal literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1.1] = 2; + + static [1.1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[1.1], + 2 +); +assert.sameValue( + C[1.1], + 2 +); +assert.sameValue( + c[String(1.1)], + 2 +); +assert.sameValue( + C[String(1.1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-exponetiation-expression.js new file mode 100644 index 0000000000..8904d0a705 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-exponetiation-expression.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from exponentiation expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [2 ** 2] = 4; + + static [2 ** 2] = 4; +}; + +let c = new C(); + +assert.sameValue( + c[2 ** 2], + 4 +); +assert.sameValue( + C[2 ** 2], + 4 +); +assert.sameValue( + c[String(2 ** 2)], + 4 +); +assert.sameValue( + C[String(2 ** 2)], + 4 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-coalesce.js new file mode 100644 index 0000000000..5b4e59ed4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-coalesce.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x; + + +let C = class { + [x ?? 1] = 2; + + static [x ?? 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x ?? 1], + 2 +); +assert.sameValue( + C[x ?? 1], + 2 +); +assert.sameValue( + c[String(x ?? 1)], + 2 +); +assert.sameValue( + C[String(x ?? 1)], + 2 +); + +assert.sameValue(x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-and.js new file mode 100644 index 0000000000..132af6f79b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-and.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x && 1] = 2; + + static [x && 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x && 1], + 2 +); +assert.sameValue( + C[x && 1], + 2 +); +assert.sameValue( + c[String(x && 1)], + 2 +); +assert.sameValue( + C[String(x && 1)], + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-or.js new file mode 100644 index 0000000000..53c41bfeeb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-expression-logical-or.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x || 1] = 2; + + static [x || 1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[x || 1], + 2 +); +assert.sameValue( + C[x || 1], + 2 +); +assert.sameValue( + c[String(x || 1)], + 2 +); +assert.sameValue( + C[String(x || 1)], + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-declaration.js new file mode 100644 index 0000000000..b5cbbf355e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-declaration.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-declaration.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function f() {} + + +let C = class { + [f()] = 1; + + static [f()] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[f()], + 1 +); +assert.sameValue( + C[f()], + 1 +); +assert.sameValue( + c[String(f())], + 1 +); +assert.sameValue( + C[String(f())], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-expression.js new file mode 100644 index 0000000000..0f45ff274f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-function-expression.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-expression.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [function () {}] = 1; + + static [function () {}] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[function () {}], + 1 +); +assert.sameValue( + C[function () {}], + 1 +); +assert.sameValue( + c[String(function () {})], + 1 +); +assert.sameValue( + C[String(function () {})], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-generator-function-declaration.js new file mode 100644 index 0000000000..0bf066e59d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-generator-function-declaration.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from generator function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { return 1; } + + +let C = class { + [g()] = 1; + + static [g()] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[g()], + 1 +); +assert.sameValue( + C[g()], + 1 +); +assert.sameValue( + c[String(g())], + 1 +); +assert.sameValue( + C[String(g())], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-identifier.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-identifier.js new file mode 100644 index 0000000000..e817da824f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-identifier.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-identifier.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 1; + + + +let C = class { + [x] = '2'; + + static [x] = '2'; +}; + +let c = new C(); + +assert.sameValue( + c[x], + '2' +); +assert.sameValue( + C[x], + '2' +); +assert.sameValue( + c[String(x)], + '2' +); +assert.sameValue( + C[String(x)], + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-e-notational-literal.js new file mode 100644 index 0000000000..20aa9fe5a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-e-notational-literal.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1] = 2; + + static [1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[1], + 2 +); +assert.sameValue( + C[1], + 2 +); +assert.sameValue( + c[String(1)], + 2 +); +assert.sameValue( + C[String(1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-separators.js new file mode 100644 index 0000000000..656fa24a75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-integer-separators.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-separators.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from integer with separators (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8; + + static [1_2_3_4_5_6_7_8] = 1_2_3_4_5_6_7_8; +}; + +let c = new C(); + +assert.sameValue( + c[1_2_3_4_5_6_7_8], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[1_2_3_4_5_6_7_8], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + c[String(1_2_3_4_5_6_7_8)], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[String(1_2_3_4_5_6_7_8)], + 1_2_3_4_5_6_7_8 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-math.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-math.js new file mode 100644 index 0000000000..dc3b42ec3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-math.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-math.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from math (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 + 2 - 3 * 4 / 5 ** 6] = 2.999232; + + static [1 + 2 - 3 * 4 / 5 ** 6] = 2.999232; +}; + +let c = new C(); + +assert.sameValue( + c[1 + 2 - 3 * 4 / 5 ** 6], + 2.999232 +); +assert.sameValue( + C[1 + 2 - 3 * 4 / 5 ** 6], + 2.999232 +); +assert.sameValue( + c[String(1 + 2 - 3 * 4 / 5 ** 6)], + 2.999232 +); +assert.sameValue( + C[String(1 + 2 - 3 * 4 / 5 ** 6)], + 2.999232 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-div.js new file mode 100644 index 0000000000..959c8c443c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-div.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 / 1] = 1; + + static [1 / 1] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[1 / 1], + 1 +); +assert.sameValue( + C[1 / 1], + 1 +); +assert.sameValue( + c[String(1 / 1)], + 1 +); +assert.sameValue( + C[String(1 / 1)], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-mult.js new file mode 100644 index 0000000000..5930a4316d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-multiplicative-expression-mult.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 * 1] = 1; + + static [1 * 1] = 1; +}; + +let c = new C(); + +assert.sameValue( + c[1 * 1], + 1 +); +assert.sameValue( + C[1 * 1], + 1 +); +assert.sameValue( + c[String(1 * 1)], + 1 +); +assert.sameValue( + C[String(1 * 1)], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-null.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-null.js new file mode 100644 index 0000000000..3a37bf8f34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-null.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-null.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [null] = null; + + static [null] = null; +}; + +let c = new C(); + +assert.sameValue( + c[null], + null +); +assert.sameValue( + C[null], + null +); +assert.sameValue( + c[String(null)], + null +); +assert.sameValue( + C[String(null)], + null +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-numeric-literal.js new file mode 100644 index 0000000000..569db4b6d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-numeric-literal.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-numeric-literal.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1] = 2; + + static [1] = 2; +}; + +let c = new C(); + +assert.sameValue( + c[1], + 2 +); +assert.sameValue( + C[1], + 2 +); +assert.sameValue( + c[String(1)], + 2 +); +assert.sameValue( + C[String(1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-string-literal.js new file mode 100644 index 0000000000..d44e0a28d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-string-literal.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-string-literal.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + ['1'] = '2'; + + static ['1'] = '2'; +}; + +let c = new C(); + +assert.sameValue( + c['1'], + '2' +); +assert.sameValue( + C['1'], + '2' +); +assert.sameValue( + c[String('1')], + '2' +); +assert.sameValue( + C[String('1')], + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-yield-expression.js new file mode 100644 index 0000000000..303614d03d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-computed-property-name-from-yield-expression.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-yield-expression.case +// - src/computed-property-names/evaluation/class-expression-fields.template +/*--- +description: Computed property name from yield expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { + + +let C = class { + [yield 9] = 9; + + static [yield 9] = 9; +}; + +let c = new C(); + +assert.sameValue( + c[yield 9], + 9 +); +assert.sameValue( + C[yield 9], + 9 +); +assert.sameValue( + c[String(yield 9)], + 9 +); +assert.sameValue( + C[String(yield 9)], + 9 +); + +} +var iter = g(); +while (iter.next().done === false) ; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-add.js new file mode 100644 index 0000000000..037048a59d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-add.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-add.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from additive expression "add" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 + 1] = () => { + return 2; + }; + + static [1 + 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1 + 1](), + 2 +); +assert.sameValue( + C[1 + 1](), + 2 +); +assert.sameValue( + c[String(1 + 1)](), + 2 +); +assert.sameValue( + C[String(1 + 1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-subtract.js new file mode 100644 index 0000000000..fd072f67ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-additive-expression-subtract.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from additive expression "subtract" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 - 1] = () => { + return 0; + }; + + static [1 - 1] = () => { + return 0; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1 - 1](), + 0 +); +assert.sameValue( + C[1 - 1](), + 0 +); +assert.sameValue( + c[String(1 - 1)](), + 0 +); +assert.sameValue( + C[String(1 - 1)](), + 0 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-arrow-function-expression.js new file mode 100644 index 0000000000..030378c2fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-arrow-function-expression.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from arrow function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [() => { }] = () => { + return 1; + }; + + static [() => { }] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[() => { }](), + 1 +); +assert.sameValue( + C[() => { }](), + 1 +); +assert.sameValue( + c[String(() => { })](), + 1 +); +assert.sameValue( + C[String(() => { })](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-assignment.js new file mode 100644 index 0000000000..743232d73b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-assignment.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from assignment expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x = 1] = () => { + return 2; + }; + + static [x = 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x = 1](), + 2 +); +assert.sameValue( + C[x = 1](), + 2 +); +assert.sameValue( + c[String(x = 1)](), + 2 +); +assert.sameValue( + C[String(x = 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js new file mode 100644 index 0000000000..dea79a9efd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-bitwise-or.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x |= 1] = () => { + return 2; + }; + + static [x |= 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x |= 1](), + 2 +); +assert.sameValue( + C[x |= 1](), + 2 +); +assert.sameValue( + c[String(x |= 1)](), + 2 +); +assert.sameValue( + C[String(x |= 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-coalesce.js new file mode 100644 index 0000000000..1a329d8f7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-coalesce.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from assignment expression coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = null; + + +let C = class { + [x ??= 1] = () => { + return 2; + }; + + static [x ??= 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x ??= 1](), + 2 +); +assert.sameValue( + C[x ??= 1](), + 2 +); +assert.sameValue( + c[String(x ??= 1)](), + 2 +); +assert.sameValue( + C[String(x ??= 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-and.js new file mode 100644 index 0000000000..5c0930729c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-and.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from assignment expression logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x &&= 1] = () => { + return 2; + }; + + static [x &&= 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x &&= 1](), + 2 +); +assert.sameValue( + C[x &&= 1](), + 2 +); +assert.sameValue( + c[String(x &&= 1)](), + 2 +); +assert.sameValue( + C[String(x &&= 1)](), + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-or.js new file mode 100644 index 0000000000..64990fe26f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-assignment-expression-logical-or.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from assignment expression logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x ||= 1] = () => { + return 2; + }; + + static [x ||= 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x ||= 1](), + 2 +); +assert.sameValue( + C[x ||= 1](), + 2 +); +assert.sameValue( + c[String(x ||= 1)](), + 2 +); +assert.sameValue( + C[String(x ||= 1)](), + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-async-arrow-function-expression.js new file mode 100644 index 0000000000..daa39f22e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-async-arrow-function-expression.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [async () => {}] = () => { + return 1; + }; + + static [async () => {}] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[async () => {}](), + 1 +); +assert.sameValue( + C[async () => {}](), + 1 +); +assert.sameValue( + c[String(async () => {})](), + 1 +); +assert.sameValue( + C[String(async () => {})](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-await-expression.js new file mode 100644 index 0000000000..821c7b8d8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-await-expression.js @@ -0,0 +1,72 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-await-expression.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, top-level-await, class-fields-public, class-static-fields-public] +flags: [generated, async, module] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +try { + + +let C = class { + [await 9] = () => { + return 9; + }; + + static [await 9] = () => { + return 9; + }; +}; + +let c = new C(); + +assert.sameValue( + c[await 9](), + 9 +); +assert.sameValue( + C[await 9](), + 9 +); +assert.sameValue( + c[String(await 9)](), + 9 +); +assert.sameValue( + C[String(await 9)](), + 9 +); + +} catch (e) { + $DONE(e); +} +$DONE(); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-false.js new file mode 100644 index 0000000000..aa638068ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-false.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-false.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [false ? 1 : 2] = () => { + return 1; + }; + + static [false ? 1 : 2] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[false ? 1 : 2](), + 1 +); +assert.sameValue( + C[false ? 1 : 2](), + 1 +); +assert.sameValue( + c[String(false ? 1 : 2)](), + 1 +); +assert.sameValue( + C[String(false ? 1 : 2)](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-true.js new file mode 100644 index 0000000000..ce74dc704a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-condition-expression-true.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-true.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [true ? 1 : 2] = () => { + return 2; + }; + + static [true ? 1 : 2] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[true ? 1 : 2](), + 2 +); +assert.sameValue( + C[true ? 1 : 2](), + 2 +); +assert.sameValue( + c[String(true ? 1 : 2)](), + 2 +); +assert.sameValue( + C[String(true ? 1 : 2)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-e-notational-literal.js new file mode 100644 index 0000000000..afc6d36883 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-e-notational-literal.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from decimal e notational literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1.e1] = () => { + return 2; + }; + + static [1.e1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1.e1](), + 2 +); +assert.sameValue( + C[1.e1](), + 2 +); +assert.sameValue( + c[String(1.e1)](), + 2 +); +assert.sameValue( + C[String(1.e1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-literal.js new file mode 100644 index 0000000000..339787a6f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-decimal-literal.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-literal.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from decimal literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1.1] = () => { + return 2; + }; + + static [1.1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1.1](), + 2 +); +assert.sameValue( + C[1.1](), + 2 +); +assert.sameValue( + c[String(1.1)](), + 2 +); +assert.sameValue( + C[String(1.1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-exponetiation-expression.js new file mode 100644 index 0000000000..c50b2889ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-exponetiation-expression.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from exponentiation expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [2 ** 2] = () => { + return 4; + }; + + static [2 ** 2] = () => { + return 4; + }; +}; + +let c = new C(); + +assert.sameValue( + c[2 ** 2](), + 4 +); +assert.sameValue( + C[2 ** 2](), + 4 +); +assert.sameValue( + c[String(2 ** 2)](), + 4 +); +assert.sameValue( + C[String(2 ** 2)](), + 4 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-coalesce.js new file mode 100644 index 0000000000..66200170fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-coalesce.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-coalesce.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from coalesce (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x; + + +let C = class { + [x ?? 1] = () => { + return 2; + }; + + static [x ?? 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x ?? 1](), + 2 +); +assert.sameValue( + C[x ?? 1](), + 2 +); +assert.sameValue( + c[String(x ?? 1)](), + 2 +); +assert.sameValue( + C[String(x ?? 1)](), + 2 +); + +assert.sameValue(x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-and.js new file mode 100644 index 0000000000..4a756972a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-and.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-and.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from logical and (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x && 1] = () => { + return 2; + }; + + static [x && 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x && 1](), + 2 +); +assert.sameValue( + C[x && 1](), + 2 +); +assert.sameValue( + c[String(x && 1)](), + 2 +); +assert.sameValue( + C[String(x && 1)](), + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-or.js new file mode 100644 index 0000000000..f4a3eec9f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-expression-logical-or.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-or.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from logical or (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let C = class { + [x || 1] = () => { + return 2; + }; + + static [x || 1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x || 1](), + 2 +); +assert.sameValue( + C[x || 1](), + 2 +); +assert.sameValue( + c[String(x || 1)](), + 2 +); +assert.sameValue( + C[String(x || 1)](), + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-declaration.js new file mode 100644 index 0000000000..73fb862845 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-declaration.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-declaration.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function f() {} + + +let C = class { + [f()] = () => { + return 1; + }; + + static [f()] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[f()](), + 1 +); +assert.sameValue( + C[f()](), + 1 +); +assert.sameValue( + c[String(f())](), + 1 +); +assert.sameValue( + C[String(f())](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-expression.js new file mode 100644 index 0000000000..bebb15621d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-function-expression.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-expression.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [function () {}] = () => { + return 1; + }; + + static [function () {}] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[function () {}](), + 1 +); +assert.sameValue( + C[function () {}](), + 1 +); +assert.sameValue( + c[String(function () {})](), + 1 +); +assert.sameValue( + C[String(function () {})](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-generator-function-declaration.js new file mode 100644 index 0000000000..a651032e6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-generator-function-declaration.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from generator function (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { return 1; } + + +let C = class { + [g()] = () => { + return 1; + }; + + static [g()] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[g()](), + 1 +); +assert.sameValue( + C[g()](), + 1 +); +assert.sameValue( + c[String(g())](), + 1 +); +assert.sameValue( + C[String(g())](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-identifier.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-identifier.js new file mode 100644 index 0000000000..c7a0ed2740 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-identifier.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-identifier.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 1; + + + +let C = class { + [x] = () => { + return '2'; + }; + + static [x] = () => { + return '2'; + }; +}; + +let c = new C(); + +assert.sameValue( + c[x](), + '2' +); +assert.sameValue( + C[x](), + '2' +); +assert.sameValue( + c[String(x)](), + '2' +); +assert.sameValue( + C[String(x)](), + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-e-notational-literal.js new file mode 100644 index 0000000000..d028f26c1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-e-notational-literal.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1] = () => { + return 2; + }; + + static [1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1](), + 2 +); +assert.sameValue( + C[1](), + 2 +); +assert.sameValue( + c[String(1)](), + 2 +); +assert.sameValue( + C[String(1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-separators.js new file mode 100644 index 0000000000..99c4ab9cf2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-integer-separators.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-separators.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from integer with separators (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1_2_3_4_5_6_7_8] = () => { + return 1_2_3_4_5_6_7_8; + }; + + static [1_2_3_4_5_6_7_8] = () => { + return 1_2_3_4_5_6_7_8; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1_2_3_4_5_6_7_8](), + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[1_2_3_4_5_6_7_8](), + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + c[String(1_2_3_4_5_6_7_8)](), + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + C[String(1_2_3_4_5_6_7_8)](), + 1_2_3_4_5_6_7_8 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-math.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-math.js new file mode 100644 index 0000000000..9a2fb42b74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-math.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-math.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from math (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 + 2 - 3 * 4 / 5 ** 6] = () => { + return 2.999232; + }; + + static [1 + 2 - 3 * 4 / 5 ** 6] = () => { + return 2.999232; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1 + 2 - 3 * 4 / 5 ** 6](), + 2.999232 +); +assert.sameValue( + C[1 + 2 - 3 * 4 / 5 ** 6](), + 2.999232 +); +assert.sameValue( + c[String(1 + 2 - 3 * 4 / 5 ** 6)](), + 2.999232 +); +assert.sameValue( + C[String(1 + 2 - 3 * 4 / 5 ** 6)](), + 2.999232 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-div.js new file mode 100644 index 0000000000..386384b025 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-div.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 / 1] = () => { + return 1; + }; + + static [1 / 1] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1 / 1](), + 1 +); +assert.sameValue( + C[1 / 1](), + 1 +); +assert.sameValue( + c[String(1 / 1)](), + 1 +); +assert.sameValue( + C[String(1 / 1)](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-mult.js new file mode 100644 index 0000000000..2c7b636587 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-multiplicative-expression-mult.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1 * 1] = () => { + return 1; + }; + + static [1 * 1] = () => { + return 1; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1 * 1](), + 1 +); +assert.sameValue( + C[1 * 1](), + 1 +); +assert.sameValue( + c[String(1 * 1)](), + 1 +); +assert.sameValue( + C[String(1 * 1)](), + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-null.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-null.js new file mode 100644 index 0000000000..7b04831bcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-null.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-null.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [null] = () => { + return null; + }; + + static [null] = () => { + return null; + }; +}; + +let c = new C(); + +assert.sameValue( + c[null](), + null +); +assert.sameValue( + C[null](), + null +); +assert.sameValue( + c[String(null)](), + null +); +assert.sameValue( + C[String(null)](), + null +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-numeric-literal.js new file mode 100644 index 0000000000..540b298896 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-numeric-literal.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-numeric-literal.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + [1] = () => { + return 2; + }; + + static [1] = () => { + return 2; + }; +}; + +let c = new C(); + +assert.sameValue( + c[1](), + 2 +); +assert.sameValue( + C[1](), + 2 +); +assert.sameValue( + c[String(1)](), + 2 +); +assert.sameValue( + C[String(1)](), + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-string-literal.js new file mode 100644 index 0000000000..04e8435be2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-string-literal.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-string-literal.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let C = class { + ['1'] = () => { + return '2'; + }; + + static ['1'] = () => { + return '2'; + }; +}; + +let c = new C(); + +assert.sameValue( + c['1'](), + '2' +); +assert.sameValue( + C['1'](), + '2' +); +assert.sameValue( + c[String('1')](), + '2' +); +assert.sameValue( + C[String('1')](), + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-yield-expression.js new file mode 100644 index 0000000000..2c2e82bf7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/cpn-class-expr-fields-methods-computed-property-name-from-yield-expression.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-yield-expression.case +// - src/computed-property-names/evaluation/class-expression-fields-methods.template +/*--- +description: Computed property name from yield expression (ComputedPropertyName in ClassExpression) +esid: prod-ComputedPropertyName +features: [computed-property-names, class-fields-public, class-static-fields-public] +flags: [generated] +info: | + ClassExpression: + classBindingIdentifier opt ClassTail + + ClassTail: + ClassHeritage opt { ClassBody opt } + + ClassBody: + ClassElementList + + ClassElementList: + ClassElement + + ClassElement: + MethodDefinition + + MethodDefinition: + PropertyName ... + get PropertyName ... + set PropertyName ... + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { + + +let C = class { + [yield 9] = () => { + return 9; + }; + + static [yield 9] = () => { + return 9; + }; +}; + +let c = new C(); + +assert.sameValue( + c[yield 9](), + 9 +); +assert.sameValue( + C[yield 9](), + 9 +); +assert.sameValue( + c[String(yield 9)](), + 9 +); +assert.sameValue( + C[String(yield 9)](), + 9 +); + +} +var iter = g(); +while (iter.next().done === false) ; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/browser.js b/js/src/tests/test262/language/expressions/class/decorator/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/decorator/shell.js b/js/src/tests/test262/language/expressions/class/decorator/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/browser.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/browser.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js new file mode 100644 index 0000000000..cb308eb848 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/decorator-member-expr-private-identifier.js @@ -0,0 +1,58 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-member-expr-private-identifier.case +// - src/decorator/syntax/class-valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class expression in class body.) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + DecoratorMemberExpression[Yield, Await] : + IdentifierReference[?Yield, ?Await] + DecoratorMemberExpression[?Yield, ?Await] . IdentifierName + DecoratorMemberExpression[?Yield, ?Await] . PrivateIdentifier + + PrivateIdentifier :: + # IdentifierName + +---*/ + + +class C { + static #$() {} + static #_() {} + static #\u{6F}() {} + static #\u2118() {} + static #ZW_\u200C_NJ() {} + static #ZW_\u200D_J() {} + static #yield() {} + static #await() {} + + static { + var D = @C.#$ + @C.#_ + @C.#\u{6F} + @C.#\u2118 + @C.#ZW_\u200C_NJ + @C.#ZW_\u200D_J + @C.#yield + @C.#await class {} + } +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/shell.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/class-valid/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/shell.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/browser.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js new file mode 100644 index 0000000000..6e6d701b99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference-yield.js @@ -0,0 +1,47 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-call-expr-identifier-reference-yield.case +// - src/decorator/syntax/valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorCallExpression (Valid syntax for decorator on class expression) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated, noStrict] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + DecoratorCallExpression[Yield, Await] : + DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await] + + DecoratorMemberExpression[Yield, Await] : + IdentifierReference[?Yield, ?Await] + DecoratorMemberExpression[?Yield, ?Await] . IdentifierName + DecoratorMemberExpression[?Yield, ?Await] . PrivateIdentifier + + IdentifierReference[Yield, Await] : + [~Yield] yield + ... + +---*/ +function decorator() { + return () => {}; +} +var yield = decorator; + + + +var C = @yield() class {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js new file mode 100644 index 0000000000..e6e9983142 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-call-expr-identifier-reference.js @@ -0,0 +1,60 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-call-expr-identifier-reference.case +// - src/decorator/syntax/valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorCallExpression (Valid syntax for decorator on class expression) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + DecoratorCallExpression[Yield, Await] : + DecoratorMemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await] + + DecoratorMemberExpression[Yield, Await] : + IdentifierReference[?Yield, ?Await] + DecoratorMemberExpression[?Yield, ?Await] . IdentifierName + DecoratorMemberExpression[?Yield, ?Await] . PrivateIdentifier + + IdentifierReference[Yield, Await] : + Identifier + [~Yield] yield + [~Await] await + +---*/ +function decorator() { + return () => {}; +} +var $ = decorator; +var _ = decorator; +var \u{6F} = decorator; +var \u2118 = decorator; +var ZW_\u200C_NJ = decorator; +var ZW_\u200D_J = decorator; +var await = decorator; + + + +var C = @$() +@_() +@\u{6F}() +@\u2118() +@ZW_\u200C_NJ() +@ZW_\u200D_J() +@await() class {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js new file mode 100644 index 0000000000..4ec9be9889 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-decorator-member-expr.js @@ -0,0 +1,53 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-member-expr-decorator-member-expr.case +// - src/decorator/syntax/valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class expression) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + DecoratorMemberExpression[Yield, Await] : + IdentifierReference[?Yield, ?Await] + DecoratorMemberExpression[?Yield, ?Await] . IdentifierName + DecoratorMemberExpression[?Yield, ?Await] . PrivateIdentifier + +---*/ +let ns = { + $() {}, + _() {}, + \u{6F}() {}, + \u2118() {}, + ZW_\u200C_NJ() {}, + ZW_\u200D_J() {}, + yield() {}, + await() {}, +} + + + +var C = @ns.$ +@ns._ +@ns.\u{6F} +@ns.\u2118 +@ns.ZW_\u200C_NJ +@ns.ZW_\u200D_J +@ns.yield +@ns.await class {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js new file mode 100644 index 0000000000..bb2fda64a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference-yield.js @@ -0,0 +1,36 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-member-expr-identifier-reference-yield.case +// - src/decorator/syntax/valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class expression) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated, noStrict] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + IdentifierReference[Yield, Await] : + [~Yield] yield + ... + +---*/ +function yield() {} + + + +var C = @yield class {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js new file mode 100644 index 0000000000..b9984f7385 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-member-expr-identifier-reference.js @@ -0,0 +1,49 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-member-expr-identifier-reference.case +// - src/decorator/syntax/valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorMemberExpression (Valid syntax for decorator on class expression) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + IdentifierReference[Yield, Await] : + Identifier + [~Yield] yield + [~Await] await + +---*/ +function $() {} +function _() {} +function \u{6F}() {} +function \u2118() {} +function ZW_\u200C_NJ() {} +function ZW_\u200D_J() {} +function await() {} + + + +var C = @$ +@_ +@\u{6F} +@\u2118 +@ZW_\u200C_NJ +@ZW_\u200D_J +@await class {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js new file mode 100644 index 0000000000..218771e83d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference-yield.js @@ -0,0 +1,54 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-parenthesized-expr-identifier-reference-yield.case +// - src/decorator/syntax/valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorParenthesizedExpression (Valid syntax for decorator on class expression) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated, noStrict] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + DecoratorParenthesizedExpression[Yield, Await] : + ( Expression[+In, ?Yield, ?Await] ) + + PrimaryExpression[Yield, Await] : + this + IdentifierReference[?Yield, ?Await] + Literal + ArrayLiteral[?Yield, ?Await] + ObjectLiteral[?Yield, ?Await] + FunctionExpression + ClassExpression[?Yield, ?Await] + GeneratorExpression + AsyncFunctionExpression + AsyncGeneratorExpression + RegularExpressionLiteral + TemplateLiteral[?Yield, ?Await, ~Tagged] + CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] + + IdentifierReference[Yield, Await] : + [~Yield] yield + ... + +---*/ +function yield() {} + + + +var C = @(yield) class {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js new file mode 100644 index 0000000000..0f449534f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/decorator-parenthesized-expr-identifier-reference.js @@ -0,0 +1,62 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/decorator/decorator-parenthesized-expr-identifier-reference.case +// - src/decorator/syntax/valid/cls-expr-decorators-valid-syntax.template +/*--- +description: Decorator @ DecoratorParenthesizedExpression (Valid syntax for decorator on class expression) +esid: prod-ClassExpression +features: [class, decorators] +flags: [generated] +info: | + ClassExpression[Yield, Await] : + DecoratorList[?Yield, ?Await]opt class BindingIdentifier[?Yield, ?Await]opt ClassTail[?Yield, ?Await] + + DecoratorList[Yield, Await] : + DecoratorList[?Yield, ?Await]opt Decorator[?Yield, ?Await] + + Decorator[Yield, Await] : + @ DecoratorMemberExpression[?Yield, ?Await] + @ DecoratorParenthesizedExpression[?Yield, ?Await] + @ DecoratorCallExpression[?Yield, ?Await] + + ... + + + DecoratorParenthesizedExpression[Yield, Await] : + ( Expression[+In, ?Yield, ?Await] ) + + PrimaryExpression[Yield, Await] : + this + IdentifierReference[?Yield, ?Await] + Literal + ArrayLiteral[?Yield, ?Await] + ObjectLiteral[?Yield, ?Await] + FunctionExpression + ClassExpression[?Yield, ?Await] + GeneratorExpression + AsyncFunctionExpression + AsyncGeneratorExpression + RegularExpressionLiteral + TemplateLiteral[?Yield, ?Await, ~Tagged] + CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] + +---*/ +function $() {} +function _() {} +function \u{6F}() {} +function \u2118() {} +function ZW_\u200C_NJ() {} +function ZW_\u200D_J() {} +function await() {} + + + +var C = @($) +@(_) +@(\u{6F}) +@(\u2118) +@(ZW_\u200C_NJ) +@(ZW_\u200D_J) +@(await) class {}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/shell.js b/js/src/tests/test262/language/expressions/class/decorator/syntax/valid/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-close.js new file mode 100644 index 0000000000..20817838eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async *method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..9d57954342 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var C = class { + async *method([x, y, z]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err.js new file mode 100644 index 0000000000..4b057a8083 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-get-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var C = class { + async *method([x]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..0e7e3d5600 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-init-iter-no-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async *method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-name-iter-val.js new file mode 100644 index 0000000000..1e1431dbbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-name-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding with normal value iteration (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..bc98e355cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..743db15320 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +new C().method([[7, 8, 9]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..65e1efb290 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async *method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..e338818946 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + async *method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([[]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..4ec8c2f1a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + async *method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..cd9d5fc265 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + async *method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([[23]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..3e4ad1d697 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + async *method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..7904f28b0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + async *method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([values]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..14ffc5e63a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Nested array destructuring with a null value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var C = class { + async *method([[x]]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..104e0c4c9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..7dea6c1ebc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..e5c01219ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..c7e8e7b87c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..3efa58de34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..2beb517227 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + async *method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..1066b40947 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer with a "hole" (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +new C().method([,]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..2b940b035f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async *method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([null, 0, false, '']).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..efebaa5eaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var C = class { + async *method([x = (function() { throw new Test262Error(); })()]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..7318a27337 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer with an undefined value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method([undefined]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..b06294ee4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + async *method([ x = unresolvableReference ]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(ReferenceError, function() { + method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..6b7198ed56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding when value iteration completes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..d0c9b898ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..c1ee4386eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var C = class { + async *method([x]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..78afb47928 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..7c22cef99a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + async *method([x]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..69b545069e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..35a9ed75f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..00f62c37e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +new C().method([{ x: 11, y: 22, z: 33 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..0e82ce9513 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..7f3e09edd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method([{ u: 777, w: 888, y: 999 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..6da248dbe6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Nested object destructuring with a null value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + async *method([{ x }]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..58afbe191e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Nested object destructuring with a value of `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + async *method([{ x }]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..2e5b9fb4a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Elision accepts exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + async *method([,]) { + + callCount = callCount + 1; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..2230892ef9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision-step-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Elision advances iterator and forwards abrupt completions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var C = class { + async *method([,]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..77e66873f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-elision.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Elision advances iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async *method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..7303bde30a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-empty.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async *method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..1e8420c35e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,91 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +new C().method([3, 4, 5]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..0eab6fa1cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,97 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element containing an elision (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async *method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +new C().method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..70d8990878 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element containing an "empty" array pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async *method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..8c2bfbc089 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element containing a rest element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async *method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +new C().method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..1656e4d8c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Lone rest element (direct binding) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + async *method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +new C().method([1]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..17c03b6247 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Rest element following elision elements (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var C = class { + async *method([, ...x]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..9928647ba4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element following elision elements (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + async *method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..8e58ac16da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: RestElement applied to an exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + async *method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +new C().method([1, 2]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..f4a615466f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var C = class { + async *method([...x]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..a543d3c5e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + async *method([...x]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..d5e0d5b60d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Lone rest element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async *method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..6ec5424abd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..abf47ee5d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element (identifier) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...x = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..df756bebfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..20c8d58a7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..b80c957f87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...x, y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..7c980fa41a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..26f6fb6db2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + async *method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..ee122bd136 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +new C().method([7, 8, 9]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..30341e94cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async *method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..9f6eb290a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var C = class { + async *method([x, y, z] = [1, 2, 3]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..669abf2f25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var C = class { + async *method([x] = iter) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..8eb2676c3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async *method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..0291735418 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-name-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..8c4d62c58c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..84b5c80507 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..e85c809434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async *method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..5948acd6f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + async *method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..41c4ee9075 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + async *method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..7c7f6c9e6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + async *method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..a73e4287af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + async *method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..2645f7707f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + async *method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..7082a9370c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Nested array destructuring with a null value (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var C = class { + async *method([[x]] = [null]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..c6a5e5d3a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..5e09c77eca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..793df094e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b4e8bc7a77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..180070272d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..2bf54480e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + async *method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..89084a4ba2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer with a "hole" (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..d8cae4dc56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..c4240f1016 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var C = class { + async *method([x = (function() { throw new Test262Error(); })()] = [undefined]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..4a69fffd4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an undefined value (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..2fc880b2a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + async *method([ x = unresolvableReference ] = []) { + + } +}; + +var method = C.prototype.method; + +assert.throws(ReferenceError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..9dc9392eac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..8e305ecd52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..ab82f51ff2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var C = class { + async *method([x] = g) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..1e192cf70f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..6246720943 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + async *method([x] = g) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..0dde0d2a74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..f828fd1c48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..454d4ff41a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..9fcf78f5ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..2e02eb5f3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..96c465bc77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Nested object destructuring with a null value (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + async *method([{ x }] = [null]) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..773e9705a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + async *method([{ x }] = []) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..537ace8621 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Elision accepts exhausted iterator (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + async *method([,] = iter) { + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..ef86eb33f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var C = class { + async *method([,] = iter) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..e387291367 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Elision advances iterator (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async *method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..2ddd5085ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async *method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..5f3e1ba6b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,91 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..de6bec6c3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,97 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element containing an elision (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async *method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..46599fe7f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async *method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..9349d85aee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element containing a rest element (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async *method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..1296ab2336 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Lone rest element (direct binding) (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + async *method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..0e420e6e8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element following elision elements (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var C = class { + async *method([, ...x] = iter) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..938ab811e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element following elision elements (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + async *method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..352fd95f66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + async *method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..1eb2361fad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var C = class { + async *method([...x] = iter) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..6f92021154 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + async *method([...x] = iter) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..b43cb7e0eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Lone rest element (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async *method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..2591249fc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..517cad0e7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..26abbe642c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..db9c27a109 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..779a3d4cff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..db9fb19969 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async *method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..02810ee827 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + async *method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..a5a7d8fe94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-null.js new file mode 100644 index 0000000000..77d26c2115 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + async *method({} = null) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..a707a46b29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-init-undefined.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + async *method({} = undefined) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..bcd87b5630 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + async *method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..f230bb48b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + async *method({ poisoned } = poisonedProperty) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..54660677c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..42ae2a6611 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..168314d36c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..73d85b5388 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..2c86f8ca4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + async *method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..3c38afeb26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..f397043f6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ x = thrower() } = {}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..ba2a05cb78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + async *method({ x = unresolvableReference } = {}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(ReferenceError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..09cfc5d977 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async *method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..959c0ce787 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ a, b = thrower(), c = ++initCount } = {}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..f2e02d1434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..a618f9aeb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..c347570076 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + async *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..7cb6b7a388 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..5745017c1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ [thrower()]: x } = {}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..23842c18fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + async *method({ poisoned: x = ++initEvalCount } = poisonedProperty) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..419f9d3e2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..cfa0d3bc6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ x: y = thrower() } = {}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..7570ec046d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + async *method({ x: y = unresolvableReference } = {}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(ReferenceError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..71a24ef8fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..f1d21f8467 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..0340e1131d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Binding as specified via property name and identifier (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..7c94907a71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..5014f9f961 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..46d921c014 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + async *method({ w: { x, y, z } = undefined } = { }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..524bf952a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..9ff0c95049 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + async *method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..7f9371452b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + async *method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..6e2738ca8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template +/*--- +description: Rest object contains just unextracted data (class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + async *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-null.js new file mode 100644 index 0000000000..9a2c00512e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + async *method({}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-undefined.js new file mode 100644 index 0000000000..a335224f4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-init-undefined.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + async *method({}) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..bebf324cce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-empty.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + async *method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(obj).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..04f618c42d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + async *method({ poisoned }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..2dafd1cae9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..d385eab1e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b5022e0802 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..6662627f93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async *method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..ba35babb16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + async *method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..51034283b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async *method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method({ w: null, x: 0, y: false, z: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..1049c0b8f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ x = thrower() }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..8696a4cbe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + async *method({ x = unresolvableReference }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(ReferenceError, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..f820c40c1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async *method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-list-err.js new file mode 100644 index 0000000000..5116b89c80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-list-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ a, b = thrower(), c = ++initCount }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..9650a3bb5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..710d2483ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +new C().method({ x: [45] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..520cc10605 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + async *method({ w: [x, y, z] = [4, 5, 6] }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..ef4aa2ee93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-ary.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: [7, undefined, ] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..4effd38ca9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Evaluation of property name returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ [thrower()]: x }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..63d6929268 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + async *method({ poisoned: x = ++initEvalCount }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..9bc0b776dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method({ s: null, u: 0, w: false, y: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..77a79e5489 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + async *method({ x: y = thrower() }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..78a7744b86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + async *method({ x: y = unresolvableReference }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(ReferenceError, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..cc4fa1a239 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..cb44fa3cd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..e0553fa92b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-id.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Binding as specified via property name and identifier (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async *method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..ed8e639c43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: undefined }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..f603c3f59a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..e73d9c0e7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + async *method({ w: { x, y, z } = undefined }) { + + } +}; + +var method = C.prototype.method; + +assert.throws(TypeError, function() { + method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..2c4efb09bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-prop-obj.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: { x: undefined, z: 7 } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..4ec0173b2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-getter.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + async *method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method({ get v() { count++; return 2; } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..9040e33170 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + async *method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +new C().method(o).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..2cbbe071d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth.template +/*--- +description: Rest object contains just unextracted data (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + async *method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method({x: 1, y: 2, a: 5, b: 3}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-close.js new file mode 100644 index 0000000000..ba92e41f73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async *method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..a2bed75691 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var C = class { + static async *method([x, y, z]) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js new file mode 100644 index 0000000000..35d85649e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-get-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var C = class { + static async *method([x]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js new file mode 100644 index 0000000000..2c5e2cb0e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-init-iter-no-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async *method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-name-iter-val.js new file mode 100644 index 0000000000..c536e90e46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-name-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding with normal value iteration (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..b93f0c52fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..6ef6ed24dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +C.method([[7, 8, 9]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..db92bd7253 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..b84dd94d6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +C.method([[]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..0c989644fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + static async *method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..9bbbd3dfb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + static async *method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([[23]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..8c7bf096da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + static async *method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..8c9ed274b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + static async *method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([values]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..daa550a75e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Nested array destructuring with a null value (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var C = class { + static async *method([[x]]) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..c3a9c315c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer with an exhausted iterator (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..e3c83b1381 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to arrow functions (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..f4ffa83509 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..f3167a1bde --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..adbae01640 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..c9ec8391d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + static async *method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..0277647bdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer with a "hole" (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +C.method([,]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..992f342012 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async *method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([null, 0, false, '']).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..f5a44ca097 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer returns an abrupt completion (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var C = class { + static async *method([x = (function() { throw new Test262Error(); })()]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..2931108c51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer with an undefined value (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method([undefined]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..fea47bf49c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + static async *method([ x = unresolvableReference ]) { + + } +}; + +var method = C.method; + +assert.throws(ReferenceError, function() { + method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..53bae4046d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration completes (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..c641873e99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..77144123ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var C = class { + static async *method([x]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..edb383febe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + static async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..3c034b5d77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + static async *method([x]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..13670ea184 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..3d0fcf8674 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..bb0319a405 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +C.method([{ x: 11, y: 22, z: 33 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..4b34afbdbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..c128d7c6d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method([{ u: 777, w: 888, y: 999 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..a3b3725ea7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Nested object destructuring with a null value (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + static async *method([{ x }]) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..8dfc6d0bda --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Nested object destructuring with a value of `undefined` (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + static async *method([{ x }]) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..ae4a90b0d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-exhausted.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Elision accepts exhausted iterator (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + static async *method([,]) { + + callCount = callCount + 1; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..11e472c5a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision-step-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Elision advances iterator and forwards abrupt completions (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var C = class { + static async *method([,]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision.js new file mode 100644 index 0000000000..ac4453820b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-elision.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Elision advances iterator (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-empty.js new file mode 100644 index 0000000000..da658794dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-empty.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async *method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..2c0ee38ce6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,91 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element containing an array BindingElementList pattern (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +C.method([3, 4, 5]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..7e97b54844 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,97 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element containing an elision (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +C.method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..12813d515c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element containing an "empty" array pattern (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async *method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..3ab056e5b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element containing a rest element (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async *method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +C.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..6fe06c2556 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-direct.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Lone rest element (direct binding) (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + static async *method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +C.method([1]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..4a56bc5ad2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element following elision elements (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var C = class { + static async *method([, ...x]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..36d3a39917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element following elision elements (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + static async *method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..14103a4f61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: RestElement applied to an exhausted iterator (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + static async *method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +C.method([1, 2]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..ff15ff5658 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var C = class { + static async *method([...x]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..4fc76be9e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + static async *method([...x]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..2d0e7f7685 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Lone rest element (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async *method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..0b56bf56e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element (nested array pattern) does not support initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..f7d87a533f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element (identifier) does not support initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...x = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..93a27685ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-init-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element (nested object pattern) does not support initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..f9aa8720be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..ae7282ba95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element (identifier) may not be followed by any element (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...x, y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..4ad94a6fb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..e63b6014a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + static async *method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..056c9c9a36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + static async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +C.method([7, 8, 9]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..5d357c5ccc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async *method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..a4c3eea3d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var C = class { + static async *method([x, y, z] = [1, 2, 3]) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..781a1f1249 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-get-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var C = class { + static async *method([x] = iter) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..6399d666d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-init-iter-no-close.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async *method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..aba5123a47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-name-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..09bb801cd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..8c3ce4f902 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..c5c1270498 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..663fb2186f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..8bc5c6e1ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + static async *method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..a85ee9f382 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + static async *method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..a6c6fd144d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + static async *method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..2c264be49f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + static async *method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..08be76c9f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Nested array destructuring with a null value (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var C = class { + static async *method([[x]] = [null]) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..0810b0a09f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..241779cb41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..1300384217 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a82c0a7cc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..784d8cdfcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..e5fc7712f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + static async *method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..2dae116ded --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with a "hole" (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..180476ea3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..5796ed9912 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var C = class { + static async *method([x = (function() { throw new Test262Error(); })()] = [undefined]) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..7110e8663a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an undefined value (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..3e642a9584 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + static async *method([ x = unresolvableReference ] = []) { + + } +}; + +var method = C.method; + +assert.throws(ReferenceError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..b858ec95e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..2ac76a7417 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..07d433def1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var C = class { + static async *method([x] = g) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..71580b2647 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + static async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..6c014b5365 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + static async *method([x] = g) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..9584e0d248 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..4fa8a88688 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..b81d14d6a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..65b4f402d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..44b32e2ae2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..6e0af4053b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Nested object destructuring with a null value (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + static async *method([{ x }] = [null]) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..9e0271ecc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var C = class { + static async *method([{ x }] = []) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..0877b06a6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Elision accepts exhausted iterator (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + static async *method([,] = iter) { + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..ca53775448 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var C = class { + static async *method([,] = iter) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..fb4cee3499 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-elision.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Elision advances iterator (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..752827bc53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-empty.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async *method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..75510fa7c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,91 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..96b99cfccb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,97 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element containing an elision (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async *method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..b46b03f18e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async *method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..7492ed7f7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element containing a rest element (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async *method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..c8f98b7c4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Lone rest element (direct binding) (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + static async *method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..8ef48c4f25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element following elision elements (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var C = class { + static async *method([, ...x] = iter) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..d60bf3e8c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element following elision elements (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + static async *method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..c964b64339 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + static async *method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..e0f36335aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var C = class { + static async *method([...x] = iter) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..51764971a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var C = class { + static async *method([...x] = iter) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..11ac4d4b2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Lone rest element (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async *method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..06d05d327e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..4b34fd2252 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..749165fe4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..25487bf1d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..042602ce26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..36fbd5cd56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async *method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..18247d2608 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + static async *method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..2ef2c3d9f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + static async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-null.js new file mode 100644 index 0000000000..72d6bfadef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + static async *method({} = null) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..b86e1b538a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-init-undefined.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + static async *method({} = undefined) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..1298b21fd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-empty.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + static async *method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..8d12d840ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + static async *method({ poisoned } = poisonedProperty) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..8b46508a24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..530655d8bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..0d00ed1906 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..e7def649ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..1712cf7868 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + static async *method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..70b952ccf4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..7d0b364bf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error thrown when evaluating the initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ x = thrower() } = {}) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..4b26911f15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + static async *method({ x = unresolvableReference } = {}) { + + } +}; + +var method = C.method; + +assert.throws(ReferenceError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..b57e3b15a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..c48ad1d8cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-list-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ a, b = thrower(), c = ++initCount } = {}) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..a622c4bb2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..59d4a3cb36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..c981e9538d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + static async *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..e6d4976b1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..096a406423 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ [thrower()]: x } = {}) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..91ad34ed23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + static async *method({ poisoned: x = ++initEvalCount } = poisonedProperty) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..33dcef1476 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..01022e6b4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Error thrown when evaluating the initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ x: y = thrower() } = {}) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..c6f4897ce9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + static async *method({ x: y = unresolvableReference } = {}) { + + } +}; + +var method = C.method; + +assert.throws(ReferenceError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..0ac539f55b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..3f459e247e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..e133896f4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name and identifier (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..e506692c4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..0eb24e673e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..2b59dfd129 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + static async *method({ w: { x, y, z } = undefined } = { }) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..f3aacba2a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..5f2ae364ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + static async *method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..22f05012f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + static async *method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..ac1d1a3d20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template +/*--- +description: Rest object contains just unextracted data (static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + static async *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-null.js new file mode 100644 index 0000000000..97980621f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + static async *method({}) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-undefined.js new file mode 100644 index 0000000000..7504a2485a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-init-undefined.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var C = class { + static async *method({}) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-empty.js new file mode 100644 index 0000000000..e7a8630aa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-empty.js @@ -0,0 +1,68 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: No property access occurs for an "empty" object binding pattern (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + static async *method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +C.method(obj).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..be191318ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-get-value-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + static async *method({ poisoned }) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..e7467ce5cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..08aa15ffde --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..cd5d2730ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..11388418f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..4ec0190329 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + static async *method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..14828b8913 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-skipped.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async *method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method({ w: null, x: 0, y: false, z: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..154bb2ed28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error thrown when evaluating the initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ x = thrower() }) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..b0f7d1ea05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + static async *method({ x = unresolvableReference }) { + + } +}; + +var method = C.method; + +assert.throws(ReferenceError, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..63ea5d206a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js new file mode 100644 index 0000000000..7773771d83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-list-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ a, b = thrower(), c = ++initCount }) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..a6716669f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..945d72329c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +C.method({ x: [45] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..e56720ca6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + static async *method({ w: [x, y, z] = [4, 5, 6] }) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..93c9a95603 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-ary.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: [7, undefined, ] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..2c9dfc8f54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-eval-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Evaluation of property name returns an abrupt completion (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ [thrower()]: x }) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..f555a23d02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var C = class { + static async *method({ poisoned: x = ++initEvalCount }) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..61d7153bb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method({ s: null, u: 0, w: false, y: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..288d1df44e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Error thrown when evaluating the initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var C = class { + static async *method({ x: y = thrower() }) { + + } +}; + +var method = C.method; + +assert.throws(Test262Error, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..9e76bb68d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var C = class { + static async *method({ x: y = unresolvableReference }) { + + } +}; + +var method = C.method; + +assert.throws(ReferenceError, function() { + method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..0185631195 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-init.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Binding as specified via property name, identifier, and initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..451fb901d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..5b96ebcd4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-id.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Binding as specified via property name and identifier (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async *method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..86ede07948 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-init.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: undefined }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..e1f678840d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..2f6209bb65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-async-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var C = class { + static async *method({ w: { x, y, z } = undefined }) { + + } +}; + +var method = C.method; + +assert.throws(TypeError, function() { + method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..f5171ab8ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-prop-obj.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: { x: undefined, z: 7 } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..f0f2b52f51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-getter.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + static async *method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method({ get v() { count++; return 2; } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..5d41ca53a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest object doesn't contain non-enumerable properties (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + static async *method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +C.method(o).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..cd60288cf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-gen-meth-static-obj-ptrn-rest-val-obj.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-gen-meth-static.template +/*--- +description: Rest object contains just unextracted data (static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + static async *method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method({x: 1, y: 2, a: 5, b: 3}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-close.js new file mode 100644 index 0000000000..3061020be9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async * #method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..db581d5bc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-init-iter-no-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async * #method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-name-iter-val.js new file mode 100644 index 0000000000..635e856952 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-name-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding with normal value iteration (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..fb7eb9c8fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..7b2fddf1a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[7, 8, 9]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..f80becc5bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..fba8fb0def --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..010385a5ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + async * #method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..f04f67b10e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + async * #method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[23]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..bc895cbbaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + async * #method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..b7e65573a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + async * #method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([values]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..2621e6acd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..3d3042c685 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..0269356212 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a6a33e7d46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..2f757ab5b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..8058133277 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + async * #method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..3947fcb041 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Destructuring initializer with a "hole" (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([,]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..a275fa2ff0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async * #method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([null, 0, false, '']).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..16f794307d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Destructuring initializer with an undefined value (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([undefined]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..9d984ee3df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding when value iteration completes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..deaae7a20a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..ba9ed9b0cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,92 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + async * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..0a4aa44308 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..3e4e90aba5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..06b51fcde6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([{ x: 11, y: 22, z: 33 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..540b2cc628 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..9b47cbc1f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([{ u: 777, w: 888, y: 999 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..aab52423aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Elision accepts exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + async * #method([,]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..a6fc24b76e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-elision.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Elision advances iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..72d3a0e776 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-empty.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async * #method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..094201d82f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,95 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([3, 4, 5]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..9c851236cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,101 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element containing an elision (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..349cbf3128 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element containing an "empty" array pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async * #method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..4da085b9d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element containing a rest element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async * #method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..2858578bed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Lone rest element (direct binding) (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + async * #method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..40ae5d9c4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element following elision elements (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + async * #method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..58ac2243dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: RestElement applied to an exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + async * #method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..847e24b44f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Lone rest element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async * #method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..389dcb5f15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...[ x ] = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..6ce6b0d7f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element (identifier) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...x = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..1cbb64462c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...{ x } = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..9e7337834d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...[x], y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..e0c772a31c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...x, y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..c02c6cfdf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...{ x }, y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..d45a868e1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + async * #method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..e21c1789c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([7, 8, 9]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..e5fc9c4ed2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async * #method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..0cac317176 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + async * #method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..bd30b11f40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-name-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..79d7734db7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..404c09e15b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..e49a16305f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..fc3bbaf9e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..42456c97ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + async * #method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..fab2692619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + async * #method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..4aa466daf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + async * #method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..204f097e9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + async * #method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..5df820152e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..3ea482f2ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..adc1327f8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a91d8e31e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..0e45412491 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..d4d6cd1e08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + async * #method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..d9857311dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer with a "hole" (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..dcaa73ed69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..4ce5515e9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an undefined value (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..5b7146755d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..0dc356769a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..8401458ffa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,92 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + async * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..1a2546e758 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..cfe69edcca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..7d5538818f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..bc37bb72a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..43f3033c84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..f2ca707af7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Elision accepts exhausted iterator (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + async * #method([,] = iter) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..7965e29881 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Elision advances iterator (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..e9ac4749a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async * #method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..9f4eefe28c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,95 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..528253c273 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,101 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element containing an elision (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + async * #method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..96cea6da19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + async * #method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..5c3256c472 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element containing a rest element (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async * #method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..1b62ac1a42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Lone rest element (direct binding) (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + async * #method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..41d9098615 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element following elision elements (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + async * #method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..3785ded56f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + async * #method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..22492932d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Lone rest element (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + async * #method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..1afa852948 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..6d5fa623d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...x = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..55ba575608 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...{ x } = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..c1c38907d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..0cb20acf53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..6a1f3f543c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + async * #method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..af67d4fca5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + async * #method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..0f2a4be3bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..490aec6215 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + async * #method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..e33df53c47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..846d241239 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..59e2b40db4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..a695121cd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..73ce3fd82a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + async * #method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..347f0723c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..bfb651e342 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..7257a565d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..293408c041 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..c1f15f9ecd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..ddfdde3558 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..7ea8b830a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..052b40e875 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..b7267de53e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Binding as specified via property name and identifier (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..7dd6fbbc52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..fff81d371b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..40c1b0b2c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + async * #method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..6bb6c41e91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + async * #method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..981f0a0c5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-dflt.template +/*--- +description: Rest object contains just unextracted data (private class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + async * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..f5bca17597 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-empty.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + async * #method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(obj).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..e896c004d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..26e74f99ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..15c3a78988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..65b384a297 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..8c2b84fb74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + async * #method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..cad6e5e6ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: null, x: 0, y: false, z: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..a289b977eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..68b835f8ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..de0a8470fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: [45] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..ecfc5e72dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-ary.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: [7, undefined, ] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..d3f5277466 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ s: null, u: 0, w: false, y: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..c28b92194b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..a7f5cdddcd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..075fc13b49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Binding as specified via property name and identifier (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + async * #method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..42f7eab5fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: undefined }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..7fe3a6bd9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-prop-obj.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: { x: undefined, z: 7 } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..686c688182 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-getter.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + async * #method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ get v() { count++; return 2; } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..976469d7ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + async * #method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(o).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..3086888a40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth.template +/*--- +description: Rest object contains just unextracted data (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + async * #method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({x: 1, y: 2, a: 5, b: 3}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js new file mode 100644 index 0000000000..b581b2beb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async * #method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js new file mode 100644 index 0000000000..707fb66e0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-init-iter-no-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async * #method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js new file mode 100644 index 0000000000..118c810aa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-name-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding with normal value iteration (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..36e9742b4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..d0de1b7573 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[7, 8, 9]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..642b5d1a17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..2907dbb274 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..bc5ebd1ccf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + static async * #method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..4721ed0e12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + static async * #method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[23]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..428550a976 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + static async * #method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..c7e9c81a20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + static async * #method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([values]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..8ac93243b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Destructuring initializer with an exhausted iterator (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..bad5a3c2bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..bcbb72465c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..f3351d4446 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..b8eeb4e547 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..c777bc5427 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + static async * #method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..e49d4d30fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Destructuring initializer with a "hole" (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([,]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..2e8f7ce8bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async * #method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([null, 0, false, '']).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..ab2532741b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Destructuring initializer with an undefined value (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([undefined]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..c69b9f65ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration completes (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..67c94fe544 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..677db6424c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,92 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + static async * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..f54467219b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..7f8ca75d45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..73c9a8d30b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-id.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([{ x: 11, y: 22, z: 33 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..379068a2d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..abaadb7d5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([{ u: 777, w: 888, y: 999 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..0f719c151f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision-exhausted.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Elision accepts exhausted iterator (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + static async * #method([,]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js new file mode 100644 index 0000000000..dd345e7840 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-elision.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Elision advances iterator (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js new file mode 100644 index 0000000000..a3268950fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-empty.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async * #method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..b5eebf7e18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,95 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element containing an array BindingElementList pattern (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([3, 4, 5]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..35dee96e2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,101 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element containing an elision (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..d71fd54e29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element containing an "empty" array pattern (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async * #method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..854d8480c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element containing a rest element (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async * #method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..ac677f6673 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-direct.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Lone rest element (direct binding) (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + static async * #method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..5b77915429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-elision.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element following elision elements (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + static async * #method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..7dcc77414d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: RestElement applied to an exhausted iterator (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + static async * #method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..ee662f2a1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Lone rest element (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async * #method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..e028671b8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...[ x ] = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..c0ea309568 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element (identifier) does not support initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...x = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..1e0a48f8cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-init-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...{ x } = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..a78e42eae8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...[x], y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..f9893c578e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element (identifier) may not be followed by any element (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...x, y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..0e5ffef29b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...{ x }, y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..ba9c828dca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + static async * #method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..05bffa5415 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + static async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([7, 8, 9]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..119d707cb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async * #method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..5c77269f3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-init-iter-no-close.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var C = class { + static async * #method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..f459332127 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-name-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..b56d272f13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..4a3ba6d20c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..64bedb062e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..237dcb9622 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..4328394728 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var C = class { + static async * #method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..5cd252e229 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var C = class { + static async * #method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..742313190a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var C = class { + static async * #method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..fdcbbb79d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var C = class { + static async * #method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..cac8f353f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..e5fe2c1293 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..bc4e244b7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..f0c471ddcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..733ba6aef5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..28d53e835c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var C = class { + static async * #method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..00f0cf91cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with a "hole" (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..90983253ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..0895f235ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an undefined value (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..a48944b39f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..52d7204d5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..78d9dee927 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,92 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var C = class { + static async * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..07542144f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..a47d400f1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..89c993a55e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..7d40d76dbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..706267f31a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..5d49135545 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Elision accepts exhausted iterator (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var C = class { + static async * #method([,] = iter) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..c998ca36f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-elision.js @@ -0,0 +1,88 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Elision advances iterator (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..09b83a3280 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-empty.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async * #method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..6427395bf3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,95 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..60d3fefb4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,101 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an elision (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var C = class { + static async * #method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..1047b1df9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var C = class { + static async * #method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..5403e7b3cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing a rest element (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async * #method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..36be1ac29f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Lone rest element (direct binding) (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var C = class { + static async * #method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..ee15ae51ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element following elision elements (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var C = class { + static async * #method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..72cd5e8c8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var C = class { + static async * #method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..39c2cfa259 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Lone rest element (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var C = class { + static async * #method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..d0bce64835 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..146b61b1e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...x = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..8b4b987d2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...{ x } = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..40280123ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..ad69fe1d75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..c9493d922b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var C = class { + static async * #method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..7412ac21d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var C = class { + static async * #method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..16e1bf5811 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var C = class { + static async * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..accd3781e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-empty.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + static async * #method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..7220e985c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..ee9cf79d41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..c721a7278c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..72c901902b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..c96d0a8e39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..7ac7db1765 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..987b5ec39b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..4a2094debe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..ea65882d11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..aba6c1e013 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..6c2a80a3ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..515736e02b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..1e2abcfac6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..c3fb47b0b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name and identifier (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..32e2e6f731 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..d73d4ac141 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..d108e79605 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + static async * #method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..49003bbba5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + static async * #method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..9a70ef9a30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static-dflt.template +/*--- +description: Rest object contains just unextracted data (private static class expression async generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + static async * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js new file mode 100644 index 0000000000..6be58fb317 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-empty.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var C = class { + static async * #method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(obj).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..74df3c5aea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..2eec8f1326 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..cd992f1869 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..b5db0f17f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..605510397f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,75 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..f4b9de2ed8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-init-skipped.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: null, x: 0, y: false, z: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..db159de3d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..75f6802985 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..0ec00fbbb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: [45] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..7c9f0e1c87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-ary.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: [7, undefined, ] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..f1a6e8f425 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var C = class { + static async * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ s: null, u: 0, w: false, y: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..9ebb5ca781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-init.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..bacd9b815a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,71 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..e88a25a335 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-id.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Binding as specified via property name and identifier (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..f578f83348 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj-init.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: undefined }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..26e1381ffe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-prop-obj.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, async-iteration] +flags: [generated, async] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var C = class { + static async * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: { x: undefined, z: 7 } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..38056a3c7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-getter.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var C = class { + static async * #method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ get v() { count++; return 2; } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..5e2a3ca294 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,77 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var C = class { + static async * #method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(o).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..380951c4e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/async-private-gen-meth-static-obj-ptrn-rest-val-obj.js @@ -0,0 +1,76 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-async-private-gen-meth-static.template +/*--- +description: Rest object contains just unextracted data (private static class expression async generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var C = class { + static async * #method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({x: 1, y: 2, a: 5, b: 3}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/class/dstr/browser.js b/js/src/tests/test262/language/expressions/class/dstr/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-close.js new file mode 100644 index 0000000000..3ae1893e4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + *method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..078f9c0592 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + *method([x, y, z]) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err.js new file mode 100644 index 0000000000..d3997ba7aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-get-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + *method([x]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..e4d9f87b43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-init-iter-no-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + *method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-name-iter-val.js new file mode 100644 index 0000000000..fb2d41258d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-name-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding with normal value iteration (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..0d2743b021 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..c669f6a8a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +new C().method([[7, 8, 9]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..0a8747c2d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + *method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..9856354f39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + *method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([[]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..71a7efde90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + *method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..b2d89b2a3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + *method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([[23]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..a69bf8978c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + *method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..900309f29e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + *method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([values]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..96e1d3df99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Nested array destructuring with a null value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + *method([[x]]) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..1129dfc0c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..b3a7786a70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..d9e7d20f0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..29f215824c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..c65faee96c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..c08f5848b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + *method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..2290d2beb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer with a "hole" (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +new C().method([,]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..f0e1d50f27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + *method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([null, 0, false, '']).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..330b1e6dcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + *method([x = (function() { throw new Test262Error(); })()]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..59620170fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer with an undefined value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method([undefined]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..70205a3b30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + *method([ x = unresolvableReference ]) {} +}; +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..ee0dece257 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding when value iteration completes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..ce3e6d8ccd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..da718226de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + *method([x]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..c4a706272a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..b3b34710e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + *method([x]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..276dcfad5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..120ff56b9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..042a0263df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +new C().method([{ x: 11, y: 22, z: 33 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..2e611e41af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..1901e64df2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method([{ u: 777, w: 888, y: 999 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..a22d819e87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Nested object destructuring with a null value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + *method([{ x }]) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..e1e7b9ab8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Nested object destructuring with a value of `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + *method([{ x }]) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..ad55bed7f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Elision accepts exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + *method([,]) { + + callCount = callCount + 1; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..e76f9b5a21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision-step-err.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Elision advances iterator and forwards abrupt completions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + *method([,]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..e9db186978 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-elision.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Elision advances iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + *method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..8c4ff9cb7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-empty.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + *method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..334f2b2240 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,110 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +new C().method([3, 4, 5]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..f519344721 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,116 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element containing an elision (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + *method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +new C().method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..967452d768 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element containing an "empty" array pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + *method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..b4eebb48ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element containing a rest element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + *method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +new C().method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..30e8963926 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Lone rest element (direct binding) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + *method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +new C().method([1]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..fed0cff47f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Rest element following elision elements (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + *method([, ...x]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..b526bf4061 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element following elision elements (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + *method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..d6b8cde5f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: RestElement applied to an exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + *method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +new C().method([1, 2]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..baefc5b619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + *method([...x]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..9dcfad7465 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + *method([...x]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..7dd7d1d9ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Lone rest element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + *method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..ff95a2dc33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..0855d3e645 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element (identifier) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...x = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..111aafd8e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..72a8c16bf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..42c8add97c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...x, y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..f009912e9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..ad63d0b0f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + *method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..0fe68b9f99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +new C().method([7, 8, 9]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..4c856d6a5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + *method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..fdf308d087 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + *method([x, y, z] = [1, 2, 3]) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..3e615aa847 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-get-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + *method([x] = iter) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..3985bb39a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + *method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..fd68e90fb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-name-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..2da37ed041 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..fd37054adb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..9ca70f4275 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + *method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..7011987813 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + *method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..4098e4e922 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + *method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..1d3b726423 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + *method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..50c29694e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + *method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..4116d11057 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + *method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..c87dd49e38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Nested array destructuring with a null value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + *method([[x]] = [null]) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..f72b61335b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..b70481bb9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..93adb15007 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b431322b2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..73b75b037e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..01d171c613 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + *method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..b1cfc734ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer with a "hole" (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..f3e3c52403 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..f6be0fcd55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + *method([x = (function() { throw new Test262Error(); })()] = [undefined]) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..e0c128932a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an undefined value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..044c8fe9bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + *method([ x = unresolvableReference ] = []) {} +}; +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..89d1f02779 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..726b9ea651 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..ad4ded6526 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + *method([x] = g) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..f3d163d08b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..822633ff53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + *method([x] = g) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..1174d260a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..21bc263a09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..4d26eb1a16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..15849cf74e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..2c12d40512 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..7b6e53122d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Nested object destructuring with a null value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + *method([{ x }] = [null]) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..26e00d6970 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + *method([{ x }] = []) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..8176bb01c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Elision accepts exhausted iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + *method([,] = iter) { + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..f464006fe6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + *method([,] = iter) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..512d026f77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Elision advances iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + *method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..2d91c889be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + *method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..ed6680799c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,110 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..60e7601e2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,116 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element containing an elision (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + *method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..0c58c3719c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + *method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..d680dff4d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element containing a rest element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + *method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..2f59ecf746 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Lone rest element (direct binding) (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + *method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..b0ad861ca5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element following elision elements (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + *method([, ...x] = iter) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..9956442115 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element following elision elements (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + *method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..734be2d5d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + *method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..cac6c2ad78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + *method([...x] = iter) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..31a3311546 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + *method([...x] = iter) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..0a8d82f84e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Lone rest element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + *method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..7cce2ff0d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..1f085b4a3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..e084820189 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..5379be57e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..14b54ac1aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..19b0598530 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + *method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..32c8faf2eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + *method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..210b4c1971 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-null.js new file mode 100644 index 0000000000..8b5eb96289 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + *method({} = null) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..876f9eb888 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-init-undefined.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + *method({} = undefined) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..b79e3999bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + *method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..51da330ccd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + *method({ poisoned } = poisonedProperty) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..b9230af5d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..461743240f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..7af28f07fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..2072d4bee3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..35aa6c0276 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + *method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..d76e75e96d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..857086f508 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ x = thrower() } = {}) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..e500325143 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + *method({ x = unresolvableReference } = {}) {} +}; +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..2faa4ae624 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + *method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..914a53b8b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-list-err.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ a, b = thrower(), c = ++initCount } = {}) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..77a9e464b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..6ebc4056d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + *method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..ad693e0c3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..f5bd622271 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..a763c30790 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ [thrower()]: x } = {}) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..83f8a19685 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + *method({ poisoned: x = ++initEvalCount } = poisonedProperty) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..6b0f7bbeab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..1ab80bd072 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ x: y = thrower() } = {}) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..2f0f09be2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + *method({ x: y = unresolvableReference } = {}) {} +}; +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..226ba35103 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..ee4f37d7b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + *method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..28cd402c2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Binding as specified via property name and identifier (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..91ee6fb10a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..1f2d472193 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..efaa31a501 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + *method({ w: { x, y, z } = undefined } = { }) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..410fb49e62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..0b08e4e726 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + *method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..ebbde42b42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + *method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..ef288fd328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-dflt.template +/*--- +description: Rest object contains just unextracted data (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-null.js new file mode 100644 index 0000000000..2f7c7330ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + *method({}) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-undefined.js new file mode 100644 index 0000000000..c69f4deac4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-init-undefined.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + *method({}) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..c4ac22d30a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + *method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(obj).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..270192b693 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-get-value-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + *method({ poisoned }) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..1d23f79598 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..7c860654c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b0e7ed2f42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..dc192e6f70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + *method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..6485ba3ca1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + *method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..c4458585ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + *method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method({ w: null, x: 0, y: false, z: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..d94517fefc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-throws.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ x = thrower() }) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..0ccddb7e37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + *method({ x = unresolvableReference }) {} +}; +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..e0e97b132d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + *method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-list-err.js new file mode 100644 index 0000000000..32b7fc9edb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-list-err.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ a, b = thrower(), c = ++initCount }) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..1ec0609e2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..05b55728f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + *method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +new C().method({ x: [45] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..516eecba29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + *method({ w: [x, y, z] = [4, 5, 6] }) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..f76b30d4ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-ary.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: [7, undefined, ] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..8e374e9451 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-eval-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Evaluation of property name returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ [thrower()]: x }) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..e2a0ff1663 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + *method({ poisoned: x = ++initEvalCount }) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..39fa7d4ef1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method({ s: null, u: 0, w: false, y: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..9e5ec6fb89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + *method({ x: y = thrower() }) {} +}; +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..d5fa950950 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + *method({ x: y = unresolvableReference }) {} +}; +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..bdd9e40623 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..944678198d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + *method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..45bc6d01fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Binding as specified via property name and identifier (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + *method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..df3ccd9d83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: undefined }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..3ef02e57b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..50c8f10969 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + *method({ w: { x, y, z } = undefined }) {} +}; +var c = new C(); + +assert.throws(TypeError, function() { + c.method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..ea46519fcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-prop-obj.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: { x: undefined, z: 7 } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..780501b11c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-getter.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + *method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method({ get v() { count++; return 2; } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..5fa420f6d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + *method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +new C().method(o).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..ee410086d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth.template +/*--- +description: Rest object contains just unextracted data (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + *method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method({x: 1, y: 2, a: 5, b: 3}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-close.js new file mode 100644 index 0000000000..6b2c777b97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static *method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..f9d214e31e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + static *method([x, y, z]) {} +}; + +assert.throws(TypeError, function() { + C.method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err.js new file mode 100644 index 0000000000..493868ba26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-get-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + static *method([x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-no-close.js new file mode 100644 index 0000000000..ce7fb1754c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-init-iter-no-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static *method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-name-iter-val.js new file mode 100644 index 0000000000..703cac80d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-name-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding with normal value iteration (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..2921f1311f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..51884c5710 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +C.method([[7, 8, 9]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..7911a37ba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static *method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..29050c869b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static *method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +C.method([[]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..f54aa894b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static *method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..ebe84e1e6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static *method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([[23]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..12ec501f28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static *method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..54ed519a8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static *method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([values]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..8a7037f020 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Nested array destructuring with a null value (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + static *method([[x]]) {} +}; + +assert.throws(TypeError, function() { + C.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..215c7a86b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer with an exhausted iterator (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..5cffd3fab5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to arrow functions (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..c3044d4ae7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..7c75bd934b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..55ddffb16c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..e3d1840bd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static *method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..848f834b65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer with a "hole" (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +C.method([,]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..98c880728d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static *method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([null, 0, false, '']).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..04782f2edc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer returns an abrupt completion (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + static *method([x = (function() { throw new Test262Error(); })()]) {} +}; + +assert.throws(Test262Error, function() { + C.method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..6c5d66ddd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer with an undefined value (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method([undefined]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..cae86bff7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static *method([ x = unresolvableReference ]) {} +}; + +assert.throws(ReferenceError, function() { + C.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..2a64371f6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration completes (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..31037bbc66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..72cf4825ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + static *method([x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..19027a8dce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..c2ea8eabb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static *method([x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..16bca2b99b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..bd5ebcc9f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..dc664dccd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +C.method([{ x: 11, y: 22, z: 33 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..368309363a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..183eb1f942 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method([{ u: 777, w: 888, y: 999 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..4ad8f993f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Nested object destructuring with a null value (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static *method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + C.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..1ac2258266 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Nested object destructuring with a value of `undefined` (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static *method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + C.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..6479c5f783 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-exhausted.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Elision accepts exhausted iterator (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static *method([,]) { + + callCount = callCount + 1; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..ee97992dbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision-step-err.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Elision advances iterator and forwards abrupt completions (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + static *method([,]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision.js new file mode 100644 index 0000000000..48e2fb836f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-elision.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Elision advances iterator (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static *method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-empty.js new file mode 100644 index 0000000000..0e1b06484c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-empty.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static *method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..6f5d443641 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,110 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element containing an array BindingElementList pattern (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +C.method([3, 4, 5]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..3a9d8a783e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,116 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element containing an elision (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static *method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +C.method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..52616b2f2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element containing an "empty" array pattern (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static *method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..03ab658328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element containing a rest element (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static *method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +C.method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..be7f756099 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-direct.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Lone rest element (direct binding) (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static *method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +C.method([1]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..acf0beebfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Rest element following elision elements (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + static *method([, ...x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..d0b24266c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-elision.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element following elision elements (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static *method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..b5efb3eec1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: RestElement applied to an exhausted iterator (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static *method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +C.method([1, 2]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..6e963688e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + static *method([...x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..d2c2819821 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static *method([...x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..75a3fb9724 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Lone rest element (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static *method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..d4726c801f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element (nested array pattern) does not support initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..43537c852e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element (identifier) does not support initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...x = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..127d1af819 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-init-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element (nested object pattern) does not support initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..53fd4a7a72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..c8af4e4a48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element (identifier) may not be followed by any element (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...x, y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..27d4cce982 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..3096f0ea81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static *method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..5eb2c63874 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +C.method([7, 8, 9]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..20d6db84c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static *method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..9cdb176e3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + static *method([x, y, z] = [1, 2, 3]) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..8a7ef761ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-get-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + static *method([x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..f929b119d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-init-iter-no-close.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static *method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..efc67322ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-name-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..278af84637 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..9d1e8a1e7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..5f1eb33fdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static *method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..01d3912f71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static *method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..ff657e5ee4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static *method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..bfde4aceb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static *method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..47d2020c73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static *method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..754b7e372f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static *method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..927bfed233 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Nested array destructuring with a null value (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + static *method([[x]] = [null]) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..f1ce4f5683 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..21c9730b3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..44932a298e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..0a6536a82c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..355c85819b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..53cbc4f54c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static *method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..9c44262bfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with a "hole" (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..537388e575 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..37d11995d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + static *method([x = (function() { throw new Test262Error(); })()] = [undefined]) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..72d565e7c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an undefined value (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..4e4a880f7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static *method([ x = unresolvableReference ] = []) {} +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..52b970d465 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..1c09b630ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..157abb25ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + static *method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..452cf400d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..29c9718072 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static *method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..1a46740221 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..38e406525b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..1bb79798f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..32269b1ad5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..8056aca11d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..2ef99972c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Nested object destructuring with a null value (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static *method([{ x }] = [null]) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..6a47f596b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static *method([{ x }] = []) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..8f7253624b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Elision accepts exhausted iterator (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static *method([,] = iter) { + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..656f28fc42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + static *method([,] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..5fd67f4560 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-elision.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Elision advances iterator (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static *method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..23df175222 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-empty.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static *method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..cf0d8c1f4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,110 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..7e4766f179 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,116 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element containing an elision (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static *method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..ebe4400ccd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static *method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..9634c82f73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element containing a rest element (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static *method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..06188cde55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Lone rest element (direct binding) (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static *method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..f2152cfbc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element following elision elements (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + static *method([, ...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..366523f2c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element following elision elements (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static *method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..a95ddf1450 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static *method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..c066660167 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + static *method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..4d9d4f4096 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static *method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..636f541eb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Lone rest element (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static *method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..0fcae1fc0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..1a52028b0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..1b18fb3601 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..64703a8fe4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..176048a28a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..b9b44d0b86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static *method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..3e2c2964d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static *method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..eb6c6603fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-null.js new file mode 100644 index 0000000000..df2c10adf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-null.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static *method({} = null) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..f6201cec9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-init-undefined.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static *method({} = undefined) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..8c39f598a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static *method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..c596a190fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static *method({ poisoned } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..1d4479bdaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..0cd9829230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..3c4937a7d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..96ea4a5b6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..95ca4e9e72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static *method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..3f3f9f9812 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..fe6207775e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error thrown when evaluating the initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ x = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..90b7420c65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static *method({ x = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..d065b7abc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static *method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..2db654dbaa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-list-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ a, b = thrower(), c = ++initCount } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..105e0ae5ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..2d1f02c0a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static *method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..01128fe2e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..bcef5b8f73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..8d2768e3c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ [thrower()]: x } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..b6295926ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static *method({ poisoned: x = ++initEvalCount } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..4177b19aa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..744ac2ff89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Error thrown when evaluating the initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ x: y = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..2127a9df17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static *method({ x: y = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..019674754e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..892e54bc60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static *method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..cfa80698f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name and identifier (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..e4e1d954eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..c3b86ba638 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..2f9f98bc4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static *method({ w: { x, y, z } = undefined } = { }) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..4cf53087d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..705e755c95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static *method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..5144dffb31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static *method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..d0d7dfdc10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template +/*--- +description: Rest object contains just unextracted data (static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-null.js new file mode 100644 index 0000000000..9f7c4e3a75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-null.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static *method({}) {} +}; + +assert.throws(TypeError, function() { + C.method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-undefined.js new file mode 100644 index 0000000000..0392d3e6fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-init-undefined.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static *method({}) {} +}; + +assert.throws(TypeError, function() { + C.method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-empty.js new file mode 100644 index 0000000000..d224216415 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: No property access occurs for an "empty" object binding pattern (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static *method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +C.method(obj).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..bd1cfb0bd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-get-value-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static *method({ poisoned }) {} +}; + +assert.throws(Test262Error, function() { + C.method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..d772dce8e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..e8bd682f8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..3f71fb921d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..aba15e8f61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static *method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..889501689c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static *method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..c605f975d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-skipped.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static *method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method({ w: null, x: 0, y: false, z: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..4e25bf50ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-throws.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error thrown when evaluating the initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ x = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..48caf63e1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static *method({ x = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..5f8e757d8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static *method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-list-err.js new file mode 100644 index 0000000000..8a1c2744aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-list-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ a, b = thrower(), c = ++initCount }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..dd37cb90b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..56c0839b41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static *method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +C.method({ x: [45] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..be87a419b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static *method({ w: [x, y, z] = [4, 5, 6] }) {} +}; + +assert.throws(TypeError, function() { + C.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..ec183f8622 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-ary.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: [7, undefined, ] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..7e4aeb2b98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-eval-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Evaluation of property name returns an abrupt completion (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ [thrower()]: x }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..9f1544be75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static *method({ poisoned: x = ++initEvalCount }) {} +}; + +assert.throws(Test262Error, function() { + C.method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..c6531a4eb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method({ s: null, u: 0, w: false, y: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..981bf4e900 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Error thrown when evaluating the initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static *method({ x: y = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..33e7bfaa1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static *method({ x: y = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..54f3899a64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-init.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Binding as specified via property name, identifier, and initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..3e339e641c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static *method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..c69e3d5e45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Binding as specified via property name and identifier (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static *method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..826d0d0d2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-init.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: undefined }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..c38a37f0fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {} +}; + +assert.throws(TypeError, function() { + C.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..457ede6fa5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static *method({ w: { x, y, z } = undefined }) {} +}; + +assert.throws(TypeError, function() { + C.method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..5686abd417 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-prop-obj.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: { x: undefined, z: 7 } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..f6c3220e18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-getter.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static *method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method({ get v() { count++; return 2; } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..74f350c496 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest object doesn't contain non-enumerable properties (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static *method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +C.method(o).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..91d4b46fdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/gen-meth-static-obj-ptrn-rest-val-obj.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-gen-meth-static.template +/*--- +description: Rest object contains just unextracted data (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static *method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method({x: 1, y: 2, a: 5, b: 3}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-close.js new file mode 100644 index 0000000000..7cbbc12184 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..806bd09118 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + method([x, y, z]) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err.js new file mode 100644 index 0000000000..4469ed652a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-get-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + method([x]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..ea4c0777a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-init-iter-no-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-name-iter-val.js new file mode 100644 index 0000000000..be583dfe69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-name-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding with normal value iteration (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..5adf7e02b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..e8a2e6b687 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +new C().method([[7, 8, 9]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..bed37f0e59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..c7f1d4b7ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([[]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..4fd3e1b43f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..66d52653d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([[23]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..65827a1784 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..d350240ca4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([values]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..d5aca5ea02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Nested array destructuring with a null value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + method([[x]]) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..e2a4e64782 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..eca8ba11f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..f4a1d30f3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..1d30ab4956 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..d7abc9ab1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..66ecf1c2ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..3c9f29554f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Destructuring initializer with a "hole" (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +new C().method([,]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..0f9ae4b548 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method([null, 0, false, '']); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..7158dacddd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Destructuring initializer returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + method([x = (function() { throw new Test262Error(); })()]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..21c9116503 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Destructuring initializer with an undefined value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method([undefined]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..a8e747e6c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + method([ x = unresolvableReference ]) {} +}; + +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..fde09d9fe8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding when value iteration completes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..cc2a754940 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..d571093957 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + method([x]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..39c1c0c51f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..6f8c616fb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + method([x]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..70f940e3d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..46bcb6a3f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..ec57cec4f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +new C().method([{ x: 11, y: 22, z: 33 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..17eb364222 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..f1da48de15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method([{ u: 777, w: 888, y: 999 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..ef223bc090 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Nested object destructuring with a null value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + method([{ x }]) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..17548d17e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Nested object destructuring with a value of `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + method([{ x }]) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..67705e38bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Elision accepts exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + method([,]) { + + callCount = callCount + 1; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..090f65f71d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision-step-err.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Elision advances iterator and forwards abrupt completions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + method([,]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..109d2d91c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-elision.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Elision advances iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..10e50538d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-empty.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..9502e2dd4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +new C().method([3, 4, 5]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..0b4300caff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,113 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element containing an elision (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +new C().method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..b6c6ef1dfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element containing an "empty" array pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..c6ebbbc68e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element containing a rest element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +new C().method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..9bb0b7f15e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Lone rest element (direct binding) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +new C().method([1]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..847ef07625 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Rest element following elision elements (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + method([, ...x]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..e2fe4d665a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element following elision elements (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..379b0f8c1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: RestElement applied to an exhausted iterator (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +new C().method([1, 2]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..8f4f5555af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + method([...x]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..ad019eafd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + method([...x]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..53e9b1da82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Lone rest element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..ef1899ce96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..aec4c12d90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element (identifier) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...x = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..39bfe34869 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..ebaf00baff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..dc07d2c004 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...x, y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..9a7edd0b79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..07606b887b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element containing an object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..a353b76ffd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest element containing an object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +new C().method([7, 8, 9]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..c2954ef1d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..3d7b26c119 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + method([x, y, z] = [1, 2, 3]) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..20d7f79684 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-get-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + method([x] = iter) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..b4c679ad24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..c9cda5261c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-name-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..1feac4a4f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..82383fb096 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..0fd71ef875 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..752e1ed050 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..ed5ef758e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..cfbcb462f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..1214245baa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..a15dcbe2b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..318811d7f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Nested array destructuring with a null value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + method([[x]] = [null]) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..0332b7a941 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..af2f6ad15a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..70fc6312a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b1d93ca322 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..3a52ab17c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..42edbe8b98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..4cc20a1bae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer with a "hole" (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..0cec1bec0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..315366340f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + method([x = (function() { throw new Test262Error(); })()] = [undefined]) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..32bf9cd915 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer with an undefined value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..42484e4e4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + method([ x = unresolvableReference ] = []) {} +}; + +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..80433e508f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..4d4ad14ff9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..82d13892ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + method([x] = g) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..8f88f821f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..015a95ed3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + method([x] = g) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..91b4648199 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..cc53a273c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..5a8a8d1d01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..8c23151586 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..af2546e70a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..bb3e822277 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Nested object destructuring with a null value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + method([{ x }] = [null]) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..1f03352ba6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + method([{ x }] = []) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..b56c437c01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Elision accepts exhausted iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + method([,] = iter) { + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..195db81937 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + method([,] = iter) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..8b2768eaf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Elision advances iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..13e387e72a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..5fdc039247 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..f85df5738e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,113 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element containing an elision (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..c54b330b90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..a836aaa1af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element containing a rest element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..92e6dc8980 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Lone rest element (direct binding) (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..bce6f02484 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Rest element following elision elements (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + method([, ...x] = iter) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..d318f73a4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element following elision elements (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..7348d391e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..6fbff7c47e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + method([...x] = iter) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..2694f793be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + method([...x] = iter) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..b4e822ee73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Lone rest element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..ea77c46b1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..4261d14d95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..26442c4544 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..ab62668157 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..bf62e198a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..c74ebb9760 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..3817e8c597 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..8b909c3008 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-null.js new file mode 100644 index 0000000000..cc6e923f6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + method({} = null) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..fa126dd3be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-init-undefined.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + method({} = undefined) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..0fb026a789 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..1be134bdf2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + method({ poisoned } = poisonedProperty) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..77e6692ef8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..a25646e4be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..693e502661 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..00257aceec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..6d53a8e0ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..3762c38335 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..188209bc0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ x = thrower() } = {}) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..43b2bfebe9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + method({ x = unresolvableReference } = {}) {} +}; + +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..69f3cdf584 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..b59a15301b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-list-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ a, b = thrower(), c = ++initCount } = {}) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..fe9a0c0a6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..b813252117 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..014284d310 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..7e08ac13d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..a46e8bd5b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ [thrower()]: x } = {}) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..c0bd16067d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + method({ poisoned: x = ++initEvalCount } = poisonedProperty) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..5b2a898498 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..ba8ccb2e69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ x: y = thrower() } = {}) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..f36922ba20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + method({ x: y = unresolvableReference } = {}) {} +}; + +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..303dca0361 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..da0e174cb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..e998f4c925 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Binding as specified via property name and identifier (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..167e94c6f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..1d36b8aca9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..e00e19e9ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + method({ w: { x, y, z } = undefined } = { }) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..debd713bcd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..b5a6feb21c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..716497aaa6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..d4dff96549 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-meth-dflt.template +/*--- +description: Rest object contains just unextracted data (class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-null.js new file mode 100644 index 0000000000..bbfcb54076 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + method({}) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-undefined.js new file mode 100644 index 0000000000..7c8f50ff27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-init-undefined.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + method({}) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..50875621e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-empty.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +new C().method(obj); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..f9ecd652d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-get-value-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + method({ poisoned }) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..628bc77583 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..0d6a9809de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b86b666e26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..45bd37c0de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..cb369546ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..0ce15730b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +new C().method({ w: null, x: 0, y: false, z: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..4f73901e1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-throws.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error thrown when evaluating the initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ x = thrower() }) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..565f440509 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + method({ x = unresolvableReference }) {} +}; + +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..d134a0042e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-list-err.js new file mode 100644 index 0000000000..59321071b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-list-err.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ a, b = thrower(), c = ++initCount }) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..9b1cd7221a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..f29d052070 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +new C().method({ x: [45] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..cf734185d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + method({ w: [x, y, z] = [4, 5, 6] }) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..4492e9dcaa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-ary.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: [7, undefined, ] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..f80d85101a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-eval-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Evaluation of property name returns an abrupt completion (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ [thrower()]: x }) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..9d2b50ef1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + method({ poisoned: x = ++initEvalCount }) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..3783ffcdd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +new C().method({ s: null, u: 0, w: false, y: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..75a924b54d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Error thrown when evaluating the initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + method({ x: y = thrower() }) {} +}; + +var c = new C(); + +assert.throws(Test262Error, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..0938f7f2bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + method({ x: y = unresolvableReference }) {} +}; + +var c = new C(); + +assert.throws(ReferenceError, function() { + c.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..18dc6112ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..2884ca894c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..30b70582c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-id.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Binding as specified via property name and identifier (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +new C().method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..058bf0934b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: undefined }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..a16f55edbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..af88355b44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + method({ w: { x, y, z } = undefined }) {} +}; + +var c = new C(); + +assert.throws(TypeError, function() { + c.method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..860508d6d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-prop-obj.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +new C().method({ w: { x: undefined, z: 7 } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..c181921b84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-getter.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method({ get v() { count++; return 2; } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..d8844b82a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +new C().method(o); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..fb794db03f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-meth.template +/*--- +description: Rest object contains just unextracted data (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +new C().method({x: 1, y: 2, a: 5, b: 3}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-close.js new file mode 100644 index 0000000000..90db339fa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..fe28076658 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + static method([x, y, z]) {} +}; + +assert.throws(TypeError, function() { + C.method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err.js new file mode 100644 index 0000000000..9ab77d237e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-get-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + static method([x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-no-close.js new file mode 100644 index 0000000000..4d282326c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-init-iter-no-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-name-iter-val.js new file mode 100644 index 0000000000..6fec6e7295 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-name-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding with normal value iteration (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..aea2f8ab10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..ebf06117f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +C.method([[7, 8, 9]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..85ec2a446f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..c471272f07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +C.method([[]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..242e225f1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..0958e05bbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([[23]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..b9414e552f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..1817ee2886 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([values]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..c112b28535 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Nested array destructuring with a null value (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + static method([[x]]) {} +}; + +assert.throws(TypeError, function() { + C.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..2a5c2d259c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Destructuring initializer with an exhausted iterator (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..0048d37326 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding does assign name to arrow functions (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..6cb201b898 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..462f1ee799 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..789a38b27c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..c5f682dd1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..61cc595f8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Destructuring initializer with a "hole" (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +C.method([,]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..7601435ba4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method([null, 0, false, '']); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..67148341ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Destructuring initializer returns an abrupt completion (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + static method([x = (function() { throw new Test262Error(); })()]) {} +}; + +assert.throws(Test262Error, function() { + C.method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..9d35477330 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Destructuring initializer with an undefined value (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method([undefined]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..af1d8b448e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static method([ x = unresolvableReference ]) {} +}; + +assert.throws(ReferenceError, function() { + C.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..4594f6ebcd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding when value iteration completes (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..7f461c495b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..761fb63d4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + static method([x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..80b5051074 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..b14c73d458 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static method([x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..6762ee3660 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..41742666a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..22aa6cf81a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +C.method([{ x: 11, y: 22, z: 33 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..3048a25f29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..cfed9c8b32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method([{ u: 777, w: 888, y: 999 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..f65a6375b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Nested object destructuring with a null value (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + C.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..f18bad3782 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Nested object destructuring with a value of `undefined` (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + C.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..a7e05d3c3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Elision accepts exhausted iterator (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static method([,]) { + + callCount = callCount + 1; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..678b9bec26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision-step-err.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Elision advances iterator and forwards abrupt completions (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + static method([,]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision.js new file mode 100644 index 0000000000..af4bb5a6a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-elision.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Elision advances iterator (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-empty.js new file mode 100644 index 0000000000..15befd5b7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-empty.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..30e9de0775 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element containing an array BindingElementList pattern (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +C.method([3, 4, 5]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..28bb6092a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,113 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element containing an elision (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +C.method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..76f0114ffb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element containing an "empty" array pattern (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..15640bd127 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element containing a rest element (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +C.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..13a7f6b173 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-direct.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Lone rest element (direct binding) (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +C.method([1]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..4206a5d5f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Rest element following elision elements (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + static method([, ...x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..fe04dbaa28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-elision.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element following elision elements (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..98b47c7b34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: RestElement applied to an exhausted iterator (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +C.method([1, 2]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..a07d6f4686 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + static method([...x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..c736d61adb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static method([...x]) {} +}; + +assert.throws(Test262Error, function() { + C.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..0c545cd109 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Lone rest element (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..15d5c2ded2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element (nested array pattern) does not support initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..5aebad1f34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element (identifier) does not support initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...x = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..c36f0ba2bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-init-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element (nested object pattern) does not support initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..35160e397f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..d2913fa4fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element (identifier) may not be followed by any element (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...x, y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..fa25aa336f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..1103d98801 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element containing an object binding pattern (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..0821c065ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest element containing an object binding pattern (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +C.method([7, 8, 9]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..66f566763a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..69566c3a3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var C = class { + static method([x, y, z] = [1, 2, 3]) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..e8f9a19218 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-get-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var C = class { + static method([x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..b516a6ddc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-init-iter-no-close.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..ba3e03e4a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-name-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..eefb1dd20e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..c40a26aa74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..cce74e1d51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..8ffa14e271 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..45b3e8707a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..3665a06576 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..ca7bde5b78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..9a2491d9ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..a8f29c979a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Nested array destructuring with a null value (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var C = class { + static method([[x]] = [null]) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..f5fd19484a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..297f72b0e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..ef99927b92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..babdef4260 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..eb4e532244 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..ec3fdfb0f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..07b559dcb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer with a "hole" (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..20995bbfa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..7b7db40b72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var C = class { + static method([x = (function() { throw new Test262Error(); })()] = [undefined]) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..95af8436cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer with an undefined value (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..293b83d8e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static method([ x = unresolvableReference ] = []) {} +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..964ed5b89f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..4720ace484 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..d4409b7bed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var C = class { + static method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..20a52118d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..976fcd30a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..391bbe5a85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..29778d7160 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..409d5b7a16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..19d843f443 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..1728fdf58b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..558ce4f712 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Nested object destructuring with a null value (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static method([{ x }] = [null]) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..b6ef08f149 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var C = class { + static method([{ x }] = []) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..49ad9d165e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Elision accepts exhausted iterator (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static method([,] = iter) { + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..5b07f94ee2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var C = class { + static method([,] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..4322c07095 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-elision.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Elision advances iterator (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..723409fbff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-empty.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..0f478ee496 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..f0d18c5631 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,113 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element containing an elision (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..25e5874eac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..8c348fb87b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element containing a rest element (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..72493a44ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Lone rest element (direct binding) (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..b7e2edc32b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Rest element following elision elements (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var C = class { + static method([, ...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..6852238383 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element following elision elements (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..92a704b6c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..e860f70442 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var C = class { + static method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..9b5abd19ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var C = class { + static method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..d8c3700ec5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Lone rest element (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..a0edbdf1cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..ae6ed2dae3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..c68602977c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..006ec87b74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..ab9c498ad5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..1e757120d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,81 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..37333b0506 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..4fd6fc9574 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-null.js new file mode 100644 index 0000000000..a39b9f53e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static method({} = null) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..0e7476ea00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-init-undefined.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static method({} = undefined) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..28ac91d9e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-empty.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..f26f38c550 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static method({ poisoned } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..06f5fa5304 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..28a3e055f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..0ca67e9639 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..53fb1bbbb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..d66ce2709f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..8410e567b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..1c90222902 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error thrown when evaluating the initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ x = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..0a409a0261 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static method({ x = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..4608f5af7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..5c7a9a9a77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-list-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ a, b = thrower(), c = ++initCount } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..2e5ea686e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..1fb66755d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..7e988bbdbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..4e22e390f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..3d1ef8649c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ [thrower()]: x } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..c7a6ddfe82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static method({ poisoned: x = ++initEvalCount } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..2fb709c945 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..5b6205c7ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Error thrown when evaluating the initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ x: y = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..23e12913ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static method({ x: y = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..4873c46ac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..48b9706012 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..571b185ff5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Binding as specified via property name and identifier (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..b1777991be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..ba82b73aff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..330ea82c63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static method({ w: { x, y, z } = undefined } = { }) {} +}; + +assert.throws(TypeError, function() { + C.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..52a3604099 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..2a42a77b81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..e86f620da2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..66f25121a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-meth-static-dflt.template +/*--- +description: Rest object contains just unextracted data (static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-null.js new file mode 100644 index 0000000000..280a47e941 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-null.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static method({}) {} +}; + +assert.throws(TypeError, function() { + C.method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-undefined.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-undefined.js new file mode 100644 index 0000000000..df0a95d5e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-init-undefined.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var C = class { + static method({}) {} +}; + +assert.throws(TypeError, function() { + C.method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-empty.js new file mode 100644 index 0000000000..a99092895c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-empty.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: No property access occurs for an "empty" object binding pattern (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +C.method(obj); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..b462384287 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-get-value-err.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static method({ poisoned }) {} +}; + +assert.throws(Test262Error, function() { + C.method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..ab2f914f6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..a35383b6f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..5ec061d8a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..0dbff560e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..647b0e1f5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..4877e96183 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-skipped.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +C.method({ w: null, x: 0, y: false, z: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..ced097f054 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-throws.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error thrown when evaluating the initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ x = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..2ded573d1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static method({ x = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..875c995682 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-list-err.js new file mode 100644 index 0000000000..a9861c983e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-list-err.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ a, b = thrower(), c = ++initCount }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..867f874020 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..327600fa8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +C.method({ x: [45] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..5473d6c30c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static method({ w: [x, y, z] = [4, 5, 6] }) {} +}; + +assert.throws(TypeError, function() { + C.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..9806570b78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-ary.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: [7, undefined, ] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..96cc198981 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-eval-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Evaluation of property name returns an abrupt completion (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ [thrower()]: x }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..ceb29677e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var C = class { + static method({ poisoned: x = ++initEvalCount }) {} +}; + +assert.throws(Test262Error, function() { + C.method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..7ca1e1a230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +C.method({ s: null, u: 0, w: false, y: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..730a8c3832 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Error thrown when evaluating the initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var C = class { + static method({ x: y = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..b9e4b13852 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Destructuring initializer is an unresolvable reference (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var C = class { + static method({ x: y = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + C.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..adb303cecf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-init.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Binding as specified via property name, identifier, and initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..2e95f888d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..ab98882aac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-id.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Binding as specified via property name and identifier (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +C.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..f4859760cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-init.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: undefined }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..0c99ea6b4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {} +}; + +assert.throws(TypeError, function() { + C.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..5dbe3ee511 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/cls-expr-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var C = class { + static method({ w: { x, y, z } = undefined }) {} +}; + +assert.throws(TypeError, function() { + C.method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..d2cb8c0119 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-prop-obj.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +C.method({ w: { x: undefined, z: 7 } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..f9b8e9846f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-getter.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method({ get v() { count++; return 2; } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..16a87d7b9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest object doesn't contain non-enumerable properties (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +C.method(o); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..d865ae9a74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/meth-static-obj-ptrn-rest-val-obj.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-meth-static.template +/*--- +description: Rest object contains just unextracted data (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +C.method({x: 1, y: 2, a: 5, b: 3}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-close.js new file mode 100644 index 0000000000..8a9cdcc257 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + * #method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..e44a228e1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-init-iter-no-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + * #method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-name-iter-val.js new file mode 100644 index 0000000000..ba588daf7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-name-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding with normal value iteration (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..9b830f576b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..aa00522695 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[7, 8, 9]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..e630fffdfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + * #method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..332c123658 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + * #method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..dd8b377d7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + * #method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..466f476178 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + * #method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[23]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..348209858f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + * #method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..bd410f3cec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + * #method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([values]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..029e06bd1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..868b06b05a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..4ac37a1d1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..d1354656f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..dae4950653 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..a793da1821 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + * #method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..dd388d2aaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Destructuring initializer with a "hole" (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([,]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..ca75a69d53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + * #method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([null, 0, false, '']).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..21652460e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Destructuring initializer with an undefined value (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([undefined]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..b53e58e7c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding when value iteration completes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..39058ff5bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..4bc1cca4bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..d40d67f51b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..cbcf13893c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..217ad687fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([{ x: 11, y: 22, z: 33 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..88cd8d9531 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..e988121871 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([{ u: 777, w: 888, y: 999 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..f1bc5271b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Elision accepts exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + * #method([,]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..da179f78d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-elision.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Elision advances iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + * #method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..a770fb4e98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-empty.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + * #method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..fc27e6b9f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,114 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([3, 4, 5]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..5bd5af430d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,120 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element containing an elision (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + * #method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..ec72211ef2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element containing an "empty" array pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + * #method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..77093b6289 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element containing a rest element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + * #method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..59feaa0e88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Lone rest element (direct binding) (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + * #method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..5aa5f57c72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element following elision elements (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + * #method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..d646cc68d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: RestElement applied to an exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + * #method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..df14ad02ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Lone rest element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + * #method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..cf4079a9a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...[ x ] = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..dd5b599f06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element (identifier) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...x = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..77f8bcc049 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...{ x } = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..739d5c5c35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...[x], y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..0be42478e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...x, y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..bd492bad5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...{ x }, y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..b5fa1729a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + * #method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..831d9a19ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([7, 8, 9]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..ad74fb6809 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + * #method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..4b60f4ee06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + * #method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..d4f2043577 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-name-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..752231a08e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..0447fa9dcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..9924edbaa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + * #method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..62dd2e44e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + * #method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..8caca6aab1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + * #method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..e32d807868 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + * #method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..8f073e8d88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + * #method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..8d4261bb47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + * #method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..42cc963f00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..e32c94f11e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..53f642c7fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..27c8a0105a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..949cf2107f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..910ef46738 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + * #method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..062026c5d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer with a "hole" (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..1dedf83a19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..5525e96014 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer with an undefined value (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..3726148920 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..34bc7514b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..01791bc2e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..2eeb81976c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..12b907a50c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..0ead3ce831 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..cf65af89ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..d4de178a42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..4e21c102f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Elision accepts exhausted iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + * #method([,] = iter) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..0e08833f55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Elision advances iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + * #method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..09c34867f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + * #method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..7b8de7dd42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,114 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..0f445b5b4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,120 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element containing an elision (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + * #method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..0e21e9f755 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + * #method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..fe2e109b6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element containing a rest element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + * #method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..237378db27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Lone rest element (direct binding) (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + * #method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..5cc4bb75bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element following elision elements (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + * #method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..f83ad16b88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + * #method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..a2ca45aeb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Lone rest element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + * #method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..288aada136 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..78ad656ed8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...x = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..affa305096 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...{ x } = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..091e69397e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..b85d8ae365 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..35cba8ea4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + * #method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..954f131235 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + * #method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..f161168a2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..5d5c4762e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + * #method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..93b312c9b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..3ab4ba5de7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..cb8b242e57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..fb52d02224 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..bc427fcf43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + * #method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..3c5d4cd4ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..1c85e238c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + * #method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..a0b7294587 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..11ab67aaff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + * #method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..3c9ff05680 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..4b972be794 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..0b35228ced --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..57aa3fafcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + * #method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..ee66ff8aa5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Binding as specified via property name and identifier (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..273b2892d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..9ad4d18006 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..1c50996fab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + * #method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..eebe0d9fe4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + * #method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..562512127e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-dflt.template +/*--- +description: Rest object contains just unextracted data (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..ceef4fe8fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-empty.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + * #method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(obj).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..1dbe03daf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..4947c6e3ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..df1974d57d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..83130c8d66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + * #method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..b2e3e9e1a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + * #method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..1c7ac4234d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: null, x: 0, y: false, z: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..4e00828637 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + * #method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..c6ea74454b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..7667bdcb32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + * #method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: [45] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..c348874bb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-ary.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: [7, undefined, ] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..088a46f99a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ s: null, u: 0, w: false, y: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..7f971870b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..0535e66753 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + * #method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..6455270c69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Binding as specified via property name and identifier (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + * #method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..b8df5d6ac7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: undefined }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..bcd6c1d83e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-prop-obj.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: { x: undefined, z: 7 } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..b706b22af9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-getter.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + * #method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ get v() { count++; return 2; } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..cc65fc7161 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + * #method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(o).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..ca956ccad9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth.template +/*--- +description: Rest object contains just unextracted data (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + * #method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({x: 1, y: 2, a: 5, b: 3}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-close.js new file mode 100644 index 0000000000..a0d3e0e850 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static * #method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js new file mode 100644 index 0000000000..656e7a62c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-init-iter-no-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static * #method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-name-iter-val.js new file mode 100644 index 0000000000..2064d6e08c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-name-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding with normal value iteration (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..a9cf0d710e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..ce44408fb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[7, 8, 9]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..e15381fe64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static * #method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..f55754f92e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static * #method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..dee5b68812 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static * #method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..5d58a0f969 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static * #method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[23]]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..4b9fa06037 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static * #method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..10f9fe109d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static * #method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([values]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..3257f92388 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Destructuring initializer with an exhausted iterator (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..dc442abba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..a00dcd9dae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..b93ccab022 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..8213aa8300 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..ffe03ea3f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static * #method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..bac4e2178b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Destructuring initializer with a "hole" (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([,]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..44a75f38b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static * #method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([null, 0, false, '']).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..4f87cba717 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Destructuring initializer with an undefined value (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([undefined]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..0c42e2b598 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration completes (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..340980b3b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..ec6a9d7801 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..2a42c6638a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..e65a4146e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..01fd488402 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-id.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([{ x: 11, y: 22, z: 33 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..71b5aba5bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..6e12625951 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([{ u: 777, w: 888, y: 999 }]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..717b44fb08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision-exhausted.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Elision accepts exhausted iterator (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static * #method([,]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision.js new file mode 100644 index 0000000000..27644db8bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-elision.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Elision advances iterator (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static * #method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-empty.js new file mode 100644 index 0000000000..3df10176f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-empty.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static * #method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..8d9a7bff41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,114 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element containing an array BindingElementList pattern (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([3, 4, 5]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..d5af7f7a41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,120 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element containing an elision (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static * #method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(g()).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..7d629b26b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element containing an "empty" array pattern (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static * #method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..b44f144f5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element containing a rest element (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static * #method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..fa12c89e27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-direct.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Lone rest element (direct binding) (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static * #method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..b042ea6651 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-elision.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element following elision elements (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static * #method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..580f92a3e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: RestElement applied to an exhausted iterator (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static * #method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..8938f56dcd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Lone rest element (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static * #method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..7b9b0fe8f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...[ x ] = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..71e640e52f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element (identifier) does not support initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...x = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..02c428c832 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-init-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...{ x } = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..fc461619c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...[x], y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..6a3ac8c58d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element (identifier) may not be followed by any element (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...x, y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..97fbf38ce1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...{ x }, y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..4a688f0162 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static * #method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..1981bb927d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest element containing an object binding pattern (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([7, 8, 9]).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..0230cf435e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static * #method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..5dd6efaa03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-init-iter-no-close.js @@ -0,0 +1,102 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static * #method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..f2b1aaf5e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-name-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..feb6b1648d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..0993c7c8c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..f10eee4cc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static * #method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..d8b3326854 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static * #method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..bef2aff71e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static * #method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..a94393732b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static * #method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..8af24fdb12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static * #method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..d2b0a3fec0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static * #method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..f6441caff2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..21cc583d0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..74ee7f3724 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..2a632e4335 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..1624baff75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..5cd4e91f6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static * #method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..b509a49adb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with a "hole" (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..bf9017e493 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static * #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..f3579a52da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer with an undefined value (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..2849a408c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..28006e1584 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..e0152b13cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..2e4c5da01c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..36c38da6d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..1c8fbdbe2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..e8d64e7333 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..1b6ce40fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..46729de0c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Elision accepts exhausted iterator (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static * #method([,] = iter) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..3d03783340 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-elision.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Elision advances iterator (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static * #method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..a165105b49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-empty.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static * #method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..22143c6565 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,114 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..86de825eb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,120 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an elision (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static * #method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..d771777d43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,103 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static * #method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..7e403c2090 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing a rest element (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static * #method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..a3ee185694 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Lone rest element (direct binding) (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static * #method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..ded7df6ae8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element following elision elements (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static * #method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..b6237320e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static * #method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..4168b02d0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Lone rest element (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static * #method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..4e1b11860e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..52629097c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...x = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..1255644a5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...{ x } = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..be33f5692e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..57f0571459 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..fb230131a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static * #method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..ecec85262e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static * #method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..d15f1b2b2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static * #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..a2c53e92d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-empty.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static * #method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..cfed69ca39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..c01146e6ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..62f20b1d6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..b73a84cf71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..25c8294791 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static * #method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..c05256f79e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static * #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..be043c218e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static * #method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..0c9c604c73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..3352c839d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..06e058a5ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..9696981403 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..9c810b9d85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..8def1410eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..c33f787595 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Binding as specified via property name and identifier (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..2c4629ce11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..33286a9a32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..308dccc6ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static * #method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..16db9a4d02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static * #method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..3492b26dca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static-dflt.template +/*--- +description: Rest object contains just unextracted data (private static class expression generator method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static * #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-empty.js new file mode 100644 index 0000000000..144417f52c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-empty.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static * #method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(obj).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..d11b70c346 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..9dfb132599 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..55e0da1362 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..9a6836a319 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static * #method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..76601188cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static * #method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..34d37c9627 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-init-skipped.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static * #method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: null, x: 0, y: false, z: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..bfb1a1be07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static * #method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..6c8551422f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..ca0ff775e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: [45] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..fc4a087c55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-ary.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: [7, undefined, ] }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..58d2aab558 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static * #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ s: null, u: 0, w: false, y: '' }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..c222540f86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-init.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..17106a1ce8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..ff41854899 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Binding as specified via property name and identifier (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static * #method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..ff294c17e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj-init.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: undefined }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..3cac196ccc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-prop-obj.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static * #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: { x: undefined, z: 7 } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..9590acba6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-getter.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static * #method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ get v() { count++; return 2; } }).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..eca2c8ad64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static * #method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(o).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..fdf5348131 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-gen-meth-static-obj-ptrn-rest-val-obj.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-gen-meth-static.template +/*--- +description: Rest object contains just unextracted data (private static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static * #method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({x: 1, y: 2, a: 5, b: 3}).next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-close.js new file mode 100644 index 0000000000..f9ab6ccbb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + #method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..3527294fb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-init-iter-no-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + #method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-name-iter-val.js new file mode 100644 index 0000000000..0c1c384b35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-name-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding with normal value iteration (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..51930c23cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..8de8d2fe46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[7, 8, 9]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..da53a1ac61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + #method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..5a8d5994ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + #method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..2029f5e516 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + #method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..37730571fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + #method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([[23]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..ccf3aa9649 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + #method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..a6e55f68b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + #method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([values]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..143d7a9c9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..3249641b99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..f72d84ac64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..86240bb8fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..90a557cf2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..9f2e8cae4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + #method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..9842981578 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Destructuring initializer with a "hole" (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([,]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..c16f5dfd5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + #method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([null, 0, false, '']); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..81b67c5123 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Destructuring initializer with an undefined value (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([undefined]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..2cc95c97c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding when value iteration completes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..a76f137d8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..d7b11bc87a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..3c3e6ae18a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..54cac0564d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..5ee30d2dc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([{ x: 11, y: 22, z: 33 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..87ebcb47ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..952f07d5a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([{ u: 777, w: 888, y: 999 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..947ff6e066 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Elision accepts exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + #method([,]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..f5f65d5954 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-elision.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Elision advances iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + #method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..31ee044d0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + #method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..5e71186e32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([3, 4, 5]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..3141b93dd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,117 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element containing an elision (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + #method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..f2c2022151 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element containing an "empty" array pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + #method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..797373f431 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element containing a rest element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + #method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..d57f44b40b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Lone rest element (direct binding) (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + #method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..7c166f8d89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element following elision elements (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + #method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..7aafb5ae22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: RestElement applied to an exhausted iterator (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + #method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..c9b3600b1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Lone rest element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + #method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..05ff8c6499 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...[ x ] = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..df14b116af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element (identifier) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...x = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..d3ba92201d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...{ x } = []]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..8e215a8402 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...[x], y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..236642cd38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...x, y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..69725bc858 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...{ x }, y]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..2a8d32a111 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element containing an object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + #method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..cb476a3572 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest element containing an object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method([7, 8, 9]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..33e03e7809 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + #method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..472fbb5774 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + #method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..b788a317b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-name-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..bb099ba497 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..a0a5083448 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..e8eec4f32c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + #method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..86b9130128 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + #method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..0da9b0a1d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + #method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..31640e7373 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + #method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..28e5d3936e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + #method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..96f3864f59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + #method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..c5fb448403 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..7d0640a937 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..8594125a2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..23482225a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..d346d46897 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..90d5594576 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + #method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..283cad6a14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Destructuring initializer with a "hole" (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..482706e82f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..dff54aa06f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Destructuring initializer with an undefined value (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..f74d74611e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..d5aaa0e106 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..27e966854f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..6bb8e37a0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..eebda9b445 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..88116d8a5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..a40c96c70f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..fb41ba8c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..e1173268ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Elision accepts exhausted iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + #method([,] = iter) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..997c6f88e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Elision advances iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + #method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..4edf700213 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + #method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..755a844f12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..cb68f35aa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,117 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element containing an elision (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + #method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..2439c38e7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + #method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..b2904924f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element containing a rest element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + #method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..a4c47ee290 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Lone rest element (direct binding) (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + #method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..66e6b6754d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element following elision elements (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + #method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..1578f4acc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + #method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..f939e7d031 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Lone rest element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + #method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..ec0977b08e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..b54c921e12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...x = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..de951a390d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...{ x } = []] = []) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..38ce3e6fc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..40ad67105c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..e34d3aa12a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + #method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..9e86a204a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + #method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..e64a645f06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..7bbf260a6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + #method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..bad2091018 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..fd685269ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..49d64ad7a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..bd007282af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..928e563b2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + #method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..29d31918fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..525e34f1f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + #method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..01b66d2f3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..d649cf63dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + #method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..d1450a4bce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..e12d1dd153 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,105 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..a8aac75a6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..2a93f8f802 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + #method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..998caf267d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Binding as specified via property name and identifier (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..d6aaf003e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..c1daf25450 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..7878793ff8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + #method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..b8b3d4f918 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + #method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..e849cfbe77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-dflt.template +/*--- +description: Rest object contains just unextracted data (private class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..dd1309945a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-empty.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + #method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(obj); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..91647c2988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..f361f6bd86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a4ae986a92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..528ec12ff2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + #method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..938a3df1c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + #method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..a3adcf38d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + #method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: null, x: 0, y: false, z: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..07293559c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + #method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..212ca00fe2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..64cf56545b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + #method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: [45] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..a4efc89585 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-ary.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: [7, undefined, ] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..38e65038dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,105 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ s: null, u: 0, w: false, y: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..0740e2389c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..82c8f38a69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + #method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..8fc660ce4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Binding as specified via property name and identifier (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + #method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..0374327ea1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: undefined }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..49829fc3fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-prop-obj.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ w: { x: undefined, z: 7 } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..26a3634ade --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-getter.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + #method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({ get v() { count++; return 2; } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..f5bf7a911a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + #method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method(o); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..61a9c40b59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-meth.template +/*--- +description: Rest object contains just unextracted data (private class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-methods-private, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + #method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + get method() { + return this.#method; + } +}; + +new C().method({x: 1, y: 2, a: 5, b: 3}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-close.js new file mode 100644 index 0000000000..af2ec50c1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static #method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-no-close.js new file mode 100644 index 0000000000..7bd6460c17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-init-iter-no-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static #method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-name-iter-val.js new file mode 100644 index 0000000000..2cb04d0bcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-name-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding with normal value iteration (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..2a6064b555 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..e54ea0ae26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[7, 8, 9]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..6971437e5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static #method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..e928ff09f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static #method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..a9374a1dcf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static #method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..cdd292381e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static #method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([[23]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..9e169b32ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static #method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..e3323b8c72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static #method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([values]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..3f6265c8ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Destructuring initializer with an exhausted iterator (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..46a6c07141 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..b65cb5686e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a944efa4c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..77976184ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..f88393fefe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static #method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..1aa3b4869f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Destructuring initializer with a "hole" (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([,]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..bb9472c5ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static #method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([null, 0, false, '']); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..8f47457b90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Destructuring initializer with an undefined value (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([undefined]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..fdeec85281 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding when value iteration completes (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..2f3bd4acf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..99601fa05e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..145838d743 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..3e722621cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..3d805dab25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-id.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([{ x: 11, y: 22, z: 33 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..f4080f6d0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..52b7116ca6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([{ u: 777, w: 888, y: 999 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..f73dceae08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision-exhausted.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Elision accepts exhausted iterator (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static #method([,]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision.js new file mode 100644 index 0000000000..b6506e84f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-elision.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Elision advances iterator (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static #method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-empty.js new file mode 100644 index 0000000000..2cc78eb9f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static #method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..c8f1b9efd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element containing an array BindingElementList pattern (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([3, 4, 5]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..d61b97db94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,117 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element containing an elision (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static #method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..a46d70d623 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element containing an "empty" array pattern (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static #method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..c6846f26b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element containing a rest element (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static #method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..475c18577e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-direct.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Lone rest element (direct binding) (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static #method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..917ab34be4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element following elision elements (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static #method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..c192ae73ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: RestElement applied to an exhausted iterator (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static #method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..7b15d2a86c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Lone rest element (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static #method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..953d4154bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...[ x ] = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..3b71a97181 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element (identifier) does not support initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...x = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..f4368b970d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-init-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...{ x } = []]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..bddc3704b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...[x], y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..e402e75116 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element (identifier) may not be followed by any element (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...x, y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..68e0879302 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...{ x }, y]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..71af8c6319 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element containing an object binding pattern (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static #method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..43524eaafd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest element containing an object binding pattern (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method([7, 8, 9]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..61262ae56f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static #method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..b2963c5fc5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-init-iter-no-close.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var C = class { + static #method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..24a6b0e528 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-name-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..cd7d7cd565 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..f0d0888b48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..37a696db2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static #method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..268b8dc94f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var C = class { + static #method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..4e5bc015d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var C = class { + static #method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..625d3b28bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var C = class { + static #method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..cad429e7a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var C = class { + static #method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..80490293c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var C = class { + static #method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..9aac8df6fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..0d8cfef27a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..06d30788ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..ecdf5cf59a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..8863eb80f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..3c6c97cd77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var C = class { + static #method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..a3c6280fe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Destructuring initializer with a "hole" (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..9bd0a9c2e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static #method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..a0dd6aaaf6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Destructuring initializer with an undefined value (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..f0936a5425 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..cc962a3284 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..2267648790 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,108 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var C = class { + static #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..a9d65e6cba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..71b2e932cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..65deee3ff9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..a3e30d2faa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..d9598ca4c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static #method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..6bcd87ec81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Elision accepts exhausted iterator (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var C = class { + static #method([,] = iter) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..8fbb1ab3f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-elision.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Elision advances iterator (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static #method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..17095f6e41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-empty.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static #method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..596b59775e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,111 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..13fb5dbd78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,117 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element containing an elision (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var C = class { + static #method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..55f75939cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,100 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var C = class { + static #method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..ba997ecde2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element containing a rest element (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static #method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..accb4ffb14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Lone rest element (direct binding) (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var C = class { + static #method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..062d0d8ecf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element following elision elements (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var C = class { + static #method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..aa8aade22c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var C = class { + static #method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..02da34ecec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Lone rest element (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var C = class { + static #method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..e5f11aad3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..340b737d24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...x = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..c2279a320f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...{ x } = []] = []) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..ab362b4861 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..b9144e0c77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..611f764948 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var C = class { + static #method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..9193c5c7e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static #method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..b30a7400f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest element containing an object binding pattern (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var C = class { + static #method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..90549daa4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-empty.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static #method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..950ab923b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..357694094b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..57f737d515 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..df3294e427 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..676b7e0443 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static #method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..302c1665bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static #method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..58eb4a4faa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static #method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..59dc6178b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..4625e11839 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static #method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..0ef4ce85ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..3c943a93ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,105 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..35dbf36f78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..501fe21151 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static #method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..5dc2edbddc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Binding as specified via property name and identifier (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..d9c4a8f0bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..5a6a5e7a13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..ec3a74fd4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static #method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..16bcb4812d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static #method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..3030b77057 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static-dflt.template +/*--- +description: Rest object contains just unextracted data (private static class expression method (default parameter)) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static #method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-empty.js new file mode 100644 index 0000000000..78a1f1492f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-empty.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: No property access occurs for an "empty" object binding pattern (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var C = class { + static #method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(obj); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..11e0f5391c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..1fca78fee5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..d956047af9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..efa67a22da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var C = class { + static #method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..e8458f0398 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,91 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators, class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var C = class { + static #method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..975dea2cb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-init-skipped.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static #method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: null, x: 0, y: false, z: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..4c2266b931 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static #method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..4050a9040e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..38cb19d92c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static #method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: [45] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..0e13ecee3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-ary.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: [7, undefined, ] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..789774c3a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,105 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var C = class { + static #method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ s: null, u: 0, w: false, y: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..f1ca7a64c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-init.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Binding as specified via property name, identifier, and initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..25c3639a11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var C = class { + static #method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..02e983d680 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-id.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Binding as specified via property name and identifier (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var C = class { + static #method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..96bb5dac99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj-init.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: undefined }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..558a46a699 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-prop-obj.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, class-static-methods-private, destructuring-binding] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var C = class { + static #method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ w: { x: undefined, z: 7 } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..98902ce234 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-getter.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var C = class { + static #method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({ get v() { count++; return 2; } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..37d5610eaa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest object doesn't contain non-enumerable properties (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var C = class { + static #method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method(o); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..0851614249 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/dstr/private-meth-static-obj-ptrn-rest-val-obj.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/cls-expr-private-meth-static.template +/*--- +description: Rest object contains just unextracted data (private static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [object-rest, class, class-static-methods-private, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static #method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } + + static get method() { + return this.#method; + } +}; + +C.method({x: 1, y: 2, a: 5, b: 3}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/dstr/shell.js b/js/src/tests/test262/language/expressions/class/dstr/shell.js new file mode 100644 index 0000000000..e69de29bb2 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..e6793241ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-names.js @@ -0,0 +1,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..9dcb10f5e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-computed-symbol-names.js @@ -0,0 +1,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..ccbbdc8a8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..b313766c52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names-asi.js @@ -0,0 +1,77 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..00afc67d5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-literal-names.js @@ -0,0 +1,96 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..ce477748a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-field-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..481ac0010c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-getter-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..2dd77f6fb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-method-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..c48f362fa7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-private-names.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..c3c9b7309a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier-initializer.js @@ -0,0 +1,87 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ac1b2c850c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-field-identifier.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..f4acc0f482 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..88d5fcbc6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-getter.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..af0dc3a9e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..eb067ac41e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-method.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..572c64a590 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..9a6d298a62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-private-setter.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..17d9bf31c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..90faf845e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ce887fc209 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..e37d28e0c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-privatename-identifier.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..903011d59d --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..6ee96c16e0 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..3061c3aea8 --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..8706c5ffc8 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..300e04fe3b --- /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,124 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..023835a511 --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..f8b63f14db --- /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,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..6cc63f1706 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..b03e2e6987 --- /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,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..025a6cb3de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..a8ace0ebb1 --- /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,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..087aba9e0f --- /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,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..36c6c5bbed --- /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,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5733b8d437 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5783deda5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-rs-static-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..4c4ee7b758 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-fields.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..85c63adb6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..95411fa58b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-static-private-methods.js @@ -0,0 +1,75 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..d5d8ec313b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-gen-string-literal-names.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..2b58ea04ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-names.js @@ -0,0 +1,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..5d16e5a1b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-computed-symbol-names.js @@ -0,0 +1,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..a93d0c7216 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..95cb640581 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names-asi.js @@ -0,0 +1,77 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..408945606e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-literal-names.js @@ -0,0 +1,96 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..d95585119e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-field-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5d77d1a4d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-getter-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..d7e5d2f6a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-method-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..20a1af5477 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-private-names.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..a560e2742f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,87 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..dd63b13308 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-field-identifier.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..f02aeb7b13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..274029073f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-getter.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..0b081de646 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..2d2f665134 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-method.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..3d9383ce5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..3250df6ed0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-private-setter.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..546e1cc17d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..60414d1677 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..57905a2b70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..bb067471b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-privatename-identifier.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ddc0583ba7 --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..7b37ed65f3 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..0a0bebd3f2 --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..c79dea0569 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..86d5ddd732 --- /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,124 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..f0ed80125c --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..b1ece2b414 --- /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,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..64ae3bd0d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ae491fe9db --- /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,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..69b7331586 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ab8cbd24f5 --- /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,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..da1178baf4 --- /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,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..8eadfb9ff4 --- /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,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5be9136796 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..7a2574ef97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..2345147bbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-fields.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..9f7f6ff8f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..1619208681 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-static-private-methods.js @@ -0,0 +1,75 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..a5c4cb1f00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-method-string-literal-names.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..b4241f26e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-names.js @@ -0,0 +1,123 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" + ); + + 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..3d933059c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-computed-symbol-names.js @@ -0,0 +1,121 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" + ); + } + + 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..33a900091a --- /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,125 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..300940616f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names-asi.js @@ -0,0 +1,93 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + 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..fcb9dbd3e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-literal-names.js @@ -0,0 +1,112 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" + ); + + 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..5289ba78e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-field-usage.js @@ -0,0 +1,65 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..9c448baa7a --- /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,65 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..1d6b759b17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-method-usage.js @@ -0,0 +1,65 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..11d6d9b8fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-private-names.js @@ -0,0 +1,87 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..109fce2be0 --- /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,103 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f2ce5c6a1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-field-identifier.js @@ -0,0 +1,110 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..4ce4dab6c4 --- /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,144 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..26f0ba713a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-getter.js @@ -0,0 +1,144 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..6a541b704c --- /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,143 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..556636b027 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-method.js @@ -0,0 +1,143 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..d711216e1e --- /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,143 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..b313ade473 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-private-setter.js @@ -0,0 +1,143 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..ac49206025 --- /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,125 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..3566ac3edc --- /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,119 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..85ed65eb08 --- /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,119 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..1e84f6fa70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-rs-privatename-identifier.js @@ -0,0 +1,125 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..285f0c9701 --- /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,151 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..daed275746 --- /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,152 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..26d3ad88b0 --- /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,151 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..8b9aedf50f --- /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,152 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..59349be2ea --- /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,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..99e2825684 --- /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,141 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..d9fe54e0b3 --- /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,138 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..c64ca474f5 --- /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,138 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..492be6f7fb --- /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,126 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..7d0d463843 --- /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,126 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..aa31544f20 --- /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,126 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..33d6b24dd1 --- /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,120 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..fd93bf9c5f --- /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,120 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..66a3013c65 --- /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,120 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..3980ec1f44 --- /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,126 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..87ec818532 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-fields.js @@ -0,0 +1,87 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..5a9ff27fa6 --- /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,104 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); + assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); + assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..af15a6cd2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-static-private-methods.js @@ -0,0 +1,91 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..6473ed15d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-string-literal-names.js @@ -0,0 +1,125 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" + ); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" + ); + + 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..241b81f484 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-names.js @@ -0,0 +1,122 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" + ); + + 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..eafb540029 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-computed-symbol-names.js @@ -0,0 +1,120 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" + ); + } + + 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..34f3fa821c --- /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,124 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..4554b1d311 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names-asi.js @@ -0,0 +1,92 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + 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..83ccaeb48a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-literal-names.js @@ -0,0 +1,111 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" + ); + + 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..c4b3e4f547 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-field-usage.js @@ -0,0 +1,64 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..9950f35f42 --- /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,64 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..350021fd3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-method-usage.js @@ -0,0 +1,64 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..6d8b9e9880 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-private-names.js @@ -0,0 +1,86 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..1762c2eb55 --- /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,102 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f7aca519f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-field-identifier.js @@ -0,0 +1,109 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..8b0fa49b3a --- /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,143 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..e96cf0800a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-getter.js @@ -0,0 +1,143 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..548d6cdac1 --- /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,142 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..ea9262ed44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-method.js @@ -0,0 +1,142 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f96db4a77c --- /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,142 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..d1a1964a1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-private-setter.js @@ -0,0 +1,142 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..2bfcd9fbfc --- /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,124 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..5b973ac647 --- /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,118 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..840498d488 --- /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,118 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..3850316196 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-rs-privatename-identifier.js @@ -0,0 +1,124 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..1fde2a2d99 --- /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,150 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..9e2290cdc8 --- /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,151 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..25f5ea4609 --- /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,150 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..d236eaab0a --- /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,151 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..eafb052e80 --- /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,139 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..9fcfc00c32 --- /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,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..e1f74411e5 --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f7ad830edb --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..227d92efc2 --- /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,125 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..17a982d70c --- /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,125 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..b00b065a1d --- /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,125 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..5f3775a3e3 --- /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,119 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..1db09a2355 --- /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,119 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f82d5557cf --- /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,119 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..b310c826e3 --- /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,125 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..92d8117e87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-fields.js @@ -0,0 +1,86 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..7860ed890a --- /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,103 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); + assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); + assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..5ba0e21df1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-static-private-methods.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..decb1b6d9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-method-string-literal-names.js @@ -0,0 +1,124 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" + ); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" + ); + + 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..b7dda110d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-computed-names.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..9f35e85621 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-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-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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..7a6ad3b5a1 --- /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,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..0221870853 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names-asi.js @@ -0,0 +1,80 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..486c47e3d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-literal-names.js @@ -0,0 +1,99 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..abad3c2d3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-field-usage.js @@ -0,0 +1,52 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..247e897d84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-getter-usage.js @@ -0,0 +1,52 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..9607bf13cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-method-usage.js @@ -0,0 +1,52 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..0d5b4f0b8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-private-names.js @@ -0,0 +1,74 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..f39ea44690 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier-initializer.js @@ -0,0 +1,90 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..3fefc3a364 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-field-identifier.js @@ -0,0 +1,97 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..3f0e6875ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter-alt.js @@ -0,0 +1,131 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..3972b6ac03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-getter.js @@ -0,0 +1,131 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..c8b4e19fec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method-alt.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..c356edac95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-method.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..226d096633 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter-alt.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..3d7c74aad6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-private-setter.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..7b8c6460d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..dc3b6596d9 --- /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,106 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..829e0fe7d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,106 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..844e3228c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-privatename-identifier.js @@ -0,0 +1,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..7933e0adb0 --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..33adc21980 --- /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,138 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..82c1a434b8 --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..5a23900ca9 --- /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,138 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..191df82493 --- /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,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..7b491d4818 --- /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,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..c5e11f4919 --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..1848007932 --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f9f969d4fa --- /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,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f07a05a2f0 --- /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,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..2bdc1b4a05 --- /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,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..c3771848bd --- /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,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..4a4bb988d9 --- /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,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..457a226fbf --- /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,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..6260adcd15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-rs-static-privatename-identifier.js @@ -0,0 +1,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..afc5fb8559 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-fields.js @@ -0,0 +1,74 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..17e918ef5d --- /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,91 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..df09f54982 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-static-private-methods.js @@ -0,0 +1,78 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..db619b279e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-gen-string-literal-names.js @@ -0,0 +1,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..55fd32f560 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-computed-names.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..d47ca6ad01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-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-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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..a331df80b9 --- /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,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..4c3e5b4d15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names-asi.js @@ -0,0 +1,80 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..d91b6856d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-literal-names.js @@ -0,0 +1,99 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..f20eae12bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-field-usage.js @@ -0,0 +1,52 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..9fc93d2618 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-getter-usage.js @@ -0,0 +1,52 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..412242540d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-method-usage.js @@ -0,0 +1,52 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..d907c65196 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-private-names.js @@ -0,0 +1,74 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..8650f4e3c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier-initializer.js @@ -0,0 +1,90 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..aca339ca7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-field-identifier.js @@ -0,0 +1,97 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..c18aa36535 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter-alt.js @@ -0,0 +1,131 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..b9ea784033 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-getter.js @@ -0,0 +1,131 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f2c645fc64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method-alt.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..a01f6c1edb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-method.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..a89e61525c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter-alt.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..895b5a135c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-private-setter.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..48f2f3ad76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-alt.js @@ -0,0 +1,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..4da8e30e0f --- /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,106 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..6aa01ab455 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,106 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..35c2dc64ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-privatename-identifier.js @@ -0,0 +1,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..1a2ec06a0d --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..1f8f9986be --- /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,138 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..39dfe2bf38 --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..93a81cbbc2 --- /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,138 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..6182eed7ea --- /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,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..ffcb933f3c --- /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,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..d5c432e8c9 --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..8548e9ace7 --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..be203c5790 --- /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,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..d06ca9f33c --- /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,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..a5d49fb781 --- /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,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..c745533ea1 --- /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,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..594b8a82cd --- /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,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..dbbcc4a193 --- /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,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..b31c77d25f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-rs-static-privatename-identifier.js @@ -0,0 +1,113 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +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..f08caebce1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-fields.js @@ -0,0 +1,74 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..039b57f9b7 --- /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,91 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..a729bfafb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-static-private-methods.js @@ -0,0 +1,78 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..956c3f244f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/after-same-line-static-method-string-literal-names.js @@ -0,0 +1,112 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "m"), + "m doesn't appear as an own property on the C prototype" +); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..1688a11db8 --- /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,39 @@ +// 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..6b32c8f02d --- /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,36 @@ +// 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..33e6b44db8 --- /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,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-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..8165d97d06 --- /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,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-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..06d3da6bef --- /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,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-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..804cb94a88 --- /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,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-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..b9bf5cb0b1 --- /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,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-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..a20d9eb5bc --- /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,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-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..003cdbe02c --- /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,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-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..4750182b02 --- /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,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-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..e7c8fd70ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-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-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..bb84f9fc1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-direct-eval-err-contains-newtarget.js @@ -0,0 +1,39 @@ +// 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..ccd5a591c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/arrow-body-private-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-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..3f8ca4cf3f --- /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| error:SyntaxError +// 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..24436319e5 --- /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| error:SyntaxError +// 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..4f95c19f08 --- /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| error:SyntaxError +// 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..c50105b76c --- /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| error:SyntaxError +// 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..127563f959 --- /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| error:SyntaxError +// 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..f5987e9846 --- /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| error:SyntaxError +// 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..d9f795e532 --- /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| error:SyntaxError +// 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..f1a94682e0 --- /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| error:SyntaxError +// 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..85aa88b1d2 --- /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| error:SyntaxError +// 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..8a0c99c5cc --- /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| error:SyntaxError +// 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..216c7ba70b --- /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| error:SyntaxError +// 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..6ea3e23f3d --- /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| error:SyntaxError +// 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..c96c901955 --- /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,76 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..423b5d8ebe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-identifier-strict-strict.js @@ -0,0 +1,67 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..9df90877c9 --- /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,72 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..4f163520d8 --- /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,78 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..6128c0caf6 --- /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,77 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..54596c20f1 --- /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,76 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..18fc3891cd --- /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,75 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..0757ff050b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-promise-reject-next.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..0f048066cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-multiple.js @@ -0,0 +1,78 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..ec1ed01193 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-arr-single.js @@ -0,0 +1,77 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..783d71c5e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-spread-obj.js @@ -0,0 +1,80 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..2d343b2a6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-next.js @@ -0,0 +1,247 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..f4d12ed865 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-return.js @@ -0,0 +1,263 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..9f76846665 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-async-throw.js @@ -0,0 +1,271 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..3d73d7315f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-expr-abrupt.js @@ -0,0 +1,82 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..784503fb80 --- /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,102 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..71d50f65cf --- /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,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..5de34b9ee4 --- /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,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..56592c1091 --- /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,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..ea0829a669 --- /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,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..277628ab2d --- /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,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..8898f3ddb8 --- /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,107 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..6bff8d1d92 --- /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,98 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..7cfd7fc69d --- /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,98 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..1e2d457b76 --- /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,98 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..ffd1d953a0 --- /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,98 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..4060d0e54c --- /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,98 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..1be034b525 --- /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,98 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..24af35bc84 --- /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,98 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..c1d4963c35 --- /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,107 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..7364a8c0b4 --- /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,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..441c8a32d7 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..646629deff --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..863fbf077e --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..640679c740 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..6175821e12 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..de9f7bf0e0 --- /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,95 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..cda0d916df --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..a98ff89c1e --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..e7b344e30b --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..81836b9ca6 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..551a7712fa --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..d6b006914a --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..d03c95b342 --- /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,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..9e5e8d02e3 --- /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,93 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..830c4430fc --- /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,103 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..16b4a22664 --- /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,93 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..a83568852e --- /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,113 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..b3cc1e2f7c --- /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,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..bec8d9404f --- /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,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..50f09af20a --- /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,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..fec694d6d4 --- /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,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..94208916de --- /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,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..e3566b58ac --- /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,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..ae164d199b --- /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,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..1ff423c11c --- /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,117 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..e2e117e81b --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..54d2cb0b2c --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..7dc8a9f960 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..c5cc194848 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..94838e59b3 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..0596acdd87 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..1dfea5caeb --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..bf2c426571 --- /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,117 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..b09f5368a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-next.js @@ -0,0 +1,250 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..5584d3cc0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-return.js @@ -0,0 +1,225 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..af20dc75d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method-static/yield-star-sync-throw.js @@ -0,0 +1,231 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); 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..410026b54c --- /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| error:SyntaxError +// 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..7f91c235a2 --- /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| error:SyntaxError +// 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..1f8a30aa76 --- /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| error:SyntaxError +// 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..1b05701442 --- /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| error:SyntaxError +// 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..b9d0ac1f9f --- /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| error:SyntaxError +// 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..eb41bc2824 --- /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| error:SyntaxError +// 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..6219aa5d0f --- /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| error:SyntaxError +// 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..2c87a125d8 --- /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| error:SyntaxError +// 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..5b4f4da3b8 --- /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| error:SyntaxError +// 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..7e4a13eff2 --- /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| error:SyntaxError +// 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..8fe6a577fc --- /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| error:SyntaxError +// 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..7120178147 --- /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| error:SyntaxError +// 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..7cf65d294e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-spread-strict-strict.js @@ -0,0 +1,86 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..b398eda103 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-identifier-strict-strict.js @@ -0,0 +1,77 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..d38cf76fdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next-catch.js @@ -0,0 +1,82 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..10f8623b68 --- /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,88 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..186f7fd24e --- /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,87 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..40ca201f43 --- /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,86 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..61ebf36c58 --- /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,85 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..105feec6c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-promise-reject-next.js @@ -0,0 +1,82 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..a0a79ab9a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-multiple.js @@ -0,0 +1,88 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..6b780cc32e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-arr-single.js @@ -0,0 +1,87 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..164c876bd1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-spread-obj.js @@ -0,0 +1,90 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..e4a1d873c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-next.js @@ -0,0 +1,257 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..7000493ebd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-return.js @@ -0,0 +1,273 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..08be1d64dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-async-throw.js @@ -0,0 +1,281 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..ceb9bd1100 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-expr-abrupt.js @@ -0,0 +1,92 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..573b57ecf0 --- /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,112 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..a21cc806df --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..45ed2fcc1f --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..07b343cb60 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..e53a9905f5 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..b39a457357 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..e6051d3cba --- /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,117 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..45d10b19e7 --- /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,108 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..f0cda9f157 --- /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,108 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..8293f29c31 --- /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,108 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..3596624b42 --- /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,108 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..264bc311bd --- /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,108 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..7fd1978091 --- /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,108 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..53154e307f --- /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,108 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..c60d632138 --- /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,117 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..2f8c7f71d4 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..e81202e020 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..bdea429935 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..390cb2b13d --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..2f16204224 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..ed3f1021f2 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..fbbe195d05 --- /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,105 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..7ba2f44a89 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..80e699cf82 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..39a393d2f7 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..342908f659 --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..8d3ec61cab --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..22440e788a --- /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,110 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..ce0b67dc74 --- /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,111 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..676a745958 --- /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,103 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..9d028dabb8 --- /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,113 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..9ae2d784af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-next-get-abrupt.js @@ -0,0 +1,103 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..37a79a08f0 --- /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,123 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..d680176eb9 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..3dde849046 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..1918d1e8be --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..1c4d3945bd --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..e45d251e7e --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..c939a18354 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..62027c11f1 --- /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,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..2f65a135d9 --- /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,127 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..985a0321da --- /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,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..ffd3905a50 --- /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,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..c3bdb3497e --- /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,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..fb593d2a9d --- /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,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..bd7b68b0ed --- /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,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..f7382cf6d4 --- /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,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..f7b166d3c0 --- /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,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..8dfa62f75b --- /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,127 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..f6e31c44d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-next.js @@ -0,0 +1,260 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..b020558fac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-return.js @@ -0,0 +1,235 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..11305429bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-gen-private-method/yield-star-sync-throw.js @@ -0,0 +1,241 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "#gen does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "#gen does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "#gen does not appear as an own property on C instance" +); 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..6b0596410f --- /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| error:SyntaxError +// 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..8ff369d74c --- /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| error:SyntaxError +// 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..526bb7567a --- /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| error:SyntaxError +// 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..96fa551ff2 --- /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| error:SyntaxError +// 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..d7412fc144 --- /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| error:SyntaxError +// 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..bdcd0c25b6 --- /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| error:SyntaxError +// 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..bac2fc26ce --- /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| async +// 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..faa7d9e961 --- /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| async +// 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..552326186f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-arrow.js @@ -0,0 +1,43 @@ +// |reftest| async +// 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..8b8df838af --- /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| async +// 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..349cecfe28 --- /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| async +// 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..753e69222f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method-static/returns-async-function.js @@ -0,0 +1,43 @@ +// |reftest| async +// 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..2ba8bcd1b7 --- /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| error:SyntaxError +// 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..273b30b611 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-binding-identifier.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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..4a76344b29 --- /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| error:SyntaxError +// 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..5495f088ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-identifier-reference.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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..2d6656dc25 --- /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| error:SyntaxError +// 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..dc8394020a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/await-as-label-identifier.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// 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..376b7aaef1 --- /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| async +// 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..4a613f967d --- /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| async +// 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..f60e5c30e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-arrow.js @@ -0,0 +1,44 @@ +// |reftest| async +// 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..304527125b --- /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| async +// 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..9d711106cc --- /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| async +// 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..e3f819699a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/async-private-method/returns-async-function.js @@ -0,0 +1,44 @@ +// |reftest| async +// 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..e73580c7c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive-symbol.js @@ -0,0 +1,123 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, s1), + "s1 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, s1), + "s1 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, s1, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, s2), + "s2 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, s2), + "s2 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, s2, { + value: 43, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, s3), + "s3 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, s3), + "s3 doesn't appear as an own property on C constructor" +); + +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..440f5e5961 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/computed-name-toprimitive.js @@ -0,0 +1,120 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "e"), + "e doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "e"), + "e doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "e", { + value: 43, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "f"), + "f doesn't appear as an own property on C prototype" +); +assert(! + Object.prototype.hasOwnProperty.call(C, "f"), + "f doesn't appear as an own property on C constructor" +); + +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..353ecfd3e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/field-declaration.js @@ -0,0 +1,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, 'f'), + "f does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C, 'g'), + "g does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C, 'h'), + "h does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C, 0), + "0 does not appear as an own property on C constructor" +); + +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/field-definition-accessor-no-line-terminator.js b/js/src/tests/test262/language/expressions/class/elements/field-definition-accessor-no-line-terminator.js new file mode 100644 index 0000000000..78b864c95d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/field-definition-accessor-no-line-terminator.js @@ -0,0 +1,52 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/class-elements/field-definition-accessor-no-line-terminator.case +// - src/class-elements/default/cls-expr.template +/*--- +description: Valid accessor FieldDefinition, ClassElementName, PropertyName Syntax (field definitions in a class expression) +esid: prod-FieldDefinition +features: [decorators, class] +flags: [generated] +info: | + FieldDefinition[Yield, Await] : + accessor [no LineTerminator here] ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt + +---*/ + + +var C = class { + accessor + $; + static accessor + $; + +} + +let c = new C(); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, 'accessor'), + "accessor doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, '$'), + "$ doesn't appear as an own property on C prototype" +); +assert( + Object.prototype.hasOwnProperty.call(C, 'accessor'), + "C constructor has an own property accessor" +); +assert( + !Object.prototype.hasOwnProperty.call(C, '$'), + "$ doesn't appear as an own property on C constructor" +); +assert( + Object.prototype.hasOwnProperty.call(c, 'accessor'), + "C instance has an own property accessor" +); +assert( + Object.prototype.hasOwnProperty.call(c, '$'), + "C instance has an own property $" +); + +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..f50b3e92bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-anonymous-function-length.js @@ -0,0 +1,48 @@ +// 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..7a303d07b0 --- /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(!Object.prototype.hasOwnProperty.call(c, "in"), "'in' is not parsed as a field declaration"); +assert(!Object.prototype.hasOwnProperty.call(c, "z"), "'z' is not parsed as a field declaration"); + +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..feeeb72fe6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-duplicate-privatenames.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// 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..18d278fc27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/fields-multiple-definitions-static-private-methods-proxy.js @@ -0,0 +1,41 @@ +// 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..7f6c8c2615 --- /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| error:SyntaxError +// 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..85e1357cd7 --- /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| error:SyntaxError +// 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..202f78ca91 --- /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| error:SyntaxError +// 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..1eb4326859 --- /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| error:SyntaxError +// 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..af8f86a3bd --- /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| error:SyntaxError +// 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..5bd7f5a197 --- /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| error:SyntaxError +// 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..ec6678dabd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-spread-strict-strict.js @@ -0,0 +1,75 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties before set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); 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..2d8409f00c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-identifier-strict-strict.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +var iter = C.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties before set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); 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..f1c1cccfff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-multiple.js @@ -0,0 +1,73 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +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..6e825fe591 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-arr-single.js @@ -0,0 +1,75 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +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..2a8d38a296 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method-static/yield-spread-obj.js @@ -0,0 +1,78 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); + +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..e7722c5e35 --- /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| error:SyntaxError +// 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..4b017c8e82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-binding-identifier.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// 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..6a6bf24503 --- /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| error:SyntaxError +// 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..753e0a585f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-identifier-reference.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// 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..fc1d2dfda4 --- /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| error:SyntaxError +// 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..d2830d4476 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-as-label-identifier.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// 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..8ce31ff8f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-spread-strict-strict.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); 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..6710c4b1a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-identifier-strict-strict.js @@ -0,0 +1,76 @@ +// |reftest| error:SyntaxError +'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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +var iter = c.gen(); + + + +assert.sameValue(callCount, 1); + +// Test the private fields do not appear as properties after set to value +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); 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..21bf163956 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-multiple.js @@ -0,0 +1,83 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +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..e17af9fbec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-arr-single.js @@ -0,0 +1,85 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +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..59f54a8897 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/gen-private-method/yield-spread-obj.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "#gen"), + "Private field '#gen' does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "#gen"), + "Private field '#gen' does not appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "#gen"), + "Private field '#gen' does not appear as an own property on C instance" +); + +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..39caf89b6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/grammar-private-field-optional-chaining.js @@ -0,0 +1,42 @@ +// 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..7413b570de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-names.js @@ -0,0 +1,158 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..dae61893bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-computed-symbol-names.js @@ -0,0 +1,156 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..af98fc0a2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,160 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..163528eb18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names-asi.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..a21e07cf69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-literal-names.js @@ -0,0 +1,147 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..4b0f6cd6d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-field-usage.js @@ -0,0 +1,100 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..0a6f0094c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-getter-usage.js @@ -0,0 +1,100 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..8135fb64c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-method-usage.js @@ -0,0 +1,100 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..0c0d8a64e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-private-names.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..83bb905415 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier-initializer.js @@ -0,0 +1,138 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..7d291aff0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-field-identifier.js @@ -0,0 +1,145 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..935cb7b4d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter-alt.js @@ -0,0 +1,179 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..5265e916ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-getter.js @@ -0,0 +1,179 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..782636708b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method-alt.js @@ -0,0 +1,178 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..41cf968b92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-method.js @@ -0,0 +1,178 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..09405d44d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter-alt.js @@ -0,0 +1,178 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..9fa4224113 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-private-setter.js @@ -0,0 +1,178 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..5207b6f797 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-alt.js @@ -0,0 +1,160 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..e072a1a26c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,154 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..0b120e9f24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier-initializer.js @@ -0,0 +1,154 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..6871e1b258 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-privatename-identifier.js @@ -0,0 +1,160 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..6a66c94792 --- /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,185 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..2a73d2410b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -0,0 +1,186 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..caa904840d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier-alt.js @@ -0,0 +1,185 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..6ee9b3fcbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,186 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..aab7ce8cd1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,175 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..c64a50a2a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,176 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..e38d8c9be2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,173 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..9d9a58356f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-method-privatename-identifier.js @@ -0,0 +1,173 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..09a8b75236 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,161 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..f6feaed2d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-alt.js @@ -0,0 +1,161 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..1a73f619f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,161 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..bd4f31926f --- /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,155 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..9a072fe1a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,155 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..6e921a5499 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,155 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..3fb7b0a0b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-rs-static-privatename-identifier.js @@ -0,0 +1,161 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..66675da1ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-fields.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..673d8d961c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods-with-fields.js @@ -0,0 +1,139 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..ebff71e556 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-static-private-methods.js @@ -0,0 +1,126 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..136006fb46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-definitions-string-literal-names.js @@ -0,0 +1,160 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert( + !Object.prototype.hasOwnProperty.call(c, "m2"), + "m2 doesn't appear as an own property on the C instance" +); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..ff67889a12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-names.js @@ -0,0 +1,130 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..919e9f5311 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-computed-symbol-names.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..c82dd4e75a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,132 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..90629749a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names-asi.js @@ -0,0 +1,100 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..e547fa0cbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-literal-names.js @@ -0,0 +1,119 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..37e31119ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-field-usage.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..83d0560f34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-getter-usage.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..b15e81b489 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-method-usage.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..ba4179c322 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-private-names.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..51cc93ee63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier-initializer.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..22efdd1a8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-field-identifier.js @@ -0,0 +1,117 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..b3d9fd1965 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter-alt.js @@ -0,0 +1,151 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..980a6582be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-getter.js @@ -0,0 +1,151 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..24d63755c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method-alt.js @@ -0,0 +1,150 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..2a82c3c604 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-method.js @@ -0,0 +1,150 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..5a89c99322 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter-alt.js @@ -0,0 +1,150 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..dddc936a56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-private-setter.js @@ -0,0 +1,150 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..1d7ce81f5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-alt.js @@ -0,0 +1,132 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..da4242fb3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,126 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..b54716d4c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier-initializer.js @@ -0,0 +1,126 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..709c94dcae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-privatename-identifier.js @@ -0,0 +1,132 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..5be482d5f6 --- /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,157 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..319757b4c2 --- /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,158 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..18a0aad6cc --- /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,157 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..48bcf6fbf8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,158 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..fe9c7b8737 --- /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,147 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..7882f8947a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,148 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..8699ddc874 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,145 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..57e272c9c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-method-privatename-identifier.js @@ -0,0 +1,145 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..a213b509f8 --- /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,133 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..687db46d38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-alt.js @@ -0,0 +1,133 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..afa4761ddb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,133 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..ff0a82c30c --- /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,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..596e888946 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..af365f5ee5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..ff78487511 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-rs-static-privatename-identifier.js @@ -0,0 +1,133 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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..f0d506bbfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-fields.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..5e242d72d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods-with-fields.js @@ -0,0 +1,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..330f1d9a59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-static-private-methods.js @@ -0,0 +1,98 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..3a33c9aad7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/multiple-stacked-definitions-string-literal-names.js @@ -0,0 +1,132 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C, "foo"), + "foo doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "foo"), + "foo doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: true, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert( + !Object.prototype.hasOwnProperty.call(C, "bar"), + "bar doesn't appear as an own property on the C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "bar"), + "bar doesn't appear as an own property on the C prototype" +); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: true, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..8bb51845c4 --- /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| 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-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..56c9fe70fd --- /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| 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-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..be5c4ada89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..1e95968ade --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..8fdfdfe461 --- /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,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-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..e109000e49 --- /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,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-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..ecbd9df6d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..d9380a5032 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..838cfa34dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..7aa613b4be --- /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,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-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..faeaaa9216 --- /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,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-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..dad896c8f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..d2d5a4228c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..c7585ff30b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..a632ad3d3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-indirect-eval-contains-arguments.js @@ -0,0 +1,26 @@ +// 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..b3a916948a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..17ff2b7c0d --- /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| 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-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..170fd74e97 --- /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| 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-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..d678a87c8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..3c241eaf8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..e96ddac107 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..a4fbb1ab8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-private-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-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..77389eae68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-private-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-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..2c9c71d224 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/nested-static-private-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-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..0c0858df09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-names.js @@ -0,0 +1,108 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..bbdfac0133 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-computed-symbol-names.js @@ -0,0 +1,106 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..f27760cd12 --- /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,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..5532125eb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names-asi.js @@ -0,0 +1,78 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..c384eab0e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-literal-names.js @@ -0,0 +1,97 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..0546b4b429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-field-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..9d8ec9da19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-getter-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..bb6512df0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-method-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..e4d0cc438f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-private-names.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..c780598caf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..6d647d5586 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-field-identifier.js @@ -0,0 +1,95 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..916834b5b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter-alt.js @@ -0,0 +1,129 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..e43fe25fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-getter.js @@ -0,0 +1,129 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..44acf6d965 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..1d05fbc5b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-method.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..0dbf55cfe9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..859d97fc55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-private-setter.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..6d1c508cc5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..08ff109053 --- /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,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..bb2f00d98d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..ec70f8d0a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..d676216aa4 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..52414c43f0 --- /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,136 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..107ad5045e --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..8d6571ce75 --- /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,136 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..9707dc7428 --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..71be8f2e14 --- /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,126 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..0405f50d1b --- /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,123 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..accc941e25 --- /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,123 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..8868bc7b49 --- /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,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..023b9986f3 --- /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,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..a090a6cf1d --- /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,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..99ba09403a --- /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,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..9234dbf6c7 --- /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,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..04a7973169 --- /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,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..908f0967e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..6f4a03a50c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-fields.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..df6b5b94c6 --- /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,89 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..8370e6fd30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-static-private-methods.js @@ -0,0 +1,76 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..a265be2d09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-no-sc-line-method-string-literal-names.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..85b8f14f9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-names.js @@ -0,0 +1,108 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..a40222a4f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-computed-symbol-names.js @@ -0,0 +1,106 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..c8cb012fbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..40555ed1c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names-asi.js @@ -0,0 +1,78 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..512b61e0c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-literal-names.js @@ -0,0 +1,97 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..d24e703794 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-field-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..b92cc27241 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-getter-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..121e4ed0d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-method-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..b84e8c40bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-private-names.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..a30999ed22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier-initializer.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..d8738f7367 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-field-identifier.js @@ -0,0 +1,95 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..d2a463086c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter-alt.js @@ -0,0 +1,129 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..7a962fb04c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-getter.js @@ -0,0 +1,129 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..ec65d1f077 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..a4d1f314f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-method.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..92ff6fdf9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..ffea3a053a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-private-setter.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..9e5db3660d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..523d2b4188 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..61b169febd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..d5363502d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..4d8db3cda7 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..ba32c03870 --- /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,136 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..3ce6f0e650 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..4a48df4a06 --- /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,136 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..47c1a8a3b5 --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..58b378b3e1 --- /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,126 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..bfbba3ef27 --- /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,123 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..053272a202 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..4f67988589 --- /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,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..db3298043c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..aa47286096 --- /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,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..07ee0beb11 --- /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,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..31cd27ebc8 --- /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,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..87bf02d5ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..4bf1312656 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-rs-static-privatename-identifier.js @@ -0,0 +1,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..53dc66f246 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-fields.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..3c34cdb121 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,89 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..dad981732c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-static-private-methods.js @@ -0,0 +1,76 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..7eb02935e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-gen-string-literal-names.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..5d0542ad1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-names.js @@ -0,0 +1,108 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..bd803f7d6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-computed-symbol-names.js @@ -0,0 +1,106 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..e9689afbe7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..d129d5b54d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names-asi.js @@ -0,0 +1,78 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..b398718e0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-literal-names.js @@ -0,0 +1,97 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..2f434e6efc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-field-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..7e77888543 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-getter-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..1080b726ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-method-usage.js @@ -0,0 +1,50 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..528d48315c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-private-names.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..3be1c3b0d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..18c7526633 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-field-identifier.js @@ -0,0 +1,95 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..08ae8e2531 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter-alt.js @@ -0,0 +1,129 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..cf1efe33f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-getter.js @@ -0,0 +1,129 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..879e0826da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..77833ee522 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-method.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..4e70395d0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..f31be2bbfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-private-setter.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..ecd76038ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..8b886724f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..21a0d1d4d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..399f11022a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..7c9f977ba5 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..00456077c7 --- /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,136 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..e582704b82 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..8a125575fe --- /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,136 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..0ae6b51ddc --- /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,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..1e744a920a --- /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,126 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..62711a2759 --- /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,123 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..e485228eff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,123 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..44e310fef3 --- /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,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..f8a867cf81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..8d0405da42 --- /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,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..3c32655b04 --- /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,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..42067f88a3 --- /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,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..b61e99539f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..7f16bf3771 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,111 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..5d525ecd2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-fields.js @@ -0,0 +1,72 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..311761f4c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods-with-fields.js @@ -0,0 +1,89 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..b86d241aff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-static-private-methods.js @@ -0,0 +1,76 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..3a780c2b71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/new-sc-line-method-string-literal-names.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..ea00382e50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWJ.js @@ -0,0 +1,80 @@ +// 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..da63e492b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-ZWNJ.js @@ -0,0 +1,80 @@ +// 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..ce91845729 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u2118.js @@ -0,0 +1,80 @@ +// 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..e34cde9544 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-escape-sequence-u6F.js @@ -0,0 +1,80 @@ +// 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..984890f647 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWJ.js @@ -0,0 +1,80 @@ +// 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..b8ffae141b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-ZWNJ.js @@ -0,0 +1,80 @@ +// 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..77aa15dba2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-common.js @@ -0,0 +1,80 @@ +// 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..addde8144d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-dollar.js @@ -0,0 +1,80 @@ +// 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..dee6e5e31e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-u2118.js @@ -0,0 +1,80 @@ +// 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..435a4c1dc5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/inst-private-name-underscore.js @@ -0,0 +1,80 @@ +// 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..4c9b23a907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWJ.js @@ -0,0 +1,80 @@ +// 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..39ae6e35e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-ZWNJ.js @@ -0,0 +1,80 @@ +// 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..718768b608 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u2118.js @@ -0,0 +1,80 @@ +// 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..5d476bbab2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-escape-sequence-u6F.js @@ -0,0 +1,80 @@ +// 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..c929640f29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWJ.js @@ -0,0 +1,80 @@ +// 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..b6f07d5aa4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-ZWNJ.js @@ -0,0 +1,80 @@ +// 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..8aa5a2c55e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-common.js @@ -0,0 +1,80 @@ +// 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..a80a10dd2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-dollar.js @@ -0,0 +1,80 @@ +// 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..dc1b2b10d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-u2118.js @@ -0,0 +1,80 @@ +// 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..245671042b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-accessor-name/static-private-name-underscore.js @@ -0,0 +1,80 @@ +// 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..d1d82b58ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..5e8b677e34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..3267d2066e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-async-generator-method-name.js @@ -0,0 +1,61 @@ +// 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..e015228345 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-async-method-name.js @@ -0,0 +1,61 @@ +// 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..8edf52fa00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..6f53a8d88a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..68aeabe77a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..401d9f416c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..56218b200a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..f7dcbc7327 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..f9677cbf04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..16b1906d5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..935635c223 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..30686fd95b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..672a337d8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..29c854c4da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..90eda76aec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-arrow-function.js @@ -0,0 +1,43 @@ +// 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..97b6081f82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-access-on-inner-function.js @@ -0,0 +1,44 @@ +// 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..a30f23fb67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-after-optional-chain.js @@ -0,0 +1,46 @@ +// 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..395263e4ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-arrow-function.js @@ -0,0 +1,35 @@ +// 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..f91ed215bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-arrow-function.js @@ -0,0 +1,37 @@ +// |reftest| async +// 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..37529243de --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-async-function.js @@ -0,0 +1,37 @@ +// |reftest| async +// 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..65c8e3da41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-as-function.js @@ -0,0 +1,35 @@ +// 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..d307e8b74d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-field-on-nested-class.js @@ -0,0 +1,47 @@ +// 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..0d5c5b62d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-fields-proxy-default-handler-throws.js @@ -0,0 +1,32 @@ +// 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..a9d0fcc434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-generator-method-name.js @@ -0,0 +1,61 @@ +// 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..3c30472961 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-arrow-function.js @@ -0,0 +1,43 @@ +// 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..222384f70d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-access-on-inner-function.js @@ -0,0 +1,44 @@ +// 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..07c93e8a68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-is-not-a-own-property.js @@ -0,0 +1,47 @@ +// 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..2422e47496 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-on-nested-class.js @@ -0,0 +1,38 @@ +// 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..c8cd3ffdd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-field-on-nested-class.js @@ -0,0 +1,46 @@ +// 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..4c1da59063 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,46 @@ +// 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..6d0dd6b812 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-method-on-nested-class.js @@ -0,0 +1,43 @@ +// 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..285821fb58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-getter-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,51 @@ +// 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..22965b2b41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-indirect-eval-contains-arguments.js @@ -0,0 +1,26 @@ +// 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..f835776d84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..1bf29fd4ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..44f61930da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..e327187300 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-arrow-function.js @@ -0,0 +1,43 @@ +// 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..47257c491b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-access-on-inner-function.js @@ -0,0 +1,44 @@ +// 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..f941693cad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-comparison.js @@ -0,0 +1,47 @@ +// 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..d7c2079be7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-get-and-call.js @@ -0,0 +1,49 @@ +// 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..24305b2efa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-is-not-a-own-property.js @@ -0,0 +1,45 @@ +// 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..7e433b2756 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-length.js @@ -0,0 +1,49 @@ +// 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..5b22a3f4fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-on-nested-class.js @@ -0,0 +1,38 @@ +// 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..cb9a0aa261 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-referenced-from-static-method.js @@ -0,0 +1,40 @@ +// 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..0ae9963eef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-field-on-nested-class.js @@ -0,0 +1,46 @@ +// 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..e35c3d056d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,49 @@ +// 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..9590c71524 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,51 @@ +// 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..c503eeaa3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-method-shadowed-on-nested-class.js @@ -0,0 +1,40 @@ +// 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..a7af985bbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-generator.js @@ -0,0 +1,135 @@ +// |reftest| async +// 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..8fd52c6c2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-async-method.js @@ -0,0 +1,130 @@ +// |reftest| async +// 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..0dc3c122d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-generator.js @@ -0,0 +1,127 @@ +// 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..71d6ac4a3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method-initialize-order.js @@ -0,0 +1,142 @@ +// 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..cd735bea4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-methods/prod-private-method.js @@ -0,0 +1,123 @@ +// 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..fd5bab9db1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-arrow-function.js @@ -0,0 +1,44 @@ +// 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..b62c896a4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-access-on-inner-function.js @@ -0,0 +1,45 @@ +// 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..3ec0eab9a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-is-not-a-own-property.js @@ -0,0 +1,48 @@ +// 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..08111943fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-on-nested-class.js @@ -0,0 +1,39 @@ +// 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..187b009b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-field-on-nested-class.js @@ -0,0 +1,53 @@ +// 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..7105e2d77c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,52 @@ +// 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..d261d4c492 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-method-on-nested-class.js @@ -0,0 +1,52 @@ +// 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..9e9bad52eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-setter-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,51 @@ +// 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..29ac94d614 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-async-generator-method-name.js @@ -0,0 +1,62 @@ +// 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..8e147e4933 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-async-method-name.js @@ -0,0 +1,62 @@ +// 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..70ca8ba444 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-field-on-nested-class.js @@ -0,0 +1,91 @@ +// 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..dd418effc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,92 @@ +// 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..45d1507a04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-method-on-nested-class.js @@ -0,0 +1,92 @@ +// 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..e6741b5096 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,93 @@ +// 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..74c749b205 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-field-usage-inside-nested-class.js @@ -0,0 +1,81 @@ +// 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..f87da5ed61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-generator-method-name.js @@ -0,0 +1,62 @@ +// 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..fee1b446bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-length.js @@ -0,0 +1,48 @@ +// 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..992817e19b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-name.js @@ -0,0 +1,73 @@ +// 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..e4ee3b42e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-field-on-nested-class.js @@ -0,0 +1,91 @@ +// 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..e685307c0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-getter-on-nested-class.js @@ -0,0 +1,92 @@ +// 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..19def12e06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-method-on-nested-class.js @@ -0,0 +1,92 @@ +// 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..a38ea9ec0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-shadowed-by-setter-on-nested-class.js @@ -0,0 +1,93 @@ +// 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..7176cf165a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-static-method-usage-inside-nested-class.js @@ -0,0 +1,83 @@ +// 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..b915d5d642 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..c870886354 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..02e7897948 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..fe334548e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/private-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-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..5be8ca5c80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-constructor.js @@ -0,0 +1,48 @@ +// 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..1aee1f7027 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-getter-before-super-return-in-field-initializer.js @@ -0,0 +1,46 @@ +// 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..f5cdc12f0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-constructor.js @@ -0,0 +1,48 @@ +// 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..cc9b9f1d68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-method-before-super-return-in-field-initializer.js @@ -0,0 +1,46 @@ +// 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..33d3f07f9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-constructor.js @@ -0,0 +1,48 @@ +// 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..3c22cd3b9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/prod-private-setter-before-super-return-in-field-initializer.js @@ -0,0 +1,46 @@ +// 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..944f4f516b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/redeclaration-symbol.js @@ -0,0 +1,63 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "y does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "y does not appear as an own property on C constructor" +); + +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..16252ed8b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/redeclaration.js @@ -0,0 +1,63 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y does not appear as an own property on C constructor" +); + +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..d3f11136b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-names.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..ce73456fa5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-computed-symbol-names.js @@ -0,0 +1,92 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..a23a92fc92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,95 @@ +// 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..9d23581ccb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names-asi.js @@ -0,0 +1,64 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..f6ac2b95be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names.js @@ -0,0 +1,83 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..dc7a64eec8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-field-usage.js @@ -0,0 +1,35 @@ +// 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..9f8ef72f44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-getter-usage.js @@ -0,0 +1,35 @@ +// 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..39be1bb56f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-method-usage.js @@ -0,0 +1,35 @@ +// 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..f46d867736 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-private-names.js @@ -0,0 +1,57 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..8ad7abfbfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter-alt.js @@ -0,0 +1,114 @@ +// 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..45d4a9f348 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-getter.js @@ -0,0 +1,114 @@ +// 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..f33a2ac1fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method-alt.js @@ -0,0 +1,113 @@ +// 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..7241b1b01d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-method.js @@ -0,0 +1,113 @@ +// 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..1bbc3c4d78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter-alt.js @@ -0,0 +1,113 @@ +// 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..882dc1bb16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-private-setter.js @@ -0,0 +1,113 @@ +// 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..ae719bc4c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-alt.js @@ -0,0 +1,95 @@ +// 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..13758efa11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,89 @@ +// 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..6724280fec --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier-initializer.js @@ -0,0 +1,89 @@ +// 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..7975f64952 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-privatename-identifier.js @@ -0,0 +1,95 @@ +// 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..2421a7d2db --- /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| async +// 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..081039674a --- /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| async +// 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..4135385ece --- /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| async +// 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..498212b253 --- /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| async +// 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..04fe5601df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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..0d9aa43ccd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,111 @@ +// 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..9e43861056 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,108 @@ +// 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..67b0c513fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-method-privatename-identifier.js @@ -0,0 +1,108 @@ +// 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..b1ed8b0e26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt-by-classname.js @@ -0,0 +1,96 @@ +// 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..b371efc656 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-alt.js @@ -0,0 +1,96 @@ +// 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..eca6cccce0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,96 @@ +// 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..01539a33dd --- /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,90 @@ +// 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..254d488901 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,90 @@ +// 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..c75c9daeea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,90 @@ +// 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..047f372bd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-rs-static-privatename-identifier.js @@ -0,0 +1,96 @@ +// 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..54705d929d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-fields.js @@ -0,0 +1,57 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..088cf25cd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods-with-fields.js @@ -0,0 +1,74 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..013a37475f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-definitions-static-private-methods.js @@ -0,0 +1,61 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..b31912d2e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/regular-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-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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..4906c6e0df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-names.js @@ -0,0 +1,120 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" + ); + + 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..2ac0e14231 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-computed-symbol-names.js @@ -0,0 +1,118 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" + ); + } + + 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..2d100c9cc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,122 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..aa944b8708 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names-asi.js @@ -0,0 +1,90 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + 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..4e881c4ec4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-literal-names.js @@ -0,0 +1,109 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" + ); + + 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..f57927115b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-field-usage.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..4f47a7cad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-getter-usage.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..a62f5195b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-method-usage.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..46ed1e5956 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-private-names.js @@ -0,0 +1,84 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..0c79f9abeb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier-initializer.js @@ -0,0 +1,100 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5b69a3868b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-field-identifier.js @@ -0,0 +1,107 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..534e834ab6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter-alt.js @@ -0,0 +1,141 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..d5823bb40b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-getter.js @@ -0,0 +1,141 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..998edfbb0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method-alt.js @@ -0,0 +1,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..6e62cd0029 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-method.js @@ -0,0 +1,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..7133ed9249 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter-alt.js @@ -0,0 +1,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..cc197bef58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-private-setter.js @@ -0,0 +1,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..e27507ea1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..f20dc121da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,116 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..12366fa718 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,116 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ce54c9e41b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-privatename-identifier.js @@ -0,0 +1,122 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..3d14a13072 --- /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,148 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..974462cf3f --- /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,149 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..a8991eecd2 --- /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,148 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..475a3480ab --- /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,149 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..c0a724a5fa --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ce286f3c9f --- /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,138 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..21f6de7543 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..bf3332a78d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..51975be248 --- /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,123 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..945b821a9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,123 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..764f5bd1d7 --- /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,123 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..f646ab6484 --- /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,117 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..0a80aed713 --- /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,117 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..2bc10ad56f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,117 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..d0d6c71146 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-rs-static-privatename-identifier.js @@ -0,0 +1,123 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5666f18381 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-fields.js @@ -0,0 +1,84 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..3c528312ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods-with-fields.js @@ -0,0 +1,101 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); + assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); + assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..412933c6a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-static-private-methods.js @@ -0,0 +1,88 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..67ba82343c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-gen-string-literal-names.js @@ -0,0 +1,122 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" + ); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" + ); + + 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..ec033fb4e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-names.js @@ -0,0 +1,119 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" + ); + + 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..277d374c92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-computed-symbol-names.js @@ -0,0 +1,117 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" + ); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" + ); + assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" + ); + } + + 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..d50aefe3f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..1fc9e01de7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names-asi.js @@ -0,0 +1,89 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + 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..a385c592a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-literal-names.js @@ -0,0 +1,108 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" + ); + + 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..55a1755662 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-field-usage.js @@ -0,0 +1,61 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..b97667936f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-getter-usage.js @@ -0,0 +1,61 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..82264063a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-method-usage.js @@ -0,0 +1,61 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..763444c560 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-private-names.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..be62bd1433 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier-initializer.js @@ -0,0 +1,99 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..bbe230964e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-field-identifier.js @@ -0,0 +1,106 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..67979cb64e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter-alt.js @@ -0,0 +1,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5d50b39e54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-getter.js @@ -0,0 +1,140 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..2dd36a8b7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method-alt.js @@ -0,0 +1,139 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..da4af1f152 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-method.js @@ -0,0 +1,139 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..108fa47573 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter-alt.js @@ -0,0 +1,139 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..7cdc52b139 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-private-setter.js @@ -0,0 +1,139 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..1e7081b352 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-alt.js @@ -0,0 +1,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..561da54683 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,115 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..3d69ae4be9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,115 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..a08dfc6949 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-privatename-identifier.js @@ -0,0 +1,121 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..aae6fa75a2 --- /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,147 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..7e36569bf9 --- /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,148 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..021435f839 --- /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,147 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..5e2785b2fe --- /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,148 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..994eb5a4d8 --- /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,136 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..86a9fcba39 --- /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,137 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..2b2a322abf --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..19a38a4723 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..b17a1f1fa0 --- /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,122 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..572825c0eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..75e1003a46 --- /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,122 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..770fc00d75 --- /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,116 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ed6152e631 --- /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,116 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..ca15b7216d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,116 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..327a92ac36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-rs-static-privatename-identifier.js @@ -0,0 +1,122 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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..270bcfdfd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-fields.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..0ece7a2e7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods-with-fields.js @@ -0,0 +1,100 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); + assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); + assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + + assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); + assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..0c40f448f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-static-private-methods.js @@ -0,0 +1,87 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); + assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); + assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + + assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); + assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); + assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..dbc9ddd287 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-async-method-string-literal-names.js @@ -0,0 +1,121 @@ +// |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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); +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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" + ); + + verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" + ); + + verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" + ); + + verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" + ); + assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" + ); + + 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..505ee57ef1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-names.js @@ -0,0 +1,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..c0514b435e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-computed-symbol-names.js @@ -0,0 +1,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..4eec1dc002 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..2ced1f2a3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names-asi.js @@ -0,0 +1,77 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..5c188a3424 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-literal-names.js @@ -0,0 +1,96 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..c48979d270 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-field-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..97229e27ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-getter-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..1fb15718ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-method-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..2adf1a4259 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-private-names.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..b8a658610b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier-initializer.js @@ -0,0 +1,87 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..3e4b04d54f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-field-identifier.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..0ae00bfa2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..c6d6193d04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-getter.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..7531e55145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..8dd575ec65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-method.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..822abac715 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..baa31196f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-private-setter.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..435d468b2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..6456b3a6fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..139d4b0db3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier-initializer.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..2c2da12ca3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-privatename-identifier.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..2fca316f72 --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..fa488d35ff --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..771b31a0ca --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..133f94a76e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..bc62f6125a --- /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,124 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..966d59cc70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..da401f652f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..39fddc3ca8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-method-privatename-identifier.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..f2096525d7 --- /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,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..b2e1b3cb78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..ee8dff4164 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..d2198dc372 --- /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,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..bbe8f2eb4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..6f9fc046a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..ca74e9bdb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-rs-static-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..1edff1e4db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-fields.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..ec5226b721 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..90882d6c68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-static-private-methods.js @@ -0,0 +1,75 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..f884246980 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-gen-string-literal-names.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..693ec20545 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-names.js @@ -0,0 +1,107 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..b1fc5657be --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-computed-symbol-names.js @@ -0,0 +1,105 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..c1198f645d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..c102852792 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names-asi.js @@ -0,0 +1,77 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..ec0fbadf3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-literal-names.js @@ -0,0 +1,96 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..db8a8fa945 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-field-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..7cbb6bdfbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-getter-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..df1c02e666 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-method-usage.js @@ -0,0 +1,49 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..5bb37c52f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-private-names.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..7762942137 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier-initializer.js @@ -0,0 +1,87 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..25157c800b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-field-identifier.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..b0b0cebcf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter-alt.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..f1327c5cd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-getter.js @@ -0,0 +1,128 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..5b4f76a664 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..6889fa9064 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-method.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..fe71360305 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter-alt.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..b270bcaec3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-private-setter.js @@ -0,0 +1,127 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..1d5bbb7f56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-alt.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..0e1295cd59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..512657752c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier-initializer.js @@ -0,0 +1,103 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..9494d5d32e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-privatename-identifier.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..891a512dee --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..3104f35c04 --- /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,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..cb1f017454 --- /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,134 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..bce016a35a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-async-method-privatename-identifier.js @@ -0,0 +1,135 @@ +// |reftest| async +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..19a5836aea --- /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,124 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..bc49c840ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,125 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..4bc5d2304e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..cff93deb37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-method-privatename-identifier.js @@ -0,0 +1,122 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..c0500f56df --- /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,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..3f9e70065f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..956e45f90c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..27e8892058 --- /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,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..5cb8e9016c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..d10387e6a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,104 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..af9366ea26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-rs-static-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +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..123913e246 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-fields.js @@ -0,0 +1,71 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private fields do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..d321144db3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,88 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..adce1e3c6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-static-private-methods.js @@ -0,0 +1,75 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +// Test the private methods do not appear as properties before set to value +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..51f6b01863 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/same-line-method-string-literal-names.js @@ -0,0 +1,109 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, "m"), + "m doesn't appear as an own property on the C instance" +); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +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..aad0b7fb88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-length.js @@ -0,0 +1,63 @@ +// 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..03c41ea274 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-anonymous-function-name.js @@ -0,0 +1,72 @@ +// 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..66d4e14e6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-field-declaration.js @@ -0,0 +1,132 @@ +// 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( + !Object.prototype.hasOwnProperty.call(c, 'f'), + "f does not appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(c, 'g'), + "g does not appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(c, 'h'), + "h does not appear as an own property on the C instance" +); +assert( + !Object.prototype.hasOwnProperty.call(c, 0), + "0 does not appear as an own property on the C instance" +); + +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..98804c5112 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-fields-proxy-default-handler-throws.js @@ -0,0 +1,30 @@ +// 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..48163c85a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-arrow-function.js @@ -0,0 +1,46 @@ +// 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..a7e255707c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-class.js @@ -0,0 +1,44 @@ +// 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..1b1777cfe9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter-access-on-inner-function.js @@ -0,0 +1,48 @@ +// 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..25978821f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-getter.js @@ -0,0 +1,57 @@ +// 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..17c826b759 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-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-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..496b781e99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-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-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..5bdd4b00b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-arrow-function.js @@ -0,0 +1,44 @@ +// 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..6d7294d36d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-access-on-inner-function.js @@ -0,0 +1,46 @@ +// 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..b43b02a11b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-and-instance-method-brand-check.js @@ -0,0 +1,66 @@ +// 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..8a67cd8e0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-referenced-from-instance-method.js @@ -0,0 +1,40 @@ +// 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..59709c19fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-method-subclass-receiver.js @@ -0,0 +1,39 @@ +// 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..b1add84534 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-methods-proxy-default-handler-throws.js @@ -0,0 +1,33 @@ +// 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..99ff6c1a22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-arrow-function.js @@ -0,0 +1,47 @@ +// 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..902991199d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-class.js @@ -0,0 +1,46 @@ +// 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..c9fae6a871 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter-access-on-inner-function.js @@ -0,0 +1,49 @@ +// 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..a53347934e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/static-private-setter.js @@ -0,0 +1,58 @@ +// 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/super-access-from-arrow-func-on-field.js b/js/src/tests/test262/language/expressions/class/elements/super-access-from-arrow-func-on-field.js new file mode 100644 index 0000000000..df472c3c64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/super-access-from-arrow-func-on-field.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/super-access-from-arrow-func-on-field.case +// - src/class-elements/default/cls-expr.template +/*--- +description: super inside arrow functions on field initializer resolves to class' super (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class-static-fields-public, class] +flags: [generated] +info: | + ClassElementName : + PropertyName + PrivateName + + SuperProperty: + super[Expression] + super.IdentifierName + +---*/ + + +var C = class { + func = () => { + super.prop = 'test262'; + } + + static staticFunc = () => { + super.staticProp = 'static test262'; + } +} + +let c = new C(); +c.func(); +assert.sameValue(c.prop, 'test262'); + +C.staticFunc(); +assert.sameValue(C.staticProp, 'static test262'); + + +reportCompare(0, 0); 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..b2512ecd2a --- /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| error:SyntaxError +// 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..798847cd9e --- /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| error:SyntaxError +// 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..c9b511f5b4 --- /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| error:SyntaxError +// 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..8508851470 --- /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| error:SyntaxError +// 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..e368898235 --- /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| error:SyntaxError +// 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..07d490312d --- /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| error:SyntaxError +// 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..7935befd05 --- /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| error:SyntaxError +// 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..7a9f632c7c --- /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| error:SyntaxError +// 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..a334ebe864 --- /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| error:SyntaxError +// 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..a356406272 --- /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| error:SyntaxError +// 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..ece01c0740 --- /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| error:SyntaxError +// 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..02e4fb26d1 --- /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| error:SyntaxError +// 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..fd998f6ac1 --- /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| error:SyntaxError +// 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..4f40fe2fb6 --- /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| error:SyntaxError +// 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..fad6f3fcea --- /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| error:SyntaxError +// 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..e51d679f5e --- /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| error:SyntaxError +// 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..13d3c2a740 --- /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| error:SyntaxError +// 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..dc8cc53146 --- /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| error:SyntaxError +// 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..cfd5642852 --- /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| error:SyntaxError +// 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..8d0017cd7a --- /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| error:SyntaxError +// 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..aeee377042 --- /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| error:SyntaxError +// 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..15b226efaa --- /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| error:SyntaxError +// 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..94d9388a28 --- /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| error:SyntaxError +// 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..1279184624 --- /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| error:SyntaxError +// 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..af609549ac --- /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| error:SyntaxError +// 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..c3788377dd --- /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| error:SyntaxError +// 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..9fb99b093c --- /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| error:SyntaxError +// 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..07027cffdf --- /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| error:SyntaxError +// 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..1fc96dc94d --- /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| error:SyntaxError +// 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..f343d70e52 --- /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| error:SyntaxError +// 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..f44b5e2eba --- /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| error:SyntaxError +// 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..3684a03b1c --- /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| error:SyntaxError +// 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..521df0882e --- /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| error:SyntaxError +// 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..676ddedde5 --- /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| error:SyntaxError +// 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..b22a41d94e --- /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| error:SyntaxError +// 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..78aa29f4ef --- /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| error:SyntaxError +// 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..6fde3047fb --- /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| error:SyntaxError +// 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..ae9e2773c2 --- /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| error:SyntaxError +// 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..a805848fb4 --- /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| error:SyntaxError +// 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..79757d74aa --- /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| error:SyntaxError +// 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..84eed95eb5 --- /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| error:SyntaxError +// 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..1406396b52 --- /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| error:SyntaxError +// 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..7a47defea3 --- /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| error:SyntaxError +// 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..e56fa55529 --- /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| error:SyntaxError +// 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..97a9234bbe --- /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| error:SyntaxError +// 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..3a05b6575a --- /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| error:SyntaxError +// 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..eb6130794f --- /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| error:SyntaxError +// 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..354e0c8746 --- /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| error:SyntaxError +// 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..1d59d48077 --- /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| error:SyntaxError +// 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..088f8034c8 --- /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| error:SyntaxError +// 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..f2537ac404 --- /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| error:SyntaxError +// 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..ece3271eac --- /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| error:SyntaxError +// 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..45748d6453 --- /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| error:SyntaxError +// 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..3268a64c8b --- /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| error:SyntaxError +// 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..b2bf807f91 --- /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| error:SyntaxError +// 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..ce67c08981 --- /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| error:SyntaxError +// 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..6a33ec513a --- /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| error:SyntaxError +// 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..8599c6db4b --- /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| error:SyntaxError +// 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..b51764253f --- /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| error:SyntaxError +// 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..ba8f5379aa --- /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| error:SyntaxError +// 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..6ab21db9ff --- /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| error:SyntaxError +// 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..4d5ed5fafd --- /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| error:SyntaxError +// 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..7dd3a6f614 --- /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| error:SyntaxError +// 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..e37573bb18 --- /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| error:SyntaxError +// 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..64782fb080 --- /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| error:SyntaxError +// 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..269fb608db --- /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| error:SyntaxError +// 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..664f377763 --- /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| error:SyntaxError +// 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..a98ceca0cd --- /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| error:SyntaxError +// 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..84833780fb --- /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| error:SyntaxError +// 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..835ed1fd44 --- /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| error:SyntaxError +// 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..a7376b9182 --- /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| error:SyntaxError +// 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..2c99382921 --- /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| error:SyntaxError +// 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..673f8a9150 --- /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| error:SyntaxError +// 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..bb0c6fe2a0 --- /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| error:SyntaxError +// 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..beace328f7 --- /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| error:SyntaxError +// 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..2c1bb28812 --- /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| error:SyntaxError +// 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..309a961850 --- /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| error:SyntaxError +// 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..ad7e8213a0 --- /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| error:SyntaxError +// 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..aac0c28dbf --- /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| error:SyntaxError +// 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..2bce7badb7 --- /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| error:SyntaxError +// 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..c775181794 --- /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| error:SyntaxError +// 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..1b5d682217 --- /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| error:SyntaxError +// 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..73e6d13717 --- /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| error:SyntaxError +// 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..ff22910b9f --- /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| error:SyntaxError +// 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..178c58cc17 --- /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| error:SyntaxError +// 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..804878eeae --- /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| error:SyntaxError +// 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..9879a56843 --- /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| error:SyntaxError +// 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..d5aaaf5cc9 --- /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| error:SyntaxError +// 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..13e1285307 --- /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| error:SyntaxError +// 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..05b109751a --- /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| error:SyntaxError +// 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..df019414c1 --- /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| error:SyntaxError +// 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..5571e89254 --- /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| error:SyntaxError +// 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..c776e1f41b --- /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| error:SyntaxError +// 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..d18c53884f --- /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| error:SyntaxError +// 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..fce05e88ba --- /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| error:SyntaxError +// 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..b7c06248fc --- /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| error:SyntaxError +// 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..1b8d6f8ca8 --- /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| error:SyntaxError +// 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..67f2881a6b --- /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| error:SyntaxError +// 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..78d3c79f4d --- /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| error:SyntaxError +// 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..570352da10 --- /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| error:SyntaxError +// 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..1e05ce0ee9 --- /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| error:SyntaxError +// 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..0595a11b49 --- /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| error:SyntaxError +// 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..36e44e5068 --- /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| error:SyntaxError +// 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..89e8c0f22a --- /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| error:SyntaxError +// 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..5e1f7f40af --- /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| error:SyntaxError +// 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..37b14b65bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-async.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// 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..33cb1fa13f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatemeth-duplicate-gen.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// 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..4a7d5fcc74 --- /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| error:SyntaxError +// 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..6532ab3fe4 --- /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| error:SyntaxError +// 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..3e45b92222 --- /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| error:SyntaxError +// 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..3e8d39fbf1 --- /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| error:SyntaxError +// 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..964f4b7995 --- /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| error:SyntaxError +// 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..f474ee6b7c --- /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| error:SyntaxError +// 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..a979dddd35 --- /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| error:SyntaxError +// 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..bca26607c5 --- /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| error:SyntaxError +// 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..d122f531ae --- /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| error:SyntaxError +// 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..63d3a13eaa --- /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| error:SyntaxError +// 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..cf1e2a3ee5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-constructor.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// 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..81043fa4dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-privatename-error.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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..dfd9d8e4a6 --- /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| error:SyntaxError +// 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..ea09d25bae --- /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| error:SyntaxError +// 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..fcb16ab416 --- /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| error:SyntaxError +// 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..da1b15e591 --- /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| error:SyntaxError +// 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..baf4ed6809 --- /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| error:SyntaxError +// 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..113af0007f --- /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| error:SyntaxError +// 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..7d2c9a6cd6 --- /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| error:SyntaxError +// 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..1e3fe1815c --- /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| error:SyntaxError +// 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..d0461d7a90 --- /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| error:SyntaxError +// 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..89fa995f50 --- /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| error:SyntaxError +// 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..df291aac7b --- /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| error:SyntaxError +// 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..57da2b2c3a --- /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| error:SyntaxError +// 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..9afdf95064 --- /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| error:SyntaxError +// 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..859d49c5dd --- /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| error:SyntaxError +// 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..13d9e1fdf8 --- /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| error:SyntaxError +// 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..38937b2f6f --- /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| error:SyntaxError +// 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..e351811145 --- /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| error:SyntaxError +// 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..f06dfe12c8 --- /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| error:SyntaxError +// 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..3a5104c1a3 --- /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| error:SyntaxError +// 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..90e18f3ca8 --- /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| error:SyntaxError +// 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..83dd76ba01 --- /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| error:SyntaxError +// 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..2187eacfc7 --- /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| error:SyntaxError +// 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..50afad12ed --- /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| error:SyntaxError +// 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..220d38438a --- /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| error:SyntaxError +// 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..a7c65a536b --- /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| error:SyntaxError +// 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..8b1df2d381 --- /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| error:SyntaxError +// 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..68e3af892a --- /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| error:SyntaxError +// 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..92f086b6a5 --- /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| error:SyntaxError +// 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..c1719b9215 --- /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| error:SyntaxError +// 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..b49bbf5cab --- /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| error:SyntaxError +// 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..832a75fa7d --- /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| error:SyntaxError +// 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..24c41d3c85 --- /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| error:SyntaxError +// 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..c6b35a444d --- /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| error:SyntaxError +// 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..32e9274eac --- /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| error:SyntaxError +// 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..fe96b06914 --- /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| error:SyntaxError +// 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..ef424f652f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/grammar-static-privatename-constructor.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// 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..082a9c2ea1 --- /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| error:SyntaxError +// 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..5ccb930ac6 --- /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| error:SyntaxError +// 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..adc3600857 --- /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| error:SyntaxError +// 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..f94e296d59 --- /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| error:SyntaxError +// 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..011e64fcaa --- /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| error:SyntaxError +// 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..1e94438481 --- /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| error:SyntaxError +// 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..cbb5478bea --- /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| error:SyntaxError +// 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..fc59fbf308 --- /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| error:SyntaxError +// 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..1ad9d43575 --- /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| error:SyntaxError +// 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..88584a739d --- /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| error:SyntaxError +// 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..9ae859e062 --- /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| error:SyntaxError +// 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..7c67f5b0e0 --- /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| error:SyntaxError +// 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..556abc11bb --- /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| error:SyntaxError +// 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..7f25a597cc --- /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| error:SyntaxError +// 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..3aac1ddd02 --- /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| error:SyntaxError +// 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..d99799a255 --- /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| error:SyntaxError +// 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..8486f6ce61 --- /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| error:SyntaxError +// 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..9242fe4448 --- /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| error:SyntaxError +// 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..c599da9b62 --- /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| error:SyntaxError +// 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..9e60290764 --- /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| error:SyntaxError +// 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..02cf2dca97 --- /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| error:SyntaxError +// 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..4879b83507 --- /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| error:SyntaxError +// 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..2ec080e169 --- /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| error:SyntaxError +// 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..13ac14d96e --- /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| error:SyntaxError +// 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..3dd3255370 --- /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| error:SyntaxError +// 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..13f1d684be --- /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| error:SyntaxError +// 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..99c238f82c --- /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| error:SyntaxError +// 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..bf3969eada --- /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| error:SyntaxError +// 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..4bbf633a8f --- /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| error:SyntaxError +// 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..d84f14a988 --- /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| error:SyntaxError +// 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..bad61fd517 --- /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| error:SyntaxError +// 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..9b9b745db7 --- /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| error:SyntaxError +// 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..30b26920ea --- /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| error:SyntaxError +// 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..8e4e6d321d --- /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| error:SyntaxError +// 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..bfd4b3bcbd --- /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| error:SyntaxError +// 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..9c3a577979 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/early-errors/super-private-access-invalid.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// 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-accessor.js b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-accessor.js new file mode 100644 index 0000000000..88781cea5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-field-accessor.js @@ -0,0 +1,27 @@ +// |reftest| skip-if(!(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('decorators'))) -- decorators is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/class-elements/grammar-field-accessor.case +// - src/class-elements/syntax/valid/cls-expr-elements-valid-syntax.template +/*--- +description: Valid accessor FieldDefinition, ClassElementName, PropertyName Syntax (class expression) +esid: prod-ClassElement +features: [decorators, class] +flags: [generated] +info: | + FieldDefinition[Yield, Await] : + ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt + accessor [no LineTerminator here] ClassElementName[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt + +---*/ + + +var C = class { + accessor $; + accessor _; + accessor \u{6F}; + accessor \u2118; + accessor ZW_\u200C_NJ; + accessor ZW_\u200D_J; +}; + +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..586be0b345 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-get-set.js @@ -0,0 +1,23 @@ +// 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..87191f4f91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatemeth-duplicate-meth-nestedclassmeth.js @@ -0,0 +1,28 @@ +// 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..d62420cadf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer-alt.js @@ -0,0 +1,69 @@ +// 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..590f8b3cfa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-classelementname-initializer.js @@ -0,0 +1,69 @@ +// 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..380dbe7f97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-identifier.js @@ -0,0 +1,66 @@ +// 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..d5a422aa4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatename-no-initializer-with-method.js @@ -0,0 +1,34 @@ +// 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..7f2f654bc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-privatenames-multi-line.js @@ -0,0 +1,34 @@ +// 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..a0cc8261ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-gen-meth-prototype.js @@ -0,0 +1,22 @@ +// 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..d7be0ccaaa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-async-meth-prototype.js @@ -0,0 +1,22 @@ +// 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..ae0b509dcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-gen-meth-prototype.js @@ -0,0 +1,22 @@ +// 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..a2b8e5950f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/syntax/valid/grammar-static-private-meth-prototype.js @@ -0,0 +1,22 @@ +// 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..d0e4c477cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-names.js @@ -0,0 +1,96 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "10"), + "10 doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "10"), + "10 doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"), + "'not initialized' doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "not initialized"), + "'not initialized' doesn't appear as an own property on C constructor" +); + +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..5e24abd937 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-symbol-names.js @@ -0,0 +1,94 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, x), + "Symbol x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, x), + "Symbol x doesn't appear as an own property on C constructor" +); + +verifyProperty(c, x, { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, y), + "Symbol y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, y), + "Symbol y doesn't appear as an own property on C constructor" +); + +verifyProperty(c, y, { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "x"), + "x doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "x"), + "x doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "x"), + "x doesn't appear as an own property on C instance" +); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "y"), + "y doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "y"), + "y doesn't appear as an own property on C constructor" +); +assert( + !Object.prototype.hasOwnProperty.call(c, "y"), + "y doesn't appear as an own property on C instance" +); + +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..d69373afbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-grammar-privatename-identifier-semantics-stringvalue.js @@ -0,0 +1,97 @@ +// 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..b42c272051 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names-asi.js @@ -0,0 +1,66 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +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..3469c35032 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-literal-names.js @@ -0,0 +1,85 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b doesn't appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c doesn't appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c doesn't appear as an own property on C constructor" +); + +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..32b81e5029 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-field-usage.js @@ -0,0 +1,37 @@ +// 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..2d672155f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-getter-usage.js @@ -0,0 +1,37 @@ +// 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..0f32fbc36f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-method-usage.js @@ -0,0 +1,37 @@ +// 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..0405b6a1b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-private-names.js @@ -0,0 +1,59 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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..4c1ad59991 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter-alt.js @@ -0,0 +1,116 @@ +// 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..c465fe8398 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-getter.js @@ -0,0 +1,116 @@ +// 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..d2c1811fbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method-alt.js @@ -0,0 +1,115 @@ +// 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..4498bc2dd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-method.js @@ -0,0 +1,115 @@ +// 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..e7c974356d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter-alt.js @@ -0,0 +1,115 @@ +// 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..e0893a60d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-private-setter.js @@ -0,0 +1,115 @@ +// 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..c92f4f1cd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-alt.js @@ -0,0 +1,97 @@ +// 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..d73a679729 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer-alt.js @@ -0,0 +1,91 @@ +// 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..20a85b1d7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier-initializer.js @@ -0,0 +1,91 @@ +// 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..bde1fcb3fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-privatename-identifier.js @@ -0,0 +1,97 @@ +// 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..bb8d173798 --- /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| async +// 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..423d092078 --- /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| async +// 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..5d51d9379d --- /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| async +// 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..73f8d2af38 --- /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| async +// 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..00277af4c1 --- /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,112 @@ +// 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..b3edf7eb1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-generator-method-privatename-identifier.js @@ -0,0 +1,113 @@ +// 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..f18d719ea5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier-alt.js @@ -0,0 +1,110 @@ +// 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..b1139230fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-method-privatename-identifier.js @@ -0,0 +1,110 @@ +// 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..86e146f07f --- /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,98 @@ +// 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..36fac631fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-alt.js @@ -0,0 +1,98 @@ +// 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..939dd0733b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-by-classname.js @@ -0,0 +1,98 @@ +// 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..f7b238395f --- /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,92 @@ +// 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..74e4c24154 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer-alt.js @@ -0,0 +1,92 @@ +// 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..5346b0c288 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier-initializer.js @@ -0,0 +1,92 @@ +// 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..9df938406a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-rs-static-privatename-identifier.js @@ -0,0 +1,98 @@ +// 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..074de4187c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-fields.js @@ -0,0 +1,59 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..f73085ecbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods-with-fields.js @@ -0,0 +1,76 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "test 6"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#xVal"), "test 7"); +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 8"); +assert(!Object.prototype.hasOwnProperty.call(c, "#xVal"), "test 9"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#yVal"), "test 10"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "test 11"); +assert(!Object.prototype.hasOwnProperty.call(c, "#yVal"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 15"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 16"); + +assert(!Object.prototype.hasOwnProperty.call(C, "#xVal"), "test 17"); +assert(!Object.prototype.hasOwnProperty.call(C, "#yVal"), "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..1100c5ef9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-static-private-methods.js @@ -0,0 +1,63 @@ +// 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(!Object.prototype.hasOwnProperty.call(C.prototype, "#x"), "test 1"); +assert(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 2"); +assert(!Object.prototype.hasOwnProperty.call(c, "#x"), "test 3"); + +assert(!Object.prototype.hasOwnProperty.call(C.prototype, "#y"), "test 4"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "test 5"); +assert(!Object.prototype.hasOwnProperty.call(c, "#y"), "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(!Object.prototype.hasOwnProperty.call(C, "#x"), "test 9"); +assert(!Object.prototype.hasOwnProperty.call(C, "#y"), "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..3e4d326660 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-string-literal-names.js @@ -0,0 +1,98 @@ +// 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( + !Object.prototype.hasOwnProperty.call(C.prototype, "a"), + "a does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "a"), + "a does not appear as an own property on C constructor" +); + +verifyProperty(c, "a", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "b"), + "b does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "b"), + "b does not appear as an own property on C constructor" +); + +verifyProperty(c, "b", { + value: undefined, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "c"), + "c does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "c"), + "c does not appear as an own property on C constructor" +); + +verifyProperty(c, "c", { + value: 39, + enumerable: true, + writable: true, + configurable: true +}); + +assert( + !Object.prototype.hasOwnProperty.call(C.prototype, "d"), + "d does not appear as an own property on C prototype" +); +assert( + !Object.prototype.hasOwnProperty.call(C, "d"), + "d does not appear as an own property on C constructor" +); + +verifyProperty(c, "d", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-length-dflt.js b/js/src/tests/test262/language/expressions/class/gen-method-length-dflt.js new file mode 100644 index 0000000000..7f07768eb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-length-dflt.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [generators, default-parameters] +includes: [propertyHelper.js] +---*/ + +var m1 = class { *m(x = 42) {} }.prototype.m; + +verifyProperty(m1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var m2 = class { *m(x = 42, y) {} }.prototype.m; + +verifyProperty(m2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var m3 = class { *m(x, y = 42) {} }.prototype.m; + +verifyProperty(m3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var m4 = class { *m(x, y = 42, z) {} }.prototype.m; + +verifyProperty(m4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-param-dflt-yield.js b/js/src/tests/test262/language/expressions/class/gen-method-param-dflt-yield.js new file mode 100644 index 0000000000..bb12e23c1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-param-dflt-yield.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorMethod[Yield]: + + * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [generators, default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, class { + *g(x = yield) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/gen-method-static/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..f92a3e37fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/array-destructuring-param-strict-body.js @@ -0,0 +1,159 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-gen-meth-static.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static *method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/browser.js b/js/src/tests/test262/language/expressions/class/gen-method-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-abrupt.js new file mode 100644 index 0000000000..4920fb93fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-abrupt.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-gen-meth-static.template +/*--- +description: Abrupt completion returned by evaluation of initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var C = class { + static *method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..58c92ec7d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,114 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-gen-meth-static.template +/*--- +description: Use of initializer when argument value is not `undefined` (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + static *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +C.method(false, '', NaN, 0, null, obj).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..d40b9205ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-arg-val-undefined.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-gen-meth-static.template +/*--- +description: Use of initializer when argument value is `undefined` (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + static *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +C.method(undefined, void 0).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-duplicates.js new file mode 100644 index 0000000000..4ae1049c88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-duplicates.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-gen-meth-static.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, class { + static *method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-later.js new file mode 100644 index 0000000000..d6b9d37d38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-later.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-gen-meth-static.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static *method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-prior.js new file mode 100644 index 0000000000..da088d30c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-prior.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-gen-meth-static.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static *method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +C.method(3).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-self.js new file mode 100644 index 0000000000..8e52c13f3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-ref-self.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-gen-meth-static.template +/*--- +description: Referencing a parameter from within its own initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static *method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-rest.js new file mode 100644 index 0000000000..241ec823c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-rest.js @@ -0,0 +1,92 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-gen-meth-static.template +/*--- +description: RestParameter does not support an initializer (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, class { + static *method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..0bce321b61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/dflt-params-trailing-comma.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..787b16d07c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template +/*--- +description: Forbidden extension, f.arguments (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + static *method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..0ddc30e4bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/cls-expr-gen-meth-static-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + static *method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..0a263e7d9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..2c65574487 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..f930b3f44b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/cls-expr-gen-meth-static-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/gen-method-static/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/gen-method-static/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..cc25805825 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/object-destructuring-param-strict-body.js @@ -0,0 +1,159 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-gen-meth-static.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static *method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..50648217fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-multiple.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-single.js new file mode 100644 index 0000000000..b7ee7161d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/params-trailing-comma-single.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/gen-method-static/rest-param-strict-body.js new file mode 100644 index 0000000000..d0e1cfb607 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/rest-param-strict-body.js @@ -0,0 +1,159 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-gen-meth-static.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static *method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/gen-method-static/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..886341148c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/rest-params-trailing-comma-early-error.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-gen-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, class { + static *method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/shell.js b/js/src/tests/test262/language/expressions/class/gen-method-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..7af8d9d38f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-binding-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier-escaped.case +// - src/generators/syntax/class-expr-static-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/gen-method-static/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-binding-identifier.js new file mode 100644 index 0000000000..71b7e09c83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-binding-identifier.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier.case +// - src/generators/syntax/class-expr-static-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/gen-method-static/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..892dd7c9f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-identifier-reference-escaped.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference-escaped.case +// - src/generators/syntax/class-expr-static-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/gen-method-static/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-identifier-reference.js new file mode 100644 index 0000000000..6172877ff1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-identifier-reference.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference.case +// - src/generators/syntax/class-expr-static-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/gen-method-static/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..c8cd084b3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-label-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier-escaped.case +// - src/generators/syntax/class-expr-static-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/gen-method-static/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-label-identifier.js new file mode 100644 index 0000000000..b7d8adb96b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-as-label-identifier.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier.case +// - src/generators/syntax/class-expr-static-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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/gen-method-static/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..fb3d06afe3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-identifier-spread-strict-strict.js @@ -0,0 +1,54 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/class-expr-static-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 method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [object-spread, generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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(); + }()), + } +}} + +var gen = C.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..781945f8dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-identifier-strict-strict.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/class-expr-static-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 method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + static MethodDefinition + + 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(); + }()) +}} + +var gen = C.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..52aa870694 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-multiple.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/class-expr-static-method.template +/*--- +description: Use yield value in a array spread position (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +includes: [compareArray.js] +info: | + ClassElement : + static MethodDefinition + + 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]; +}} + +var gen = C.gen; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-single.js new file mode 100644 index 0000000000..e39b1b257e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-arr-single.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/class-expr-static-method.template +/*--- +description: Use yield value in a array spread position (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +info: | + ClassElement : + static MethodDefinition + + 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]; +}} + +var gen = C.gen; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-obj.js new file mode 100644 index 0000000000..59efdcb5f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method-static/yield-spread-obj.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/class-expr-static-method.template +/*--- +description: Use yield value in a object spread position (Static generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [object-spread, generators] +flags: [generated] +info: | + ClassElement : + static MethodDefinition + + 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, + }; +}} + +var gen = C.gen; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/gen-method/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..382571774f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/array-destructuring-param-strict-body.js @@ -0,0 +1,159 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-gen-meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + *method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method/browser.js b/js/src/tests/test262/language/expressions/class/gen-method/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-abrupt.js new file mode 100644 index 0000000000..7ae11fb838 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-abrupt.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-gen-meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var C = class { + *method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..671666e723 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,114 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-gen-meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +C.prototype.method(false, '', NaN, 0, null, obj).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..601bc232b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-arg-val-undefined.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-gen-meth.template +/*--- +description: Use of initializer when argument value is `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +C.prototype.method(undefined, void 0).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-duplicates.js new file mode 100644 index 0000000000..4dfd12d4b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-duplicates.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-gen-meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, class { + *method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-later.js new file mode 100644 index 0000000000..9bfbf71abc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-later.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-gen-meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + *method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-prior.js new file mode 100644 index 0000000000..69cca8620b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-prior.js @@ -0,0 +1,94 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-gen-meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + *method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +C.prototype.method(3).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-self.js new file mode 100644 index 0000000000..daa861f73d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-ref-self.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-gen-meth.template +/*--- +description: Referencing a parameter from within its own initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + *method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-rest.js new file mode 100644 index 0000000000..c5b333e3df --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-rest.js @@ -0,0 +1,92 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-gen-meth.template +/*--- +description: RestParameter does not support an initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, class { + *method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..4c9c625f8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/dflt-params-trailing-comma.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..d760fdd8b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template +/*--- +description: Forbidden extension, f.arguments (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + *method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.prototype.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..42381b9c8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/cls-expr-gen-meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + *method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.prototype.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..6f347e6def --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.prototype.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..b59a856eb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.prototype.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..94bd5da396 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/cls-expr-gen-meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class, generators] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + *method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.prototype.method().next(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/gen-method/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/gen-method/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..0839174212 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/object-destructuring-param-strict-body.js @@ -0,0 +1,159 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-gen-meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + *method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..c204e8597f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-multiple.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-single.js new file mode 100644 index 0000000000..3bd2c86926 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/params-trailing-comma-single.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/gen-method/rest-param-strict-body.js new file mode 100644 index 0000000000..969ed39077 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/rest-param-strict-body.js @@ -0,0 +1,159 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-gen-meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + *method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/gen-method/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..90fed21dfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/rest-params-trailing-comma-early-error.js @@ -0,0 +1,85 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-gen-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, class { + *method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/gen-method/shell.js b/js/src/tests/test262/language/expressions/class/gen-method/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/gen-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..b23ff6b26a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-binding-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier-escaped.case +// - src/generators/syntax/class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/gen-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-binding-identifier.js new file mode 100644 index 0000000000..1c1f7fb97f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-binding-identifier.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier.case +// - src/generators/syntax/class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/gen-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..a300a44742 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-identifier-reference-escaped.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference-escaped.case +// - src/generators/syntax/class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/gen-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-identifier-reference.js new file mode 100644 index 0000000000..117f7ac3a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-identifier-reference.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference.case +// - src/generators/syntax/class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/gen-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..8ec9ddf683 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-label-identifier-escaped.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier-escaped.case +// - src/generators/syntax/class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/gen-method/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-label-identifier.js new file mode 100644 index 0000000000..aeb8c22d37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-as-label-identifier.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier.case +// - src/generators/syntax/class-expr-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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/gen-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..d726b13afa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-identifier-spread-strict-strict.js @@ -0,0 +1,54 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/class-expr-method.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [object-spread, generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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(); + }()), + } +}} + +var gen = C.prototype.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..577563a951 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-identifier-strict-strict.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/class-expr-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 method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + ClassElement : + MethodDefinition + + 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(); + }()) +}} + +var gen = C.prototype.gen; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..6e1fa9a34e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-multiple.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/class-expr-method.template +/*--- +description: Use yield value in a array spread position (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +includes: [compareArray.js] +info: | + ClassElement : + MethodDefinition + + 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]; +}} + +var gen = C.prototype.gen; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-single.js new file mode 100644 index 0000000000..3a34a9245c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-arr-single.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/class-expr-method.template +/*--- +description: Use yield value in a array spread position (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +info: | + ClassElement : + MethodDefinition + + 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]; +}} + +var gen = C.prototype.gen; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-obj.js b/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-obj.js new file mode 100644 index 0000000000..930e769b68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/gen-method/yield-spread-obj.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/class-expr-method.template +/*--- +description: Use yield value in a object spread position (Generator method as a ClassExpression element) +esid: prod-GeneratorMethod +features: [object-spread, generators] +flags: [generated] +info: | + ClassElement : + MethodDefinition + + 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, + }; +}} + +var gen = C.prototype.gen; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/getter-param-dflt.js b/js/src/tests/test262/language/expressions/class/getter-param-dflt.js new file mode 100644 index 0000000000..2e326ff1da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/getter-param-dflt.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + Get accessor method may not have a formal parameter (regardless of the + presence of an initializer) +info: | + Syntax + + MethodDefinition[Yield] : + + get PropertyName[?Yield] ( ) { FunctionBody } +features: [default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, class { get a(param = null) {} }; diff --git a/js/src/tests/test262/language/expressions/class/heritage-arrow-function.js b/js/src/tests/test262/language/expressions/class/heritage-arrow-function.js new file mode 100644 index 0000000000..90ccbfcd32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/heritage-arrow-function.js @@ -0,0 +1,33 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + Throw a TypeError exception if IsConstructor(superclass) is false (async arrow) +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + + 5. Else, + Set the running execution context's LexicalEnvironment to classScope. + Let superclassRef be the result of evaluating ClassHeritage. + Set the running execution context's LexicalEnvironment to env. + Let superclass be ? GetValue(superclassRef). + If superclass is null, then + Let protoParent be null. + Let constructorParent be %Function.prototype%. + Else if IsConstructor(superclass) is false, throw a TypeError exception. + ... +features: [class] +---*/ + + +assert.throws(TypeError, () => { + var C = class extends (async () => {}) {}; +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/heritage-async-arrow-function.js b/js/src/tests/test262/language/expressions/class/heritage-async-arrow-function.js new file mode 100644 index 0000000000..90ccbfcd32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/heritage-async-arrow-function.js @@ -0,0 +1,33 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + Throw a TypeError exception if IsConstructor(superclass) is false (async arrow) +info: | + Runtime Semantics: ClassDefinitionEvaluation + + ClassTail : ClassHeritage { ClassBody } + ... + + 5. Else, + Set the running execution context's LexicalEnvironment to classScope. + Let superclassRef be the result of evaluating ClassHeritage. + Set the running execution context's LexicalEnvironment to env. + Let superclass be ? GetValue(superclassRef). + If superclass is null, then + Let protoParent be null. + Let constructorParent be %Function.prototype%. + Else if IsConstructor(superclass) is false, throw a TypeError exception. + ... +features: [class] +---*/ + + +assert.throws(TypeError, () => { + var C = class extends (async () => {}) {}; +}); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-break-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-break-escaped.js new file mode 100644 index 0000000000..7728b37d15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-break-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: break is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + bre\u0061k() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['break'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-case-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-case-escaped.js new file mode 100644 index 0000000000..644f2679b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-case-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: case is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + c\u0061se() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['case'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-catch-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-catch-escaped.js new file mode 100644 index 0000000000..39b79bc09b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-catch-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: catch is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + c\u0061tch() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['catch'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-class-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-class-escaped.js new file mode 100644 index 0000000000..8a56065f2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-class-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: class is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + cl\u0061ss() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['class'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-const-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-const-escaped.js new file mode 100644 index 0000000000..b84f6e0c88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-const-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: const is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0063onst() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['const'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-continue-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-continue-escaped.js new file mode 100644 index 0000000000..8318aee3da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-continue-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: continue is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0063ontinue() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['continue'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-debugger-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-debugger-escaped.js new file mode 100644 index 0000000000..a9093c0002 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-debugger-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: debugger is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0064ebugger() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['debugger'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped-ext.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped-ext.js new file mode 100644 index 0000000000..8b72c1da35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped-ext.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: default is a valid identifier name, using extended escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + def\u{61}ult() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['default'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped.js new file mode 100644 index 0000000000..5a83da04bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-default-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: default is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + def\u0061ult() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['default'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-default.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-default.js new file mode 100644 index 0000000000..6056a90035 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-default.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: default is a valid identifier name (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + default() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['default'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-delete-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-delete-escaped.js new file mode 100644 index 0000000000..d2d91de474 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-delete-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: delete is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0064elete() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['delete'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-do-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-do-escaped.js new file mode 100644 index 0000000000..beea4119cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-do-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: do is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0064o() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['do'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-else-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-else-escaped.js new file mode 100644 index 0000000000..cc19d59c19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-else-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: else is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0065lse() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['else'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-enum-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-enum-escaped.js new file mode 100644 index 0000000000..aed0920e94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-enum-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: enum is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0065num() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['enum'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-export-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-export-escaped.js new file mode 100644 index 0000000000..5098b47cab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-export-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: export is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0065xport() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['export'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped-ext.js new file mode 100644 index 0000000000..004091cc86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped-ext.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: extends is a valid identifier name, using extended escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u{65}xtends() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['extends'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped.js new file mode 100644 index 0000000000..7e5d5b6e21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: extends is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0065xtends() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['extends'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends.js new file mode 100644 index 0000000000..67f742372f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-extends.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: extends is a valid identifier name (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + extends() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['extends'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-finally-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-finally-escaped.js new file mode 100644 index 0000000000..22db29bb33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-finally-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: finally is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0066inally() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['finally'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-for-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-for-escaped.js new file mode 100644 index 0000000000..b1e6dccedd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-for-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: for is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0066or() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['for'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-function-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-function-escaped.js new file mode 100644 index 0000000000..0aa78f81c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-function-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: function is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0066unction() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['function'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-if-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-if-escaped.js new file mode 100644 index 0000000000..469cbcfbc1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-if-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: if is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + i\u0066() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['if'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-implements-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-implements-escaped.js new file mode 100644 index 0000000000..e8164d219b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-implements-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: implements is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0069mplements() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['implements'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-import-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-import-escaped.js new file mode 100644 index 0000000000..b209229540 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-import-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: import is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0069mport() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['import'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-in-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-in-escaped.js new file mode 100644 index 0000000000..d51e478c97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-in-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: in is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0069n() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['in'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-instanceof-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-instanceof-escaped.js new file mode 100644 index 0000000000..4fd101347d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-instanceof-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: instanceof is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + \u0069nstanceof() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['instanceof'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-interface-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-interface-escaped.js new file mode 100644 index 0000000000..094fa28e09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-interface-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: interface is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + interf\u0061ce() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['interface'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-let-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-let-escaped.js new file mode 100644 index 0000000000..0b72d9c34c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-let-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: let is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + l\u0065t() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['let'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-new-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-new-escaped.js new file mode 100644 index 0000000000..1105a76a56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-new-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: new is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + n\u0065w() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['new'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-package-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-package-escaped.js new file mode 100644 index 0000000000..a746588bcf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-package-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: package is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + p\u0061ckage() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['package'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-private-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-private-escaped.js new file mode 100644 index 0000000000..926ee4f6d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-private-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: private is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + privat\u0065() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['private'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-protected-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-protected-escaped.js new file mode 100644 index 0000000000..9b1a7b7717 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-protected-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: protected is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + prot\u0065cted() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['protected'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-public-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-public-escaped.js new file mode 100644 index 0000000000..8d6d35974f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-public-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: public is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + pu\u0062lic() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['public'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-return-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-return-escaped.js new file mode 100644 index 0000000000..9634da4360 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-return-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: return is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + r\u0065turn() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['return'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-static-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-static-escaped.js new file mode 100644 index 0000000000..f91a09c7e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-static-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/class-expression-method-def.template +/*--- +description: static is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + st\u0061tic() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['static'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-super-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-super-escaped.js new file mode 100644 index 0000000000..a9151506cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-super-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: super is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + sup\u0065r() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['super'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-switch-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-switch-escaped.js new file mode 100644 index 0000000000..990e87849f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-switch-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: switch is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + sw\u0069tch() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['switch'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-this-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-this-escaped.js new file mode 100644 index 0000000000..962dee47fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-this-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: this is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + th\u0069s() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['this'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-throw-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-throw-escaped.js new file mode 100644 index 0000000000..cd041e5e46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-throw-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: throw is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + t\u0068row() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['throw'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-try-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-try-escaped.js new file mode 100644 index 0000000000..a0f8572092 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-try-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: try is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + tr\u0079() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['try'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-typeof-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-typeof-escaped.js new file mode 100644 index 0000000000..0e4033d6cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-typeof-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: typeof is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + typ\u0065of() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['typeof'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-var-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-var-escaped.js new file mode 100644 index 0000000000..23214d39e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-var-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: var is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + v\u0061r() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['var'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-void-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-void-escaped.js new file mode 100644 index 0000000000..40bd00fda1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-void-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: void is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + voi\u0064() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['void'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-while-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-while-escaped.js new file mode 100644 index 0000000000..7d2b5674d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-while-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: while is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + whil\u0065() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['while'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/ident-name-method-def-with-escaped.js b/js/src/tests/test262/language/expressions/class/ident-name-method-def-with-escaped.js new file mode 100644 index 0000000000..6726825307 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/ident-name-method-def-with-escaped.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/class-expression-method-def.template +/*--- +description: with is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +features: [class] +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. + +---*/ + + +var C = class { + w\u0069th() { return 42; } +} + +var obj = new C(); + +assert.sameValue(obj['with'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-length-dflt.js b/js/src/tests/test262/language/expressions/class/method-length-dflt.js new file mode 100644 index 0000000000..46e601d767 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-length-dflt.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [default-parameters] +includes: [propertyHelper.js] +---*/ + +var m1 = class { m(x = 42) {} }.prototype.m; + +verifyProperty(m1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var m2 = class { m(x = 42, y) {} }.prototype.m; + +verifyProperty(m2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var m3 = class { m(x, y = 42) {} }.prototype.m; + +verifyProperty(m3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var m4 = class { m(x, y = 42, z) {} }.prototype.m; + +verifyProperty(m4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-param-dflt-yield.js b/js/src/tests/test262/language/expressions/class/method-param-dflt-yield.js new file mode 100644 index 0000000000..340cb13359 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-param-dflt-yield.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + YieldExpression cannot be used within the FormalParameters of a class method +info: | + MethodDefinition[Yield] : + + PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } +features: [generators, default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, class { + m(x = yield) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/method-static/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/method-static/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..4ffadd8f72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/array-destructuring-param-strict-body.js @@ -0,0 +1,155 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-meth-static.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method-static/browser.js b/js/src/tests/test262/language/expressions/class/method-static/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-abrupt.js new file mode 100644 index 0000000000..83b885004f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-abrupt.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-meth-static.template +/*--- +description: Abrupt completion returned by evaluation of initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var C = class { + static method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..eaae45c604 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,110 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-meth-static.template +/*--- +description: Use of initializer when argument value is not `undefined` (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + static method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +C.method(false, '', NaN, 0, null, obj); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..6655922c05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-arg-val-undefined.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-meth-static.template +/*--- +description: Use of initializer when argument value is `undefined` (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + static method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +C.method(undefined, void 0); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-duplicates.js new file mode 100644 index 0000000000..226d11a9d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-duplicates.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-meth-static.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, class { + static method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-later.js new file mode 100644 index 0000000000..5ed2b1b54b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-later.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-meth-static.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-prior.js new file mode 100644 index 0000000000..eef892c675 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-prior.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-meth-static.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +C.method(3); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-self.js new file mode 100644 index 0000000000..95c4bbb6d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-ref-self.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-meth-static.template +/*--- +description: Referencing a parameter from within its own initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + static method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-rest.js new file mode 100644 index 0000000000..b9186cf9b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-rest.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-meth-static.template +/*--- +description: RestParameter does not support an initializer (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, class { + static method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method-static/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..c6252c43c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/dflt-params-trailing-comma.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..b7d5acf676 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template +/*--- +description: Forbidden extension, f.arguments (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + static method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..e748b6eae9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/cls-expr-meth-static-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + static method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..798184cc95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..616e9b95c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..5e95123c09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/cls-expr-meth-static-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template +/*--- +description: Forbidden extension, o.caller (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + static method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/method-static/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method-static/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/method-static/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..1dacd75052 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/object-destructuring-param-strict-body.js @@ -0,0 +1,155 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-meth-static.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..bf0285a7ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-multiple.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-single.js new file mode 100644 index 0000000000..0ff6e03bdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/params-trailing-comma-single.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method-static/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/method-static/rest-param-strict-body.js new file mode 100644 index 0000000000..d681225e1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/rest-param-strict-body.js @@ -0,0 +1,155 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-meth-static.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + static method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method-static/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/method-static/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..21e13b2db6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method-static/rest-params-trailing-comma-early-error.js @@ -0,0 +1,80 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, class { + static method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method-static/shell.js b/js/src/tests/test262/language/expressions/class/method-static/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/method/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..69a5f04560 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/array-destructuring-param-strict-body.js @@ -0,0 +1,155 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method/browser.js b/js/src/tests/test262/language/expressions/class/method/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-abrupt.js new file mode 100644 index 0000000000..80ef17afa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-abrupt.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/cls-expr-meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var C = class { + method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..3dbe3aab14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,110 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/cls-expr-meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var C = class { + method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +C.prototype.method(false, '', NaN, 0, null, obj); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..2088270e24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-arg-val-undefined.js @@ -0,0 +1,93 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/cls-expr-meth.template +/*--- +description: Use of initializer when argument value is `undefined` (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var C = class { + method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +C.prototype.method(undefined, void 0); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-duplicates.js new file mode 100644 index 0000000000..30e6337dd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-duplicates.js @@ -0,0 +1,84 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/cls-expr-meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, class { + method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-later.js new file mode 100644 index 0000000000..ab2724b0fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-later.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/cls-expr-meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-prior.js new file mode 100644 index 0000000000..fec59950f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-prior.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/cls-expr-meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +C.prototype.method(3); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-self.js new file mode 100644 index 0000000000..69d6f193da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-ref-self.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/cls-expr-meth.template +/*--- +description: Referencing a parameter from within its own initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var C = class { + method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + C.prototype.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-rest.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-rest.js new file mode 100644 index 0000000000..236497491c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-rest.js @@ -0,0 +1,88 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/cls-expr-meth.template +/*--- +description: RestParameter does not support an initializer (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, class { + method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/class/method/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..a2859b382a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/dflt-params-trailing-comma.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..1fbf315541 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template +/*--- +description: Forbidden extension, f.arguments (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +C.prototype.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..decb13378a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/cls-expr-meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var C = class { + method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +C.prototype.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..eaeb5677da --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.prototype.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..e5e8332971 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.prototype.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..5e109e3330 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/cls-expr-meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template +/*--- +description: Forbidden extension, o.caller (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [class] +flags: [generated, noStrict] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var C = class { + method() { + /* implicit strict */ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +C.prototype.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/class/method/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/class/method/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..4524a9ce78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/object-destructuring-param-strict-body.js @@ -0,0 +1,155 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/cls-expr-meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/class/method/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..fe77a1e8bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/params-trailing-comma-multiple.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/class/method/params-trailing-comma-single.js new file mode 100644 index 0000000000..4812bb84e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/params-trailing-comma-single.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/method/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/class/method/rest-param-strict-body.js new file mode 100644 index 0000000000..a1ab4df1b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/rest-param-strict-body.js @@ -0,0 +1,155 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/cls-expr-meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, class { + method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/class/method/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..c38a3ca80a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/method/rest-params-trailing-comma-early-error.js @@ -0,0 +1,80 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/cls-expr-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, class { + method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/class/method/shell.js b/js/src/tests/test262/language/expressions/class/method/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/name.js b/js/src/tests/test262/language/expressions/class/name.js new file mode 100644 index 0000000000..f3a3ae912f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/name.js @@ -0,0 +1,56 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-class-definitions-runtime-semantics-evaluation +description: Assignment of function `name` attribute +info: | + ClassExpression : class ClassTail + + 1. Let value be ? ClassDefinitionEvaluation of ClassTail with arguments + undefined and "". + ... + 4. Return value. + + ClassExpression : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be ? ClassDefinitionEvaluation of ClassTail with arguments + className and className. + ... + 4. Return value. + + 14.6.13 Runtime Semantics: ClassDefinitionEvaluation + + ... + 12. Let constructorInfo be DefineMethod of constructor with arguments proto, + className as the optional name argument, and constructorParent. + ... + + 14.3.7 Runtime Semantics: DefineMethod + + ... + 7. Let closure be FunctionCreate(kind, UniqueFormalParameters, FunctionBody, + scope, name, prototype). + ... + +includes: [propertyHelper.js] +---*/ + +verifyProperty(class {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(class cls {}, "name", { + value: "cls", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(class { constructor() {} }, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(class cls { constructor() {} }, "name", { + value: "cls", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-args-unmapped.js b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-args-unmapped.js new file mode 100644 index 0000000000..dd31dc4761 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-args-unmapped.js @@ -0,0 +1,108 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [generators, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; + } +}; + +C.prototype.method().next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-ref-arguments.js b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-ref-arguments.js new file mode 100644 index 0000000000..b5a94abead --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-ref-arguments.js @@ -0,0 +1,87 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [generators, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + *method(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; + } +}; + +C.prototype.method(undefined, undefined, 'third', 'fourth').next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-args-unmapped.js b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-args-unmapped.js new file mode 100644 index 0000000000..c3d22a3c65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-args-unmapped.js @@ -0,0 +1,108 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [generators, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; + } +}; + +C.method().next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-ref-arguments.js b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-ref-arguments.js new file mode 100644 index 0000000000..aa513126e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-gen-meth-static-ref-arguments.js @@ -0,0 +1,87 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [generators, default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static *method(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; + } +}; + +C.method(undefined, undefined, 'third', 'fourth').next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-meth-args-unmapped.js b/js/src/tests/test262/language/expressions/class/params-dflt-meth-args-unmapped.js new file mode 100644 index 0000000000..cf79e567ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-meth-args-unmapped.js @@ -0,0 +1,105 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; + } +}; + +C.prototype.method(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-meth-ref-arguments.js b/js/src/tests/test262/language/expressions/class/params-dflt-meth-ref-arguments.js new file mode 100644 index 0000000000..81521fa2d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-meth-ref-arguments.js @@ -0,0 +1,84 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + method(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; + } +}; + +C.prototype.method(undefined, undefined, 'third', 'fourth'); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-meth-static-args-unmapped.js b/js/src/tests/test262/language/expressions/class/params-dflt-meth-static-args-unmapped.js new file mode 100644 index 0000000000..a6641fb563 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-meth-static-args-unmapped.js @@ -0,0 +1,105 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; + } +}; + +C.method(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/params-dflt-meth-static-ref-arguments.js b/js/src/tests/test262/language/expressions/class/params-dflt-meth-static-ref-arguments.js new file mode 100644 index 0000000000..c50c7810a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/params-dflt-meth-static-ref-arguments.js @@ -0,0 +1,84 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var C = class { + static method(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; + } +}; + +C.method(undefined, undefined, 'third', 'fourth'); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/poisoned-underscore-proto.js b/js/src/tests/test262/language/expressions/class/poisoned-underscore-proto.js new file mode 100644 index 0000000000..b27de560b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/poisoned-underscore-proto.js @@ -0,0 +1,30 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-ClassExpression +description: > + ClassExpression should directly set [[Prototype]] internal slot. +info: | + ClassDefinitionEvaluation + + [...] + 7. Let proto be ObjectCreate(protoParent). + + ObjectCreate ( proto [ , internalSlotsList ] ) + + [...] + 4. Set obj.[[Prototype]] to proto. +features: [class, __proto__] +---*/ + +Object.defineProperty(Object.prototype, '__proto__', { + set: function() { + throw new Test262Error('should not be called'); + }, +}); + +var A = class extends Array {}; + +assert.sameValue(new A(1).length, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval-indirect.js b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval-indirect.js new file mode 100644 index 0000000000..ffe5870538 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval-indirect.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private getter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + get #m() { return 'test262'; } + + access(o) { + return o.#m; + } +} +)`; + +let createAndInstantiateClass = function (_eval) { + return new (_eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(eval); +let c2 = createAndInstantiateClass(eval); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval.js b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval.js new file mode 100644 index 0000000000..f8cf15c9ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-eval.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private getter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + get #m() { return 'test262'; } + + access(o) { + return o.#m; + } +} +)`; + +let createAndInstantiateClass = function () { + return new (eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-factory.js b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-factory.js new file mode 100644 index 0000000000..18a5b690a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-factory.js @@ -0,0 +1,49 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private getter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +---*/ + +let createAndInstantiateClass = function () { + const C = class { + get #m() { return 'test262'; } + + access(o) { + return o.#m; + } + } + + let c = new C(); + return c; +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-function-ctor.js new file mode 100644 index 0000000000..531d435480 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-function-ctor.js @@ -0,0 +1,52 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private getter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +---*/ + +let classStringExpression = ` +return class { + get #m() { return 'test262'; } + + access(o) { + return o.#m; + } +} +`; + +let createAndInstantiateClass = function () { + let classFactoryFunction = new Function(classStringExpression); + let Class = classFactoryFunction(); + return new Class(); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js new file mode 100644 index 0000000000..e31d0cf9b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js @@ -0,0 +1,55 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private getter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private, cross-realm] +---*/ + +let classStringExpression = ` +return class { + get #m() { return 'test262'; } + + access(o) { + return o.#m; + } +} +`; + +let createAndInstantiateClass = function () { + let realm = $262.createRealm(); + let classFactoryFunction = new (realm.global.Function)(classStringExpression); + let Class = classFactoryFunction(); + let obj = new Class(); + obj.realm = realm; + return obj; +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(c1.realm.global.TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(c2.realm.global.TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm.js b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm.js new file mode 100644 index 0000000000..e09ce11af1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-getter-brand-check-multiple-evaluations-of-class-realm.js @@ -0,0 +1,56 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private getter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private, cross-realm] +flags: [noStrict] +---*/ + +let realm1 = $262.createRealm(); +let realm2 = $262.createRealm(); +let eval1 = realm1.global.eval; +let eval2 = realm2.global.eval; + +let classStringExpression = `( +class { + get #m() { return 'test262'; } + + access(o) { + return o.#m; + } +} +)`; + +let createAndInstantiateClass = function (_eval) { + return new (_eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(eval1); +let c2 = createAndInstantiateClass(eval2); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(realm1.global.TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(realm2.global.TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval-indirect.js b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval-indirect.js new file mode 100644 index 0000000000..8147cbb9f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval-indirect.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private method) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class C { + #m() { return 'test262'; } + + access(o) { + return o.#m(); + } +} +)`; + +let createAndInstantiateClass = function (_eval) { + return new (_eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(eval); +let c2 = createAndInstantiateClass(eval); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval.js b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval.js new file mode 100644 index 0000000000..e2334ff07e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-eval.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private method) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class C { + #m() { return 'test262'; } + + access(o) { + return o.#m(); + } +} +)`; + +let createAndInstantiateClass = function () { + return new (eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-factory.js b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-factory.js new file mode 100644 index 0000000000..1107fe9e74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-factory.js @@ -0,0 +1,48 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private method) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +---*/ + +let createAndInstantiateClass = function () { + const C = class { + #m() { return 'test262'; } + + access(o) { + return o.#m(); + } + } + + return new C(); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-function-ctor.js new file mode 100644 index 0000000000..e8015aa527 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-function-ctor.js @@ -0,0 +1,52 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private method) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +---*/ + +let classStringExpression = ` +return class C { + #m() { return 'test262'; } + + access(o) { + return o.#m(); + } +} +`; + +let createAndInstantiateClass = function () { + let classFactoryFunction = new Function(classStringExpression); + let Class = classFactoryFunction(); + return new Class(); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm-function-ctor.js new file mode 100644 index 0000000000..d7e38435ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm-function-ctor.js @@ -0,0 +1,55 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private method) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private, cross-realm] +---*/ + +let classStringExpression = ` +return class C { + #m() { return 'test262'; } + + access(o) { + return o.#m(); + } +} +`; + +let createAndInstantiateClass = function () { + let realm = $262.createRealm(); + let classFactoryFunction = new (realm.global.Function)(classStringExpression); + let Class = classFactoryFunction(); + let obj = new Class(); + obj.realm = realm; + return obj; +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(c1.realm.global.TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(c2.realm.global.TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm.js b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm.js new file mode 100644 index 0000000000..88949b923b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-method-brand-check-multiple-evaluations-of-class-realm.js @@ -0,0 +1,56 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private method) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private, cross-realm] +flags: [noStrict] +---*/ + +let realm1 = $262.createRealm(); +let realm2 = $262.createRealm(); +let eval1 = realm1.global.eval; +let eval2 = realm2.global.eval; + +let classStringExpression = `( +class { + #m() { return 'test262'; } + + access(o) { + return o.#m(); + } +} +)`; + +let createAndInstantiateClass = function (_eval) { + return new (_eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(eval1); +let c2 = createAndInstantiateClass(eval2); + +assert.sameValue(c1.access(c1), 'test262'); +assert.sameValue(c2.access(c2), 'test262'); + +assert.throws(realm1.global.TypeError, function() { + c1.access(c2); +}, 'invalid access of c1 private method'); + +assert.throws(realm2.global.TypeError, function() { + c2.access(c1); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval-indirect.js b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval-indirect.js new file mode 100644 index 0000000000..48438a9e97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval-indirect.js @@ -0,0 +1,53 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private setter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + set #m(v) { this._v = v; } + + access(o, v) { + o.#m = v; + } +} +)`; + +let createAndInstantiateClass = function (_eval) { + return new (_eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(eval); +let c2 = createAndInstantiateClass(eval); + +c1.access(c1, 'test262'); +assert.sameValue(c1._v, 'test262'); +c2.access(c2, 'test262'); +assert.sameValue(c2._v, 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2, 'foo'); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1, 'foo'); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval.js b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval.js new file mode 100644 index 0000000000..d763af7cfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-eval.js @@ -0,0 +1,53 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private setter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + set #m(v) { this._v = v; } + + access(o, v) { + o.#m = v; + } +} +)`; + +let createAndInstantiateClass = function () { + return new (eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +c1.access(c1, 'test262'); +assert.sameValue(c1._v, 'test262'); +c2.access(c2, 'test262'); +assert.sameValue(c2._v, 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2, 'foo'); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1, 'foo'); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-factory.js b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-factory.js new file mode 100644 index 0000000000..80ec752d1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-factory.js @@ -0,0 +1,50 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private setter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +---*/ + +let createAndInstantiateClass = function () { + const C = class { + set #m(v) { this._v = v; } + + access(o, v) { + o.#m = v; + } + } + + return new C(); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +c1.access(c1, 'test262'); +assert.sameValue(c1._v, 'test262'); +c2.access(c2, 'test262'); +assert.sameValue(c2._v, 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2, 'foo'); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1, 'foo'); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-function-ctor.js new file mode 100644 index 0000000000..08bddbae91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-function-ctor.js @@ -0,0 +1,54 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private setter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private] +---*/ + +let classStringExpression = ` +return class { + set #m(v) { this._v = v; } + + access(o, v) { + o.#m = v; + } +} +`; + +let createAndInstantiateClass = function () { + let classFactoryFunction = new Function(classStringExpression); + let Class = classFactoryFunction(); + return new Class(); +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +c1.access(c1, 'test262'); +assert.sameValue(c1._v, 'test262'); +c2.access(c2, 'test262'); +assert.sameValue(c2._v, 'test262'); + +assert.throws(TypeError, function() { + c1.access(c2, 'foo'); +}, 'invalid access of c1 private method'); + +assert.throws(TypeError, function() { + c2.access(c1, 'foo'); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js new file mode 100644 index 0000000000..ffd9b1665b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm-function-ctor.js @@ -0,0 +1,57 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private setter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private, cross-realm] +---*/ + +let classStringExpression = ` +return class { + set #m(v) { this._v = v; } + + access(o, v) { + o.#m = v; + } +} +`; + +let createAndInstantiateClass = function () { + let realm = $262.createRealm(); + let classFactoryFunction = new (realm.global.Function)(classStringExpression); + let Class = classFactoryFunction(); + let obj = new Class(); + obj.realm = realm; + return obj; +}; + +let c1 = createAndInstantiateClass(); +let c2 = createAndInstantiateClass(); + +c1.access(c1, 'test262'); +assert.sameValue(c1._v, 'test262'); +c2.access(c2, 'test262'); +assert.sameValue(c2._v, 'test262'); + +assert.throws(c1.realm.global.TypeError, function() { + c1.access(c2, 'foo'); +}, 'invalid access of c1 private method'); + +assert.throws(c2.realm.global.TypeError, function() { + c2.access(c1, 'foo'); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm.js b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm.js new file mode 100644 index 0000000000..cb127d61b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-setter-brand-check-multiple-evaluations-of-class-realm.js @@ -0,0 +1,58 @@ +// Copyright (C) 2019 Jaideep Bhoosreddy (Bloomberg LP). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private setter) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 11. Let proto be ObjectCreate(protoParent). + ... + 31. If PrivateBoundIdentifiers of ClassBody contains a Private Name P such that the P's [[Kind]] field is either "method" or "accessor", + a. Set F.[[PrivateBrand]] to proto. + ... + + 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. +features: [class, class-methods-private, cross-realm] +flags: [noStrict] +---*/ + +let realm1 = $262.createRealm(); +let realm2 = $262.createRealm(); +let eval1 = realm1.global.eval; +let eval2 = realm2.global.eval; + +let classStringExpression = `( +class { + set #m(v) { this._v = v; } + + access(o, v) { + o.#m = v; + } +} +)`; + +let createAndInstantiateClass = function (_eval) { + return new (_eval(classStringExpression)); +}; + +let c1 = createAndInstantiateClass(eval1); +let c2 = createAndInstantiateClass(eval2); + +c1.access(c1, 'test262'); +assert.sameValue(c1._v, 'test262'); +c2.access(c2, 'test262'); +assert.sameValue(c2._v, 'test262'); + +assert.throws(realm1.global.TypeError, function() { + c1.access(c2, 'foo'); +}, 'invalid access of c1 private method'); + +assert.throws(realm2.global.TypeError, function() { + c2.access(c1, 'foo'); +}, 'invalid access of c2 private method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-direct-eval.js b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-direct-eval.js new file mode 100644 index 0000000000..f312d90898 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-direct-eval.js @@ -0,0 +1,70 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static field) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassElementName : PrivateIdentifier + 1. Let privateIdentifier be StringValue of PrivateIdentifier. + 2. Let privateName be NewPrivateName(privateIdentifier). + 3. Let scope be the running execution context's PrivateEnvironment. + 4. Let scopeEnvRec be scope's EnvironmentRecord. + 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName). + 6. Return privateName. + + ClassTail : ClassHeritage { ClassBody } + ... + 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) + ... + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). +features: [class, class-static-fields-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static #m = 'test262'; + + static access() { + return this.#m; + } +} +)`; + +let evalClass = function () { + return eval(classStringExpression); +}; + +let C1 = evalClass(); +let C2 = evalClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static field'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static field'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-eval-indirect.js b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-eval-indirect.js new file mode 100644 index 0000000000..3b37db3ea9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-eval-indirect.js @@ -0,0 +1,70 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static field) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassElementName : PrivateIdentifier + 1. Let privateIdentifier be StringValue of PrivateIdentifier. + 2. Let privateName be NewPrivateName(privateIdentifier). + 3. Let scope be the running execution context's PrivateEnvironment. + 4. Let scopeEnvRec be scope's EnvironmentRecord. + 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName). + 6. Return privateName. + + ClassTail : ClassHeritage { ClassBody } + ... + 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) + ... + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). +features: [class, class-static-fields-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static #m = 'test262'; + + static access() { + return this.#m; + } +} +)`; + +let evalClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = evalClass(eval); +let C2 = evalClass(eval); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static field'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static field'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-factory.js b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-factory.js new file mode 100644 index 0000000000..a8efd743b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-factory.js @@ -0,0 +1,65 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static field) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassElementName : PrivateIdentifier + 1. Let privateIdentifier be StringValue of PrivateIdentifier. + 2. Let privateName be NewPrivateName(privateIdentifier). + 3. Let scope be the running execution context's PrivateEnvironment. + 4. Let scopeEnvRec be scope's EnvironmentRecord. + 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName). + 6. Return privateName. + + ClassTail : ClassHeritage { ClassBody } + ... + 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) + ... + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). +features: [class, class-static-fields-private] +---*/ + +let createClass = function () { + return class { + static #m = 'test262'; + + static access() { + return this.#m; + } + } +}; + +let C1 = createClass(); +let C2 = createClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static field'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static field'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-function-ctor.js new file mode 100644 index 0000000000..d2e571c6f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-function-ctor.js @@ -0,0 +1,70 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static field) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassElementName : PrivateIdentifier + 1. Let privateIdentifier be StringValue of PrivateIdentifier. + 2. Let privateName be NewPrivateName(privateIdentifier). + 3. Let scope be the running execution context's PrivateEnvironment. + 4. Let scopeEnvRec be scope's EnvironmentRecord. + 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName). + 6. Return privateName. + + ClassTail : ClassHeritage { ClassBody } + ... + 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) + ... + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). +features: [class, class-static-fields-private] +---*/ + +let classStringExpression = ` +return class { + static #m = 'test262'; + + static access() { + return this.#m; + } +} +`; + +let createClass = function () { + let classFactoryFunction = new Function(classStringExpression); + return classFactoryFunction(); +}; + +let C1 = createClass(); +let C2 = createClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static field'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static field'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-realm.js b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-realm.js new file mode 100644 index 0000000000..94348c45ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-field-multiple-evaluations-of-class-realm.js @@ -0,0 +1,75 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static field) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassElementName : PrivateIdentifier + 1. Let privateIdentifier be StringValue of PrivateIdentifier. + 2. Let privateName be NewPrivateName(privateIdentifier). + 3. Let scope be the running execution context's PrivateEnvironment. + 4. Let scopeEnvRec be scope's EnvironmentRecord. + 5. Perform ! scopeEnvRec.InitializeBinding(privateIdentifier, privateName). + 6. Return privateName. + + ClassTail : ClassHeritage { ClassBody } + ... + 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) + ... + 8. If fieldName is a Private Name, + a. Perform ? PrivateFieldAdd(fieldName, receiver, initValue). +features: [class, class-static-fields-private, cross-realm] +flags: [noStrict] +---*/ + +let global1 = $262.createRealm().global; +let global2 = $262.createRealm().global; +let eval1 = global1.eval; +let eval2 = global2.eval; + +let classStringExpression = `( +class { + static #m = 'test262'; + + static access() { + return this.#m; + } +} +)`; + +let evalClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = evalClass(eval1); +let C2 = evalClass(eval2); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(global1.TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static field'); + +assert.throws(global2.TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static field'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-direct-eval.js b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-direct-eval.js new file mode 100644 index 0000000000..6f62df7505 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-direct-eval.js @@ -0,0 +1,56 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static getter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static get #m() { + return 'Test262'; + }; + + static access() { + return this.#m; + } +} +)`; + +let evalClass = function () { + return eval(classStringExpression); +}; + +let C1 = evalClass(); +let C2 = evalClass(); + +assert.sameValue(C1.access(), 'Test262'); +assert.sameValue(C2.access(), 'Test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static getter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static getter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-eval-indirect.js b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-eval-indirect.js new file mode 100644 index 0000000000..96c34a9a38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-eval-indirect.js @@ -0,0 +1,56 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static getter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static get #m() { + return 'test262'; + }; + + static access() { + return this.#m; + } +} +)`; + +let evalClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = evalClass(eval); +let C2 = evalClass(eval); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static getter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static getter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-factory.js b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-factory.js new file mode 100644 index 0000000000..6fd36824a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-factory.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static getter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +---*/ + +let createClass = function () { + return class { + static get #m() { + return 'test262'; + }; + + static access() { + return this.#m; + } + } +}; + +let C1 = createClass(); +let C2 = createClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static getter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static getter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-function-ctor.js new file mode 100644 index 0000000000..92eee80519 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-function-ctor.js @@ -0,0 +1,56 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static getter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +---*/ + +let classStringExpression = ` +return class { + static get #m() { + return 'test262'; + }; + + static access() { + return this.#m; + } +} +`; + +let createClass = function () { + let classFactoryFunction = new Function(classStringExpression); + return classFactoryFunction(); +}; + +let C1 = createClass(); +let C2 = createClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static getter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static getter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-realm.js b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-realm.js new file mode 100644 index 0000000000..e55fee402f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-getter-multiple-evaluations-of-class-realm.js @@ -0,0 +1,61 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static getter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private, cross-realm] +flags: [noStrict] +---*/ + +let global1 = $262.createRealm().global; +let global2 = $262.createRealm().global; +let eval1 = global1.eval; +let eval2 = global2.eval; + +let classStringExpression = `( +class { + static get #m() { + return 'test262'; + }; + + static access() { + return this.#m; + } +} +)`; + +let evalClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = evalClass(eval1); +let C2 = evalClass(eval2); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(global1.TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static getter'); + +assert.throws(global2.TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static getter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-direct-eval.js b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-direct-eval.js new file mode 100644 index 0000000000..741e7d8d0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-direct-eval.js @@ -0,0 +1,54 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private static methods) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static #m() { return 'test262'; } + + static access() { + return this.#m(); + } +} +)`; + +let evalClass = function () { + return eval(classStringExpression); +}; + +let C1 = evalClass(); +let C2 = evalClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static method'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-eval-indirect.js b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-eval-indirect.js new file mode 100644 index 0000000000..d9e1bf0852 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-eval-indirect.js @@ -0,0 +1,54 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private static methods) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static #m() { return 'test262'; } + + static access() { + return this.#m(); + } +} +)`; + +let evalClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = evalClass(eval); +let C2 = evalClass(eval); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static method'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-factory.js b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-factory.js new file mode 100644 index 0000000000..bb585d57d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-factory.js @@ -0,0 +1,49 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private static methods) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +---*/ + +let createClass = function () { + return class { + static #m() { return 'test262'; } + + static access() { + return this.#m(); + } + } +}; + +let C1 = createClass(); +let C2 = createClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static method'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-function-ctor.js new file mode 100644 index 0000000000..04f4da476d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-function-ctor.js @@ -0,0 +1,54 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private static methods) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +---*/ + +let classStringExpression = ` +return class { + static #m() { return 'test262'; } + + static access() { + return this.#m(); + } +} +`; + +let createClass = function () { + let classFactoryFunction = new Function(classStringExpression); + return classFactoryFunction(); +}; + +let C1 = createClass(); +let C2 = createClass(); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static method'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-realm.js b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-realm.js new file mode 100644 index 0000000000..3853f8bb6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-method-brand-check-multiple-evaluations-of-class-realm.js @@ -0,0 +1,59 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different brand (private static methods) +esid: sec-privatefieldget +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private, cross-realm] +flags: [noStrict] +---*/ + +let global1 = $262.createRealm().global; +let global2 = $262.createRealm().global; +let eval1 = global1.eval; +let eval2 = global2.eval; + +let classStringExpression = `( +class { + static #m() { return 'test262'; } + + static access() { + return this.#m(); + } +} +)`; + +let createClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = createClass(eval1); +let C2 = createClass(eval2); + +assert.sameValue(C1.access(), 'test262'); +assert.sameValue(C2.access(), 'test262'); + +assert.throws(global1.TypeError, function() { + C1.access.call(C2); +}, 'invalid access of c1 private static method'); + +assert.throws(global2.TypeError, function() { + C2.access.call(C1); +}, 'invalid access of c2 private static method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-direct-eval.js b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-direct-eval.js new file mode 100644 index 0000000000..b208c3c4b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-direct-eval.js @@ -0,0 +1,58 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static setter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static set #m(v) { + this._v = v; + } + + static access() { + this.#m = 'test262'; + } +} +)`; + +let evalClass = function () { + return eval(classStringExpression); +}; + +let C1 = evalClass(); +let C2 = evalClass(); + +C1.access(); +assert.sameValue(C1._v, 'test262'); +C2.access(); +assert.sameValue(C2._v, 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static setter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static setter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-eval-indirect.js b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-eval-indirect.js new file mode 100644 index 0000000000..92b73e18b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-eval-indirect.js @@ -0,0 +1,58 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static setter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +flags: [noStrict] +---*/ + +let classStringExpression = `( +class { + static set #m(v) { + this._v = v; + }; + + static access() { + this.#m = 'test262'; + } +} +)`; + +let evalClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = evalClass(eval); +let C2 = evalClass(eval); + +C1.access(); +assert.sameValue(C1._v, 'test262'); +C2.access(); +assert.sameValue(C2._v, 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static setter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static setter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-factory.js b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-factory.js new file mode 100644 index 0000000000..f529637c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-factory.js @@ -0,0 +1,53 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static setter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +---*/ + +let createClass = function () { + return class { + static set #m(v) { + this._v = v; + }; + + static access() { + this.#m = 'test262'; + } + } +}; + +let C1 = createClass(); +let C2 = createClass(); + +C1.access(); +assert.sameValue(C1._v, 'test262'); +C2.access(); +assert.sameValue(C2._v, 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static setter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static setter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-function-ctor.js b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-function-ctor.js new file mode 100644 index 0000000000..0c5e44d091 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-function-ctor.js @@ -0,0 +1,58 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static setter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private] +---*/ + +let classStringExpression = ` +return class { + static set #m(v) { + this._v = v; + } + + static access() { + this.#m = 'test262'; + } +} +`; + +let createClass = function () { + let classFactoryFunction = new Function(classStringExpression); + return classFactoryFunction(); +}; + +let C1 = createClass(); +let C2 = createClass(); + +C1.access(); +assert.sameValue(C1._v, 'test262'); +C2.access(); +assert.sameValue(C2._v, 'test262'); + +assert.throws(TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static setter'); + +assert.throws(TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static setter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-realm.js b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-realm.js new file mode 100644 index 0000000000..42f18f6718 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/private-static-setter-multiple-evaluations-of-class-realm.js @@ -0,0 +1,63 @@ +// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Every new evaluation of a class creates a different Private Name (private static setter) +esid: sec-runtime-semantics-evaluate-name +info: | + ClassTail : ClassHeritage { ClassBody } + ... + 19. Let F be constructorInfo.[[Closure]]. + 20. If ClassHeritage_opt is present and protoParent is not null, then set F.[[ConstructorKind]] to "derived". + 21. Perform MakeConstructor(F, false, proto). + 22. Perform MakeClassConstructor(F). + ... + 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). + ... + + 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. +features: [class, class-static-methods-private, cross-realm] +flags: [noStrict] +---*/ + +let global1 = $262.createRealm().global; +let global2 = $262.createRealm().global; +let eval1 = global1.eval; +let eval2 = global2.eval; + +let classStringExpression = `( +class { + static set #m(v) { + this._v = v; + } + + static access() { + this.#m = 'test262'; + } +} +)`; + +let evalClass = function (_eval) { + return _eval(classStringExpression); +}; + +let C1 = evalClass(eval1); +let C2 = evalClass(eval2); + +C1.access(); +assert.sameValue(C1._v, 'test262'); +C2.access(); +assert.sameValue(C2._v, 'test262'); + +assert.throws(global1.TypeError, function() { + C1.access.call(C2); +}, 'invalid access of C1 private static setter'); + +assert.throws(global2.TypeError, function() { + C2.access.call(C1); +}, 'invalid access of C2 private static setter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/restricted-properties.js b/js/src/tests/test262/language/expressions/class/restricted-properties.js new file mode 100644 index 0000000000..96700d56f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/restricted-properties.js @@ -0,0 +1,62 @@ +// Copyright (C) 2015 Caitlin Potter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions created using ClassExpression syntactic form do not + have own properties "caller" or "arguments", but inherit them from + %FunctionPrototype%. +es6id: 16.1 +---*/ + +var BaseClass = class {}; + +assert.sameValue( + BaseClass.hasOwnProperty('caller'), false, 'No "caller" own property' +); +assert.sameValue( + BaseClass.hasOwnProperty('arguments'), false, 'No "arguments" own property' +); + +assert.throws(TypeError, function() { + return BaseClass.caller; +}); + +assert.throws(TypeError, function() { + BaseClass.caller = {}; +}); + +assert.throws(TypeError, function() { + return BaseClass.arguments; +}); + +assert.throws(TypeError, function() { + BaseClass.arguments = {}; +}); + +var SubClass = class extends BaseClass {}; + +assert.sameValue( + SubClass.hasOwnProperty('caller'), false, 'No "caller" own property' +); +assert.sameValue( + SubClass.hasOwnProperty('arguments'), false, 'No "arguments" own property' +); + +assert.throws(TypeError, function() { + return SubClass.caller; +}); + +assert.throws(TypeError, function() { + SubClass.caller = {}; +}); + +assert.throws(TypeError, function() { + return SubClass.arguments; +}); + +assert.throws(TypeError, function() { + SubClass.arguments = {}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-close.js new file mode 100644 index 0000000000..78963c6bbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-close.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var probe; + +var C = class { + // A parameter expression is necessary to trigger the creation of the scope + // under test. + *m(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}; +C.prototype.m().next(); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-open.js new file mode 100644 index 0000000000..7549456a9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-gen-meth-paramsbody-var-open.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +var C = class{ + *m(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}; +C.prototype.m().next(); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-close.js new file mode 100644 index 0000000000..90d0bd9b38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-close.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +var C = class { + // A parameter expression is necessary to trigger the creation of the scope + // under test. + m(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}; +C.prototype.m(); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-open.js new file mode 100644 index 0000000000..9693f1f365 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-meth-paramsbody-var-open.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +var C = class { + m(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}; +C.prototype.m(); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-name-lex-close.js b/js/src/tests/test262/language/expressions/class/scope-name-lex-close.js new file mode 100644 index 0000000000..59a12cbe8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-name-lex-close.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: Removal of lexical environment for class "name" +info: | + [...] + 22. Set the running execution context's LexicalEnvironment to lex. + [...] +---*/ + +var C = 'outside'; + +var cls = class C { + method() { + return C; + } +}; + +assert.sameValue(cls.prototype.method(), cls, 'from instance method'); +assert.sameValue(C, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-name-lex-open-heritage.js b/js/src/tests/test262/language/expressions/class/scope-name-lex-open-heritage.js new file mode 100644 index 0000000000..27690ddd4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-name-lex-open-heritage.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + Creation of new lexical environment for the class "name" (with a heritage) +info: | + 1. Let lex be the LexicalEnvironment of the running execution context. + 2. Let classScope be NewDeclarativeEnvironment(lex). + 3. Let classScopeEnvRec be classScope's EnvironmentRecord. + 4. If className is not undefined, then + a. Perform classScopeEnvRec.CreateImmutableBinding(className, true). + 5. If ClassHeritageopt is not present, then + [...] + 6. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + [...] +---*/ + +var probeBefore = function() { return C; }; +var probeHeritage, setHeritage; +var C = 'outside'; + +var cls = class C extends ( + probeHeritage = function() { return C; }, + setHeritage = function() { C = null; } + ) { + method() { + return C; + } +}; + +assert.sameValue(probeBefore(), 'outside'); +assert.sameValue(probeHeritage(), cls, 'from class heritage'); +assert.throws(TypeError, setHeritage, 'inner binding rejects modification'); +assert.sameValue(probeHeritage(), cls, 'inner binding is immutable'); +assert.sameValue(cls.prototype.method(), cls, 'from instance method'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-name-lex-open-no-heritage.js b/js/src/tests/test262/language/expressions/class/scope-name-lex-open-no-heritage.js new file mode 100644 index 0000000000..4c15a96c9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-name-lex-open-no-heritage.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +description: > + Creation of new lexical environment for the class "name" (without a + heritage) +info: | + 1. Let lex be the LexicalEnvironment of the running execution context. + 2. Let classScope be NewDeclarativeEnvironment(lex). + 3. Let classScopeEnvRec be classScope's EnvironmentRecord. + 4. If className is not undefined, then + a. Perform classScopeEnvRec.CreateImmutableBinding(className, true). + 5. If ClassHeritageopt is not present, then + [...] + 6. Else, + a. Set the running execution context's LexicalEnvironment to classScope. + [...] + 11. Set the running execution context's LexicalEnvironment to classScope. +---*/ + +var probeBefore = function() { return C; }; +var C = 'outside'; + +var cls = class C { + probe() { + return C; + } + modify() { + C = null; + } +}; + +assert.sameValue(probeBefore(), 'outside'); +assert.sameValue(cls.prototype.probe(), cls, 'inner binding value'); +assert.throws( + TypeError, cls.prototype.modify, 'inner binding rejects modification' +); +assert.sameValue(cls.prototype.probe(), cls, 'inner binding is immutable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-close.js new file mode 100644 index 0000000000..ebf67e96f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-close.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +var C = class { + // A parameter expression is necessary to trigger the creation of the scope + // under test. + set a(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}; +C.prototype.a = null; + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-open.js new file mode 100644 index 0000000000..bc5d45bfea --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-setter-paramsbody-var-open.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +var C = class { + set a(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}; +C.prototype.a = undefined; + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js new file mode 100644 index 0000000000..f9599e22e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-close.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var probe; + +var C = class { + // A parameter expression is necessary to trigger the creation of the scope + // under test. + static *m(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}; +C.m().next(); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js new file mode 100644 index 0000000000..7e0f7fdde9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-static-gen-meth-paramsbody-var-open.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +var C = class { + static *m(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}; +C.m().next(); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-close.js new file mode 100644 index 0000000000..8402c1ad13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-close.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +var C = class { + // A parameter expression is necessary to trigger the creation of the scope + // under test. + static m(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}; +C.m(); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-open.js new file mode 100644 index 0000000000..b2e9596fc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-static-meth-paramsbody-var-open.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +var C = class { + static m(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}; +C.m(); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-close.js new file mode 100644 index 0000000000..537d50a70d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-close.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +var C = class { + // A parameter expression is necessary to trigger the creation of the scope + // under test. + static set a(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}; +C.a = null; + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-open.js new file mode 100644 index 0000000000..8a13473e4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/scope-static-setter-paramsbody-var-open.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +var C = class { + static set a(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}; +C.a = undefined; + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/setter-length-dflt.js b/js/src/tests/test262/language/expressions/class/setter-length-dflt.js new file mode 100644 index 0000000000..a23b4a7c46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/setter-length-dflt.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [default-parameters] +includes: [propertyHelper.js] +---*/ + +var C = class { set m(x = 42) {} }; +var set = Object.getOwnPropertyDescriptor(C.prototype, 'm').set; + +verifyProperty(set, 'length', { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/shell.js b/js/src/tests/test262/language/expressions/class/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/static-gen-method-param-dflt-yield.js b/js/src/tests/test262/language/expressions/class/static-gen-method-param-dflt-yield.js new file mode 100644 index 0000000000..25fef6b7e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/static-gen-method-param-dflt-yield.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorMethod[Yield]: + + * PropertyName[?Yield] ( StrictFormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [generators, default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, class { + static *g(x = yield) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/static-init-await-binding.js b/js/src/tests/test262/language/expressions/class/static-init-await-binding.js new file mode 100644 index 0000000000..adfc00c8b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/static-init-await-binding.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is disallowed as a BindingIdentifier +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class C { + static { + (class await {}); + } +} diff --git a/js/src/tests/test262/language/expressions/class/static-init-await-reference.js b/js/src/tests/test262/language/expressions/class/static-init-await-reference.js new file mode 100644 index 0000000000..ee37e95dde --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/static-init-await-reference.js @@ -0,0 +1,30 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as a IdentifierReference in method parameter lists +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + new (class { + constructor(x = fromParam = await) { + fromBody = await; + } + }); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/static-method-length-dflt.js b/js/src/tests/test262/language/expressions/class/static-method-length-dflt.js new file mode 100644 index 0000000000..6706704a5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/static-method-length-dflt.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [default-parameters] +includes: [propertyHelper.js] +---*/ + +var m1 = class { static m(x = 42) {} }.m; + +verifyProperty(m1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var m2 = class { static m(x = 42, y) {} }.m; + +verifyProperty(m2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var m3 = class { static m(x, y = 42) {} }.m; + +verifyProperty(m3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var m4 = class { static m(x, y = 42, z) {} }.m; + +verifyProperty(m4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/static-method-param-dflt-yield.js b/js/src/tests/test262/language/expressions/class/static-method-param-dflt-yield.js new file mode 100644 index 0000000000..651d2470e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/static-method-param-dflt-yield.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + YieldExpression cannot be used within the FormalParameters of a class method +info: | + MethodDefinition[Yield] : + + PropertyName[?Yield] ( StrictFormalParameters ) { FunctionBody } +features: [generators, default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, class { + static m(x = yield) {} +}; diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/browser.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/shell.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-AggregateError.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-AggregateError.js new file mode 100644 index 0000000000..f786da087d --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-AggregateError.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/AggregateError.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubAggregateError() instanceof AggregateError (Subclass instanceof Heritage) +features: [AggregateError] +flags: [generated] +---*/ + + +const Subclass = class extends AggregateError {} + +const sub = new Subclass([]); +assert(sub instanceof Subclass); +assert(sub instanceof AggregateError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Array.js new file mode 100644 index 0000000000..cd4372ef2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Array.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubArray() instanceof Array (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ArrayBuffer.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ArrayBuffer.js new file mode 100644 index 0000000000..3cc43323d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ArrayBuffer.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/ArrayBuffer.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubArrayBuffer() instanceof ArrayBuffer (Subclass instanceof Heritage) +features: [TypedArray, ArrayBuffer] +flags: [generated] +---*/ + + +const Subclass = class extends ArrayBuffer {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof ArrayBuffer); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigInt64Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigInt64Array.js new file mode 100644 index 0000000000..3ac3ee4c1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigInt64Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/BigInt64Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubBigInt64Array() instanceof BigInt64Array (Subclass instanceof Heritage) +features: [TypedArray, BigInt] +flags: [generated] +---*/ + + +const Subclass = class extends BigInt64Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof BigInt64Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigUint64Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigUint64Array.js new file mode 100644 index 0000000000..2930d817a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-BigUint64Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/BigUint64Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubBigUint64Array() instanceof BigUint64Array (Subclass instanceof Heritage) +features: [TypedArray, BigInt] +flags: [generated] +---*/ + + +const Subclass = class extends BigUint64Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof BigUint64Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Boolean.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Boolean.js new file mode 100644 index 0000000000..367987224b --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Boolean.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Boolean.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubBoolean() instanceof Boolean (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends Boolean {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Boolean); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-DataView.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-DataView.js new file mode 100644 index 0000000000..61980eecbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-DataView.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/DataView.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubDataView() instanceof DataView (Subclass instanceof Heritage) +features: [TypedArray, DataView] +flags: [generated] +---*/ + + +const Subclass = class extends DataView {} + +const sub = new Subclass(new ArrayBuffer(1)); +assert(sub instanceof Subclass); +assert(sub instanceof DataView); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Date.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Date.js new file mode 100644 index 0000000000..e943ecf8db --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Date.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Date.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubDate() instanceof Date (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends Date {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Date); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Error.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Error.js new file mode 100644 index 0000000000..47f359b910 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Error.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Error.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubError() instanceof Error (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends Error {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Error); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-EvalError.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-EvalError.js new file mode 100644 index 0000000000..2fa23ce656 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-EvalError.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/EvalError.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubEvalError() instanceof EvalError (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends EvalError {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof EvalError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float32Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float32Array.js new file mode 100644 index 0000000000..e97b6a9c7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float32Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Float32Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubFloat32Array() instanceof Float32Array (Subclass instanceof Heritage) +features: [TypedArray, Float32Array] +flags: [generated] +---*/ + + +const Subclass = class extends Float32Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Float32Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float64Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float64Array.js new file mode 100644 index 0000000000..03f107e67c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Float64Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Float64Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubFloat64Array() instanceof Float64Array (Subclass instanceof Heritage) +features: [TypedArray, Float64Array] +flags: [generated] +---*/ + + +const Subclass = class extends Float64Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Float64Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Function.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Function.js new file mode 100644 index 0000000000..a78cb3c833 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Function.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Function.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubFunction() instanceof Function (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends Function {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Function); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int16Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int16Array.js new file mode 100644 index 0000000000..2db4ba9cd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int16Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Int16Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubInt16Array() instanceof Int16Array (Subclass instanceof Heritage) +features: [TypedArray, Int16Array] +flags: [generated] +---*/ + + +const Subclass = class extends Int16Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Int16Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int32Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int32Array.js new file mode 100644 index 0000000000..998a7ec0b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int32Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Int32Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubInt32Array() instanceof Int32Array (Subclass instanceof Heritage) +features: [TypedArray, Int32Array] +flags: [generated] +---*/ + + +const Subclass = class extends Int32Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Int32Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int8Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int8Array.js new file mode 100644 index 0000000000..3da14a4171 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Int8Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Int8Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubInt8Array() instanceof Int8Array (Subclass instanceof Heritage) +features: [TypedArray, Int8Array] +flags: [generated] +---*/ + + +const Subclass = class extends Int8Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Int8Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Map.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Map.js new file mode 100644 index 0000000000..5d642e0d33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Map.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Map.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubMap() instanceof Map (Subclass instanceof Heritage) +features: [Map] +flags: [generated] +---*/ + + +const Subclass = class extends Map {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Map); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Number.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Number.js new file mode 100644 index 0000000000..970578e470 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Number.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Number.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubNumber() instanceof Number (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends Number {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Number); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Object.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Object.js new file mode 100644 index 0000000000..c5a3b317f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Object.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Object.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubObject() instanceof Object (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends Object {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Object); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Promise.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Promise.js new file mode 100644 index 0000000000..e9f59dd151 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Promise.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Promise.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubPromise() instanceof Promise (Subclass instanceof Heritage) +features: [Promise] +flags: [generated] +---*/ + + +const Subclass = class extends Promise {} + +const sub = new Subclass(() => {}); +assert(sub instanceof Subclass); +assert(sub instanceof Promise); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RangeError.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RangeError.js new file mode 100644 index 0000000000..d08b268c10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RangeError.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/RangeError.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubRangeError() instanceof RangeError (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends RangeError {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof RangeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ReferenceError.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ReferenceError.js new file mode 100644 index 0000000000..76d69bb8bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-ReferenceError.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/ReferenceError.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubReferenceError() instanceof ReferenceError (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends ReferenceError {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RegExp.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RegExp.js new file mode 100644 index 0000000000..cbcb238f79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-RegExp.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/RegExp.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubRegExp() instanceof RegExp (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends RegExp {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof RegExp); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Set.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Set.js new file mode 100644 index 0000000000..abf77b7a3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Set.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Set.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubSet() instanceof Set (Subclass instanceof Heritage) +features: [Set] +flags: [generated] +---*/ + + +const Subclass = class extends Set {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Set); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SharedArrayBuffer.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SharedArrayBuffer.js new file mode 100644 index 0000000000..ff42b128e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SharedArrayBuffer.js @@ -0,0 +1,18 @@ +// |reftest| skip-if(!this.hasOwnProperty('SharedArrayBuffer')) -- SharedArrayBuffer is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/SharedArrayBuffer.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubSharedArrayBuffer() instanceof SharedArrayBuffer (Subclass instanceof Heritage) +features: [SharedArrayBuffer] +flags: [generated] +---*/ + + +const Subclass = class extends SharedArrayBuffer {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof SharedArrayBuffer); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-String.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-String.js new file mode 100644 index 0000000000..b5197f212a --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-String.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/String.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubString() instanceof String (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends String {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof String); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SyntaxError.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SyntaxError.js new file mode 100644 index 0000000000..71120e6eb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-SyntaxError.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/SyntaxError.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubSyntaxError() instanceof SyntaxError (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends SyntaxError {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof SyntaxError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-TypeError.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-TypeError.js new file mode 100644 index 0000000000..0990fda4ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-TypeError.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/TypeError.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubTypeError() instanceof TypeError (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends TypeError {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-URIError.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-URIError.js new file mode 100644 index 0000000000..69d04e2375 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-URIError.js @@ -0,0 +1,16 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/URIError.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubURIError() instanceof URIError (Subclass instanceof Heritage) +flags: [generated] +---*/ + + +const Subclass = class extends URIError {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof URIError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint16Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint16Array.js new file mode 100644 index 0000000000..4d0898087c --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint16Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Uint16Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubUint16Array() instanceof Uint16Array (Subclass instanceof Heritage) +features: [TypedArray, Uint16Array] +flags: [generated] +---*/ + + +const Subclass = class extends Uint16Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Uint16Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint32Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint32Array.js new file mode 100644 index 0000000000..ebb0a69023 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint32Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Uint32Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubUint32Array() instanceof Uint32Array (Subclass instanceof Heritage) +features: [TypedArray, Uint32Array] +flags: [generated] +---*/ + + +const Subclass = class extends Uint32Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Uint32Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8Array.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8Array.js new file mode 100644 index 0000000000..fe118ed742 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8Array.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Uint8Array.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubUint8Array() instanceof Uint8Array (Subclass instanceof Heritage) +features: [TypedArray, Uint8Array] +flags: [generated] +---*/ + + +const Subclass = class extends Uint8Array {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Uint8Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8ClampedArray.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8ClampedArray.js new file mode 100644 index 0000000000..a23e7662b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-Uint8ClampedArray.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/Uint8ClampedArray.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubUint8ClampedArray() instanceof Uint8ClampedArray (Subclass instanceof Heritage) +features: [TypedArray, Uint8ClampedArray] +flags: [generated] +---*/ + + +const Subclass = class extends Uint8ClampedArray {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof Uint8ClampedArray); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakMap.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakMap.js new file mode 100644 index 0000000000..8af4b9fc98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakMap.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/WeakMap.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubWeakMap() instanceof WeakMap (Subclass instanceof Heritage) +features: [WeakMap] +flags: [generated] +---*/ + + +const Subclass = class extends WeakMap {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof WeakMap); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakRef.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakRef.js new file mode 100644 index 0000000000..5dd3ef78af --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakRef.js @@ -0,0 +1,18 @@ +// |reftest| skip-if(!this.hasOwnProperty('WeakRef')) -- WeakRef is not enabled unconditionally +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/WeakRef.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubWeakRef() instanceof WeakRef (Subclass instanceof Heritage) +features: [WeakRef] +flags: [generated] +---*/ + + +const Subclass = class extends WeakRef {} + +const sub = new Subclass({}); +assert(sub instanceof Subclass); +assert(sub instanceof WeakRef); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakSet.js b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakSet.js new file mode 100644 index 0000000000..0d03d32ff9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/class/subclass-builtins/subclass-WeakSet.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/subclass-builtins/WeakSet.case +// - src/subclass-builtins/default/expression.template +/*--- +description: new SubWeakSet() instanceof WeakSet (Subclass instanceof Heritage) +features: [WeakSet] +flags: [generated] +---*/ + + +const Subclass = class extends WeakSet {} + +const sub = new Subclass(); +assert(sub instanceof Subclass); +assert(sub instanceof WeakSet); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/abrupt-is-a-short-circuit.js b/js/src/tests/test262/language/expressions/coalesce/abrupt-is-a-short-circuit.js new file mode 100644 index 0000000000..fb04d2c0ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/abrupt-is-a-short-circuit.js @@ -0,0 +1,60 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Abrupt completions are also a Short circuit and prevent evaluation of the right-side expressions +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; +function poison() { + throw new Test262Error('poison handled'); +} + +function morePoison() { + throw 'poison!!!!'; +} + +x = undefined; +assert.throws(Test262Error, function() { + undefined ?? poison() ?? morePoison(); +}, 'undefined ?? poison() ?? morePoison();'); + +x = undefined; +assert.throws(Test262Error, function() { + null ?? poison() ?? morePoison(); +}, 'null ?? poison() ?? morePoison();'); + +assert.throws(Test262Error, function() { + poison() ?? morePoison(); +}, 'poison() ?? morePoison();'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/browser.js b/js/src/tests/test262/language/expressions/coalesce/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-and.js b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-and.js new file mode 100644 index 0000000000..3341112b8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-and.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Cannot immediately contain, or be contained within, an && or || operation. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression +features: [coalesce-expression] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0 && 0 ?? true; diff --git a/js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-or.js b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-or.js new file mode 100644 index 0000000000..2cbcae7549 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-head-with-logical-or.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Cannot immediately contain, or be contained within, an && or || operation. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression +features: [coalesce-expression] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0 || 0 ?? true; diff --git a/js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js new file mode 100644 index 0000000000..b11323b4fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-and.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + If the CoalesceExpressionHead is undefined or null, follow return the right-side value. + Otherwise, return the left-side value. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression +features: [coalesce-expression] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0 ?? 0 && true; diff --git a/js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-or.js b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-or.js new file mode 100644 index 0000000000..98326f3dc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/cannot-chain-tail-with-logical-or.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + If the CoalesceExpressionHead is undefined or null, follow return the right-side value. + Otherwise, return the left-side value. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression +features: [coalesce-expression] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0 ?? 0 || true; diff --git a/js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-and.js b/js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-and.js new file mode 100644 index 0000000000..edcf93b557 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-and.js @@ -0,0 +1,55 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + CoalesceExpression is chainable with the LogicalANDExpression is any is covered. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = undefined; +x = (null ?? 41) && 42; +assert.sameValue(x, 42, '(null ?? 41) && 42'); + +x = undefined; +x = null ?? (41 && 42); +assert.sameValue(x, 42, 'null ?? (41 && 42)`'); + +x = undefined; +x = (41 && 42) ?? null; +assert.sameValue(x, 42, '(41 && 42) ?? null'); + +x = undefined; +x = 41 && (null ?? 42); +assert.sameValue(x, 42, '41 && (null ?? 42)`'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-or.js b/js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-or.js new file mode 100644 index 0000000000..79e9a6dd9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/chainable-if-parenthesis-covered-logical-or.js @@ -0,0 +1,63 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + CoalesceExpression is chainable with the LogicalORExpression is any is covered. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = undefined; +x = (null ?? 42) || 43; +assert.sameValue(x, 42, '(null ?? 42) || 43'); + +x = undefined; +x = null ?? (42 || 43); +assert.sameValue(x, 42, 'null ?? (42 || 43)`'); + +x = undefined; +x = (null || 42) ?? 43; +assert.sameValue(x, 42, '(null || 42) ?? 43'); + +x = undefined; +x = null || (42 ?? 43); +assert.sameValue(x, 42, 'null || (42 ?? 43)`'); + +x = undefined; +x = (42 || 43) ?? null; +assert.sameValue(x, 42, '(42 || 43) ?? null'); + +x = undefined; +x = 42 || (null ?? 43); +assert.sameValue(x, 42, '42 || (null ?? 43)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-and.js b/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-and.js new file mode 100644 index 0000000000..dac7e04fc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-and.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + CoalesceExpression is chainable with the BitwiseANDExpression +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = null ?? 42 & 43; +assert.sameValue(x, 42, 'null ?? 42 & 43'); + +x = undefined ?? 42 & 43; +assert.sameValue(x, 42, 'null ?? 42 & 43'); + +x = false ?? 42 & 43; +assert.sameValue(x, false, 'false ?? 42 & 43'); + +x = true ?? 42 & 43; +assert.sameValue(x, true, 'true ?? 42 & 43'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-or.js b/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-or.js new file mode 100644 index 0000000000..214d4fd9aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-or.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + CoalesceExpression is chainable with the BitwiseORExpression +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = null ?? 1 | 42; +assert.sameValue(x, 43, 'null ?? 1 | 42'); + +x = undefined ?? 1 | 42; +assert.sameValue(x, 43, 'null ?? 1 | 42'); + +x = false ?? 1 | 42; +assert.sameValue(x, false, 'false ?? 1 | 42'); + +x = true ?? 1 | 42; +assert.sameValue(x, true, 'true ?? 1 | 42'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-xor.js b/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-xor.js new file mode 100644 index 0000000000..a3b6ad4ab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/chainable-with-bitwise-xor.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + CoalesceExpression is chainable with the BitwiseXORExpression +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = null ?? 1 ^ 42; +assert.sameValue(x, 43, 'null ?? 1 ^ 42'); + +x = undefined ?? 1 ^ 42; +assert.sameValue(x, 43, 'null ?? 1 ^ 42'); + +x = false ?? 1 ^ 42; +assert.sameValue(x, false, 'false ?? 1 ^ 42'); + +x = true ?? 1 ^ 42; +assert.sameValue(x, true, 'true ?? 1 ^ 42'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/chainable.js b/js/src/tests/test262/language/expressions/coalesce/chainable.js new file mode 100644 index 0000000000..09ad90452a --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/chainable.js @@ -0,0 +1,52 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + If the CoalesceExpressionHead is undefined or null, follow return the right-side value. + Otherwise, return the left-side value. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = null ?? undefined ?? 42; +assert.sameValue(x, 42, 'null ?? undefined ?? 42'); + +x = undefined ?? null ?? 42; +assert.sameValue(x, 42, 'undefined ?? null ?? 42'); + +x = null ?? null ?? 42; +assert.sameValue(x, 42, 'null ?? null ?? 42'); + +x = undefined ?? undefined ?? 42; +assert.sameValue(x, 42, 'null ?? null ?? 42'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/follows-null.js b/js/src/tests/test262/language/expressions/coalesce/follows-null.js new file mode 100644 index 0000000000..82a95419ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/follows-null.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + If the CoalesceExpressionHead is null, follow return the right-side eval. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = null ?? 42; +assert.sameValue(x, 42, 'null ?? 42'); + +x = null ?? undefined; +assert.sameValue(x, undefined, 'null ?? undefined'); + +x = null ?? null; +assert.sameValue(x, null, 'null ?? null'); + +x = null ?? false; +assert.sameValue(x, false, 'null ?? false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/follows-undefined.js b/js/src/tests/test262/language/expressions/coalesce/follows-undefined.js new file mode 100644 index 0000000000..0728ed1ff2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/follows-undefined.js @@ -0,0 +1,51 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + If the CoalesceExpressionHead is undefined, follow return the right-side eval. +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = undefined ?? 42; +assert.sameValue(x, 42, 'undefined ?? 42'); + +x = undefined ?? undefined; +assert.sameValue(x, undefined, 'undefined ?? undefined'); + +x = undefined ?? null; +assert.sameValue(x, null, 'undefined ?? null'); + +x = undefined ?? false; +assert.sameValue(x, false, 'undefined ?? false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/shell.js b/js/src/tests/test262/language/expressions/coalesce/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-0.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-0.js new file mode 100644 index 0000000000..547f62a1cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-0.js @@ -0,0 +1,83 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (0) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = undefined; +x = 0 ?? 1; +assert.sameValue(x, 0, '0 ?? 1'); + +x = undefined; +x = 0 ?? null; +assert.sameValue(x, 0, '0 ?? null'); + +x = undefined; +x = 0 ?? undefined; +assert.sameValue(x, 0, '0 ?? undefined'); + +x = undefined; +x = 0 ?? null ?? undefined; +assert.sameValue(x, 0, '0 ?? null ?? undefined'); + +x = undefined; +x = 0 ?? undefined ?? null; +assert.sameValue(x, 0, '0 ?? undefined ?? null'); + +x = undefined; +x = 0 ?? null ?? null; +assert.sameValue(x, 0, '0 ?? null ?? null'); + +x = undefined; +x = 0 ?? undefined ?? undefined; +assert.sameValue(x, 0, '0 ?? null ?? null'); + +x = undefined; +x = null ?? 0 ?? null; +assert.sameValue(x, 0, 'null ?? 0 ?? null'); + +x = undefined; +x = null ?? 0 ?? undefined; +assert.sameValue(x, 0, 'null ?? 0 ?? undefined'); + +x = undefined; +x = undefined ?? 0 ?? null; +assert.sameValue(x, 0, 'undefined ?? 0 ?? null'); + +x = undefined; +x = undefined ?? 0 ?? undefined; +assert.sameValue(x, 0, 'undefined ?? 0 ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-42.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-42.js new file mode 100644 index 0000000000..b30d905f2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-42.js @@ -0,0 +1,83 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (42) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = undefined; +x = 42 ?? 1; +assert.sameValue(x, 42, '42 ?? 1'); + +x = undefined; +x = 42 ?? null; +assert.sameValue(x, 42, '42 ?? null'); + +x = undefined; +x = 42 ?? undefined; +assert.sameValue(x, 42, '42 ?? undefined'); + +x = undefined; +x = 42 ?? null ?? undefined; +assert.sameValue(x, 42, '42 ?? null ?? undefined'); + +x = undefined; +x = 42 ?? undefined ?? null; +assert.sameValue(x, 42, '42 ?? undefined ?? null'); + +x = undefined; +x = 42 ?? null ?? null; +assert.sameValue(x, 42, '42 ?? null ?? null'); + +x = undefined; +x = 42 ?? undefined ?? undefined; +assert.sameValue(x, 42, '42 ?? null ?? null'); + +x = undefined; +x = null ?? 42 ?? null; +assert.sameValue(x, 42, 'null ?? 42 ?? null'); + +x = undefined; +x = null ?? 42 ?? undefined; +assert.sameValue(x, 42, 'null ?? 42 ?? undefined'); + +x = undefined; +x = undefined ?? 42 ?? null; +assert.sameValue(x, 42, 'undefined ?? 42 ?? null'); + +x = undefined; +x = undefined ?? 42 ?? undefined; +assert.sameValue(x, 42, 'undefined ?? 42 ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-empty-string.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-empty-string.js new file mode 100644 index 0000000000..c513e2cbc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-empty-string.js @@ -0,0 +1,84 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (the empty string) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; +var str = ''; + +x = undefined; +x = str ?? 1; +assert.sameValue(x, str, 'str ?? 1'); + +x = undefined; +x = str ?? null; +assert.sameValue(x, str, 'str ?? null'); + +x = undefined; +x = str ?? undefined; +assert.sameValue(x, str, 'str ?? undefined'); + +x = undefined; +x = str ?? null ?? undefined; +assert.sameValue(x, str, 'str ?? null ?? undefined'); + +x = undefined; +x = str ?? undefined ?? null; +assert.sameValue(x, str, 'str ?? undefined ?? null'); + +x = undefined; +x = str ?? null ?? null; +assert.sameValue(x, str, 'str ?? null ?? null'); + +x = undefined; +x = str ?? undefined ?? undefined; +assert.sameValue(x, str, 'str ?? null ?? null'); + +x = undefined; +x = null ?? str ?? null; +assert.sameValue(x, str, 'null ?? str ?? null'); + +x = undefined; +x = null ?? str ?? undefined; +assert.sameValue(x, str, 'null ?? str ?? undefined'); + +x = undefined; +x = undefined ?? str ?? null; +assert.sameValue(x, str, 'undefined ?? str ?? null'); + +x = undefined; +x = undefined ?? str ?? undefined; +assert.sameValue(x, str, 'undefined ?? str ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-false.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-false.js new file mode 100644 index 0000000000..d235729393 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-false.js @@ -0,0 +1,83 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (false) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = undefined; +x = false ?? 1; +assert.sameValue(x, false, 'false ?? 1'); + +x = undefined; +x = false ?? null; +assert.sameValue(x, false, 'false ?? null'); + +x = undefined; +x = false ?? undefined; +assert.sameValue(x, false, 'false ?? undefined'); + +x = undefined; +x = false ?? null ?? undefined; +assert.sameValue(x, false, 'false ?? null ?? undefined'); + +x = undefined; +x = false ?? undefined ?? null; +assert.sameValue(x, false, 'false ?? undefined ?? null'); + +x = undefined; +x = false ?? null ?? null; +assert.sameValue(x, false, 'false ?? null ?? null'); + +x = undefined; +x = false ?? undefined ?? undefined; +assert.sameValue(x, false, 'false ?? null ?? null'); + +x = undefined; +x = null ?? false ?? null; +assert.sameValue(x, false, 'null ?? false ?? null'); + +x = undefined; +x = null ?? false ?? undefined; +assert.sameValue(x, false, 'null ?? false ?? undefined'); + +x = undefined; +x = undefined ?? false ?? null; +assert.sameValue(x, false, 'undefined ?? false ?? null'); + +x = undefined; +x = undefined ?? false ?? undefined; +assert.sameValue(x, false, 'undefined ?? false ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-object.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-object.js new file mode 100644 index 0000000000..5f2eee11e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-object.js @@ -0,0 +1,91 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (object) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; +var obj = { + toString() { + return null; + }, + valueOf() { + return null; + } +}; + +x = undefined; +x = obj ?? 1; +assert.sameValue(x, obj, 'obj ?? 1'); + +x = undefined; +x = obj ?? null; +assert.sameValue(x, obj, 'obj ?? null'); + +x = undefined; +x = obj ?? undefined; +assert.sameValue(x, obj, 'obj ?? undefined'); + +x = undefined; +x = obj ?? null ?? undefined; +assert.sameValue(x, obj, 'obj ?? null ?? undefined'); + +x = undefined; +x = obj ?? undefined ?? null; +assert.sameValue(x, obj, 'obj ?? undefined ?? null'); + +x = undefined; +x = obj ?? null ?? null; +assert.sameValue(x, obj, 'obj ?? null ?? null'); + +x = undefined; +x = obj ?? undefined ?? undefined; +assert.sameValue(x, obj, 'obj ?? null ?? null'); + +x = undefined; +x = null ?? obj ?? null; +assert.sameValue(x, obj, 'null ?? obj ?? null'); + +x = undefined; +x = null ?? obj ?? undefined; +assert.sameValue(x, obj, 'null ?? obj ?? undefined'); + +x = undefined; +x = undefined ?? obj ?? null; +assert.sameValue(x, obj, 'undefined ?? obj ?? null'); + +x = undefined; +x = undefined ?? obj ?? undefined; +assert.sameValue(x, obj, 'undefined ?? obj ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-string.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-string.js new file mode 100644 index 0000000000..9979a685cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-string.js @@ -0,0 +1,84 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (string) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; +var str = 'undefined'; + +x = undefined; +x = str ?? 1; +assert.sameValue(x, str, 'str ?? 1'); + +x = undefined; +x = str ?? null; +assert.sameValue(x, str, 'str ?? null'); + +x = undefined; +x = str ?? undefined; +assert.sameValue(x, str, 'str ?? undefined'); + +x = undefined; +x = str ?? null ?? undefined; +assert.sameValue(x, str, 'str ?? null ?? undefined'); + +x = undefined; +x = str ?? undefined ?? null; +assert.sameValue(x, str, 'str ?? undefined ?? null'); + +x = undefined; +x = str ?? null ?? null; +assert.sameValue(x, str, 'str ?? null ?? null'); + +x = undefined; +x = str ?? undefined ?? undefined; +assert.sameValue(x, str, 'str ?? null ?? null'); + +x = undefined; +x = null ?? str ?? null; +assert.sameValue(x, str, 'null ?? str ?? null'); + +x = undefined; +x = null ?? str ?? undefined; +assert.sameValue(x, str, 'null ?? str ?? undefined'); + +x = undefined; +x = undefined ?? str ?? null; +assert.sameValue(x, str, 'undefined ?? str ?? null'); + +x = undefined; +x = undefined ?? str ?? undefined; +assert.sameValue(x, str, 'undefined ?? str ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-symbol.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-symbol.js new file mode 100644 index 0000000000..827c6e8535 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-symbol.js @@ -0,0 +1,84 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (Symbol) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; +var s = Symbol(); + +x = undefined; +x = s ?? 1; +assert.sameValue(x, s, 's ?? null'); + +x = undefined; +x = s ?? null; +assert.sameValue(x, s, 's ?? null'); + +x = undefined; +x = s ?? undefined; +assert.sameValue(x, s, 's ?? undefined'); + +x = undefined; +x = s ?? null ?? undefined; +assert.sameValue(x, s, 's ?? null ?? undefined'); + +x = undefined; +x = s ?? undefined ?? null; +assert.sameValue(x, s, 's ?? undefined ?? null'); + +x = undefined; +x = s ?? null ?? null; +assert.sameValue(x, s, 's ?? null ?? null'); + +x = undefined; +x = s ?? undefined ?? undefined; +assert.sameValue(x, s, 's ?? null ?? null'); + +x = undefined; +x = null ?? s ?? null; +assert.sameValue(x, s, 'null ?? s ?? null'); + +x = undefined; +x = null ?? s ?? undefined; +assert.sameValue(x, s, 'null ?? s ?? undefined'); + +x = undefined; +x = undefined ?? s ?? null; +assert.sameValue(x, s, 'undefined ?? s ?? null'); + +x = undefined; +x = undefined ?? s ?? undefined; +assert.sameValue(x, s, 'undefined ?? s ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-true.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-true.js new file mode 100644 index 0000000000..9b24181ab3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-number-true.js @@ -0,0 +1,83 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit if the CoalesceExpressionHead is not undefined or null (true) +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; + +x = undefined; +x = true ?? 1; +assert.sameValue(x, true, 'true ?? null'); + +x = undefined; +x = true ?? null; +assert.sameValue(x, true, 'true ?? null'); + +x = undefined; +x = true ?? undefined; +assert.sameValue(x, true, 'true ?? undefined'); + +x = undefined; +x = true ?? null ?? undefined; +assert.sameValue(x, true, 'true ?? null ?? undefined'); + +x = undefined; +x = true ?? undefined ?? null; +assert.sameValue(x, true, 'true ?? undefined ?? null'); + +x = undefined; +x = true ?? null ?? null; +assert.sameValue(x, true, 'true ?? null ?? null'); + +x = undefined; +x = true ?? undefined ?? undefined; +assert.sameValue(x, true, 'true ?? null ?? null'); + +x = undefined; +x = null ?? true ?? null; +assert.sameValue(x, true, 'null ?? true ?? null'); + +x = undefined; +x = null ?? true ?? undefined; +assert.sameValue(x, true, 'null ?? true ?? undefined'); + +x = undefined; +x = undefined ?? true ?? null; +assert.sameValue(x, true, 'undefined ?? true ?? null'); + +x = undefined; +x = undefined ?? true ?? undefined; +assert.sameValue(x, true, 'undefined ?? true ?? undefined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/short-circuit-prevents-evaluation.js b/js/src/tests/test262/language/expressions/coalesce/short-circuit-prevents-evaluation.js new file mode 100644 index 0000000000..14cbd109e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/short-circuit-prevents-evaluation.js @@ -0,0 +1,58 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Short circuit can prevent evaluation of the right-side expressions +esid: sec-conditional-operator +info: | + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression + + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + Runtime Semantics: Evaluation + + CoalesceExpression:CoalesceExpressionHead??BitwiseORExpression + + 1. Let lref be the result of evaluating CoalesceExpressionHead. + 2. Let lval be ? GetValue(lref). + 3. If lval is undefined or null, + a. Let rref be the result of evaluating BitwiseORExpression. + b. Return ? GetValue(rref). + 4. Otherwise, return lval. +features: [coalesce-expression] +---*/ + +var x; +function poison() { + throw new Test262Error('should not evaluate poison'); +} + +x = undefined; +x = undefined ?? 42 ?? undefined ?? poison(); +assert.sameValue(x, 42); + +x = undefined; +x = 42 ?? undefined ?? poison(); +assert.sameValue(x, 42); + +x = undefined; +x = undefined ?? 42 ?? poison(); +assert.sameValue(x, 42); + +x = undefined; +x = 42 ?? poison(); +assert.sameValue(x, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/tco-pos-null-strict.js b/js/src/tests/test262/language/expressions/coalesce/tco-pos-null-strict.js new file mode 100644 index 0000000000..9030e2227c --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/tco-pos-null-strict.js @@ -0,0 +1,30 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +info: | + Expression Rules + + CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression + + 1. Return HasCallInTailPosition of BitwiseORExpression with argument call. +flags: [onlyStrict] +features: [tail-call-optimization, coalesce-expression] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return null ?? f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/coalesce/tco-pos-undefined-strict.js b/js/src/tests/test262/language/expressions/coalesce/tco-pos-undefined-strict.js new file mode 100644 index 0000000000..70f6ff59ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/coalesce/tco-pos-undefined-strict.js @@ -0,0 +1,30 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +info: | + Expression Rules + + CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression + + 1. Return HasCallInTailPosition of BitwiseORExpression with argument call. +flags: [onlyStrict] +features: [tail-call-optimization, coalesce-expression] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return undefined ?? f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A1.js b/js/src/tests/test262/language/expressions/comma/S11.14_A1.js new file mode 100644 index 0000000000..ed057b15fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/comma/S11.14_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between Expression and , or between , and + AssignmentExpression are allowed +es5id: 11.14_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if ((eval("false\u0009,\u0009true")) !== true) { + throw new Test262Error('#1: (false\\u0009,\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("false\u000B,\u000Btrue")) !== true) { + throw new Test262Error('#2: (false\\u000B,\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("false\u000C,\u000Ctrue")) !== true) { + throw new Test262Error('#3: (false\\u000C,\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("false\u0020,\u0020true")) !== true) { + throw new Test262Error('#4: (false\\u0020,\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("false\u00A0,\u00A0true")) !== true) { + throw new Test262Error('#5: (false\\u00A0,\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("false\u000A,\u000Atrue")) !== true) { + throw new Test262Error('#6: (false\\u000A,\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("false\u000D,\u000Dtrue")) !== true) { + throw new Test262Error('#7: (false\\u000D,\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("false\u2028,\u2028true")) !== true) { + throw new Test262Error('#8: (false\\u2028,\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("false\u2029,\u2029true")) !== true) { + throw new Test262Error('#9: (false\\u2029,\\u2029true) === true'); +} + + +//CHECK#10 +if ((eval("false\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029,\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) { + throw new Test262Error('#10: (false\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029,\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js new file mode 100644 index 0000000000..dae0979097 --- /dev/null +++ b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T1.js @@ -0,0 +1,53 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.14_A2.1_T1 +description: Either Expression is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((1,2) !== 2) { + throw new Test262Error('#1: (1,2) === 2. Actual: ' + ((1,2))); +} + +//CHECK#2 +var x = 1; +if ((x, 2) !== 2) { + throw new Test262Error('#2: var x = 1; (x, 2) === 2. Actual: ' + ((x, 2))); +} + +//CHECK#3 +var y = 2; +if ((1, y) !== 2) { + throw new Test262Error('#3: var y = 2; (1, y) === 2. Actual: ' + ((1, y))); +} + +//CHECK#4 +var x = 1; +var y = 2; +if ((x, y) !== 2) { + throw new Test262Error('#4: var x = 1; var y = 2; (x, y) === 2. Actual: ' + ((x, y))); +} + +//CHECK#5 +var x = 1; +if ((x, x) !== 1) { + throw new Test262Error('#5: var x = 1; (x, x) === 1. Actual: ' + ((x, x))); +} + +//CHECK#6 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = true; +objecty.prop = 1.1; +if ((objectx.prop = false, objecty.prop) !== objecty.prop) { + throw new Test262Error('#6: var objectx = new Object(); var objecty = new Object(); objectx.prop = true; objecty.prop = 1; (objectx.prop = false, objecty.prop) === objecty.prop. Actual: ' + ((objectx.prop = false, objecty.prop))); +} else { + if (objectx.prop !== false) { + throw new Test262Error('#6: var objectx = new Object(); var objecty = new Object(); objectx.prop = true; objecty.prop = 1; objectx.prop = false, objecty.prop; objectx.prop === false'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js new file mode 100644 index 0000000000..ae38566aef --- /dev/null +++ b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.14_A2.1_T2 +description: If GetBase(Expression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x, 1; + throw new Test262Error('#1.1: x, 1 throw ReferenceError. Actual: ' + (x, 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x, 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js new file mode 100644 index 0000000000..758858f8e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/comma/S11.14_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.14_A2.1_T3 +description: If GetBase(AssigmentExpression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1, y; + throw new Test262Error('#1.1: 1, y throw ReferenceError. Actual: ' + (1, y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1, y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/comma/S11.14_A3.js b/js/src/tests/test262/language/expressions/comma/S11.14_A3.js new file mode 100644 index 0000000000..27e20205a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/comma/S11.14_A3.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Comma Operator evaluates all Expressions and returns the last of them +es5id: 11.14_A3 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +var y = 0; +var z = 0; +if ((x = 1, y = 2, z = 3) !== 3) { + throw new Test262Error('#1: var x = 0; var y = 0; var z = 0; (x = 1, y = 2, z = 3) === 3. Actual: ' + ((x = 1, y = 2, z = 3))); +} + +var x = 0; +var y = 0; +var z = 0; +x = 1, y = 2, z = 3; + +//CHECK#2 +if (x !== 1) { + throw new Test262Error('#2: var x = 0; var y = 0; var z = 0; x = 1, y = 2, z = 3; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +if (y !== 2) { + throw new Test262Error('#3: var x = 0; var y = 0; var z = 0; x = 1, y = 2, z = 3; y === 2. Actual: ' + (y)); +} + +//CHECK#4 +if (z !== 3) { + throw new Test262Error('#4: var x = 0; var y = 0; var z = 0; x = 1, y = 2, z = 3; z === 3. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/comma/browser.js b/js/src/tests/test262/language/expressions/comma/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/comma/shell.js b/js/src/tests/test262/language/expressions/comma/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/comma/tco-final-strict.js b/js/src/tests/test262/language/expressions/comma/tco-final-strict.js new file mode 100644 index 0000000000..f3998eb21c --- /dev/null +++ b/js/src/tests/test262/language/expressions/comma/tco-final-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return 0, f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-1-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-1-s.js new file mode 100644 index 0000000000..860b8ea7f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-1-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-1-s +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Compound + Assignment operator(*=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_1 *= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-10-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-10-s.js new file mode 100644 index 0000000000..2faafbc2c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-10-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-10-s +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Compound + Assignment operator(^=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_10 ^= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-11-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-11-s.js new file mode 100644 index 0000000000..eacdde129d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-11-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-11-s +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Compound + Assignment operator(|=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_11 |= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-12-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-12-s.js new file mode 100644 index 0000000000..64140e987a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-12-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-12-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(*=) evaluates to a resolvable reference +---*/ + + var _11_13_2_12 = 5 + _11_13_2_12 *= 2; + +assert.sameValue(_11_13_2_12, 10, '_11_13_2_12'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-13-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-13-s.js new file mode 100644 index 0000000000..fb49371147 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-13-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-13-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(/=) evaluates to a resolvable reference +---*/ + + var _11_13_2_13 = 6 + _11_13_2_13 /= 2; + +assert.sameValue(_11_13_2_13, 3, '_11_13_2_13'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-14-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-14-s.js new file mode 100644 index 0000000000..e765268f7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-14-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-14-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(%=) evaluates to a resolvable reference +---*/ + + var _11_13_2_14 = 5 + _11_13_2_14 %= 2; + +assert.sameValue(_11_13_2_14, 1, '_11_13_2_14'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-15-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-15-s.js new file mode 100644 index 0000000000..7ddb8bc132 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-15-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-15-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(>>>=) evaluates to a resolvable reference +---*/ + + var _11_13_2_15 = 8 + _11_13_2_15 >>>= 2; + +assert.sameValue(_11_13_2_15, 2, '_11_13_2_15'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-16-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-16-s.js new file mode 100644 index 0000000000..33163dc7a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-16-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-16-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(-=) evaluates to a resolvable reference +---*/ + + var _11_13_2_16 = 5 + _11_13_2_16 -= 2; + +assert.sameValue(_11_13_2_16, 3, '_11_13_2_16'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-17-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-17-s.js new file mode 100644 index 0000000000..6ad052276d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-17-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-17-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(<<=) evaluates to a resolvable reference +---*/ + + var _11_13_2_17 = 1; + _11_13_2_17 <<= 2; + +assert.sameValue(_11_13_2_17, 4, '_11_13_2_17'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-18-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-18-s.js new file mode 100644 index 0000000000..75bd0d8e4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-18-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-18-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(>>=) evaluates to a resolvable reference +---*/ + + var _11_13_2_18 = 4 + _11_13_2_18 >>= 2; + +assert.sameValue(_11_13_2_18, 1, '_11_13_2_18'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-19-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-19-s.js new file mode 100644 index 0000000000..dfe7f7f8e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-19-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-19-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(+=) evaluates to a resolvable reference +---*/ + + var _11_13_2_19 = -1 + _11_13_2_19 += 10; + +assert.sameValue(_11_13_2_19, 9, '_11_13_2_19'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-2-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-2-s.js new file mode 100644 index 0000000000..a5010a29ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-2-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-2-s +description: > + Strict Mode - ReferenceError is thrown if the LeftHandSideExpression of a + Compound Assignment operator(/=) evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_2 /= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-20-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-20-s.js new file mode 100644 index 0000000000..dbecd1e14d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-20-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-20-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(&=) evaluates to a resolvable reference +---*/ + + var _11_13_2_20 = 5 + _11_13_2_20 &= 3; + +assert.sameValue(_11_13_2_20, 1, '_11_13_2_20'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-21-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-21-s.js new file mode 100644 index 0000000000..525d3374a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-21-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-21-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(^=) evaluates to a resolvable reference +---*/ + + var _11_13_2_21 = 5 + _11_13_2_21 ^= 3; + +assert.sameValue(_11_13_2_21, 6, '_11_13_2_21'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-22-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-22-s.js new file mode 100644 index 0000000000..e8fd2bac20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-22-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-22-s +description: > + ReferenceError isn't thrown if the LeftHandSideExpression of a Compound + Assignment operator(|=) evaluates to a resolvable reference +---*/ + + var _11_13_2_22 = 5 + _11_13_2_22 |= 2; + +assert.sameValue(_11_13_2_22, 7, '_11_13_2_22'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-23-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-23-s-strict.js new file mode 100644 index 0000000000..dbfb3f9fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-23-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-23-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(*=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop *= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-24-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-24-s-strict.js new file mode 100644 index 0000000000..4f827d66c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-24-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-24-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(/=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop /= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-25-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-25-s-strict.js new file mode 100644 index 0000000000..761ab24cc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-25-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-25-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(%=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop %= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-26-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-26-s-strict.js new file mode 100644 index 0000000000..63d5b60be3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-26-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-26-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(+=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop += 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-27-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-27-s-strict.js new file mode 100644 index 0000000000..ac762ff2f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-27-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-27-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(-=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop -= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-28-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-28-s-strict.js new file mode 100644 index 0000000000..ab81ebf7e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-28-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-28-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(<<=) is a reference to a data + property with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop <<= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-29-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-29-s-strict.js new file mode 100644 index 0000000000..2f532dcc83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-29-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-29-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>=) is a reference to a data + property with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-30-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-30-s-strict.js new file mode 100644 index 0000000000..e4be71b5bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-30-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-30-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>>=) is a reference to a data + property with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>>= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-31-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-31-s-strict.js new file mode 100644 index 0000000000..151abacdd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-31-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-31-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(&=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop &= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js new file mode 100644 index 0000000000..8c3f5cc145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-32-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-32-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(^=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop ^= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-33-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-33-s-strict.js new file mode 100644 index 0000000000..a8bf7c873a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-33-s-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-33-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(|=) is a reference to a data property + with the attribute value {[[Writable]]:false} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + value: 10, + writable: false, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop |= 20; +}); +assert.sameValue(obj.prop, 10, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-34-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-34-s-strict.js new file mode 100644 index 0000000000..d000837723 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-34-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-34-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(*=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop *= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-35-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-35-s-strict.js new file mode 100644 index 0000000000..4b30aabdf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-35-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-35-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(/=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop /= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-36-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-36-s-strict.js new file mode 100644 index 0000000000..0a475a6aad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-36-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-36-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(%=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop %= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-37-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-37-s-strict.js new file mode 100644 index 0000000000..46ca3ff608 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-37-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-37-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(+=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop += 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-38-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-38-s-strict.js new file mode 100644 index 0000000000..392974d4c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-38-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-38-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(-=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop -= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-39-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-39-s-strict.js new file mode 100644 index 0000000000..c23720a86b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-39-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-39-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(<<=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop <<= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-4-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-4-s.js new file mode 100644 index 0000000000..1bb1260b96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-4-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-4-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(+=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_4 += 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-40-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-40-s-strict.js new file mode 100644 index 0000000000..04bc4602d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-40-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-40-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-41-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-41-s-strict.js new file mode 100644 index 0000000000..29d9c2fe21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-41-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-41-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>>=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop >>>= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-42-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-42-s-strict.js new file mode 100644 index 0000000000..5e5a07de71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-42-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-42-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(&=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop &= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-43-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-43-s-strict.js new file mode 100644 index 0000000000..4a0468bd15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-43-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-43-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(^=) is a reference to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop ^= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-44-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-44-s-strict.js new file mode 100644 index 0000000000..8264e12584 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-44-s-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-44-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(|=) is a reference of to an accessor + property with the attribute value {[[Set]]:undefined} +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.defineProperty(obj, "prop", { + get: function () { + return 11; + }, + set: undefined, + enumerable: true, + configurable: true + }); +assert.throws(TypeError, function() { + obj.prop |= 20; +}); +assert.sameValue(obj.prop, 11, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-45-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-45-s-strict.js new file mode 100644 index 0000000000..3e6aca427d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-45-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-45-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(*=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len *= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-46-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-46-s-strict.js new file mode 100644 index 0000000000..fe68ee8985 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-46-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-46-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(/=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len /= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-47-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-47-s-strict.js new file mode 100644 index 0000000000..8b9086b469 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-47-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-47-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(%=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len %= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-48-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-48-s-strict.js new file mode 100644 index 0000000000..89ec389e67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-48-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-48-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(+=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len += 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-49-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-49-s-strict.js new file mode 100644 index 0000000000..5636fadc11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-49-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-49-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(-=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len -= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-5-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-5-s.js new file mode 100644 index 0000000000..ec5931d0e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-5-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-5-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(-=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_5 -= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-50-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-50-s-strict.js new file mode 100644 index 0000000000..a3ddae6c1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-50-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-50-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(<<=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len <<= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-51-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-51-s-strict.js new file mode 100644 index 0000000000..e257753fff --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-51-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-51-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len >>= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-52-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-52-s-strict.js new file mode 100644 index 0000000000..650f489673 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-52-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-52-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(>>>=) is a reference to a + non-existent property of an object whose [[Extensible]] internal + property if false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len >>>= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-53-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-53-s-strict.js new file mode 100644 index 0000000000..4ba94616ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-53-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-53-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(&=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len &= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-54-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-54-s-strict.js new file mode 100644 index 0000000000..3f50e7bd1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-54-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-54-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(^=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len ^= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-55-s-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-55-s-strict.js new file mode 100644 index 0000000000..f3e49586aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-55-s-strict.js @@ -0,0 +1,21 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-55-s +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a + Compound Assignment operator(|=) is a reference to a non-existent + property of an object whose [[Extensible]] internal property is + false +flags: [onlyStrict] +---*/ + + var obj = {}; + Object.preventExtensions(obj); +assert.throws(TypeError, function() { + obj.len |= 10; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-1gs-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-1gs-strict.js new file mode 100644 index 0000000000..e8aa0127d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-1gs-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-1gs +description: > + Strict Mode - SyntaxError is throw if the identifier eval appears + as the LeftHandSideExpression of a Compound Assignment operator(*=) +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +eval *= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-s.js new file mode 100644 index 0000000000..9e3576dfcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-6-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(<<=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_6 <<= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-8-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-8-s.js new file mode 100644 index 0000000000..820436d1dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-8-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-8-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(>>>=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_8 >>>= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-9-s.js b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-9-s.js new file mode 100644 index 0000000000..19586dc2ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/11.13.2-9-s.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-9-s +description: > + Strict Mode - ReferenceError is thrown if the + LeftHandSideExpression of a Compound Assignment operator(&=) + evaluates to an unresolvable reference +---*/ + + +assert.throws(ReferenceError, function() { + eval("_11_13_2_9 &= 1;"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.1.js new file mode 100644 index 0000000000..7e2334171d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.1 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x *= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x *= -1); +if (z !== -1) { + throw new Test262Error('#1: var x = 1; var z = (x *= -1); z === -1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = -1; +var z = (x *= y); +if (z !== -1) { + throw new Test262Error('#2: var x = 1; var y = -1; var z = (x *= y); z === -1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.10.js new file mode 100644 index 0000000000..c5be69d568 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.10.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.10 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x ^= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x ^= 1); +if (z !== 0) { + throw new Test262Error('#1: var x = 1; var z = (x ^= 1); z === 0. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x ^= y); +if (z !== 0) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x ^= y); z === 0. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.11.js new file mode 100644 index 0000000000..210c91c8d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.11.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.11 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x |= y" +---*/ + +//CHECK#1 +var x = 0; +var z = (x |= 1); +if (z !== 1) { + throw new Test262Error('#1: var x = 0; var z = (x |= 1); z === 1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 0; +var y = 1; +var z = (x |= y); +if (z !== 1) { + throw new Test262Error('#2: var x = 0; var y = 1; var z = (x |= y); z === 1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.2.js new file mode 100644 index 0000000000..955514fd90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.2 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x /= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x /= -1); +if (z !== -1) { + throw new Test262Error('#1: var x = 1; var z = (x /= -1); z === -1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = -1; +var z = (x /= y); +if (z !== -1) { + throw new Test262Error('#2: var x = 1; var y = -1; var z = (x /= y); z === -1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.3.js new file mode 100644 index 0000000000..f7ca64f6f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.3 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x %= y" +---*/ + +//CHECK#1 +var x = -1; +var z = (x %= 2); +if (z !== -1) { + throw new Test262Error('#1: var x = -1; var z = (x %= 2); z === -1. Actual: ' + (z)); +} + +//CHECK#2 +var x = -1; +var y = 2; +var z = (x %= y); +if (z !== -1) { + throw new Test262Error('#2: var x = -1; var y = 2; var z = (x %= y); z === -1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.4.js new file mode 100644 index 0000000000..0bd848bd88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.4.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.4 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x += y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x += 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 1; var z = (x += 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x += y); +if (z !== 2) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x += y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.5.js new file mode 100644 index 0000000000..9e35143575 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.5.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.5 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x -= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x -= 1); +if (z !== 0) { + throw new Test262Error('#1: var x = 1; var z = (x -= 1); z === 0. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x -= y); +if (z !== 0) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x -= y); z === 0. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.6.js new file mode 100644 index 0000000000..8f6a835c17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.6.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.6 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x <<= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x <<= 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 1; var z = (x <<= 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x <<= y); +if (z !== 2) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x <<= y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.7.js new file mode 100644 index 0000000000..844b57e2b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.7.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.7 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x >>= y" +---*/ + +//CHECK#1 +var x = 4; +var z = (x >>= 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 4; var z = (x >>= 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 4; +var y = 1; +var z = (x >>= y); +if (z !== 2) { + throw new Test262Error('#2: var x = 4; var y = 1; var z = (x >>= y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.8.js new file mode 100644 index 0000000000..88a43f406b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.8.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.8 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x >>>= y" +---*/ + +//CHECK#1 +var x = 4; +var z = (x >>>= 1); +if (z !== 2) { + throw new Test262Error('#1: var x = 4; var z = (x >>>= 1); z === 2. Actual: ' + (z)); +} + +//CHECK#2 +var x = 4; +var y = 1; +var z = (x >>>= y); +if (z !== 2) { + throw new Test262Error('#2: var x = 4; var y = 1; var z = (x >>>= y); z === 2. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.9.js new file mode 100644 index 0000000000..c51adfbd94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T1.9.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T1.9 +description: > + Either Type is not Reference or GetBase is not null, check + opeartor is "x &= y" +---*/ + +//CHECK#1 +var x = 1; +var z = (x &= 1); +if (z !== 1) { + throw new Test262Error('#1: var x = 1; var z = (x &= 1); z === 1. Actual: ' + (z)); +} + +//CHECK#2 +var x = 1; +var y = 1; +var z = (x &= y); +if (z !== 1) { + throw new Test262Error('#2: var x = 1; var y = 1; var z = (x &= y); z === 1. Actual: ' + (z)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.1.js new file mode 100644 index 0000000000..b9a3dace1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.1 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x *= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x *= y); + throw new Test262Error('#1.1: var x = 1; x *= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x *= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.10.js new file mode 100644 index 0000000000..2875b2aac7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.10.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.10 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x ^= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x ^= y); + throw new Test262Error('#1.1: var x = 1; x ^= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x ^= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.11.js new file mode 100644 index 0000000000..72f3178b67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.11.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.11 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x |= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x |= y); + throw new Test262Error('#1.1: var x = 1; x |= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x |= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.2.js new file mode 100644 index 0000000000..b029bb82b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.2 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x /= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x /= y); + throw new Test262Error('#1.1: var x = 1; x /= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x /= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.3.js new file mode 100644 index 0000000000..8a26baad37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.3 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x %= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x %= y); + throw new Test262Error('#1.1: var x = 1; x %= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x %= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.4.js new file mode 100644 index 0000000000..1c64664556 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.4 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x += y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x += y); + throw new Test262Error('#1.1: var x = 1; x += y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x += y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.5.js new file mode 100644 index 0000000000..59e817b30c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.5 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x -= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x -= y); + throw new Test262Error('#1.1: var x = 1; x -= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x -= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.6.js new file mode 100644 index 0000000000..458dea846d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.6.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.6 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x <<= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x <<= y); + throw new Test262Error('#1.1: var x = 1; x <<= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x <<= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.7.js new file mode 100644 index 0000000000..68a2753fbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.7.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.7 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x >>= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x >>= y); + throw new Test262Error('#1.1: var x = 1; x >>= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x >>= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.8.js new file mode 100644 index 0000000000..009e557a1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.8.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.8 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x >>>= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x >>>= y); + throw new Test262Error('#1.1: var x = 1; x >>>= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x >>>= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.9.js new file mode 100644 index 0000000000..118605d529 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T2.9.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T2.9 +description: > + If GetBase(AssigmentExpression) is null, throw ReferenceError. + Check operator is "x &= y" +---*/ + +//CHECK#1 +try { + var x = 1; + var z = (x &= y); + throw new Test262Error('#1.1: var x = 1; x &= y throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: var x = 1; x &= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.1.js new file mode 100644 index 0000000000..672f6fde95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.1 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x *= y" +---*/ + +//CHECK#1 +try { + var z = (x *= 1); + throw new Test262Error('#1.1: x *= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x *= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.10.js new file mode 100644 index 0000000000..eb372f48b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.10.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.10 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x ^= y" +---*/ + +//CHECK#1 +try { + var z = (x ^= 1); + throw new Test262Error('#1.1: x ^= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x ^= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.11.js new file mode 100644 index 0000000000..b312c4d1d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.11.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.11 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x |= y" +---*/ + +//CHECK#1 +try { + var z = (x |= 1); + throw new Test262Error('#1.1: x |= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x |= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.2.js new file mode 100644 index 0000000000..a6b251d30c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.2 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x /= y" +---*/ + +//CHECK#1 +try { + var z = (x /= 1); + throw new Test262Error('#1.1: x /= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x /= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.3.js new file mode 100644 index 0000000000..9719a44a6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.3 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x %= y" +---*/ + +//CHECK#1 +try { + var z = (x %= 1); + throw new Test262Error('#1.1: x %= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x %= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.4.js new file mode 100644 index 0000000000..1decafce4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.4.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.4 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x += y" +---*/ + +//CHECK#1 +try { + var z = (x += 1); + throw new Test262Error('#1.1: x += 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x += 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.5.js new file mode 100644 index 0000000000..da86bb97ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.5.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.5 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x -= y" +---*/ + +//CHECK#1 +try { + var z = (x -= 1); + throw new Test262Error('#1.1: x -= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x -= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.6.js new file mode 100644 index 0000000000..5c8b00b534 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.6.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.6 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x <<= y" +---*/ + +//CHECK#1 +try { + var z = (x <<= 1); + throw new Test262Error('#1.1: x <<= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x <<= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.7.js new file mode 100644 index 0000000000..4bde0847bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.7.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.7 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x >>= y" +---*/ + +//CHECK#1 +try { + var z = (x >>= 1); + throw new Test262Error('#1.1: x >>= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >>= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.8.js new file mode 100644 index 0000000000..8b765b8d4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.8.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.8 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x >>>= y" +---*/ + +//CHECK#1 +try { + var z = (x >>>= 1); + throw new Test262Error('#1.1: x >>>= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >>>= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.9.js new file mode 100644 index 0000000000..cce71d8b81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A2.1_T3.9.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses GetValue +es5id: 11.13.2_A2.1_T3.9 +description: > + If GetBase(LeftHandSideExpression) is null, throw ReferenceError. + Check operator is "x &= y" +---*/ + +//CHECK#1 +try { + var z = (x &= 1); + throw new Test262Error('#1.1: x &= 1 throw ReferenceError. Actual: ' + (z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x &= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T1.js new file mode 100644 index 0000000000..5a33755c68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T1 +description: Checking Expression and Variable statements for x *= y +---*/ + +//CHECK#1 +var x = 1; +x *= -1; +if (x !== -1) { + throw new Test262Error('#1: var x = 1; x *= -1; x === -1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y *= -1; +if (y !== -1) { + throw new Test262Error('#2: y = 1; y *= -1; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T10.js new file mode 100644 index 0000000000..7b096ad917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T10.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T10 +description: Checking Expression and Variable statements for x ^= y +---*/ + +//CHECK#1 +var x = 0; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#1: var x = 0; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y ^= 0; +if (y !== 1) { + throw new Test262Error('#2: y = 1; y ^= 0; y === 1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T11.js new file mode 100644 index 0000000000..eb777834cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T11.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T11 +description: Checking Expression and Variable statements for x |= y +---*/ + +//CHECK#1 +var x = 0; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: var x = 0; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y |= 0; +if (y !== 1) { + throw new Test262Error('#2: y = 1; y |= 0; y === 1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T2.js new file mode 100644 index 0000000000..d5e22f4a6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T2 +description: Checking Expression and Variable statements for x /= y +---*/ + +//CHECK#1 +var x = 1; +x /= -1; +if (x !== -1) { + throw new Test262Error('#1: var x = 1; x /= -1; x === -1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y /= -1; +if (y !== -1) { + throw new Test262Error('#2: y = 1; y /= -1; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T3.js new file mode 100644 index 0000000000..ef6eed7edc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T3 +description: Checking Expression and Variable statements for x %= y +---*/ + +//CHECK#1 +var x = -1; +x %= 2; +if (x !== -1) { + throw new Test262Error('#1: var x = -1; x %= 2; x === -1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = -1; +y %= 2; +if (y !== -1) { + throw new Test262Error('#2: y = -1; y %= 2; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T4.js new file mode 100644 index 0000000000..0c4fe2b2c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T4.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T4 +description: Checking Expression and Variable statements for x += y +---*/ + +//CHECK#1 +var x = 1; +x += 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 1; x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y += 1; +if (y !== 2) { + throw new Test262Error('#2: y = 1; y += 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T5.js new file mode 100644 index 0000000000..6a532210d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T5.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T5 +description: Checking Expression and Variable statements for x -= y +---*/ + +//CHECK#1 +var x = -1; +x -= 1; +if (x !== -2) { + throw new Test262Error('#1: var x = -1; x -= 1; x === -2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = -1; +y -= 1; +if (y !== -2) { + throw new Test262Error('#2: y = -1; y -= 1; y === -2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T6.js new file mode 100644 index 0000000000..7809b7bb3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T6.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T6 +description: Checking Expression and Variable statements for x <<= y +---*/ + +//CHECK#1 +var x = 1; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 1; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y <<= 1; +if (y !== 2) { + throw new Test262Error('#2: y = 1; y <<= 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T7.js new file mode 100644 index 0000000000..b3c807623c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T7.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T7 +description: Checking Expression and Variable statements for x >>= y +---*/ + +//CHECK#1 +var x = 4; +x >>= 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 4; x >>= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 4; +y >>= 1; +if (y !== 2) { + throw new Test262Error('#2: y = 4; y >>= 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T8.js new file mode 100644 index 0000000000..8acd706ac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T8.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T8 +description: Checking Expression and Variable statements for x >>>= y +---*/ + +//CHECK#1 +var x = 4; +x >>>= 1; +if (x !== 2) { + throw new Test262Error('#1: var x = 4; x >>>= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 4; +y >>>= 1; +if (y !== 2) { + throw new Test262Error('#2: y = 4; y >>>= 1; y === 2. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T9.js new file mode 100644 index 0000000000..54c5a9fdca --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.1_T9.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y uses PutValue(x, x @ y) +es5id: 11.13.2_A3.1_T9 +description: Checking Expression and Variable statements for x &= y +---*/ + +//CHECK#1 +var x = 1; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: var x = 1; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +var y; +y = 1; +y &= 1; +if (y !== 1) { + throw new Test262Error('#2: y = 1; y &= 1; y === 1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T1.js new file mode 100644 index 0000000000..1e3c5cfdc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T1 +description: Checking Expression and Variable statements for x *= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x *= -1); +if (x1 !== -1) { + throw new Test262Error('#1: var x = 1; var x1 = (x *= -1); x1 === -1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y *= -1); +if (y1 !== -1) { + throw new Test262Error('#2: y = 1; y1 = (y *= -1); y1 === -1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T10.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T10.js new file mode 100644 index 0000000000..71c96aec95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T10.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T10 +description: Checking Expression and Variable statements for x ^= y +---*/ + +//CHECK#1 +var x = 0; +var x1 = (x ^= 1); +if (x1 !== 1) { + throw new Test262Error('#1: var x = 0; var x1 = (x ^= 1); x1 === 1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y ^= 0); +if (y1 !== 1) { + throw new Test262Error('#2: y = 1; y1 = (y ^= 0); y1 === 1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T11.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T11.js new file mode 100644 index 0000000000..801efd8781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T11.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T11 +description: Checking Expression and Variable statements for x |= y +---*/ + +//CHECK#1 +var x = 0; +var x1 = (x |= 1); +if (x1 !== 1) { + throw new Test262Error('#1: var x = 0; var x1 = (x |= 1); x1 === 1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y |= 0); +if (y1 !== 1) { + throw new Test262Error('#2: y = 1; y1 = (y |= 0); y1 === 1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T2.js new file mode 100644 index 0000000000..29389a74e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T2 +description: Checking Expression and Variable statements for x /= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x /= -1); +if (x1 !== -1) { + throw new Test262Error('#1: var x = 1; var x1 = (x /= -1); x1 === -1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y /= -1); +if (y1 !== -1) { + throw new Test262Error('#2: y = 1; y1 = (y /= -1); y1 === -1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T3.js new file mode 100644 index 0000000000..9664e4aa20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T3 +description: Checking Expression and Variable statements for x %= y +---*/ + +//CHECK#1 +var x = -1; +var x1 = (x %= 2); +if (x1 !== -1) { + throw new Test262Error('#1: var x = -1; var x1 = (x %= 2); x1 === -1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = -1; +y1 = (y %= 2); +if (y1 !== -1) { + throw new Test262Error('#2: y = -1; y1 = (y %= 2); y1 === -1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T4.js new file mode 100644 index 0000000000..a9af22d470 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T4.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T4 +description: Checking Expression and Variable statements for x += y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x += 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 1; var x1 = (x += 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y += 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 1; y1 = (y += 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T5.js new file mode 100644 index 0000000000..139229e652 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T5.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T5 +description: Checking Expression and Variable statements for x -= y +---*/ + +//CHECK#1 +var x = -1; +var x1 = (x -= 1); +if (x1 !== -2) { + throw new Test262Error('#1: var x = -1; var x1 = (x -= 1); x1 === -2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = -1; +y1 = (y -= 1); +if (y1 !== -2) { + throw new Test262Error('#2: y = -1; y1 = (y -= 1); y1 === -2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T6.js new file mode 100644 index 0000000000..39115cd993 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T6.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T6 +description: Checking Expression and Variable statements for x <<= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x <<= 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 1; var x1 = (x <<= 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y <<= 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 1; y1 = (y <<= 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T7.js new file mode 100644 index 0000000000..01a95c1c62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T7.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T7 +description: Checking Expression and Variable statements for x >>= y +---*/ + +//CHECK#1 +var x = 4; +var x1 = (x >>= 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 4; var x1 = (x >>= 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 4; +y1 = (y >>= 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 4; y1 = (y >>= 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T8.js new file mode 100644 index 0000000000..5991068ce5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T8.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T8 +description: Checking Expression and Variable statements for x >>>= y +---*/ + +//CHECK#1 +var x = 4; +var x1 = (x >>>= 1); +if (x1 !== 2) { + throw new Test262Error('#1: var x = 4; var x1 = (x >>>= 1); x1 === 2. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 4; +y1 = (y >>>= 1); +if (y1 !== 2) { + throw new Test262Error('#2: y = 4; y1 = (y >>>= 1); y1 === 2. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T9.js new file mode 100644 index 0000000000..9c35b70a38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A3.2_T9.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x @= y returns x @ y +es5id: 11.13.2_A3.2_T9 +description: Checking Expression and Variable statements for x &= y +---*/ + +//CHECK#1 +var x = 1; +var x1 = (x &= 1); +if (x1 !== 1) { + throw new Test262Error('#1: var x = 1; var x1 = (x &= 1); x1 === 1. Actual: ' + (x1)); +} + +//CHECK#2 +var y; +var y1; +y = 1; +y1 = (y &= 1); +if (y1 !== 1) { + throw new Test262Error('#2: y = 1; y1 = (y &= 1); y1 === 1. Actual: ' + (y1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.1.js new file mode 100644 index 0000000000..f5ed53e39d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x ^= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.2.js new file mode 100644 index 0000000000..0d9f200b9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x ^= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x ^= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.3.js new file mode 100644 index 0000000000..4315a394ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x ^= "1"; +if (x !== 1) { + throw new Test262Error('#5: x = "x"; x ^= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x ^= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x ^= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.4.js new file mode 100644 index 0000000000..78ae6f1f5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x ^= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x ^= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x ^= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x ^= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x ^= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x ^= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.1.js new file mode 100644 index 0000000000..4cc67d1bd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x ^= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x ^= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.2.js new file mode 100644 index 0000000000..6d669da838 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x ^= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x ^= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x ^= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x ^= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#9: x = "x"; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x ^= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x ^= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.3.js new file mode 100644 index 0000000000..579dcf893d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x ^= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#2: x = null; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x ^= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = null; x ^= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.4.js new file mode 100644 index 0000000000..389e982aef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= 1; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x ^= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x ^= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x ^= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.5.js new file mode 100644 index 0000000000..40d3a4fedd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x ^= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x ^= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x ^= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x ^= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x ^= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x ^= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x ^= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x ^= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.6.js new file mode 100644 index 0000000000..c226a3003d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x ^= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x ^= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x ^= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.7.js new file mode 100644 index 0000000000..9d12bf3de0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x ^= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x ^= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = null; x ^= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x ^= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = null; x ^= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.8.js new file mode 100644 index 0000000000..1481976090 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x ^= true; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x ^= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x ^= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x ^= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x ^= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.9.js new file mode 100644 index 0000000000..b176bc590b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.10_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x ^= y is the same as x = x ^ y +es5id: 11.13.2_A4.10_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x ^= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x ^= true; +if (x !== 1) { + throw new Test262Error('#2: x = null; x ^= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x ^= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x ^= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x ^= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = null; x ^= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.1.js new file mode 100644 index 0000000000..fd1591fbce --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x |= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.2.js new file mode 100644 index 0000000000..b093bf01ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x |= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x |= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.3.js new file mode 100644 index 0000000000..ef852129d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#5: x = "x"; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x |= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x |= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.4.js new file mode 100644 index 0000000000..86f3b083f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x |= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x |= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x |= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x |= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x |= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x |= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.1.js new file mode 100644 index 0000000000..1ada0dc500 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x |= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.2.js new file mode 100644 index 0000000000..5434dddd0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x |= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x |= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x |= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x |= 1; +if (x !== 1) { + throw new Test262Error('#9: x = "x"; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x |= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x |= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.3.js new file mode 100644 index 0000000000..2b76e7201b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x |= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x |= 1; +if (x !== 1) { + throw new Test262Error('#2: x = null; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x |= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = null; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.4.js new file mode 100644 index 0000000000..8b98072e98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x |= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= 1; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x |= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x |= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x |= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x |= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.5.js new file mode 100644 index 0000000000..9b5da8785b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x |= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x |= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.6.js new file mode 100644 index 0000000000..13e91da781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x |= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.7.js new file mode 100644 index 0000000000..cba6b8d9b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x |= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x |= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = null; x |= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x |= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = null; x |= new String("1"); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.8.js new file mode 100644 index 0000000000..b6c84f16f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x |= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = undefined; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = undefined; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.9.js new file mode 100644 index 0000000000..ed8fbf0deb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.11_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x |= y is the same as x = x | y +es5id: 11.13.2_A4.11_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x |= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x |= true; +if (x !== 1) { + throw new Test262Error('#2: x = null; x |= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x |= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x |= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x |= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = null; x |= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.1.js new file mode 100644 index 0000000000..f8575a4297 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x *= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x *= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.2.js new file mode 100644 index 0000000000..26581f39aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x *= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x *= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x *= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.3.js new file mode 100644 index 0000000000..1d3b54a8a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x *= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x *= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x *= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x *= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x *= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.4.js new file mode 100644 index 0000000000..49231feef4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.1.js new file mode 100644 index 0000000000..ca6aeabb32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Number (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x *= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x *= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x *= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.2.js new file mode 100644 index 0000000000..94e38b256f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x *= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x *= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x *= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x *= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x *= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x *= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x *= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x *= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x *= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x *= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.3.js new file mode 100644 index 0000000000..0e5dc94328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x *= null; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x *= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x *= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x *= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Number(1); x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.4.js new file mode 100644 index 0000000000..0aa1ad0a91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x *= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x *= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.5.js new file mode 100644 index 0000000000..e6b11a3471 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) amd Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x *= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x *= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x *= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x *= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x *= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x *= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x *= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x *= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x *= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.6.js new file mode 100644 index 0000000000..dc441c2cad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + primitive String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x *= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x *= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.7.js new file mode 100644 index 0000000000..0682be8cdd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x *= null; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x *= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x *= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x *= null; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.8.js new file mode 100644 index 0000000000..c4a95ef646 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x *= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x *= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x *= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x *= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x *= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.9.js new file mode 100644 index 0000000000..375ab3e845 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.1_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x *= y is the same as the production x = x * y +es5id: 11.13.2_A4.1_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x *= null; +if (x !== 0) { + throw new Test262Error('#1: x = true; x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x *= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x *= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x *= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x *= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x *= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x *= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.1.js new file mode 100644 index 0000000000..d0e608c6d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x /= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x /= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.2.js new file mode 100644 index 0000000000..08e431bce8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x /= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x /= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x /= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.3.js new file mode 100644 index 0000000000..a29deb0f98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x /= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x /= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x /= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x /= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x /= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.4.js new file mode 100644 index 0000000000..4400d9da1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= null; +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = null; x /= null; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.1.js new file mode 100644 index 0000000000..d2bc042113 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x /= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x /= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x /= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.2.js new file mode 100644 index 0000000000..7bb8e87fd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x /= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x /= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x /= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x /= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x /= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x /= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x /= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x /= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x /= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x /= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.3.js new file mode 100644 index 0000000000..eacda13613 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: x = 1; x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x /= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x /= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: x = new Number(1); x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x /= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.4.js new file mode 100644 index 0000000000..6e22840446 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x /= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x /= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.5.js new file mode 100644 index 0000000000..65fc8330d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x /= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x /= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x /= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x /= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x /= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x /= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x /= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x /= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x /= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.6.js new file mode 100644 index 0000000000..485b528988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x /= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x /= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.7.js new file mode 100644 index 0000000000..838ba70014 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: x = "1"; x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x /= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x /= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: x = new String("1"); x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x /= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.8.js new file mode 100644 index 0000000000..83d73b6121 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x /= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x /= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x /= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x /= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x /= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.9.js new file mode 100644 index 0000000000..bffeca6706 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.2_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x /= y is the same as x = x / y +es5id: 11.13.2_A4.2_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: x = true; x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x /= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x /= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x /= null; +if (x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: x = new Boolean(true); x /= null; x === +Infinity. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x /= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x /= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.1.js new file mode 100644 index 0000000000..7bd5c2a1ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x %= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.2.js new file mode 100644 index 0000000000..de0857fe40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x %= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x %= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x %= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.3.js new file mode 100644 index 0000000000..272b39a164 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x %= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x %= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x %= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x %= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x %= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.4.js new file mode 100644 index 0000000000..78f15cb2ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = null; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.1.js new file mode 100644 index 0000000000..822e165567 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x %= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x %= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.2.js new file mode 100644 index 0000000000..76e9cbd5a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x %= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x %= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x %= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x %= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x %= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x %= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x %= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.3.js new file mode 100644 index 0000000000..85ca1c95dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x %= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x %= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x %= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.4.js new file mode 100644 index 0000000000..342e4f9712 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x %= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x %= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.5.js new file mode 100644 index 0000000000..254a579b00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x %= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x %= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.6.js new file mode 100644 index 0000000000..7fdb4d4b47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x %= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x %= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.7.js new file mode 100644 index 0000000000..3aa454b330 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x %= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x %= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x %= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.8.js new file mode 100644 index 0000000000..82eb2b4489 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x %= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x %= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x %= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x %= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x %= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.9.js new file mode 100644 index 0000000000..35db066b08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.3_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x %= y is the same as x = x % y +es5id: 11.13.2_A4.3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x %= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x %= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x %= null; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x %= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x %= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x %= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.1.js new file mode 100644 index 0000000000..def9e95ec1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x += true; +if (x !== 2) { + throw new Test262Error('#1: x = true; x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x += true; +if (x !== 2) { + throw new Test262Error('#2: x = new Boolean(true); x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#3: x = true; x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = new Boolean(true); x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.2.js new file mode 100644 index 0000000000..6ca4000f7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x += 1; +if (x !== 2) { + throw new Test262Error('#1: x = 1; x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x += 1; +if (x !== 2) { + throw new Test262Error('#2: x = new Number(1); x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#3: x = 1; x += new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#4: x = new Number(1); x += new Number(1); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.3.js new file mode 100644 index 0000000000..985c4e05d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.3 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x += null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x += null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.4.js new file mode 100644 index 0000000000..fcbdccdb5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T1.4.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T1.4 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += "1"; +if (x !== "11") { + throw new Test262Error('#1: x = "1"; x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x += "1"; +if (x !== "11") { + throw new Test262Error('#2: x = new String("1"); x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#3: x = "1"; x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#4: x = new String("1"); x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#5 +if ("x" + "1" !=="x1") { + throw new Test262Error('#5: x = "x"; x += "1"; x === "x1". Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x += "x"; +if (x !== "1x") { + throw new Test262Error('#6: x = "1"; x += "x"; x === "1x". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.1.js new file mode 100644 index 0000000000..62ac5d69dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x += 1; +if (x !== 2) { + throw new Test262Error('#1: x = true; x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x += true; +if (x !== 2) { + throw new Test262Error('#2: x = 1; x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += 1; +if (x !== 2) { + throw new Test262Error('#3: x = new Boolean(true); x += 1; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = 1; x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#5: x = true; x += new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x += true; +if (x !== 2) { + throw new Test262Error('#6: x = new Number(1); x += true; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x += new Number(1); +if (x !== 2) { + throw new Test262Error('#7: x = new Boolean(true); x += new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x += new Boolean(true); +if (x !== 2) { + throw new Test262Error('#8: x = new Number(1); x += new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.2.js new file mode 100644 index 0000000000..3c7e88f2ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.2.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x += null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x += 1; +if (x !== 1) { + throw new Test262Error('#2: x = null; x += 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x += null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = null; x += new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.3.js new file mode 100644 index 0000000000..43820b63c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x += 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x += new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x += new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.4.js new file mode 100644 index 0000000000..59f82c7814 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x += true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x += undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x += new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x += new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.5.js new file mode 100644 index 0000000000..8d192bb96a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.5.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x += null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x += true; +if (x !== 1) { + throw new Test262Error('#2: x = null; x += true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x += null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = null; x += new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.6.js new file mode 100644 index 0000000000..9262f90349 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.6.js @@ -0,0 +1,82 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += 1; +if (x !== "11") { + throw new Test262Error('#1: x = "1"; x += 1; x === "11". Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x += "1"; +if (x !== "11") { + throw new Test262Error('#2: x = 1; x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x += 1; +if (x !== "11") { + throw new Test262Error('#3: x = new String("1"); x += 1; x === "11". Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#4: x = 1; x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x += new Number(1); +if (x !== "11") { + throw new Test262Error('#5: x = "1"; x += new Number(1); x === "11". Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x += "1"; +if (x !== "11") { + throw new Test262Error('#6: x = new Number(1); x += "1"; x === "11". Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x += new Number(1); +if (x !== "11") { + throw new Test262Error('#7: x = new String("1"); x += new Number(1); x === "11". Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x += new String("1"); +if (x !== "11") { + throw new Test262Error('#8: x = new Number(1); x += new String("1"); x === "11". Actual: ' + (x)); +} + +//CHECK#9 +if ("x" + 1 !=="x1") { + throw new Test262Error('#9: x = "x"; x += 1; x === "x1". Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x += "x"; +if (x !== "1x") { + throw new Test262Error('#10: x = 1; x += "x"; x === "1x". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.7.js new file mode 100644 index 0000000000..7f6910bc82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.7.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x += "1"; +if (x !== "true1") { + throw new Test262Error('#1: x = true; x += "1"; x === "true1". Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x += true; +if (x !== "1true") { + throw new Test262Error('#2: x = "1"; x += true; x === "1true". Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x += "1"; +if (x !== "true1") { + throw new Test262Error('#3: x = new Boolean(true); x += "1"; x === "true1". Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x += new Boolean(true); +if (x !== "1true") { + throw new Test262Error('#4: x = "1"; x += new Boolean(true); x === "1true". Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x += new String("1"); +if (x !== "true1") { + throw new Test262Error('#5: x = true; x += new String("1"); x === "true1". Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x += true; +if (x !== "1true") { + throw new Test262Error('#6: x = new String("1"); x += true; x === "1true". Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x += new String("1"); +if (x !== "true1") { + throw new Test262Error('#7: x = new Boolean(true); x += new String("1"); x === "true1". Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x += new Boolean(true); +if (x !== "1true") { + throw new Test262Error('#8: x = new String("1"); x += new Boolean(true); x === "1true". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.8.js new file mode 100644 index 0000000000..4f7d89de42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += undefined; +if (x !== "1undefined") { + throw new Test262Error('#1: x = "1"; x += undefined; x === "1undefined". Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x += "1"; +if (x !== "undefined1") { + throw new Test262Error('#2: x = undefined; x += "1"; x === "undefined1". Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x += undefined; +if (x !== "1undefined") { + throw new Test262Error('#3: x = new String("1"); x += undefined; x === "1undefined". Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x += new String("1"); +if (x !== "undefined1") { + throw new Test262Error('#4: x = undefined; x += new String("1"); x === "undefined1". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.9.js new file mode 100644 index 0000000000..639527314f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.4_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x += y is the same as x = x + y +es5id: 11.13.2_A4.4_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x += null; +if (x !== "1null") { + throw new Test262Error('#1: x = "1"; x += null; x === "1null". Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x += "1"; +if (x !== "null1") { + throw new Test262Error('#2: x = null; x += "1"; x === "null1". Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x += null; +if (x !== "1null") { + throw new Test262Error('#3: x = new String("1"); x += null; x === "1null". Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x += new String("1"); +if (x !== "null1") { + throw new Test262Error('#4: x = null; x += new String("1"); x === "null1". Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.1.js new file mode 100644 index 0000000000..ed0149dd80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x -= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x -= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.2.js new file mode 100644 index 0000000000..61eacf24ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x -= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x -= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x -= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.3.js new file mode 100644 index 0000000000..719695d9ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x -= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x -= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#5: x = "x"; x -= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x -= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#6: x = "1"; x -= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.4.js new file mode 100644 index 0000000000..b5d683c827 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = null; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= null; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= null; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = undefined; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x -= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.1.js new file mode 100644 index 0000000000..677b2adb57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x -= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x -= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x -= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.2.js new file mode 100644 index 0000000000..55cbe1d128 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x -= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x -= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x -= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x -= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x -= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x -= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x -= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#9: x = "x"; x -= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x -= "x"; +if (isNaN(x) !== true) { + throw new Test262Error('#10: x = 1; x -= "x"; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.3.js new file mode 100644 index 0000000000..96eaea4146 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x -= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x -= 1; +if (x !== -1) { + throw new Test262Error('#2: x = null; x -= 1; x === -1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x -= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= new Number(1); +if (x !== -1) { + throw new Test262Error('#4: x = null; x -= new Number(1); x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.4.js new file mode 100644 index 0000000000..3a206858ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = 1; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= 1; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= 1; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Number(1); x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x -= new Number(1); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x -= new Number(1); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.5.js new file mode 100644 index 0000000000..463f5ed417 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x -= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x -= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x -= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x -= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x -= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x -= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x -= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x -= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x -= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.6.js new file mode 100644 index 0000000000..7b4d2150af --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = "1"; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= "1"; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= "1"; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new String("1"); x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x -= new String("1"); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x -= new String("1"); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.7.js new file mode 100644 index 0000000000..5c3cda3495 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x -= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x -= "1"; +if (x !== -1) { + throw new Test262Error('#2: x = null; x -= "1"; x === -1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x -= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= new String("1"); +if (x !== -1) { + throw new Test262Error('#4: x = null; x -= new String("1"); x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.8.js new file mode 100644 index 0000000000..b5294039d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#1: x = true; x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x -= true; +if (isNaN(x) !== true) { + throw new Test262Error('#2: x = undefined; x -= true; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= undefined; +if (isNaN(x) !== true) { + throw new Test262Error('#3: x = new Boolean(true); x -= undefined; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x -= new Boolean(true); +if (isNaN(x) !== true) { + throw new Test262Error('#4: x = undefined; x -= new Boolean(true); x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.9.js new file mode 100644 index 0000000000..1d3e75c723 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.5_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x -= y is the same as x = x - y +es5id: 11.13.2_A4.5_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x -= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x -= true; +if (x !== -1) { + throw new Test262Error('#2: x = null; x -= true; x === -1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x -= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x -= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x -= new Boolean(true); +if (x !== -1) { + throw new Test262Error('#4: x = null; x -= new Boolean(true); x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.1.js new file mode 100644 index 0000000000..4558b9c05e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= true; +if (x !== 2) { + throw new Test262Error('#1: x = true; x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x <<= true; +if (x !== 2) { + throw new Test262Error('#2: x = new Boolean(true); x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#3: x = true; x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = new Boolean(true); x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.2.js new file mode 100644 index 0000000000..224ac0392b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: x = 1; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x <<= 1; +if (x !== 2) { + throw new Test262Error('#2: x = new Number(1); x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#3: x = 1; x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#4: x = new Number(1); x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.3.js new file mode 100644 index 0000000000..a1dd211c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#1: x = "1"; x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#2: x = new String("1"); x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#3: x = "1"; x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#4: x = new String("1"); x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x <<= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x <<= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x <<= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x <<= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.4.js new file mode 100644 index 0000000000..4289785f6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x <<= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x <<= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x <<= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x <<= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.1.js new file mode 100644 index 0000000000..7bda109d85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: x = true; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x <<= true; +if (x !== 2) { + throw new Test262Error('#2: x = 1; x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= 1; +if (x !== 2) { + throw new Test262Error('#3: x = new Boolean(true); x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = 1; x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#5: x = true; x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x <<= true; +if (x !== 2) { + throw new Test262Error('#6: x = new Number(1); x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#7: x = new Boolean(true); x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#8: x = new Number(1); x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.2.js new file mode 100644 index 0000000000..3dd1687ced --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= 1; +if (x !== 2) { + throw new Test262Error('#1: x = "1"; x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#2: x = 1; x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x <<= 1; +if (x !== 2) { + throw new Test262Error('#3: x = new String("1"); x <<= 1; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#4: x = 1; x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#5: x = "1"; x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#6: x = new Number(1); x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x <<= new Number(1); +if (x !== 2) { + throw new Test262Error('#7: x = new String("1"); x <<= new Number(1); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#8: x = new Number(1); x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x <<= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x <<= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x <<= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x <<= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.3.js new file mode 100644 index 0000000000..0534254c01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x <<= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x <<= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x <<= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x <<= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.4.js new file mode 100644 index 0000000000..f8c43acf4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x <<= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x <<= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.5.js new file mode 100644 index 0000000000..822955fa07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#1: x = true; x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x <<= true; +if (x !== 2) { + throw new Test262Error('#2: x = "1"; x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= "1"; +if (x !== 2) { + throw new Test262Error('#3: x = new Boolean(true); x <<= "1"; x === 2. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#4: x = "1"; x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#5: x = true; x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x <<= true; +if (x !== 2) { + throw new Test262Error('#6: x = new String("1"); x <<= true; x === 2. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x <<= new String("1"); +if (x !== 2) { + throw new Test262Error('#7: x = new Boolean(true); x <<= new String("1"); x === 2. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x <<= new Boolean(true); +if (x !== 2) { + throw new Test262Error('#8: x = new String("1"); x <<= new Boolean(true); x === 2. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.6.js new file mode 100644 index 0000000000..2ecf4e2778 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x <<= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x <<= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.7.js new file mode 100644 index 0000000000..f2f834c04c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x <<= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x <<= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x <<= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x <<= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.8.js new file mode 100644 index 0000000000..bd1eedac29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x <<= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x <<= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x <<= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x <<= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x <<= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.9.js new file mode 100644 index 0000000000..9dedd45cfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.6_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x <<= y is the same as x = x << y +es5id: 11.13.2_A4.6_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x <<= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x <<= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x <<= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x <<= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x <<= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x <<= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x <<= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.1.js new file mode 100644 index 0000000000..4e2534c00e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.2.js new file mode 100644 index 0000000000..e04ddfcda0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x >>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.3.js new file mode 100644 index 0000000000..fdca6c1f7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x >>= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x >>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.4.js new file mode 100644 index 0000000000..d8e9bf8230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x >>= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x >>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x >>= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x >>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.1.js new file mode 100644 index 0000000000..b117dc0d8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.2.js new file mode 100644 index 0000000000..5a80e627e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x >>= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x >>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.3.js new file mode 100644 index 0000000000..8d8f1abd89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.4.js new file mode 100644 index 0000000000..d501ff9063 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.5.js new file mode 100644 index 0000000000..a520ed896a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x >>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.6.js new file mode 100644 index 0000000000..a482690907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.7.js new file mode 100644 index 0000000000..53f7e3f1eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.8.js new file mode 100644 index 0000000000..35d00528c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.9.js new file mode 100644 index 0000000000..4c6216226b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.7_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>= y is the same as x = x >> y +es5id: 11.13.2_A4.7_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x >>= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.1.js new file mode 100644 index 0000000000..cfeb7a1d87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = new Boolean(true); x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#3: x = true; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = new Boolean(true); x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.2.js new file mode 100644 index 0000000000..7f6201ddd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = new Number(1); x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#3: x = 1; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = new Number(1); x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.3.js new file mode 100644 index 0000000000..0904e92645 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = new String("1"); x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#3: x = "1"; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = new String("1"); x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x >>>= "x"; +if (x !== 1) { + throw new Test262Error('#6: x = "1"; x >>>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.4.js new file mode 100644 index 0000000000..da04b34049 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x >>>= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x >>>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x >>>= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x >>>= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.1.js new file mode 100644 index 0000000000..d03b390225 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.2.js new file mode 100644 index 0000000000..1d099a158e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = 1; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = 1; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#5: x = "1"; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#6: x = new Number(1); x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#7: x = new String("1"); x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#8: x = new Number(1); x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x >>>= "x"; +if (x !== 1) { + throw new Test262Error('#10: x = 1; x >>>= "x"; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.3.js new file mode 100644 index 0000000000..c0762d70ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>>= null; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.4.js new file mode 100644 index 0000000000..3281c8c605 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Number(1); x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>>= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>>= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.5.js new file mode 100644 index 0000000000..bade1ef9f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#1: x = true; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = "1"; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = "1"; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#5: x = true; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x >>>= true; +if (x !== 0) { + throw new Test262Error('#6: x = new String("1"); x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#7: x = new Boolean(true); x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#8: x = new String("1"); x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.6.js new file mode 100644 index 0000000000..94ec28e55a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.7.js new file mode 100644 index 0000000000..d942f683c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x >>>= null; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>>= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>>= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x >>>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.8.js new file mode 100644 index 0000000000..eb448b52b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= undefined; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= undefined; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.9.js new file mode 100644 index 0000000000..7a3b5a1d55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.8_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x >>>= y is the same as x = x >>> y +es5id: 11.13.2_A4.8_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x >>>= null; +if (x !== 1) { + throw new Test262Error('#1: x = true; x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x >>>= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x >>>= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x >>>= null; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x >>>= null; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x >>>= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x >>>= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.1.js new file mode 100644 index 0000000000..a59158aca2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +var x; + +//CHECK#1 +x = true; +x &= true; +if (x !== 1) { + throw new Test262Error('#1: x = true; x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Boolean(true); +x &= true; +if (x !== 1) { + throw new Test262Error('#2: x = new Boolean(true); x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = true; +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#3: x = true; x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Boolean(true); +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = new Boolean(true); x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.2.js new file mode 100644 index 0000000000..aac470947e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +var x; + +//CHECK#1 +x = 1; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: x = 1; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new Number(1); +x &= 1; +if (x !== 1) { + throw new Test262Error('#2: x = new Number(1); x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = 1; +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#3: x = 1; x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new Number(1); +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#4: x = new Number(1); x &= new Number(1); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.3.js new file mode 100644 index 0000000000..cc7360b8ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.3.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = new String("1"); +x &= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = new String("1"); x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = "1"; +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#3: x = "1"; x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = new String("1"); +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = new String("1"); x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "x"; +x &= "1"; +if (x !== 0) { + throw new Test262Error('#5: x = "x"; x &= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#6 +x = "1"; +x &= "x"; +if (x !== 0) { + throw new Test262Error('#6: x = "1"; x &= "x"; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.4.js new file mode 100644 index 0000000000..c3eda9ebcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T1.4.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +var x; + +//CHECK#1 +x = null; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = null; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= null; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = undefined; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = undefined; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= null; +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= null; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.1.js new file mode 100644 index 0000000000..e685aeba7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: x = true; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x &= true; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = true; x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x &= true; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.2.js new file mode 100644 index 0000000000..ae2aad2a94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.2.js @@ -0,0 +1,84 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= 1; +if (x !== 1) { + throw new Test262Error('#1: x = "1"; x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = 1; +x &= "1"; +if (x !== 1) { + throw new Test262Error('#2: x = 1; x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x &= 1; +if (x !== 1) { + throw new Test262Error('#3: x = new String("1"); x &= 1; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = 1; +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#4: x = 1; x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = "1"; +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#5: x = "1"; x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new Number(1); +x &= "1"; +if (x !== 1) { + throw new Test262Error('#6: x = new Number(1); x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new String("1"); +x &= new Number(1); +if (x !== 1) { + throw new Test262Error('#7: x = new String("1"); x &= new Number(1); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new Number(1); +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#8: x = new Number(1); x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#9 +x = "x"; +x &= 1; +if (x !== 0) { + throw new Test262Error('#9: x = "x"; x &= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#10 +x = 1; +x &= "x"; +if (x !== 0) { + throw new Test262Error('#10: x = 1; x &= "x"; x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.3.js new file mode 100644 index 0000000000..f7c993447e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.3.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = 1; +x &= null; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x &= 1; +if (x !== 0) { + throw new Test262Error('#2: x = null; x &= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x &= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Number(1); x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.4.js new file mode 100644 index 0000000000..e860aad6b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = 1; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = 1; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= 1; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= 1; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Number(1); +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = new Number(1); x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x &= new Number(1); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x &= new Number(1); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.5.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.5.js new file mode 100644 index 0000000000..6088e77af8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.5.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +var x; + +//CHECK#1 +x = true; +x &= "1"; +if (x !== 1) { + throw new Test262Error('#1: x = true; x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#2 +x = "1"; +x &= true; +if (x !== 1) { + throw new Test262Error('#2: x = "1"; x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= "1"; +if (x !== 1) { + throw new Test262Error('#3: x = new Boolean(true); x &= "1"; x === 1. Actual: ' + (x)); +} + +//CHECK#4 +x = "1"; +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#4: x = "1"; x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +//CHECK#5 +x = true; +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#5: x = true; x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#6 +x = new String("1"); +x &= true; +if (x !== 1) { + throw new Test262Error('#6: x = new String("1"); x &= true; x === 1. Actual: ' + (x)); +} + +//CHECK#7 +x = new Boolean(true); +x &= new String("1"); +if (x !== 1) { + throw new Test262Error('#7: x = new Boolean(true); x &= new String("1"); x === 1. Actual: ' + (x)); +} + +//CHECK#8 +x = new String("1"); +x &= new Boolean(true); +if (x !== 1) { + throw new Test262Error('#8: x = new String("1"); x &= new Boolean(true); x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.6.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.6.js new file mode 100644 index 0000000000..06bbd59949 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.6.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x &= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x &= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.7.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.7.js new file mode 100644 index 0000000000..6143f0a96a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.7.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = "1"; +x &= null; +if (x !== 0) { + throw new Test262Error('#1: x = "1"; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x &= "1"; +if (x !== 0) { + throw new Test262Error('#2: x = null; x &= "1"; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new String("1"); +x &= null; +if (x !== 0) { + throw new Test262Error('#3: x = new String("1"); x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= new String("1"); +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= new String("1"); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.8.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.8.js new file mode 100644 index 0000000000..248a32ea25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.8.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +var x; + +//CHECK#1 +x = true; +x &= undefined; +if (x !== 0) { + throw new Test262Error('#1: x = true; x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = undefined; +x &= true; +if (x !== 0) { + throw new Test262Error('#2: x = undefined; x &= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= undefined; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x &= undefined; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = undefined; +x &= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = undefined; x &= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.9.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.9.js new file mode 100644 index 0000000000..27fda32bf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A4.9_T2.9.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The production x &= y is the same as x = x & y +es5id: 11.13.2_A4.9_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +var x; + +//CHECK#1 +x = true; +x &= null; +if (x !== 0) { + throw new Test262Error('#1: x = true; x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +x = null; +x &= true; +if (x !== 0) { + throw new Test262Error('#2: x = null; x &= true; x === 0. Actual: ' + (x)); +} + +//CHECK#3 +x = new Boolean(true); +x &= null; +if (x !== 0) { + throw new Test262Error('#3: x = new Boolean(true); x &= null; x === 0. Actual: ' + (x)); +} + +//CHECK#4 +x = null; +x &= new Boolean(true); +if (x !== 0) { + throw new Test262Error('#4: x = null; x &= new Boolean(true); x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T1.js new file mode 100644 index 0000000000..daf140bc53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.10_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x ^= 3; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T2.js new file mode 100644 index 0000000000..c502af641a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.10_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x ^= 3; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T3.js new file mode 100644 index 0000000000..ea37861ec8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.10_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.10_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x ^= 3; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T1.js new file mode 100644 index 0000000000..6df8dc7cfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.11_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x |= 4; + } + + if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T2.js new file mode 100644 index 0000000000..3849dea273 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.11_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x |= 4; +} + +if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T3.js new file mode 100644 index 0000000000..419d8daf9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.11_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.11_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x |= 4; + } +} + +if (innerScope.x !== 6) { + throw new Test262Error('#1: innerScope.x === 6. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T1.js new file mode 100644 index 0000000000..190a1e2635 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.1_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x *= 3; + } + + if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T2.js new file mode 100644 index 0000000000..75749802a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.1_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x *= 3; +} + +if (scope.x !== 6) { + throw new Test262Error('#1: scope.x === 6. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T3.js new file mode 100644 index 0000000000..62d97a5bf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.1_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.1_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x *= 3; + } +} + +if (innerScope.x !== 6) { + throw new Test262Error('#1: innerScope.x === 6. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T1.js new file mode 100644 index 0000000000..f3998fdadd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.2_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 6; + } + }; + + with (scope) { + x /= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T2.js new file mode 100644 index 0000000000..96997c6b06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.2_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 6; + } +}; + +with (scope) { + x /= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T3.js new file mode 100644 index 0000000000..350bbe7acc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.2_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.2_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 6; + } +}; + +with (outerScope) { + with (innerScope) { + x /= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T1.js new file mode 100644 index 0000000000..40ed4cf9b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.3_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 5; + } + }; + + with (scope) { + x %= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T2.js new file mode 100644 index 0000000000..69784760c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.3_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + x %= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T3.js new file mode 100644 index 0000000000..1447c6170e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.3_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.3_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 5; + } +}; + +with (outerScope) { + with (innerScope) { + x %= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T1.js new file mode 100644 index 0000000000..0e612dd794 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.4_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x += y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x += 1; + } + + if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T2.js new file mode 100644 index 0000000000..caf85f5752 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.4_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x += y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x += 1; +} + +if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T3.js new file mode 100644 index 0000000000..b7d76bf280 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.4_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.4_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x += y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x += 1; + } +} + +if (innerScope.x !== 3) { + throw new Test262Error('#1: innerScope.x === 3. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T1.js new file mode 100644 index 0000000000..1b932c6532 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.5_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x -= 1; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T2.js new file mode 100644 index 0000000000..53ff618dca --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.5_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x -= 1; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T3.js new file mode 100644 index 0000000000..b152ad1d8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.5_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.5_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x -= 1; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T1.js new file mode 100644 index 0000000000..4d1009a50b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.6_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x <<= 3; + } + + if (scope.x !== 16) { + throw new Test262Error('#1: scope.x === 16. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T2.js new file mode 100644 index 0000000000..9589ad500e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.6_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x <<= 3; +} + +if (scope.x !== 16) { + throw new Test262Error('#1: scope.x === 16. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T3.js new file mode 100644 index 0000000000..38f50694c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.6_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.6_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x <<= 3; + } +} + +if (innerScope.x !== 16) { + throw new Test262Error('#1: innerScope.x === 16. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T1.js new file mode 100644 index 0000000000..46b239ec80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.7_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 16; + } + }; + + with (scope) { + x >>= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T2.js new file mode 100644 index 0000000000..be9206bb29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.7_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + x >>= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T3.js new file mode 100644 index 0000000000..cd8ea99619 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.7_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.7_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 16; + } +}; + +with (outerScope) { + with (innerScope) { + x >>= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T1.js new file mode 100644 index 0000000000..b042f46dde --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.8_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 16; + } + }; + + with (scope) { + x >>>= 3; + } + + if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T2.js new file mode 100644 index 0000000000..fb30c9d5d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.8_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + x >>>= 3; +} + +if (scope.x !== 2) { + throw new Test262Error('#1: scope.x === 2. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T3.js new file mode 100644 index 0000000000..f5932e231c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.8_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.8_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 16; + } +}; + +with (outerScope) { + with (innerScope) { + x >>>= 3; + } +} + +if (innerScope.x !== 2) { + throw new Test262Error('#1: innerScope.x === 2. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T1.js new file mode 100644 index 0000000000..11e84a9b79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T1.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.9_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 5; + } + }; + + with (scope) { + x &= 3; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T2.js new file mode 100644 index 0000000000..8a81a95de1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T2.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.9_T2 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + x &= 3; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T3.js new file mode 100644 index 0000000000..6dfd64aa2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A5.9_T3.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A5.9_T3 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lref, v) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 5; + } +}; + +with (outerScope) { + with (innerScope) { + x &= 3; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js new file mode 100644 index 0000000000..6b4cbe0798 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.10_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.10_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x ^= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 1; + var innerX = (function() { + x ^= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 5) { + throw new Test262Error('#2: x === 5. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js new file mode 100644 index 0000000000..109c389db5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.11_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.11_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x |= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 1; + var innerX = (function() { + x |= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 5) { + throw new Test262Error('#2: x === 5. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js new file mode 100644 index 0000000000..86adf5d5fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.1_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.1_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x *= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 3; + var innerX = (function() { + x *= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 12) { + throw new Test262Error('#2: x === 12. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.2_T1.js new file mode 100644 index 0000000000..f74ec0fb7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.2_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.2_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x /= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 15; + var innerX = (function() { + x /= (eval("var x = 2;"), 3); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 5) { + throw new Test262Error('#2: x === 5. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js new file mode 100644 index 0000000000..1592b0c675 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.3_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.3_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x %= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 7; + var innerX = (function() { + x %= (eval("var x = 2;"), 4); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 3) { + throw new Test262Error('#2: x === 3. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js new file mode 100644 index 0000000000..d11fadffc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.4_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.4_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x += y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 3; + var innerX = (function() { + x += (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.5_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.5_T1.js new file mode 100644 index 0000000000..f7731d0985 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.5_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.5_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x -= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 5; + var innerX = (function() { + x -= (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.6_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.6_T1.js new file mode 100644 index 0000000000..6590243878 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.6_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.6_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x <<= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 1; + var innerX = (function() { + x <<= (eval("var x = 2;"), 3); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 8) { + throw new Test262Error('#2: x === 8. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.7_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.7_T1.js new file mode 100644 index 0000000000..30abe88d8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.7_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.7_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x >>= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 8; + var innerX = (function() { + x >>= (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.8_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.8_T1.js new file mode 100644 index 0000000000..01f0416ec7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.8_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.8_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x >>>= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 8; + var innerX = (function() { + x >>>= (eval("var x = 2;"), 1); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 4) { + throw new Test262Error('#2: x === 4. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js new file mode 100644 index 0000000000..aae8537e0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A6.9_T1.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator calls PutValue(lref, v) +es5id: S11.13.2_A6.9_T1 +description: > + Evaluating LeftHandSideExpression lref returns Reference type; Reference + base value is an environment record and environment record kind is + declarative environment record. PutValue(lref, v) uses the initially + created Reference even if a more local binding is available. + Check operator is "x &= y". +flags: [noStrict] +---*/ + +function testCompoundAssignment() { + var x = 5; + var innerX = (function() { + x &= (eval("var x = 2;"), 3); + return x; + })(); + + if (innerX !== 2) { + throw new Test262Error('#1: innerX === 2. Actual: ' + (innerX)); + } + if (x !== 1) { + throw new Test262Error('#2: x === 1. Actual: ' + (x)); + } +} +testCompoundAssignment(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T1.js new file mode 100644 index 0000000000..5c27a61259 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x ^= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] ^= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ^= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T2.js new file mode 100644 index 0000000000..f622885f78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x ^= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] ^= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ^= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T3.js new file mode 100644 index 0000000000..9e4a3f1a15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x ^= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ^= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js new file mode 100644 index 0000000000..ff695c43a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.10_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x ^= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] ^= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T1.js new file mode 100644 index 0000000000..49ea2c4ef7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x |= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] |= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] |= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T2.js new file mode 100644 index 0000000000..4c7041ebfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x |= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] |= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] |= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T3.js new file mode 100644 index 0000000000..65d03bf9cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x |= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] |= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js new file mode 100644 index 0000000000..15feb15855 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.11_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x |= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] |= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T1.js new file mode 100644 index 0000000000..ad2e41b205 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x *= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] *= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] *= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T2.js new file mode 100644 index 0000000000..54c8008bda --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x *= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] *= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] *= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T3.js new file mode 100644 index 0000000000..85b140c6d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x *= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] *= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js new file mode 100644 index 0000000000..5fba889a16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.1_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x *= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] *= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T1.js new file mode 100644 index 0000000000..cda71eeaac --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x /= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] /= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] /= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T2.js new file mode 100644 index 0000000000..2a8d5a043f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x /= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] /= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] /= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T3.js new file mode 100644 index 0000000000..baab6dc1c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x /= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] /= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js new file mode 100644 index 0000000000..7ed2022cb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.2_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x /= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] /= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T1.js new file mode 100644 index 0000000000..e6a9bb1207 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x %= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] %= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] %= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T2.js new file mode 100644 index 0000000000..81eefd06c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x %= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] %= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] %= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T3.js new file mode 100644 index 0000000000..06d2c500db --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x %= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] %= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js new file mode 100644 index 0000000000..b406b3a09f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.3_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x %= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] %= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T1.js new file mode 100644 index 0000000000..738f93b099 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x += y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] += expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] += expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T2.js new file mode 100644 index 0000000000..5088f94841 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x += y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] += expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] += expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T3.js new file mode 100644 index 0000000000..4342e1f8be --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x += y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] += expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js new file mode 100644 index 0000000000..ecf20f1f9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.4_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x += y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] += expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T1.js new file mode 100644 index 0000000000..1e688e5e0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x -= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] -= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] -= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T2.js new file mode 100644 index 0000000000..ad987fb7e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x -= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] -= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] -= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js new file mode 100644 index 0000000000..331ca21c1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x -= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] -= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js new file mode 100644 index 0000000000..296954a4ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.5_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x -= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] -= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T1.js new file mode 100644 index 0000000000..07fb5b0dbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x <<= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] <<= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] <<= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T2.js new file mode 100644 index 0000000000..baa7f62e1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x <<= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] <<= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] <<= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T3.js new file mode 100644 index 0000000000..0d90ffd3aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x <<= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] <<= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js new file mode 100644 index 0000000000..67605051a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.6_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x <<= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] <<= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T1.js new file mode 100644 index 0000000000..7ddb944e23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x >>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T2.js new file mode 100644 index 0000000000..feb30a4fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x >>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T3.js new file mode 100644 index 0000000000..eeefc80916 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x >>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js new file mode 100644 index 0000000000..f4ed7f80ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.7_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x >>= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] >>= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js new file mode 100644 index 0000000000..f6d5071321 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x >>>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>>= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T2.js new file mode 100644 index 0000000000..a9cfa6a6de --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x >>>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] >>>= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T3.js new file mode 100644 index 0000000000..96ec552572 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x >>>= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] >>>= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js new file mode 100644 index 0000000000..6e8afd8de5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.8_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x >>>= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] >>>= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T1.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T1.js new file mode 100644 index 0000000000..15a44cc7b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + null value. + Check operator is "x &= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] &= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] &= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T2.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T2.js new file mode 100644 index 0000000000..1884b2611a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T2.js @@ -0,0 +1,41 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. base is the + undefined value. + Check operator is "x &= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] &= expr(); +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] &= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T3.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T3.js new file mode 100644 index 0000000000..40f836ec94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T3.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. Evaluating + ToPropertyKey(prop) throws an error. + Check operator is "x &= y". +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = {}; + var prop = { + toString: function() { + throw new DummyError(); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] &= expr(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js new file mode 100644 index 0000000000..fcb6adb0a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/S11.13.2_A7.9_T4.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compound Assignment Operator evaluates its operands from left to right. +description: > + The left-hand side expression is evaluated before the right-hand side. + Left-hand side expression is MemberExpression: base[prop]. ToPropertyKey(prop) + is only called once. + Check operator is "x &= y". +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return ""; + } +}; +var expr = function() { + return 0; +}; + +base[prop] &= expr(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/add-arguments-strict-strict.js new file mode 100644 index 0000000000..145758b184 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-15-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(+=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments += 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/add-eval-strict-strict.js new file mode 100644 index 0000000000..57bdddf5e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-4-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(+=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval += 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/add-non-simple.js new file mode 100644 index 0000000000..1f94eb9e8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound addition assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 += 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/add-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/add-whitespace.js new file mode 100644 index 0000000000..6e63978f49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/add-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T4 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x += y +---*/ + +var x; + +x = -1; +assert.sameValue(x += -1, -2, 'U+0009 (expression)'); +assert.sameValue(x, -2, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x += -1, -2, 'U+000B (expression)'); +assert.sameValue(x, -2, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x += -1, -2, 'U+000C (expression)'); +assert.sameValue(x, -2, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x += -1, -2, 'U+0020 (expression)'); +assert.sameValue(x, -2, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x += -1, -2, 'U+00A0 (expression)'); +assert.sameValue(x, -2, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x ++= +-1, -2, 'U+000A (expression)'); +assert.sameValue(x, -2, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x += -1, -2, 'U+000D (expression)'); +assert.sameValue(x, -2, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
+=
-1, -2, 'U+2028 (expression)'); +assert.sameValue(x, -2, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
+=
-1, -2, 'U+2029 (expression)'); +assert.sameValue(x, -2, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x   + 

+=   + 

-1, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/and-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/and-arguments-strict-strict.js new file mode 100644 index 0000000000..65f5b03bc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/and-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-20-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments &= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/and-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/and-eval-strict-strict.js new file mode 100644 index 0000000000..4706382651 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/and-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-9-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval &= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/and-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/and-whitespace.js new file mode 100644 index 0000000000..b4805bb278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/and-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T9 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x &= y +---*/ + +var x; + +x = 1; +assert.sameValue(x &= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x &= 1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x &= 1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x &= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x &= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +&= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x &= 1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
&=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
&=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x   + 

&=   + 

1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/browser.js b/js/src/tests/test262/language/expressions/compound-assignment/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/compound-assignment/btws-and-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/btws-and-non-simple.js new file mode 100644 index 0000000000..9b8361ef9e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/btws-and-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "bitwise and" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 &= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/btws-or-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/btws-or-non-simple.js new file mode 100644 index 0000000000..d52e29b340 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/btws-or-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "bitwise or" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 |= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/btws-xor-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/btws-xor-non-simple.js new file mode 100644 index 0000000000..9dff195e9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/btws-xor-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "bitwise xor" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 ^= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js new file mode 100644 index 0000000000..de0fa45112 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--1.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.10_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; + +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x ^= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js new file mode 100644 index 0000000000..696b2a8784 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--10.js @@ -0,0 +1,43 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.4_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ + +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x += 1; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js new file mode 100644 index 0000000000..f4d614ae06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--11.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.4_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x += 1; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js new file mode 100644 index 0000000000..c589c1206e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--12.js @@ -0,0 +1,43 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x -= 1; + count++; + }); + count++; +})(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js new file mode 100644 index 0000000000..35bc18dc14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--13.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x -= 1; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js new file mode 100644 index 0000000000..1e9c6279b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--14.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.6_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x <<= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js new file mode 100644 index 0000000000..ae2a62b447 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--15.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.6_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x <<= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js new file mode 100644 index 0000000000..fdaa5b9b3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--16.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.7_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js new file mode 100644 index 0000000000..d9d57f34ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--17.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.7_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 16; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js new file mode 100644 index 0000000000..db1ec52a06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--18.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.8_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 16; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>>= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js new file mode 100644 index 0000000000..3b6a864575 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--19.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.8_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 16; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x >>>= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js new file mode 100644 index 0000000000..7cbe910c9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--2.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.11_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x |= 4; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js new file mode 100644 index 0000000000..c106d4dd97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--20.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.9_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x &= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js new file mode 100644 index 0000000000..f758fa4426 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--21.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.9_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 5; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x &= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js new file mode 100644 index 0000000000..37c46072fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--3.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.11_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x |= 4; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js new file mode 100644 index 0000000000..cb3deef671 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--4.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.1_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x *= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js new file mode 100644 index 0000000000..143fa2d1df --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--5.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.1_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x *= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js new file mode 100644 index 0000000000..ac41064fec --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--6.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.2_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 6; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x /= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js new file mode 100644 index 0000000000..caf84805a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--7.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.2_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 6; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x /= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js new file mode 100644 index 0000000000..e593221296 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--8.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.3_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 5; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x %= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js new file mode 100644 index 0000000000..90fe161825 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v--9.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.3_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 5; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x %= 3; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js new file mode 100644 index 0000000000..4f13b58d74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/compound-assignment-operator-calls-putvalue-lref--v-.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Compound Assignment Operator calls PutValue(lref, v) (formerly S11.13.2_A5.10_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x ^= 3; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/div-arguments-strict-strict.js new file mode 100644 index 0000000000..83b57671c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-13-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(/=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments /= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/div-eval-strict-strict.js new file mode 100644 index 0000000000..d65990a988 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-2-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(/=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval /= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/div-non-simple.js new file mode 100644 index 0000000000..ce5a54be44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound division assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 /= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/div-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/div-whitespace.js new file mode 100644 index 0000000000..5491504675 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/div-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T2 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x /= y +---*/ + +var x; + +x = -1; +assert.sameValue(x /= -1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x /= -1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x /= -1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x /= -1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x /= -1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +/= +-1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x /= -1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
/=
-1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
/=
-1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x   + 

/=   + 

-1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js new file mode 100644 index 0000000000..0adbe1dc31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-add.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound addition assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 1; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field += 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 3, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 3, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js new file mode 100644 index 0000000000..c9683a4b0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitand.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b0101; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field &= 0b1010; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0000, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b0000, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js new file mode 100644 index 0000000000..b14e2bb217 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitor.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b0101; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field |= 0b1010; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b1111, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b1111, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js new file mode 100644 index 0000000000..28d203b234 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-bitxor.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0x1111; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field ^= 0x1010; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0x0101, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0x0101, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js new file mode 100644 index 0000000000..99eb2feda5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-div.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound division assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 1; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field /= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0.5, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0.5, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js new file mode 100644 index 0000000000..309c23fad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-exp.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 10; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field **= 3; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1000, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 1000, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js new file mode 100644 index 0000000000..d651584439 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-lshift.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound left-shift assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b0110; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field <<= 4; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b01100000, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b01100000, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js new file mode 100644 index 0000000000..1b54a87119 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mod.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound modulo assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 3; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field %= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 1, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js new file mode 100644 index 0000000000..788535e828 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-mult.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound multiplication assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 2; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field *= 3; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 6, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 6, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js new file mode 100644 index 0000000000..9f5720e576 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-rshift.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound right-shift assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b1100; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field >>>= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b0011, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js new file mode 100644 index 0000000000..29ee0aa6a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-srshift.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 0b1100; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field >>= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 0b0011, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js new file mode 100644 index 0000000000..43269fb797 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-accessor-property-sub.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/getter-setter.template +/*--- +description: Compound subtraction assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + +---*/ + + +class C { + #setterCalledWith; + get #field() { + return 3; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field -= 2; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 1, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js new file mode 100644 index 0000000000..da3f639be3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-add.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound addition assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 1; + compoundAssignment() { + return this.#field += 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 3, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 3, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js new file mode 100644 index 0000000000..5c2b4747a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitand.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b0101; + compoundAssignment() { + return this.#field &= 0b1010; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0000, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b0000, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js new file mode 100644 index 0000000000..653c0cff81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitor.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b0101; + compoundAssignment() { + return this.#field |= 0b1010; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b1111, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b1111, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js new file mode 100644 index 0000000000..499df6df35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-bitxor.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0x1111; + compoundAssignment() { + return this.#field ^= 0x1010; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0x0101, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0x0101, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js new file mode 100644 index 0000000000..2906c7dddb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-div.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound division assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 1; + compoundAssignment() { + return this.#field /= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0.5, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0.5, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js new file mode 100644 index 0000000000..368fa1728e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-exp.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 10; + compoundAssignment() { + return this.#field **= 3; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1000, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 1000, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js new file mode 100644 index 0000000000..7f17309635 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-lshift.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound left-shift assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b0110; + compoundAssignment() { + return this.#field <<= 4; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b01100000, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b01100000, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js new file mode 100644 index 0000000000..8104ea3b76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mod.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound modulo assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 3; + compoundAssignment() { + return this.#field %= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 1, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js new file mode 100644 index 0000000000..731a259be9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-mult.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound multiplication assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 2; + compoundAssignment() { + return this.#field *= 3; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 6, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 6, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js new file mode 100644 index 0000000000..3969e09d86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-rshift.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound right-shift assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b1100; + compoundAssignment() { + return this.#field >>>= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b0011, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js new file mode 100644 index 0000000000..ac5f3c8d0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-srshift.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 0b1100; + compoundAssignment() { + return this.#field >>= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 0b0011, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 0b0011, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js new file mode 100644 index 0000000000..1d6d12de8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-data-property-sub.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/data-property.template +/*--- +description: Compound subtraction assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + +---*/ + + +class C { + #field = 3; + compoundAssignment() { + return this.#field -= 2; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 1, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js new file mode 100644 index 0000000000..bc4584acf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-add.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound addition assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod += 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js new file mode 100644 index 0000000000..88d4ba9fd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitand.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod &= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js new file mode 100644 index 0000000000..2b184c370e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitor.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod |= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js new file mode 100644 index 0000000000..54a8597e54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-bitxor.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod ^= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js new file mode 100644 index 0000000000..af4370bba5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-div.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound division assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod /= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js new file mode 100644 index 0000000000..7c98267457 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-exp.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod **= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js new file mode 100644 index 0000000000..11af1cbb57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-lshift.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound left-shift assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod <<= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js new file mode 100644 index 0000000000..26e5d0b8d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mod.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound modulo assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod %= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js new file mode 100644 index 0000000000..0edfcd0f7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-mult.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound multiplication assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod *= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js new file mode 100644 index 0000000000..ba0727fb07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-rshift.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound right-shift assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod >>>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js new file mode 100644 index 0000000000..f7a5df37bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-srshift.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod >>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js new file mode 100644 index 0000000000..5f473bd99b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-method-sub.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/method.template +/*--- +description: Compound subtraction assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod -= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js new file mode 100644 index 0000000000..4bedca0b25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-add.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/add.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound addition assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field += 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js new file mode 100644 index 0000000000..54c16908a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitand.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitand.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound bitwise-and assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field &= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js new file mode 100644 index 0000000000..ab78b7df37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitor.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitor.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound bitwise-or assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field |= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js new file mode 100644 index 0000000000..66e8cdb061 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-bitxor.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/bitxor.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound bitwise-xor assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field ^= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js new file mode 100644 index 0000000000..1378f4870e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-div.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/div.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound division assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field /= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js new file mode 100644 index 0000000000..b65039627c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-exp.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/exp.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound exponentiation assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [exponentiation, class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field **= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js new file mode 100644 index 0000000000..c1fb6a7284 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-lshift.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/lshift.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound left-shift assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field <<= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js new file mode 100644 index 0000000000..e1c2491bfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mod.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mod.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound modulo assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field %= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js new file mode 100644 index 0000000000..b611243ecb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-mult.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/mult.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound multiplication assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field *= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js new file mode 100644 index 0000000000..5c969340f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-rshift.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/rshift.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound right-shift assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field >>>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js new file mode 100644 index 0000000000..ac393d51a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-srshift.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/srshift.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound signed-right-shift assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field >>= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js new file mode 100644 index 0000000000..20067bd51f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-hand-side-private-reference-readonly-accessor-property-sub.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/compound-assignment-private/sub.case +// - src/compound-assignment-private/default/getter.template +/*--- +description: Compound subtraction assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private] +flags: [generated] +info: | + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + ... + 7. Let _r_ be ApplyStringOrNumericBinaryOperator(_lval_, _opText_, _rval_). + 8. Perform ? PutValue(_lref_, _r_). + 9. Return _r_. + + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + +---*/ + + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field -= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/left-shift-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/left-shift-non-simple.js new file mode 100644 index 0000000000..829fbaee21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/left-shift-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "left shift" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 <<= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/lshift-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/lshift-arguments-strict-strict.js new file mode 100644 index 0000000000..7704c1372c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/lshift-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-17-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(<<=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments <<= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/lshift-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/lshift-eval-strict-strict.js new file mode 100644 index 0000000000..c292a4521e --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/lshift-eval-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-6-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment + operator(<<=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval <<= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/lshift-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/lshift-whitespace.js new file mode 100644 index 0000000000..3036e42e4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/lshift-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T6 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x <<= y +---*/ + +var x; + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+0009 (expression)'); +assert.sameValue(x, 2, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+000B (expression)'); +assert.sameValue(x, 2, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+000C (expression)'); +assert.sameValue(x, 2, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+0020 (expression)'); +assert.sameValue(x, 2, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+00A0 (expression)'); +assert.sameValue(x, 2, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +<<= +1, 2, 'U+000A (expression)'); +assert.sameValue(x, 2, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x <<= 1, 2, 'U+000D (expression)'); +assert.sameValue(x, 2, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
<<=
1, 2, 'U+2028 (expression)'); +assert.sameValue(x, 2, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
<<=
1, 2, 'U+2029 (expression)'); +assert.sameValue(x, 2, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x   + 

<<=   + 

1, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-arguments-strict-strict.js new file mode 100644 index 0000000000..cf5071d6da --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-14-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(%=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments %= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-div-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-div-non-simple.js new file mode 100644 index 0000000000..a66a73279d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-div-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "modular division" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 %= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-eval-strict-strict.js new file mode 100644 index 0000000000..9332c16cf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-3-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(%=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval %= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mod-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/mod-whitespace.js new file mode 100644 index 0000000000..e9059eda6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mod-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T3 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x %= y +---*/ + +var x; + +x = -1; +assert.sameValue(x %= -1, -0, 'U+0009 (expression)'); +assert.sameValue(x, -0, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x %= -1, -0, 'U+000B (expression)'); +assert.sameValue(x, -0, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x %= -1, -0, 'U+000C (expression)'); +assert.sameValue(x, -0, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x %= -1, -0, 'U+0020 (expression)'); +assert.sameValue(x, -0, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x %= -1, -0, 'U+00A0 (expression)'); +assert.sameValue(x, -0, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +%= +-1, -0, 'U+000A (expression)'); +assert.sameValue(x, -0, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x %= -1, -0, 'U+000D (expression)'); +assert.sameValue(x, -0, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
%=
-1, -0, 'U+2028 (expression)'); +assert.sameValue(x, -0, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
%=
-1, -0, 'U+2029 (expression)'); +assert.sameValue(x, -0, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x   + 

%=   + 

-1, -0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, -0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-arguments-strict-strict.js new file mode 100644 index 0000000000..ff130c7fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-12-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(*=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments *= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-eval-strict-strict.js new file mode 100644 index 0000000000..e3b9571c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-1-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(*=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval *= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-non-simple.js new file mode 100644 index 0000000000..ca674a09d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound multiplication assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 *= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/mult-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/mult-whitespace.js new file mode 100644 index 0000000000..610f11b3a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/mult-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T1 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x *= y +---*/ + +var x; + +x = -1; +assert.sameValue(x *= -1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x *= -1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x *= -1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x *= -1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x *= -1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +*= +-1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x *= -1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
*=
-1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
*=
-1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x   + 

*=   + 

-1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/or-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/or-arguments-strict-strict.js new file mode 100644 index 0000000000..6c2d92d29f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/or-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-22-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(|=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments |= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/or-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/or-eval-strict-strict.js new file mode 100644 index 0000000000..65f633282a --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/or-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-11-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(|=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval |= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/or-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/or-whitespace.js new file mode 100644 index 0000000000..a8558ffd7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/or-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T11 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x |= y +---*/ + +var x; + +x = 0; +assert.sameValue(x |= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = 0; +assert.sameValue(x |= 1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = 0; +assert.sameValue(x |= 1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = 0; +assert.sameValue(x |= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = 0; +assert.sameValue(x |= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = 0; +assert.sameValue(x +|= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = 0; +assert.sameValue(x |= 1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = 0; +assert.sameValue(x
|=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = 0; +assert.sameValue(x
|=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = 0; +assert.sameValue(x   + 

|=   + 

1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/right-shift-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/right-shift-non-simple.js new file mode 100644 index 0000000000..7e814e2223 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/right-shift-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "right shift" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 >>= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/shell.js b/js/src/tests/test262/language/expressions/compound-assignment/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/compound-assignment/srshift-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/srshift-arguments-strict-strict.js new file mode 100644 index 0000000000..00ef900315 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/srshift-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-18-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments >>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/srshift-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/srshift-eval-strict-strict.js new file mode 100644 index 0000000000..e197aab414 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/srshift-eval-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-7-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment + operator(>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval >>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/srshift-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/srshift-whitespace.js new file mode 100644 index 0000000000..4e4675045f --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/srshift-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T7 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x >>= y +---*/ + +var x; + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+0009 (expression)'); +assert.sameValue(x, 0, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+000B (expression)'); +assert.sameValue(x, 0, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+000C (expression)'); +assert.sameValue(x, 0, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+0020 (expression)'); +assert.sameValue(x, 0, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+00A0 (expression)'); +assert.sameValue(x, 0, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +>>= +1, 0, 'U+000A (expression)'); +assert.sameValue(x, 0, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x >>= 1, 0, 'U+000D (expression)'); +assert.sameValue(x, 0, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
>>=
1, 0, 'U+2028 (expression)'); +assert.sameValue(x, 0, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
>>=
1, 0, 'U+2029 (expression)'); +assert.sameValue(x, 0, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x   + 

>>=   + 

1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/sub-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/sub-arguments-strict-strict.js new file mode 100644 index 0000000000..0bd8b2cd0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/sub-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-16-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(-=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments -= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/sub-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/sub-eval-strict-strict.js new file mode 100644 index 0000000000..a8b98e484d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/sub-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-5-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(-=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval -= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/sub-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/sub-whitespace.js new file mode 100644 index 0000000000..69f19463c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/sub-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T5 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x -= y +---*/ + +var x; + +x = -1; +assert.sameValue(x -= 1, -2, 'U+0009 (expression)'); +assert.sameValue(x, -2, 'U+0009 (side effect)'); + +x = -1; +assert.sameValue(x -= 1, -2, 'U+000B (expression)'); +assert.sameValue(x, -2, 'U+000B (side effect)'); + +x = -1; +assert.sameValue(x -= 1, -2, 'U+000C (expression)'); +assert.sameValue(x, -2, 'U+000C (side effect)'); + +x = -1; +assert.sameValue(x -= 1, -2, 'U+0020 (expression)'); +assert.sameValue(x, -2, 'U+0020 (side effect)'); + +x = -1; +assert.sameValue(x -= 1, -2, 'U+00A0 (expression)'); +assert.sameValue(x, -2, 'U+00A0 (side effect)'); + +x = -1; +assert.sameValue(x +-= +1, -2, 'U+000A (expression)'); +assert.sameValue(x, -2, 'U+000A (side effect)'); + +x = -1; +assert.sameValue(x -= 1, -2, 'U+000D (expression)'); +assert.sameValue(x, -2, 'U+000D (side effect)'); + +x = -1; +assert.sameValue(x
-=
1, -2, 'U+2028 (expression)'); +assert.sameValue(x, -2, 'U+2028 (side effect)'); + +x = -1; +assert.sameValue(x
-=
1, -2, 'U+2029 (expression)'); +assert.sameValue(x, -2, 'U+2029 (side effect)'); + +x = -1; +assert.sameValue(x   + 

-=   + 

1, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, -2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/subtract-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/subtract-non-simple.js new file mode 100644 index 0000000000..b7287ac573 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/subtract-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound subtraction assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 -= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/u-right-shift-non-simple.js b/js/src/tests/test262/language/expressions/compound-assignment/u-right-shift-non-simple.js new file mode 100644 index 0000000000..3ebdab7788 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/u-right-shift-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Compound "unsigned right shift" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +1 >>>= 1; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/urshift-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/urshift-arguments-strict-strict.js new file mode 100644 index 0000000000..234f7bd714 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/urshift-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-19-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(>>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments >>>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/urshift-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/urshift-eval-strict-strict.js new file mode 100644 index 0000000000..6db086ec18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/urshift-eval-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-8-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment + operator(>>>=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval >>>= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/urshift-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/urshift-whitespace.js new file mode 100644 index 0000000000..a17a46973d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/urshift-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T8 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x >>>= y +---*/ + +var x; + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+0009 (expression)'); +assert.sameValue(x, 0, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+000B (expression)'); +assert.sameValue(x, 0, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+000C (expression)'); +assert.sameValue(x, 0, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+0020 (expression)'); +assert.sameValue(x, 0, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+00A0 (expression)'); +assert.sameValue(x, 0, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +>>>= +1, 0, 'U+000A (expression)'); +assert.sameValue(x, 0, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x >>>= 1, 0, 'U+000D (expression)'); +assert.sameValue(x, 0, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
>>>=
1, 0, 'U+2028 (expression)'); +assert.sameValue(x, 0, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
>>>=
1, 0, 'U+2029 (expression)'); +assert.sameValue(x, 0, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x   + 

>>>=   + 

1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/compound-assignment/xor-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/xor-arguments-strict-strict.js new file mode 100644 index 0000000000..0f50993e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/xor-arguments-strict-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-21-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Compound Assignment + operator(^=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments ^= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/xor-eval-strict-strict.js b/js/src/tests/test262/language/expressions/compound-assignment/xor-eval-strict-strict.js new file mode 100644 index 0000000000..55fb822df1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/xor-eval-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.13.2-6-10-s +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Compound Assignment operator(^=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval ^= 20; diff --git a/js/src/tests/test262/language/expressions/compound-assignment/xor-whitespace.js b/js/src/tests/test262/language/expressions/compound-assignment/xor-whitespace.js new file mode 100644 index 0000000000..7baad7be85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/compound-assignment/xor-whitespace.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +es5id: 11.13.2_A1_T10 +esid: sec-assignment-operators +description: Checking by using eval, check operator is x ^= y +---*/ + +var x; + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+0009 (expression)'); +assert.sameValue(x, 0, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+000B (expression)'); +assert.sameValue(x, 0, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+000C (expression)'); +assert.sameValue(x, 0, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+0020 (expression)'); +assert.sameValue(x, 0, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+00A0 (expression)'); +assert.sameValue(x, 0, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +^= +1, 0, 'U+000A (expression)'); +assert.sameValue(x, 0, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x ^= 1, 0, 'U+000D (expression)'); +assert.sameValue(x, 0, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
^=
1, 0, 'U+2028 (expression)'); +assert.sameValue(x, 0, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
^=
1, 0, 'U+2029 (expression)'); +assert.sameValue(x, 0, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x   + 

^=   + 

1, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 0, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A1_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A1_T2.js new file mode 100644 index 0000000000..3e437f82ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A1_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of ToString conversion from undefined value is "undefined" +es5id: 9.8_A1_T2 +description: > + Undefined values is undefined, void 0 and eval("var x"). Use + implicit transformation +---*/ + +// CHECK#1 +if (undefined + "" !== "undefined") { + throw new Test262Error('#1: undefined + "" === "undefined". Actual: ' + (undefined + "")); +} + +// CHECK#2 +if (void 0 + "" !== "undefined") { + throw new Test262Error('#2: void 0 + "" === "undefined". Actual: ' + (void 0 + "")); +} + +// CHECK#3 +if (eval("var x") + "" !== "undefined") { + throw new Test262Error('#3: eval("var x") + "" === "undefined". Actual: ' + (eval("var x") + "")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A2_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A2_T2.js new file mode 100644 index 0000000000..dd6ebcebff --- /dev/null +++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A2_T2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of ToString conversion from null value is "null" +es5id: 9.8_A2_T2 +description: null convert to String by implicit transformation +---*/ + +// CHECK#1 +if (null + "" !== "null") { + throw new Test262Error('#1: null + "" === "null". Actual: ' + (null + "")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A3_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A3_T2.js new file mode 100644 index 0000000000..9eaf919e8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A3_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of ToString conversion from boolean value is "true" if + the argument is "true", else is "false" +es5id: 9.8_A3_T2 +description: True and false convert to String by implicit transformation +---*/ + +// CHECK#1 +if (false + "" !== "false") { + throw new Test262Error('#1: false + "" === "false". Actual: ' + (false + "")); +} + +// CHECK#2 +if (true + "" !== "true") { + throw new Test262Error('#2: true + "" === "true". Actual: ' + (true + "")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.js new file mode 100644 index 0000000000..e73e78e90b --- /dev/null +++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of String conversion from string value is the input argument (no + conversion) +es5id: 9.8_A4_T2 +description: Some strings convert to String by implicit transformation +---*/ + +// CHECK#1 +var x1 = "abc"; +if (x1 + "" !== x1) { + throw new Test262Error('#1: "abc" + "" === "abc". Actual: ' + ("abc" + "")); +} + +// CHECK#2 +var x2 = "abc"; +if (typeof x2 + "" !== typeof x2) { + throw new Test262Error('#2: typeof "abc" + "" === "string". Actual: ' + (typeof "abc" + "")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js new file mode 100644 index 0000000000..55e772e126 --- /dev/null +++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js @@ -0,0 +1,93 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of String conversion from Object value is conversion + from primitive value +es5id: 9.8_A5_T2 +description: Some objects convert to String by implicit transformation +---*/ + +// CHECK#1 +if (new Number() + "" !== "0") { + throw new Test262Error('#1: new Number() + "" === "0". Actual: ' + (new Number() + "")); +} + +// CHECK#2 +if (new Number(0) + "" !== "0") { + throw new Test262Error('#2: new Number(0) + "" === "0". Actual: ' + (new Number(0) + "")); +} + +// CHECK#3 +if (new Number(Number.NaN) + "" !== "NaN") { + throw new Test262Error('#3: new Number(Number.NaN) + "" === "NaN". Actual: ' + (new Number(Number.NaN) + "")); +} + +// CHECK#4 +if (new Number(null) + "" !== "0") { + throw new Test262Error('#4: new Number(null) + "" === "0". Actual: ' + (new Number(null) + "")); +} + +// CHECK#5 +if (new Number(void 0) + "" !== "NaN") { + throw new Test262Error('#5: new Number(void 0) + "" === "NaN. Actual: ' + (new Number(void 0) + "")); +} + +// CHECK#6 +if (new Number(true) + "" !== "1") { + throw new Test262Error('#6: new Number(true) + "" === "1". Actual: ' + (new Number(true) + "")); +} + +// CHECK#7 +if (new Number(false) + "" !== "0") { + throw new Test262Error('#7: new Number(false) + "" === "0". Actual: ' + (new Number(false) + "")); +} + +// CHECK#8 +if (new Boolean(true) + "" !== "true") { + throw new Test262Error('#8: new Boolean(true) + "" === "true". Actual: ' + (new Boolean(true) + "")); +} + +// CHECK#9 +if (new Boolean(false) + "" !== "false") { + throw new Test262Error('#9: Number(new Boolean(false)) === "false". Actual: ' + (Number(new Boolean(false)))); +} + +// CHECK#10 +if (new Array(2,4,8,16,32) + "" !== "2,4,8,16,32") { + throw new Test262Error('#10: new Array(2,4,8,16,32) + "" === "2,4,8,16,32". Actual: ' + (new Array(2,4,8,16,32) + "")); +} + +// CHECK#11 +var myobj1 = { + toNumber : function(){return 12345;}, + toString : function(){return 67890;}, + valueOf : function(){return "[object MyObj]";} + }; + +if (myobj1 + "" !== "[object MyObj]"){ + throw new Test262Error('#11: myobj1 + "" calls ToPrimitive with hint Number. Exptected: "[object MyObj]". Actual: ' + (myobj1 + "")); +} + +// CHECK#12 +var myobj2 = { + toNumber : function(){return 12345;}, + toString : function(){return 67890}, + valueOf : function(){return {}} + }; + +if (myobj2 + "" !== "67890"){ + throw new Test262Error('#12: myobj2 + "" calls ToPrimitive with hint Number. Exptected: "67890". Actual: ' + (myobj2 + "")); +} + +// CHECK#13 +var myobj3 = { + toNumber : function(){return 12345;} + }; + +if (myobj3 + "" !== "[object Object]"){ + throw new Test262Error('#13: myobj3 + "" calls ToPrimitive with hint Number. Exptected: "[object Object]". Actual: ' + (myobj3 + "")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/concatenation/browser.js b/js/src/tests/test262/language/expressions/concatenation/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/concatenation/shell.js b/js/src/tests/test262/language/expressions/concatenation/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A1.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A1.js new file mode 100644 index 0000000000..f16b32fb76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LogicalORExpression and "?" or + between "?" and AssignmentExpression or between AssignmentExpression and + ":" or between ":" and AssignmentExpression are allowed +es5id: 11.12_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if ((eval("false\u0009?\u0009true\u0009:\u0009true")) !== true) { + throw new Test262Error('#1: (false\\u0009?\\u0009true\\u0009:\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("false\u000B?\u000Btrue\u000B:\u000Btrue")) !== true) { + throw new Test262Error('#2: (false\\u000B?\\u000Btrue\\u000B:\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("false\u000C?\u000Ctrue\u000C:\u000Ctrue")) !== true) { + throw new Test262Error('#3: (false\\u000C?\\u000Ctrue\\u000C:\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("false\u0020?\u0020true\u0020:\u0020true")) !== true) { + throw new Test262Error('#4: (false\\u0020?\\u0020true\\u0020:\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("false\u00A0?\u00A0true\u00A0:\u00A0true")) !== true) { + throw new Test262Error('#5: (false\\u00A0?\\u00A0true\\u00A0:\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("false\u000A?\u000Atrue\u000A:\u000Atrue")) !== true) { + throw new Test262Error('#6: (false\\u000A?\\u000Atrue\\u000A:\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("false\u000D?\u000Dtrue\u000D:\u000Dtrue")) !== true) { + throw new Test262Error('#7: (false\\u000D?\\u000Dtrue\\u000D:\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("false\u2028?\u2028true\u2028:\u2028true")) !== true) { + throw new Test262Error('#8: (false\\u2028?\\u2028true\\u2028:\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("false\u2029?\u2029true\u2029:\u2029true")) !== true) { + throw new Test262Error('#9: (false\\u2029?\\u2029true\\u2029:\\u2029true) === true'); +} + +//CHECK#10 +if ((eval("false\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029?\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029:\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) { + throw new Test262Error('#10: (false\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029?\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029:\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T1.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T1.js new file mode 100644 index 0000000000..4859764b0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T1.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Operator x ? y : z uses GetValue" +es5id: 11.12_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((true ? false : true) !== false) { + throw new Test262Error('#1: (true ? false : true) === false'); +} + +//CHECK#2 +if ((false ? false : true) !== true) { + throw new Test262Error('#2: (false ? false : true) === true'); +} + +//CHECK#3 +var x = new Boolean(true); +var y = new Boolean(false); +if ((x ? y : true) !== y) { + throw new Test262Error('#3: var x = new Boolean(true); var y = new Boolean(false); (x ? y : true) === y'); +} + +//CHECK#4 +var z = new Boolean(true); +if ((false ? false : z) !== z) { + throw new Test262Error('#4: var z = new Boolean(true); (false ? false : z) === z'); +} + +//CHECK#5 +var x = new Boolean(true); +var y = new Boolean(false); +var z = new Boolean(true); +if ((x ? y : z) !== y) { + throw new Test262Error('#5: var x = new Boolean(true); var y = new Boolean(false); var z = new Boolean(true); (x ? y : z) === y'); +} + +//CHECK#6 +var x = false; +var y = new Boolean(false); +var z = new Boolean(true); +if ((x ? y : z) !== z) { + throw new Test262Error('#6: var x = false; var y = new Boolean(false); var z = new Boolean(true); (x ? y : z) === z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T2.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T2.js new file mode 100644 index 0000000000..af5a146748 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Operator x ? y : z uses GetValue" +es5id: 11.12_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x ? true : false; + throw new Test262Error('#1.1: x ? true : false throw ReferenceError. Actual: ' + (x ? true : false)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x ? true : false throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T3.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T3.js new file mode 100644 index 0000000000..7153bf8896 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Operator x ? y : z uses GetValue" +es5id: 11.12_A2.1_T3 +description: > + If ToBoolean(x) is true and GetBase(y) is null, throw + ReferenceError +---*/ + +//CHECK#1 +try { + true ? y : false; + throw new Test262Error('#1.1: true ? y : false throw ReferenceError. Actual: ' + (true ? y : false)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: true ? y : false throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T4.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T4.js new file mode 100644 index 0000000000..8eb9fe4fa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T4.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Operator x ? y : z uses GetValue" +es5id: 11.12_A2.1_T4 +description: > + If ToBoolean(x) is false and GetBase(z) is null, throw + ReferenceError +---*/ + +//CHECK#1 +try { + false ? true : z; + throw new Test262Error('#1.1: false ? true : z throw ReferenceError. Actual: ' + (false ? true : z)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: false ? true : z throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T5.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T5.js new file mode 100644 index 0000000000..202243cf02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T5.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Operator x ? y : z uses GetValue" +es5id: 11.12_A2.1_T5 +description: If ToBoolean(x) is true and GetBase(z) is null, return y +---*/ + +//CHECK#1 +var y = new Object(); +if ((true ? y : z) !== y) { + throw new Test262Error('#1: var y = new Object(); (true ? y : z) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T6.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T6.js new file mode 100644 index 0000000000..543da3822b --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A2.1_T6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Operator x ? y : z uses GetValue" +es5id: 11.12_A2.1_T6 +description: If ToBoolean(x) is false and GetBase(y) is null, return z +---*/ + +//CHECK#1 +var z = new Object(); +if ((false ? y : z) !== z) { + throw new Test262Error('#1: var z = new Object(); (false ? y : z) === z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T1.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T1.js new file mode 100644 index 0000000000..ac41442d8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return z +es5id: 11.12_A3_T1 +description: Type(y) and Type(z) are boolean primitives +---*/ + +//CHECK#1 +if ((false ? false : true) !== true) { + throw new Test262Error('#1: (false ? false : true) === true'); +} + +//CHECK#2 +var z = new Boolean(true); +if ((false ? true : z) !== z) { + throw new Test262Error('#2: (var y = new Boolean(true); (false ? true : z) === z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T2.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T2.js new file mode 100644 index 0000000000..567736d830 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return z +es5id: 11.12_A3_T2 +description: Type(y) and Type(z) are number primitives +---*/ + +//CHECK#1 +if ((0 ? 0 : 1) !== 1) { + throw new Test262Error('#1: (0 ? 0 : 1) === 1'); +} + +//CHECK#2 +var z = new Number(1); +if ((0 ? 1 : z) !== z) { + throw new Test262Error('#2: (var y = new Number(1); (0 ? 1 : z) === z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T3.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T3.js new file mode 100644 index 0000000000..6b705fc0b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return z +es5id: 11.12_A3_T3 +description: Type(y) and Type(z) are string primitives +---*/ + +//CHECK#1 +if (("" ? "" : "1") !== "1") { + throw new Test262Error('#1: ("" ? "" : "1") === "1"'); +} + +//CHECK#2 +var z = new String("1"); +if (("" ? "1" : z) !== z) { + throw new Test262Error('#2: (var y = new String("1"); ("" ? "1" : z) === z'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T4.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T4.js new file mode 100644 index 0000000000..05812b3093 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return z +es5id: 11.12_A3_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((false ? true : undefined) !== undefined) { + throw new Test262Error('#1: (false ? true : undefined) === undefined'); +} + +//CHECK#2 +if ((false ? true : null) !== null) { + throw new Test262Error('#2: (false ? true : null) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T1.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T1.js new file mode 100644 index 0000000000..6ff8031efa --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.12_A4_T1 +description: Type(y) and Type(z) are boolean primitives +---*/ + +//CHECK#1 +if ((true ? false : true) !== false) { + throw new Test262Error('#1: (true ? false : true) === false'); +} + +//CHECK#2 +var y = new Boolean(true); +if ((true ? y : false) !== y) { + throw new Test262Error('#2: (var y = new Boolean(true); (true ? y : false) === y'); +} + +//CHECK#3 +var y = new Boolean(false); +if ((y ? y : true) !== y) { + throw new Test262Error('#3: (var y = new Boolean(false); (y ? y : true) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T2.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T2.js new file mode 100644 index 0000000000..997de777f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.12_A4_T2 +description: Type(y) and Type(z) are number primitives +---*/ + +//CHECK#1 +if ((1 ? 0 : 1) !== 0) { + throw new Test262Error('#1: (1 ? 0 : 1) === 0'); +} + +//CHECK#2 +var y = new Number(1); +if ((1 ? y : 0) !== y) { + throw new Test262Error('#2: (var y = new Number(1); (1 ? y : 0) === y'); +} + +//CHECK#3 +var y = new Number(NaN); +if ((y ? y : 1) !== y) { + throw new Test262Error('#3: (var y = new Number(NaN); (y ? y : 1) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T3.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T3.js new file mode 100644 index 0000000000..7d5b4b9643 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.12_A4_T3 +description: Type(y) and Type(z) are string primitives +---*/ + +//CHECK#1 +if (("1" ? "" : "1") !== "") { + throw new Test262Error('#1: ("1" ? "" : "1") === ""'); +} + +//CHECK#2 +var y = new String("1"); +if (("1" ? y : "") !== y) { + throw new Test262Error('#2: (var y = new String("1"); ("1" ? y : "") === y'); +} + +//CHECK#3 +var y = new String("y"); +if ((y ? y : "1") !== y) { + throw new Test262Error('#3: (var y = new String("y"); (y ? y : "1") === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T4.js b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T4.js new file mode 100644 index 0000000000..1ec3450deb --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/S11.12_A4_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.12_A4_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((true ? undefined : true) !== undefined) { + throw new Test262Error('#1: (true ? undefined : true) === undefined'); +} + +//CHECK#2 +if ((true ? null : true) !== null) { + throw new Test262Error('#2: (true ? null : true) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/browser.js b/js/src/tests/test262/language/expressions/conditional/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/conditional/coalesce-expr-ternary.js b/js/src/tests/test262/language/expressions/conditional/coalesce-expr-ternary.js new file mode 100644 index 0000000000..543f22127a --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/coalesce-expr-ternary.js @@ -0,0 +1,75 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + ShortCircuitExpression in the Conditional Expression (? :) +esid: sec-conditional-operator +info: | + ShortCircuitExpression : + LogicalORExpression + CoalesceExpression + + CoalesceExpression : + CoalesceExpressionHead ?? BitwiseORExpression + + CoalesceExpressionHead : + CoalesceExpression + BitwiseORExpression + + ConditionalExpression : + ShortCircuitExpression + ShortCircuitExpression ? AssignmentExpression : AssignmentExpression +features: [coalesce-expression] +---*/ + +var x; + +x = undefined ?? true ? 0 : 42; +assert.sameValue(x, 0, 'undefined ?? true ? 0 : 42'); + +x = undefined; +x = null ?? true ? 0 : 42; +assert.sameValue(x, 0, 'null ?? true ? 0 : 42'); + +x = undefined; +x = undefined ?? false ? 0 : 42; +assert.sameValue(x, 42, 'undefined ?? false ? 0 : 42'); + +x = undefined; +x = null ?? false ? 0 : 42; +assert.sameValue(x, 42, 'null ?? false ? 0 : 42'); + +x = undefined; +x = false ?? true ? 0 : 42; +assert.sameValue(x, 42, 'false ?? true ? 0 : 42'); + +x = undefined; +x = 0 ?? true ? 0 : 42; +assert.sameValue(x, 42, '0 ?? true ? 0 : 42'); + +x = undefined; +x = 1 ?? false ? 0 : 42; +assert.sameValue(x, 0, '1 ?? false ? 0 : 42'); + +x = undefined; +x = true ?? false ? 0 : 42; +assert.sameValue(x, 0, 'true ?? false ? 0 : 42'); + +x = undefined; +x = true ?? true ? 0 : 42; +assert.sameValue(x, 0, 'true ?? true ? 0 : 42'); + +x = undefined; +x = '' ?? true ? 0 : 42; +assert.sameValue(x, 42, '"" ?? true ? 0 : 42'); + +x = undefined; +x = Symbol() ?? false ? 0 : 42; +assert.sameValue(x, 0, 'Symbol() ?? false ? 0 : 42'); + +x = undefined; +x = {} ?? false ? 0 : 42; +assert.sameValue(x, 0, 'object ?? false ? 0 : 42'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/in-branch-1.js b/js/src/tests/test262/language/expressions/conditional/in-branch-1.js new file mode 100644 index 0000000000..7ae7ef62b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/in-branch-1.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-conditional-operator +es6id: 12.13 +description: > + The first AssignmentExpression may include the `in` keyword in any context +info: | + Syntax + + ConditionalExpression[In, Yield] : + LogicalORExpression[?In, ?Yield] + LogicalORExpression[?In, ?Yield] ? AssignmentExpression[+In, ?Yield] : AssignmentExpression[?In, ?Yield] +---*/ + +var cond1Count = 0; +var cond2Count = 0; +var cond1 = function() { + cond1Count += 1; + return {}; +}; +var cond2 = function() { + cond2Count += 1; +}; +for (true ? '' in cond1() : cond2(); false; ) ; + +assert.sameValue(cond1Count, 1); +assert.sameValue(cond2Count, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/in-branch-2.js b/js/src/tests/test262/language/expressions/conditional/in-branch-2.js new file mode 100644 index 0000000000..ce37772cd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/in-branch-2.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-conditional-operator +es6id: 12.13 +description: > + The second AssignmentExpression cannot include the `in` keyword in contexts + where it is disallowed. +info: | + Syntax + + ConditionalExpression[In, Yield] : + LogicalORExpression[?In, ?Yield] + LogicalORExpression[?In, ?Yield] ? AssignmentExpression[+In, ?Yield] : AssignmentExpression[?In, ?Yield] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +for (true ? 0 : 0 in {}; false; ) ; diff --git a/js/src/tests/test262/language/expressions/conditional/in-condition.js b/js/src/tests/test262/language/expressions/conditional/in-condition.js new file mode 100644 index 0000000000..5cbb70c50d --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/in-condition.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-conditional-operator +es6id: 12.13 +description: > + The expression's LogicalORExpression sub-expression cannot include the `in` + keyword in contexts where it is disallowed. +info: | + Syntax + + ConditionalExpression[In, Yield] : + LogicalORExpression[?In, ?Yield] + LogicalORExpression[?In, ?Yield] ? AssignmentExpression[+In, ?Yield] : AssignmentExpression[?In, ?Yield] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +for ('' in {} ? 0 : 0; false; ) ; diff --git a/js/src/tests/test262/language/expressions/conditional/shell.js b/js/src/tests/test262/language/expressions/conditional/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/conditional/symbol-conditional-evaluation.js b/js/src/tests/test262/language/expressions/conditional/symbol-conditional-evaluation.js new file mode 100644 index 0000000000..35c95a12aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/symbol-conditional-evaluation.js @@ -0,0 +1,14 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.12.3 +description: > + Conditional Symbol evaluation +features: [Symbol] +---*/ +var sym = Symbol(); + +assert.sameValue(sym ? 1 : 2, 1, "`sym ? 1 : 2` is `1`"); +assert.sameValue(!sym ? 1 : 2, 2, "`!sym ? 1 : 2` is `2`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/tco-cond-strict.js b/js/src/tests/test262/language/expressions/conditional/tco-cond-strict.js new file mode 100644 index 0000000000..0977d097ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/tco-cond-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return true ? f(n - 1) : 0; +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/conditional/tco-pos-strict.js b/js/src/tests/test262/language/expressions/conditional/tco-pos-strict.js new file mode 100644 index 0000000000..71931daf96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/conditional/tco-pos-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return false ? 0 : f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-0-1.js b/js/src/tests/test262/language/expressions/delete/11.4.1-0-1.js new file mode 100644 index 0000000000..2abdae51d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-0-1.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator as UnaryExpression +flags: [noStrict] +---*/ + +var x = 1; +var y = 2; +var z = 3; + +assert((!delete x || delete y), '(!delete x || delete y)'); +assert(delete delete z, 'delete delete z'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-2-2.js b/js/src/tests/test262/language/expressions/delete/11.4.1-2-2.js new file mode 100644 index 0000000000..5fd845828a --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-2-2.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns true when deleting returned value from a + function +---*/ + +var bIsFooCalled = false; +var foo = function() { + bIsFooCalled = true; +}; + +var d = delete foo(); + +assert.sameValue(d, true, 'd'); +assert.sameValue(bIsFooCalled, true, 'bIsFooCalled'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-3-1.js b/js/src/tests/test262/language/expressions/delete/11.4.1-3-1.js new file mode 100644 index 0000000000..26fd6e8472 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-3-1.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns true when deleting an unresolvable + reference +flags: [noStrict] +---*/ + +assert.sameValue(delete unresolvable, true, 'delete unresolvable === true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-3-2.js b/js/src/tests/test262/language/expressions/delete/11.4.1-3-2.js new file mode 100644 index 0000000000..5b104a6308 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-3-2.js @@ -0,0 +1,15 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator throws ReferenceError when deleting an explicitly + qualified yet unresolvable reference (base obj undefined) +---*/ + +assert.throws(ReferenceError, function() { + delete unresolvable.x; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-3-3.js b/js/src/tests/test262/language/expressions/delete/11.4.1-3-3.js new file mode 100644 index 0000000000..6b1fbba700 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-3-3.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns true when deleting an explicitly qualified + yet unresolvable reference (property undefined for base obj) +---*/ + +var o = {}; +assert.sameValue(delete o.x, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-1-s-strict.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-1-s-strict.js new file mode 100644 index 0000000000..4bde0ebeee --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-1-s-strict.js @@ -0,0 +1,23 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown when deleting non-configurable + data property +flags: [onlyStrict] +---*/ + +var obj = {}; +Object.defineProperty(obj, 'prop', { + value: 'abc', + configurable: false, +}); +assert.throws(TypeError, function() { + delete obj.prop; +}); +assert.sameValue(obj.prop, 'abc', 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-2-s-strict.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-2-s-strict.js new file mode 100644 index 0000000000..e8f9b5724d --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-2-s-strict.js @@ -0,0 +1,25 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown when deleting non-configurable + accessor property +flags: [onlyStrict] +---*/ + +var obj = {}; +Object.defineProperty(obj, 'prop', { + get: function() { + return 'abc'; + }, + configurable: false, +}); +assert.throws(TypeError, function() { + delete obj.prop; +}); +assert.sameValue(obj.prop, 'abc', 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-3-s.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-3-s.js new file mode 100644 index 0000000000..5a75ac567b --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-3-s.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + TypeError isn't thrown when deleting configurable data property +---*/ + +var obj = {}; +Object.defineProperty(obj, 'prop', { + value: 'abc', + configurable: true, +}); + +delete obj.prop; + +assert.sameValue( + obj.hasOwnProperty('prop'), + false, + 'obj.hasOwnProperty("prop")' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-4-s.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-4-s.js new file mode 100644 index 0000000000..6783d5090e --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4-a-4-s.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + TypeError isn't thrown when deleting configurable accessor property +---*/ + +var obj = {}; +Object.defineProperty(obj, 'prop', { + get: function() { + return 'abc'; + }, + configurable: true, +}); + +delete obj.prop; + +assert.sameValue( + obj.hasOwnProperty('prop'), + false, + 'obj.hasOwnProperty("prop")' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-1.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-1.js new file mode 100644 index 0000000000..856ea0da33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-1.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns true when deleting a configurable data + property +---*/ + +var o = {}; + +var desc = { + value: 1, + configurable: true, +}; +Object.defineProperty(o, 'foo', desc); + +var d = delete o.foo; + +assert.sameValue(d, true, 'd'); +assert.sameValue(o.hasOwnProperty('foo'), false, 'o.hasOwnProperty("foo")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-10.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-10.js new file mode 100644 index 0000000000..c0738a9755 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-10.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns true for property (stringify) defined on + built-in object (JSON) +---*/ + +var d = delete JSON.stringify; + +assert.sameValue(d, true, 'd'); +assert.sameValue(JSON.stringify, undefined, 'JSON.stringify'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-11.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-11.js new file mode 100644 index 0000000000..83304245cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-11.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns true on deleting arguments + properties(arguments.callee) +flags: [noStrict] +---*/ + +(function() { + var d = delete arguments.callee; + + assert.sameValue(d, true, 'd'); + assert.sameValue(arguments.callee, undefined, 'arguments.callee'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-12.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-12.js new file mode 100644 index 0000000000..3f7fc897a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-12.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns false when deleting a property(length) +flags: [noStrict] +---*/ + +var a = [1, 2, 3]; +a.x = 10; +var d = delete a.length; + +assert.sameValue(d, false, 'd'); +assert.sameValue(a.length, 3, 'a.length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-13.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-13.js new file mode 100644 index 0000000000..459421fa5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-13.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns false when deleting Array object +flags: [noStrict] +---*/ + +var a = [1, 2, 3]; +a.x = 10; + +var d = delete a; + +assert.sameValue(d, false, 'd'); +assert.sameValue(Array.isArray(a), true, 'Array.isArray(a)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-14.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-14.js new file mode 100644 index 0000000000..dd3d849168 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-14.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns true when deleting Array elements +---*/ + +var a = [1, 2, 3]; +a.x = 10; +var d = delete a[1]; + +assert.sameValue(d, true, 'd'); +assert.sameValue(a[1], undefined, 'a[1]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-15.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-15.js new file mode 100644 index 0000000000..ea2a3e0bd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-15.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns true when deleting Array expandos +---*/ + +var a = [1, 2, 3]; +a.x = 10; +var d = delete a.x; + +assert.sameValue(d, true, 'd'); +assert.sameValue(a.x, undefined, 'a.x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-16.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-16.js new file mode 100644 index 0000000000..4d0e7d1ef0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-16.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns false on deleting arguments object +flags: [noStrict] +---*/ + +(function() { + assert.sameValue(delete arguments, false, 'delete arguments'); + assert.notSameValue(arguments, undefined, 'arguments'); +})(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-17.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-17.js new file mode 100644 index 0000000000..d5d9e39ce6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-17.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns true on deleting a arguments element +---*/ + +function foo(a, b) { + var d = delete arguments[0]; + return d === true && arguments[0] === undefined; +} + +assert.sameValue(foo(1, 2), true, 'foo(1,2)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-2.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-2.js new file mode 100644 index 0000000000..dc375ee9ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-2.js @@ -0,0 +1,32 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns true when deleting a configurable accessor + property +---*/ + +var o = {}; + +// define an accessor +// dummy getter +var getter = function() { + return 1; +}; +var desc = { + get: getter, + configurable: true, +}; +Object.defineProperty(o, 'foo', desc); + +var d = delete o.foo; + +assert.sameValue(d, true, 'd'); +assert.sameValue(o.hasOwnProperty('foo'), false, 'o.hasOwnProperty("foo")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3-s-strict.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3-s-strict.js new file mode 100644 index 0000000000..8a25d34be6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3-s-strict.js @@ -0,0 +1,27 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator throws TypeError when deleting a non-configurable + data property in strict mode +flags: [onlyStrict] +---*/ + +var o = {}; +var desc = { + value: 1, +}; // all other attributes default to false +Object.defineProperty(o, 'foo', desc); + +// Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false. +assert.throws(TypeError, function() { + delete o.foo; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3.js new file mode 100644 index 0000000000..76eb6c2eb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-3.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns false when deleting a non-configurable + data property +flags: [noStrict] +---*/ + +var o = {}; +var desc = { + value: 1, + configurable: false, +}; // all other attributes default to false +Object.defineProperty(o, 'foo', desc); + +// Now, deleting o.foo should fail because [[Configurable]] on foo is false. +var d = delete o.foo; + +assert.sameValue(d, false, 'd'); +assert.sameValue(o.hasOwnProperty('foo'), true, 'o.hasOwnProperty("foo")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-4.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-4.js new file mode 100644 index 0000000000..425ce3ff35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-4.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns false when deleting a non-configurable + data property (NaN) +flags: [noStrict] +---*/ + +// NaN (15.1.1.1) has [[Configurable]] set to false. +var d = delete NaN; + +assert.sameValue(d, false, 'd'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-5.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-5.js new file mode 100644 index 0000000000..da68d598ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-5.js @@ -0,0 +1,26 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns false when deleting the declaration of the environment object + inside 'with' +flags: [noStrict] +---*/ + +var o = new Object(); +o.x = 1; +var d; +with(o) { + d = delete o; +} + +assert.sameValue(d, false, 'd'); +assert.sameValue(typeof o, 'object', 'typeof(o)'); +assert.sameValue(o.x, 1, 'o.x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-6.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-6.js new file mode 100644 index 0000000000..cee3aff136 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-6.js @@ -0,0 +1,23 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns true when deleting a property inside 'with' +flags: [noStrict] +---*/ + +var o = new Object(); +o.x = 1; +var d; +with(o) { + d = delete x; +} + +assert.sameValue(d, true, 'd'); +assert.sameValue(o.x, undefined, 'o.x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-7.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-7.js new file mode 100644 index 0000000000..0507d4019f --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-7.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator inside 'eval' +flags: [noStrict] +---*/ + +var x = 1; +var d = eval('delete x'); + +assert.sameValue(d, false, 'd'); +assert.sameValue(x, 1, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8-s-strict.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8-s-strict.js new file mode 100644 index 0000000000..d6150ba9e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8-s-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator throws TypeError when deleting a non-configurable + data property in strict mode +flags: [onlyStrict] +---*/ + +var global = this; +// NaN (15.1.1.1) has [[Configurable]] set to false. +assert.throws(TypeError, function() { + delete global.NaN; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8.js new file mode 100644 index 0000000000..b6638c57f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-8.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: delete operator returns true for built-in objects (JSON) +flags: [noStrict] +---*/ + +var d = delete JSON; + +assert.sameValue(d, true, 'd'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9-s-strict.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9-s-strict.js new file mode 100644 index 0000000000..332c565978 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9-s-strict.js @@ -0,0 +1,20 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator throws TypeError when deleting a non-configurable + data property (Math.LN2) in strict mode +flags: [onlyStrict] +---*/ + +assert.throws(TypeError, function() { + delete Math.LN2; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9.js b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9.js new file mode 100644 index 0000000000..b2472ca17a --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-4.a-9.js @@ -0,0 +1,19 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns false when deleting a non-configurable + data property (Math.LN2) +flags: [noStrict] +---*/ + +var d = delete Math.LN2; + +assert.sameValue(d, false, 'd'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-5-1.js b/js/src/tests/test262/language/expressions/delete/11.4.1-5-1.js new file mode 100644 index 0000000000..22b056520c --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-5-1.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns false when deleting a direct reference to + a var +flags: [noStrict] +---*/ + +var x = 1; + +// Now, deleting 'x' directly should fail; +var d = delete x; + +assert.sameValue(d, false, 'd'); +assert.sameValue(x, 1, 'x'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-5-2.js b/js/src/tests/test262/language/expressions/delete/11.4.1-5-2.js new file mode 100644 index 0000000000..7f7cb95ad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-5-2.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns false when deleting a direct reference to + a function argument +flags: [noStrict] +---*/ + +function foo(a, b) { + // Now, deleting 'a' directly should fail + // because 'a' is direct reference to a function argument; + var d = delete a; + return d === false && a === 1; +} + +assert(foo(1, 2), 'foo(1,2) !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-5-3.js b/js/src/tests/test262/language/expressions/delete/11.4.1-5-3.js new file mode 100644 index 0000000000..a9353540ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-5-3.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator returns false when deleting a direct reference to + a function name +flags: [noStrict] +---*/ + +var foo = function() {}; + +// Now, deleting 'foo' directly should fail; +var d = delete foo; + +assert.sameValue(d, false, 'd'); +assert.sameValue(typeof foo, 'function', 'typeof foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-5-a-27-s-strict.js b/js/src/tests/test262/language/expressions/delete/11.4.1-5-a-27-s-strict.js new file mode 100644 index 0000000000..c32710b2b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-5-a-27-s-strict.js @@ -0,0 +1,25 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown after deleting a property, + calling preventExtensions, and attempting to reassign the property +flags: [onlyStrict] +---*/ + +var a = { + x: 0, + get y() { + return 0; + }, +}; +delete a.x; +Object.preventExtensions(a); +assert.throws(TypeError, function() { + a.x = 1; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.1-5-a-28-s.js b/js/src/tests/test262/language/expressions/delete/11.4.1-5-a-28-s.js new file mode 100644 index 0000000000..aa465ea689 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.1-5-a-28-s.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: Strict Mode - TypeError is not thrown when deleting RegExp.length +---*/ + +var a = new RegExp(); +var b = delete RegExp.length; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/11.4.4-4.a-3-s-strict.js b/js/src/tests/test262/language/expressions/delete/11.4.4-4.a-3-s-strict.js new file mode 100644 index 0000000000..8a25d34be6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/11.4.4-4.a-3-s-strict.js @@ -0,0 +1,27 @@ +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + This test is actually testing the [[Delete]] internal method (8.12.8). Since the + language provides no way to directly exercise [[Delete]], the tests are placed here. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operator throws TypeError when deleting a non-configurable + data property in strict mode +flags: [onlyStrict] +---*/ + +var o = {}; +var desc = { + value: 1, +}; // all other attributes default to false +Object.defineProperty(o, 'foo', desc); + +// Now, deleting o.foo should throw TypeError because [[Configurable]] on foo is false. +assert.throws(TypeError, function() { + delete o.foo; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.1.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.1.js new file mode 100644 index 0000000000..d8e0b58f99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is not Reference, return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking primitive value and Object value cases +---*/ + +//CHECK#1 +if (delete 1 !== true) { + throw new Test262Error('#1: delete 1 === true'); +} + +//CHECK#2 +if (delete new Object() !== true) { + throw new Test262Error('#2: delete new Object() === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T1.js new file mode 100644 index 0000000000..fff3348455 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If GetBase(x) doesn't have a property GetPropertyName(x), return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking undeclared variable case +flags: [noStrict] +---*/ + +//CHECK#1 +if (delete x !== true) { + throw new Test262Error('#1: delete x === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T2.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T2.js new file mode 100644 index 0000000000..b415e3cf1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If GetBase(x) doesn't have a property GetPropertyName(x), return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking Object object and Function object cases +---*/ + +//CHECK#1 +function MyFunction() {} +var MyObject = new MyFunction(); +if (delete MyObject.prop !== true) { + throw new Test262Error( + '#1: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject.prop === true' + ); +} + +//CHECK#2 +var MyObject = new Object(); +if (delete MyObject.prop !== true) { + throw new Test262Error('#2: var MyObject = new Object(); delete MyObject.prop === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T3.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T3.js new file mode 100644 index 0000000000..eeb3a8653c --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A2.2_T3.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If GetBase(x) doesn't have a property GetPropertyName(x), return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking undeclared variable case +---*/ + +//CHECK#1 +if (delete this.x !== true) { + throw new Test262Error('#1: delete this.x === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.1.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.1.js new file mode 100644 index 0000000000..14f3600ced --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.1.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property has the DontDelete attribute, return false +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +flags: [noStrict] +---*/ + +//CHECK#1 +var x = 1; +if (delete x !== false) { + throw new Test262Error('#1: var x = 1; delete x === false'); +} + +//CHECK#2 +var y = 1; +if (delete this.y !== false) { + throw new Test262Error('#2: var y = 1; delete this.y === false'); +} + +//CHECK#3 +function MyFunction() {} +if (delete MyFunction !== false) { + throw new Test262Error('#3: function MyFunction(){}; delete MyFunction === false'); +} + +//CHECK#4 +var MyObject = new MyFunction(); +if (delete MyObject !== false) { + throw new Test262Error( + '#4: function MyFunction(){}; var MyObject = new MyFunction(); delete MyObject === false' + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T1.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T1.js new file mode 100644 index 0000000000..9abad43558 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +flags: [noStrict] +---*/ + +//CHECK#1 +x = 1; +if (delete x !== true) { + throw new Test262Error('#1: x = 1; delete x === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T2.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T2.js new file mode 100644 index 0000000000..5474433e74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +---*/ + +//CHECK#1 +function MyFunction() {} +MyFunction.prop = 1; +if (delete MyFunction.prop !== true) { + throw new Test262Error( + '#1: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop === true' + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T3.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T3.js new file mode 100644 index 0000000000..c33135a62e --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.2_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +---*/ + +//CHECK#1 +function MyFunction() {} +var MyObject = new MyFunction(); +MyObject.prop = 1; +if (delete MyObject.prop !== true) { + throw new Test262Error( + '#1: function MyFunction(){}; var MyObject = new MyFunction(); MyFunction.prop = 1; delete MyObject.prop === true' + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T1.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T1.js new file mode 100644 index 0000000000..5acc552403 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, remove the property +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +flags: [noStrict] +---*/ + +//CHECK#1 +try { + x = 1; + delete x; + x; + throw new Test262Error('#1: x = 1; delete x; x is not exist'); +} catch (e) { + if (e instanceof ReferenceError !== true) { + throw new Test262Error('#1: x = 1; delete x; x is not exist'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T2.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T2.js new file mode 100644 index 0000000000..ce9fd18cd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, remove the property +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +---*/ + +//CHECK#1 +function MyFunction() {} +MyFunction.prop = 1; +delete MyFunction.prop; +if (MyFunction.prop !== undefined) { + throw new Test262Error( + '#1: function MyFunction(){}; MyFunction.prop = 1; delete MyFunction.prop; MyFunction.prop === undefined. Actual: ' + + MyFunction.prop + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T3.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T3.js new file mode 100644 index 0000000000..f6a517fdd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, remove the property +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +---*/ + +//CHECK#1 +function MyFunction() {} +var MyObjectVar = new MyFunction(); +MyObjectVar.prop = 1; +delete MyObjectVar.prop; +if (MyObjectVar.prop !== undefined) { + throw new Test262Error( + '#1: function MyFunction(){}; var MyObjectVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectVar.prop; MyObjectVar.prop === undefined. Actual: ' + + MyObjectVar.prop + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T4.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T4.js new file mode 100644 index 0000000000..d188fb1e5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, remove the property +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +flags: [noStrict] +---*/ + +//CHECK#1 +function MyFunction() {} +var MyObjectVar = new MyFunction(); +if (delete MyObjectVar !== false) { + throw new Test262Error( + '#1: function MyFunction(){}; var MyObjectVar = new MyFunction(); delete MyObjectVar === false' + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T5.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T5.js new file mode 100644 index 0000000000..0d9910dcb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T5.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, remove the property +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +flags: [noStrict] +---*/ + +//CHECK#1 +function MyFunction() {} +MyObjectNotVar = new MyFunction(); +MyObjectNotVar.prop = 1; +delete MyObjectNotVar.prop; +if (MyObjectNotVar.prop !== undefined) { + throw new Test262Error( + '#1: function MyFunction(){}; MyObjectNotVar = new MyFunction(); MyFunction.prop = 1; delete MyObjectNotVar.prop; MyObjectNotVar.prop === undefined. Actual: ' + + MyObjectNotVar.prop + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T6.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T6.js new file mode 100644 index 0000000000..e121ab7bd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A3.3_T6.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If the property doesn't have the DontDelete attribute, remove the property +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking declared variable +flags: [noStrict] +---*/ + +//CHECK#1 +function MyFunction() {} +var MyObjectVar = new MyFunction(); +if (delete MyObjectNotVar !== true) { + throw new Test262Error( + '#1: function MyFunction(){}; var MyObjectNotVar = new MyFunction(); delete MyObjectNotVar === true' + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A4.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A4.js new file mode 100644 index 0000000000..8e96fd1198 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + "Delete" operator removes property, which is reference to the object, not + the object +esid: sec-delete-operator-runtime-semantics-evaluation +description: Checking two reference by one object +flags: [noStrict] +---*/ + +//CHECK#1 +var obj = new Object(); +var ref = obj; +delete ref; +if (typeof obj !== 'object') { + throw new Test262Error( + '#1: obj = new Object(); ref = obj; delete ref; typeof obj === "object". Actual: ' + + typeof obj + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S11.4.1_A5-strict.js b/js/src/tests/test262/language/expressions/delete/S11.4.1_A5-strict.js new file mode 100644 index 0000000000..caafc98766 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S11.4.1_A5-strict.js @@ -0,0 +1,36 @@ +'use strict'; +// Copyright 2011 Google Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + A strict delete should either succeed, returning true, or it + should fail by throwing a TypeError. Under no circumstances + should a strict delete return false. +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + See if a strict delete returns false when deleting a non-standard + property. +flags: [onlyStrict] +---*/ + +var reNames = Object.getOwnPropertyNames(RegExp); +for (var i = 0, len = reNames.length; i < len; i++) { + var reName = reNames[i]; + if (reName !== 'prototype') { + var deleted = 'unassigned'; + try { + deleted = delete RegExp[reName]; + } catch (err) { + if (!(err instanceof TypeError)) { + throw new Test262Error('#1: strict delete threw a non-TypeError: ' + err); + } + // fall through + } + if (deleted === false) { + throw new Test262Error('#2: Strict delete returned false'); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S8.12.7_A1.js b/js/src/tests/test262/language/expressions/delete/S8.12.7_A1.js new file mode 100644 index 0000000000..548ed5ea96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S8.12.7_A1.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[Delete]] method of O is called with property name P, + and If the property has the DontDelete attribute, return false +esid: sec-delete-operator-runtime-semantics-evaluation +description: Try to delete Math.E, that has the DontDelete attribute +flags: [noStrict] +---*/ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete Math.E !== false) { + throw new Test262Error('#1: delete Math.E === false. Actual: ' + delete Math.E); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (Math.E === undefined) { + throw new Test262Error('#2: delete Math.E; Math.E !== undefined'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T1.js b/js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T1.js new file mode 100644 index 0000000000..e7bf650573 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T1.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[Delete]] method of O is called with property name P, + and if O doesn't have a property with name P, return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Try to delete not existent properties +---*/ + +var __color__map = {}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete __color__map.red !== true) { + throw new Test262Error( + '#1: var __color__map = {}; delete __color__map.red === true. Actual: ' + + delete __color__map.red + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (delete __color__map['green'] !== true) { + throw new Test262Error( + '#2: var __color__map = {}; delete __color__map["green"] === true. Actual: ' + + delete __color__map['green'] + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +var blue = 1; +if (delete __color__map[blue] !== true) { + throw new Test262Error( + '#3: var __color__map = {}; var blue = 1; delete __color__map[blue] === true. Actual: ' + + delete __color__map[blue] + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T2.js b/js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T2.js new file mode 100644 index 0000000000..beac6d7393 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S8.12.7_A2_T2.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[Delete]] method of O is called with property name P, + and if O doesn't have a property with name P, return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + Try to delete not existent properties of O, but existent property + of prototype +---*/ + +function Palette() {} +Palette.prototype = { + red: 0xff0000, + green: 0x00ff00, +}; +var __palette = new Palette(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__palette.red !== 0xff0000) { + throw new Test262Error( + '#1: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' + + __palette.red + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (delete __palette.red !== true) { + throw new Test262Error( + '#2 function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; delete __palette.red === true. Actual: ' + + delete __palette.red + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__palette.red !== 0xff0000) { + throw new Test262Error( + '#3: function Palette(){}; Palette.prototype = {red:0xFF0000, green:0x00FF00}; __palette = new Palette; __palette.red === 0xFF0000. Actual: ' + + __palette.red + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/S8.12.7_A3.js b/js/src/tests/test262/language/expressions/delete/S8.12.7_A3.js new file mode 100644 index 0000000000..650c637732 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/S8.12.7_A3.js @@ -0,0 +1,66 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[Delete]] method of O is called with property name P, + removes the property with name P from O and return true +esid: sec-delete-operator-runtime-semantics-evaluation +description: Delete existent properties +---*/ + +var BLUE_NUM = 1; +var BLUE_STR = '1'; +var YELLOW_NUM = 2; +var YELLOW_STR = '2'; +var __color__map = { + red: 0xff0000, + BLUE_NUM: 0x0000ff, + green: 0x00ff00, + YELLOW_STR: 0xffff00, +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete __color__map[YELLOW_NUM] !== true) { + throw new Test262Error( + '#1: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[YELLOW_NUM] === true;' + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__color__map[YELLOW_STR] !== undefined) { + throw new Test262Error( + '#2: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[YELLOW_NUM]; __color__map[YELLOW_STR] === undefined. Actual: ' + + __color__map[YELLOW_STR] + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (delete __color__map[BLUE_STR] !== true) { + throw new Test262Error( + '#3: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[BLUE_STR] === true. Actual: ' + + delete __color__map[BLUE_STR] + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__color__map[BLUE_NUM] !== undefined) { + throw new Test262Error( + '#4: var BLUE_NUM=1; var BLUE_STR="1"; var YELLOW_NUM=2; var YELLOW_STR="2"; var __color__map = {red:0xFF0000, BLUE_NUM:0x0000FF, green:0x00FF00, YELLOW_STR:0xFFFF00}; delete __color__map[BLUE_STR]; __color__map[BLUE_NUM] === undefined. Actual: ' + + __color__map[BLUE_NUM] + ); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/browser.js b/js/src/tests/test262/language/expressions/delete/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/delete/delete-unresolvable-base-object-reference-throws-typeerror.js b/js/src/tests/test262/language/expressions/delete/delete-unresolvable-base-object-reference-throws-typeerror.js new file mode 100644 index 0000000000..934e59eec9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/delete-unresolvable-base-object-reference-throws-typeerror.js @@ -0,0 +1,14 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + delete operations throws TypeError exception when base object is unresolvable reference. +---*/ + +assert.throws(TypeError, () => { + delete Object[0][0]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/identifier-strict-recursive-strict.js b/js/src/tests/test262/language/expressions/delete/identifier-strict-recursive-strict.js new file mode 100644 index 0000000000..1ef9cb5076 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/identifier-strict-recursive-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// Copyright (c) 2021 Gus Caplan. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-delete-operator-static-semantics-early-errors +description: Parsing error when operand is an IdentifierReference +info: | + It is a Syntax Error if the UnaryExpression is contained in strict mode code + and the derived UnaryExpression is PrimaryExpression:IdentifierReference. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +delete ((identifier)); diff --git a/js/src/tests/test262/language/expressions/delete/identifier-strict-strict.js b/js/src/tests/test262/language/expressions/delete/identifier-strict-strict.js new file mode 100644 index 0000000000..d84e8a4e59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/identifier-strict-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2018 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-delete-operator-static-semantics-early-errors +description: Parsing error when operand is an IdentifierReference +info: | + It is a Syntax Error if the UnaryExpression is contained in strict mode code + and the derived UnaryExpression is PrimaryExpression:IdentifierReference. +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +delete test262identifier; diff --git a/js/src/tests/test262/language/expressions/delete/member-computed-reference-null.js b/js/src/tests/test262/language/expressions/delete/member-computed-reference-null.js new file mode 100644 index 0000000000..d8fd93ffd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/member-computed-reference-null.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator +description: Delete Operator throws an error if the base reference is not object-coercible (null). +info: | + # 12.5.3.2 Runtime Semantics: Evaluation + UnaryExpression : delete UnaryExpression + + [...] + 5. If IsPropertyReference(ref) is true, then + a. If IsSuperReference(ref) is true, throw a ReferenceError exception. + b. Let baseObj be ? ToObject(ref.[[Base]]). +---*/ + +var base = null; + +assert.throws(TypeError, function() { + delete base[0]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/member-computed-reference-undefined.js b/js/src/tests/test262/language/expressions/delete/member-computed-reference-undefined.js new file mode 100644 index 0000000000..591401402b --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/member-computed-reference-undefined.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator +description: Delete Operator throws an error if the base reference is not object-coercible (undefined). +info: | + # 12.5.3.2 Runtime Semantics: Evaluation + UnaryExpression : delete UnaryExpression + + [...] + 5. If IsPropertyReference(ref) is true, then + a. If IsSuperReference(ref) is true, throw a ReferenceError exception. + b. Let baseObj be ? ToObject(ref.[[Base]]). +---*/ + +var base = undefined; + +assert.throws(TypeError, function() { + delete base[0]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/member-identifier-reference-null.js b/js/src/tests/test262/language/expressions/delete/member-identifier-reference-null.js new file mode 100644 index 0000000000..68c62e3ac2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/member-identifier-reference-null.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator +description: Delete Operator throws an error if the base reference is not object-coercible (null). +info: | + # 12.5.3.2 Runtime Semantics: Evaluation + UnaryExpression : delete UnaryExpression + + [...] + 5. If IsPropertyReference(ref) is true, then + a. If IsSuperReference(ref) is true, throw a ReferenceError exception. + b. Let baseObj be ? ToObject(ref.[[Base]]). +---*/ + +var base = null; + +assert.throws(TypeError, function() { + delete base.prop; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/member-identifier-reference-undefined.js b/js/src/tests/test262/language/expressions/delete/member-identifier-reference-undefined.js new file mode 100644 index 0000000000..bb02eb1be5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/member-identifier-reference-undefined.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-delete-operator +description: Delete Operator throws an error if the base reference is not object-coercible (undefined). +info: | + # 12.5.3.2 Runtime Semantics: Evaluation + UnaryExpression : delete UnaryExpression + + [...] + 5. If IsPropertyReference(ref) is true, then + a. If IsSuperReference(ref) is true, throw a ReferenceError exception. + b. Let baseObj be ? ToObject(ref.[[Base]]). +---*/ + +var base = undefined; + +assert.throws(TypeError, function() { + delete base.prop; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/non-reference-return-true.js b/js/src/tests/test262/language/expressions/delete/non-reference-return-true.js new file mode 100644 index 0000000000..85c2e44f68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/non-reference-return-true.js @@ -0,0 +1,37 @@ +// Copyright (c) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: > + The delete expression should return true if the right hand UnaryExpression is not a Reference +info: | + Runtime Semantics: Evaluation + UnaryExpression : delete UnaryExpression + + 1. Let ref be the result of evaluating UnaryExpression. + 2. ReturnIfAbrupt(ref). + 3. If Type(ref) is not Reference, return true. +---*/ + +var a = { b: 42 }; +assert.sameValue(delete void a.b, true, 'delete void a.b'); +assert.sameValue(delete void 0, true, 'delete void 0'); +assert.sameValue(delete typeof 0, true, 'delete typeof 0'); +assert.sameValue(delete delete 0, true, 'delete delete 0'); +assert.sameValue(delete void typeof +-~!0, true, 'delete void typeof +-~!0'); +assert.sameValue(delete {x:1}, true, 'delete {x:1}'); +assert.sameValue(delete null, true, 'delete null'); +assert.sameValue(delete true, true, 'delete true'); +assert.sameValue(delete false, true, 'delete false'); +assert.sameValue(delete 0, true, 'delete 0'); +assert.sameValue(delete 1, true, 'delete 1'); +assert.sameValue(delete '', true, 'delete ""'); +assert.sameValue(delete 'Test262', true, 'delete "Test262"'); +assert.sameValue(delete 'Test262'[100], true, 'delete "Test262"[100]'); +assert.sameValue(delete typeof +-~!0, true, 'delete typeof +-~!0'); +assert.sameValue(delete +-~!0, true, 'delete +-~!0'); +assert.sameValue(delete -~!0, true, 'delete -~!0'); +assert.sameValue(delete ~!0, true, 'delete ~!0'); +assert.sameValue(delete !0, true, 'delete !0'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/shell.js b/js/src/tests/test262/language/expressions/delete/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/delete/super-property-method.js b/js/src/tests/test262/language/expressions/delete/super-property-method.js new file mode 100644 index 0000000000..80406af00d --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/super-property-method.js @@ -0,0 +1,27 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: Attempts to delete super reference property references throws ReferenceError exception +features: [class] +---*/ + +class X { + method() { + return this; + } +} + +class Y extends X { + method() { + delete super.method; + } +} + +const y = new Y(); + +assert.throws(ReferenceError, () => { + y.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/super-property-null-base.js b/js/src/tests/test262/language/expressions/delete/super-property-null-base.js new file mode 100644 index 0000000000..fc279a2acf --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/super-property-null-base.js @@ -0,0 +1,38 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: The restriction on the base of a super property must not be enforced before the delete expression is evaluated. +info: | + # 13.3.7.3 MakeSuperPropertyReference ( actualThis, propertyKey, strict ) + + 1. Let env be GetThisEnvironment(). + 2. Assert: env.HasSuperBinding() is true. + 3. Let baseValue be ? env.GetSuperBase(). + 4. Let bv be ? RequireObjectCoercible(baseValue). + + # 13.5.1.2 Runtime Semantics: Evaluation + UnaryExpression : delete UnaryExpression + + 1. Let ref be the result of evaluating UnaryExpression. + 2. ReturnIfAbrupt(ref). + [...] + 5. If IsPropertyReference(ref) is true, then + a. Assert: ! IsPrivateReference(ref) is false. + b. If IsSuperReference(ref) is true, throw a ReferenceError exception. +features: [class] +---*/ + +class C { + static m() { + delete super.x; + } +} + +Object.setPrototypeOf(C, null); + +assert.throws(ReferenceError, () => { + C.m(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/super-property.js b/js/src/tests/test262/language/expressions/delete/super-property.js new file mode 100644 index 0000000000..2e6e6e4857 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/super-property.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-delete-operator-runtime-semantics-evaluation +description: SuperReferences may not be deleted +info: | + [...] + 5.If IsPropertyReference(ref) is true, then + a. If IsSuperReference(ref) is true, throw a ReferenceError exception. +features: [class] +---*/ + +class C extends Object { + constructor() { + super(); + delete super.x; + } +} + +assert.throws(ReferenceError, () => { + new C(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/delete/white-space-line-terminator-between-delete-unaryexpression-allowed.js b/js/src/tests/test262/language/expressions/delete/white-space-line-terminator-between-delete-unaryexpression-allowed.js new file mode 100644 index 0000000000..aeed0ffa12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/delete/white-space-line-terminator-between-delete-unaryexpression-allowed.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-delete-operator +description: > + White Space and Line Terminator between "delete" and UnaryExpression are allowed +info: | + UnaryExpression : + delete UnaryExpression + +---*/ + +var result; + +result = delete 0; +assert.sameValue(result, true, '\\u0009'); + +result = delete 0; +assert.sameValue(result, true, '\\u000B'); + +result = delete 0; +assert.sameValue(result, true, '\\u000C'); + +result = delete 0; +assert.sameValue(result, true, '\\u0020'); + +result = delete 0; +assert.sameValue(result, true, '\\u00A0'); + +// Line Break is intentional +result = delete +0; +assert.sameValue(result, true, '\\u000A'); + +// Line Break is intentional +result = delete +0; +assert.sameValue(result, true, '\\u000D'); + +result = delete
0; +assert.sameValue(result, true, '\\u2028'); + +result = delete
0; +assert.sameValue(result, true, '\\u2029'); + +// Line Break is intentional +result = delete   +

0; +assert.sameValue(result, true, '\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A1.js new file mode 100644 index 0000000000..b5123ab9cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between MultiplicativeExpression and "/" + or between "/" and UnaryExpression are allowed +es5id: 11.5.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009/\u00091") !== 1) { + throw new Test262Error('#1: 1\\u0009/\\u00091 === 1'); +} + +//CHECK#2 +if (eval("1\u000B/\u000B1") !== 1) { + throw new Test262Error('#2: 1\\u000B/\\u000B1 === 1'); +} + +//CHECK#3 +if (eval("1\u000C/\u000C1") !== 1) { + throw new Test262Error('#3: 1\\u000C/\\u000C1 === 1'); +} + +//CHECK#4 +if (eval("1\u0020/\u00201") !== 1) { + throw new Test262Error('#4: 1\\u0020/\\u00201 === 1'); +} + +//CHECK#5 +if (eval("1\u00A0/\u00A01") !== 1) { + throw new Test262Error('#5: 1\\u00A0/\\u00A01 === 1'); +} + +//CHECK#6 +if (eval("1\u000A/\u000A1") !== 1) { + throw new Test262Error('#6: 1\\u000A/\\u000A1 === 1'); +} + +//CHECK#7 +if (eval("1\u000D/\u000D1") !== 1) { + throw new Test262Error('#7: 1\\u000D/\\u000D1 === 1'); +} + +//CHECK#8 +if (eval("1\u2028/\u20281") !== 1) { + throw new Test262Error('#8: 1\\u2028/\\u20281 === 1'); +} + +//CHECK#9 +if (eval("1\u2029/\u20291") !== 1) { + throw new Test262Error('#9: 1\\u2029/\\u20291 === 1'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029/\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029/\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T1.js new file mode 100644 index 0000000000..1d586de1ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y uses GetValue +es5id: 11.5.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 / 1 !== 1) { + throw new Test262Error('#1: 1 / 1 === 1. Actual: ' + (1 / 1)); +} + +//CHECK#2 +var x = 1; +if (x / 1 !== 1) { + throw new Test262Error('#2: var x = 1; x / 1 === 1. Actual: ' + (x / 1)); +} + +//CHECK#3 +var y = 1; +if (1 / y !== 1) { + throw new Test262Error('#3: var y = 1; 1 / y === 1. Actual: ' + (1 / y)); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x / y !== 1) { + throw new Test262Error('#4: var x = 1; var y = 1; x / y === 1. Actual: ' + (x / y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop / objecty.prop !== 1) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop / objecty.prop === 1. Actual: ' + (objectx.prop / objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T2.js new file mode 100644 index 0000000000..7e69a0c475 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y uses GetValue +es5id: 11.5.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x / 1; + throw new Test262Error('#1.1: x / 1 throw ReferenceError. Actual: ' + (x / 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x / 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T3.js new file mode 100644 index 0000000000..d2f9ca248c --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y uses GetValue +es5id: 11.5.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 / y; + throw new Test262Error('#1.1: 1 / y throw ReferenceError. Actual: ' + (1 / y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 / y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.2_T1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.2_T1.js new file mode 100644 index 0000000000..95c743230a --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y uses [[Default Value]] +es5id: 11.5.2_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 1}} / 1 !== 1) { + throw new Test262Error('#1: {valueOf: function() {return 1}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}} / 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} / 1 !== 1) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} / 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} / 1 !== 1) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} / 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 !== 1) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} / 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} / 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 / {toString: function() {return 1}} !== 1) { + throw new Test262Error('#5: 1 / {toString: function() {return 1}} === 1. Actual: ' + (1 / {toString: function() {return 1}})); +} + +//CHECK#6 +if (1 / {valueOf: function() {return {}}, toString: function() {return 1}} !== 1) { + throw new Test262Error('#6: 1 / {valueOf: function() {return {}}, toString: function() {return 1}} === 1. Actual: ' + (1 / {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + 1 / {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 1 / {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 / {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 / {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 / {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 / {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 / {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 / {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.3_T1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.3_T1.js new file mode 100644 index 0000000000..a2a1141525 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.5.2_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x / y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x / y throw "x". Actual: ' + (x / y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x / y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T1.js new file mode 100644 index 0000000000..3ddc83b907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) / x !== 1) { + throw new Test262Error('#1: var x = 0; (x = 1) / x === 1. Actual: ' + ((x = 1) / x)); +} + +//CHECK#2 +var x = 0; +if (x / (x = 1) !== 0) { + throw new Test262Error('#2: var x = 0; x / (x = 1) === 0. Actual: ' + (x / (x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T2.js new file mode 100644 index 0000000000..3b2419c405 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() / y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() / y() throw "x". Actual: ' + (x() / y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() / y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T3.js new file mode 100644 index 0000000000..ad78780226 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.2_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x / (x = 1); + throw new Test262Error('#1.1: x / (x = 1) throw ReferenceError. Actual: ' + (x / (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x / (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T4.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T4.js new file mode 100644 index 0000000000..022389c4bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.2_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) / y !== 1) { + throw new Test262Error('#1: (y = 1) / y === 1. Actual: ' + ((y = 1) / y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.1.js new file mode 100644 index 0000000000..50468e2b9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (true / true !== 1) { + throw new Test262Error('#1: true / true === 1. Actual: ' + (true / true)); +} + +//CHECK#2 +if (new Boolean(true) / true !== 1) { + throw new Test262Error('#2: new Boolean(true) / true === 1. Actual: ' + (new Boolean(true) / true)); +} + +//CHECK#3 +if (true / new Boolean(true) !== 1) { + throw new Test262Error('#3: true / new Boolean(true) === 1. Actual: ' + (true / new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) / new Boolean(true) !== 1) { + throw new Test262Error('#4: new Boolean(true) / new Boolean(true) === 1. Actual: ' + (new Boolean(true) / new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.2.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.2.js new file mode 100644 index 0000000000..a2525b5a0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if (1 / 1 !== 1) { + throw new Test262Error('#1: 1 / 1 === 1. Actual: ' + (1 / 1)); +} + +//CHECK#2 +if (new Number(1) / 1 !== 1) { + throw new Test262Error('#2: new Number(1) / 1 === 1. Actual: ' + (new Number(1) / 1)); +} + +//CHECK#3 +if (1 / new Number(1) !== 1) { + throw new Test262Error('#3: 1 / new Number(1) === 1. Actual: ' + (1 / new Number(1))); +} + +//CHECK#4 +if (new Number(1) / new Number(1) !== 1) { + throw new Test262Error('#4: new Number(1) / new Number(1) === 1. Actual: ' + (new Number(1) / new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.3.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.3.js new file mode 100644 index 0000000000..072f5ab333 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if ("1" / "1" !== 1) { + throw new Test262Error('#1: "1" / "1" === 1. Actual: ' + ("1" / "1")); +} + +//CHECK#2 +if (new String("1") / "1" !== 1) { + throw new Test262Error('#2: new String("1") / "1" === 1. Actual: ' + (new String("1") / "1")); +} + +//CHECK#3 +if ("1" / new String("1") !== 1) { + throw new Test262Error('#3: "1" / new String("1") === 1. Actual: ' + ("1" / new String("1"))); +} + +//CHECK#4 +if (new String("1") / new String("1") !== 1) { + throw new Test262Error('#4: new String("1") / new String("1") === 1. Actual: ' + (new String("1") / new String("1"))); +} + +//CHECK#5 +if (isNaN("x" / "1") !== true) { + throw new Test262Error('#5: "x" / "1" === Not-a-Number. Actual: ' + ("x" / "1")); +} + +//CHECK#6 +if (isNaN("1" / "x") !== true) { + throw new Test262Error('#6: "1" / "x" === Not-a-Number. Actual: ' + ("1" / "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.4.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.4.js new file mode 100644 index 0000000000..f0ebec4739 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if (isNaN(null / undefined) !== true) { + throw new Test262Error('#1: null / undefined === Not-a-Number. Actual: ' + (null / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / null) !== true) { + throw new Test262Error('#2: undefined / null === Not-a-Number. Actual: ' + (undefined / null)); +} + +//CHECK#3 +if (isNaN(undefined / undefined) !== true) { + throw new Test262Error('#3: undefined / undefined === Not-a-Number. Actual: ' + (undefined / undefined)); +} + +//CHECK#4 +if (isNaN(null / null) !== true) { + throw new Test262Error('#4: null / null === Not-a-Number. Actual: ' + (null / null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.5.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.5.js new file mode 100644 index 0000000000..f46b4d1e8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (isNaN({} / function(){return 1}) !== true) { + throw new Test262Error('#1: {} / function(){return 1} === Not-a-Number. Actual: ' + ({} / function(){return 1})); +} + +//CHECK#2 +if (isNaN(function(){return 1} / {}) !== true) { + throw new Test262Error('#2: function(){return 1} / {} === Not-a-Number. Actual: ' + (function(){return 1} / {})); +} + +//CHECK#3 +if (isNaN(function(){return 1} / function(){return 1}) !== true) { + throw new Test262Error('#3: function(){return 1} / function(){return 1} === Not-a-Number. Actual: ' + (function(){return 1} / function(){return 1})); +} + +//CHECK#4 +if (isNaN({} / {}) !== true) { + throw new Test262Error('#4: {} / {} === Not-a-Number. Actual: ' + ({} / {})); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.1.js new file mode 100644 index 0000000000..48b4ee9964 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true / 1 !== 1) { + throw new Test262Error('#1: true / 1 === 1. Actual: ' + (true / 1)); +} + +//CHECK#2 +if (1 / true !== 1) { + throw new Test262Error('#2: 1 / true === 1. Actual: ' + (1 / true)); +} + +//CHECK#3 +if (new Boolean(true) / 1 !== 1) { + throw new Test262Error('#3: new Boolean(true) / 1 === 1. Actual: ' + (new Boolean(true) / 1)); +} + +//CHECK#4 +if (1 / new Boolean(true) !== 1) { + throw new Test262Error('#4: 1 / new Boolean(true) === 1. Actual: ' + (1 / new Boolean(true))); +} + +//CHECK#5 +if (true / new Number(1) !== 1) { + throw new Test262Error('#5: true / new Number(1) === 1. Actual: ' + (true / new Number(1))); +} + +//CHECK#6 +if (new Number(1) / true !== 1) { + throw new Test262Error('#6: new Number(1) / true === 1. Actual: ' + (new Number(1) / true)); +} + +//CHECK#7 +if (new Boolean(true) / new Number(1) !== 1) { + throw new Test262Error('#7: new Boolean(true) / new Number(1) === 1. Actual: ' + (new Boolean(true) / new Number(1))); +} + +//CHECK#8 +if (new Number(1) / new Boolean(true) !== 1) { + throw new Test262Error('#8: new Number(1) / new Boolean(true) === 1. Actual: ' + (new Number(1) / new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.2.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.2.js new file mode 100644 index 0000000000..02b859f0c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if ("1" / 1 !== 1) { + throw new Test262Error('#1: "1" / 1 === 1. Actual: ' + ("1" / 1)); +} + +//CHECK#2 +if (1 / "1" !== 1) { + throw new Test262Error('#2: 1 / "1" === 1. Actual: ' + (1 / "1")); +} + +//CHECK#3 +if (new String("1") / 1 !== 1) { + throw new Test262Error('#3: new String("1") / 1 === 1. Actual: ' + (new String("1") / 1)); +} + +//CHECK#4 +if (1 / new String("1") !== 1) { + throw new Test262Error('#4: 1 / new String("1") === 1. Actual: ' + (1 / new String("1"))); +} + +//CHECK#5 +if ("1" / new Number(1) !== 1) { + throw new Test262Error('#5: "1" / new Number(1) === 1. Actual: ' + ("1" / new Number(1))); +} + +//CHECK#6 +if (new Number(1) / "1" !== 1) { + throw new Test262Error('#6: new Number(1) / "1" === 1. Actual: ' + (new Number(1) / "1")); +} + +//CHECK#7 +if (new String("1") / new Number(1) !== 1) { + throw new Test262Error('#7: new String("1") / new Number(1) === 1. Actual: ' + (new String("1") / new Number(1))); +} + +//CHECK#8 +if (new Number(1) / new String("1") !== 1) { + throw new Test262Error('#8: new Number(1) / new String("1") === 1. Actual: ' + (new Number(1) / new String("1"))); +} + +//CHECK#9 +if (isNaN("x" / 1) !== true) { + throw new Test262Error('#9: "x" / 1 === Not-a-Number. Actual: ' + ("x" / 1)); +} + +//CHECK#10 +if (isNaN(1 / "x") !== true) { + throw new Test262Error('#10: 1 / "x" === Not-a-Number. Actual: ' + (1 / "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.3.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.3.js new file mode 100644 index 0000000000..23115bcca9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 / null !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: 1 / null === +Infinity. Actual: ' + (1 / null)); +} + +//CHECK#2 +if (null / 1 !== 0) { + throw new Test262Error('#2: null / 1 === 0. Actual: ' + (null / 1)); +} + +//CHECK#3 +if (new Number(1) / null !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: new Number(1) / null === +Infinity. Actual: ' + (new Number(1) / null)); +} + +//CHECK#4 +if (null / new Number(1) !== 0) { + throw new Test262Error('#4: null / new Number(1) === 0. Actual: ' + (null / new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.4.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.4.js new file mode 100644 index 0000000000..297ce64c0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(1 / undefined) !== true) { + throw new Test262Error('#1: 1 / undefined === Not-a-Number. Actual: ' + (1 / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / 1) !== true) { + throw new Test262Error('#2: undefined / 1 === Not-a-Number. Actual: ' + (undefined / 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) / undefined) !== true) { + throw new Test262Error('#3: new Number(1) / undefined === Not-a-Number. Actual: ' + (new Number(1) / undefined)); +} + +//CHECK#4 +if (isNaN(undefined / new Number(1)) !== true) { + throw new Test262Error('#4: undefined / new Number(1) === Not-a-Number. Actual: ' + (undefined / new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.5.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.5.js new file mode 100644 index 0000000000..c9fe1c4079 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true / "1" !== 1) { + throw new Test262Error('#1: true / "1" === 1. Actual: ' + (true / "1")); +} + +//CHECK#2 +if ("1" / true !== 1) { + throw new Test262Error('#2: "1" / true === 1. Actual: ' + ("1" / true)); +} + +//CHECK#3 +if (new Boolean(true) / "1" !== 1) { + throw new Test262Error('#3: new Boolean(true) / "1" === 1. Actual: ' + (new Boolean(true) / "1")); +} + +//CHECK#4 +if ("1" / new Boolean(true) !== 1) { + throw new Test262Error('#4: "1" / new Boolean(true) === 1. Actual: ' + ("1" / new Boolean(true))); +} + +//CHECK#5 +if (true / new String("1") !== 1) { + throw new Test262Error('#5: true / new String("1") === 1. Actual: ' + (true / new String("1"))); +} + +//CHECK#6 +if (new String("1") / true !== 1) { + throw new Test262Error('#6: new String("1") / true === 1. Actual: ' + (new String("1") / true)); +} + +//CHECK#7 +if (new Boolean(true) / new String("1") !== 1) { + throw new Test262Error('#7: new Boolean(true) / new String("1") === 1. Actual: ' + (new Boolean(true) / new String("1"))); +} + +//CHECK#8 +if (new String("1") / new Boolean(true) !== 1) { + throw new Test262Error('#8: new String("1") / new Boolean(true) === 1. Actual: ' + (new String("1") / new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.6.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.6.js new file mode 100644 index 0000000000..8f68d34e06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN("1" / undefined) !== true) { + throw new Test262Error('#1: "1" / undefined === Not-a-Number. Actual: ' + ("1" / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / "1") !== true) { + throw new Test262Error('#2: undefined / "1" === Not-a-Number. Actual: ' + (undefined / "1")); +} + +//CHECK#3 +if (isNaN(new String("1") / undefined) !== true) { + throw new Test262Error('#3: new String("1") / undefined === Not-a-Number. Actual: ' + (new String("1") / undefined)); +} + +//CHECK#4 +if (isNaN(undefined / new String("1")) !== true) { + throw new Test262Error('#4: undefined / new String("1") === Not-a-Number. Actual: ' + (undefined / new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.7.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.7.js new file mode 100644 index 0000000000..67fdf426d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" / null !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: "1" / null === +Infinity. Actual: ' + ("1" / null)); +} + +//CHECK#2 +if (null / "1" !== 0) { + throw new Test262Error('#2: null / "1" === 0. Actual: ' + (null / "1")); +} + +//CHECK#3 +if (new String("1") / null !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: new String("1") / null === +Infinity. Actual: ' + (new String("1") / null)); +} + +//CHECK#4 +if (null / new String("1") !== 0) { + throw new Test262Error('#4: null / new String("1") === 0. Actual: ' + (null / new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.8.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.8.js new file mode 100644 index 0000000000..eb9305bd69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(true / undefined) !== true) { + throw new Test262Error('#1: true / undefined === Not-a-Number. Actual: ' + (true / undefined)); +} + +//CHECK#2 +if (isNaN(undefined / true) !== true) { + throw new Test262Error('#2: undefined / true === Not-a-Number. Actual: ' + (undefined / true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) / undefined) !== true) { + throw new Test262Error('#3: new Boolean(true) / undefined === Not-a-Number. Actual: ' + (new Boolean(true) / undefined)); +} + +//CHECK#4 +if (isNaN(undefined / new Boolean(true)) !== true) { + throw new Test262Error('#4: undefined / new Boolean(true) === Not-a-Number. Actual: ' + (undefined / new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.9.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.9.js new file mode 100644 index 0000000000..e6db734c7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x / y returns ToNumber(x) / ToNumber(y) +es5id: 11.5.2_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true / null !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: true / null === +Infinity. Actual: ' + (true / null)); +} + +//CHECK#2 +if (null / true !== 0) { + throw new Test262Error('#2: null / true === 0. Actual: ' + (null / true)); +} + +//CHECK#3 +if (new Boolean(true) / null !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: new Boolean(true) / null === +Infinity. Actual: ' + (new Boolean(true) / null)); +} + +//CHECK#4 +if (null / new Boolean(true) !== 0) { + throw new Test262Error('#4: null / new Boolean(true) === 0. Actual: ' + (null / new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.1.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.1.js new file mode 100644 index 0000000000..a549d49b59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T1.1 +description: If left operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN / Number.NaN) !== true) { + throw new Test262Error('#1: NaN / NaN === Not-a-Number. Actual: ' + (NaN / NaN)); +} + +//CHECK#2 +if (isNaN(Number.NaN / +0) !== true) { + throw new Test262Error('#2: NaN / +0 === Not-a-Number. Actual: ' + (NaN / +0)); +} + +//CHECK#3 +if (isNaN(Number.NaN / -0) !== true) { + throw new Test262Error('#3: NaN / -0 === Not-a-Number. Actual: ' + (NaN / -0)); +} + +//CHECK#4 +if (isNaN(Number.NaN / Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: NaN / Infinity === Not-a-Number. Actual: ' + (NaN / Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NaN / Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: NaN / -Infinity === Not-a-Number. Actual: ' + (NaN / -Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NaN / Number.MAX_VALUE) !== true) { + throw new Test262Error('#6: NaN / Number.MAX_VALUE === Not-a-Number. Actual: ' + (NaN / Number.MAX_VALUE)); +} + +//CHECK#7 +if (isNaN(Number.NaN / Number.MIN_VALUE) !== true) { + throw new Test262Error('#7: NaN / Number.MIN_VALUE === Not-a-Number. Actual: ' + (NaN / Number.MIN_VALUE)); +} + +//CHECK#8 +if (isNaN(Number.NaN / 1) !== true) { + throw new Test262Error('#8: NaN / 1 === Not-a-Number. Actual: ' + (NaN / 1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.2.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.2.js new file mode 100644 index 0000000000..81df40be6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T1.2.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T1.2 +description: If right operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN / Number.NaN) !== true) { + throw new Test262Error('#1: NaN / NaN === Not-a-Number. Actual: ' + (NaN / NaN)); +} + +//CHECK#2 +if (isNaN(+0 / Number.NaN) !== true) { + throw new Test262Error('#2: +0 / NaN === Not-a-Number. Actual: ' + (+0 / NaN)); +} + +//CHECK#3 +if (isNaN(-0 / Number.NaN) !== true) { + throw new Test262Error('#3: -0 / NaN === Not-a-Number. Actual: ' + (-0 / NaN)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY / Number.NaN) !== true) { + throw new Test262Error('#4: Infinity / NaN === Not-a-Number. Actual: ' + (Infinity / NaN)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY / Number.NaN) !== true) { + throw new Test262Error('#5: -Infinity / NaN === Not-a-Number. Actual: ' + ( -Infinity / NaN)); +} + +//CHECK#6 +if (isNaN(Number.MAX_VALUE / Number.NaN) !== true) { + throw new Test262Error('#6: Number.MAX_VALUE / NaN === Not-a-Number. Actual: ' + (Number.MAX_VALUE / NaN)); +} + +//CHECK#7 +if (isNaN(Number.MIN_VALUE / Number.NaN) !== true) { + throw new Test262Error('#7: Number.MIN_VALUE / NaN === Not-a-Number. Actual: ' + (Number.MIN_VALUE / NaN)); +} + +//CHECK#8 +if (isNaN(1 / Number.NaN) !== true) { + throw new Test262Error('#8: 1 / NaN === Not-a-Number. Actual: ' + (1 / NaN)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T10.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T10.js new file mode 100644 index 0000000000..b30666edc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T10.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T10 +description: > + If both operands are finite and nonzero, the quotient is computed + and rounded using IEEE 754 round-to-nearest mode. If the + magnitude is too small to represent, the result is then a zero of + appropriate sign +---*/ + +//CHECK#1 +if (Number.MIN_VALUE / 2.1 !== 0) { + throw new Test262Error('#1: Number.MIN_VALUE / 2.1 === 0. Actual: ' + (Number.MIN_VALUE / 2.1)); +} + +//CHECK#2 +if (Number.MIN_VALUE / -2.1 !== -0) { + throw new Test262Error('#2.1: Number.MIN_VALUE / -2.1 === 0. Actual: ' + (Number.MIN_VALUE / -2.1)); +} else { + if (1 / (Number.MIN_VALUE / -2.1) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2.2: Number.MIN_VALUE / -2.1 === -0. Actual: +0'); + } +} + +//CHECK#3 +if (Number.MIN_VALUE / 2.0 !== 0) { + throw new Test262Error('#3: Number.MIN_VALUE / 2.0 === 0. Actual: ' + (Number.MIN_VALUE / 2.0)); +} + +//CHECK#4 +if (Number.MIN_VALUE / -2.0 !== -0) { + throw new Test262Error('#4.1: Number.MIN_VALUE / -2.0 === -0. Actual: ' + (Number.MIN_VALUE / -2.0)); +} else { + if (1 / (Number.MIN_VALUE / -2.0) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4.2: Number.MIN_VALUE / -2.0 === -0. Actual: +0'); + } +} + +//CHECK#5 +if (Number.MIN_VALUE / 1.9 !== Number.MIN_VALUE) { + throw new Test262Error('#5: Number.MIN_VALUE / 1.9 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.9)); +} + +//CHECK#6 +if (Number.MIN_VALUE / -1.9 !== -Number.MIN_VALUE) { + throw new Test262Error('#6: Number.MIN_VALUE / -1.9 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.9)); +} + +//CHECK#7 +if (Number.MIN_VALUE / 1.1 !== Number.MIN_VALUE) { + throw new Test262Error('#7: Number.MIN_VALUE / 1.1 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / 1.1)); +} + +//CHECK#8 +if (Number.MIN_VALUE / -1.1 !== -Number.MIN_VALUE) { + throw new Test262Error('#8: Number.MIN_VALUE / -1.1 === -Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE / -1.1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T2.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T2.js new file mode 100644 index 0000000000..a638cf09a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T2 +description: > + The sign of the result is positive if both operands have the same + sign, negative if the operands have different signs +---*/ + +//CHECK#1 +if (1 / 1 !== 1) { + throw new Test262Error('#1: 1 / 1 === 1. Actual: ' + (1 / 1)); +} + +//CHECK#2 +if (1 / -1 !== -1) { + throw new Test262Error('#2: 1 / -1 === -1. Actual: ' + (1 / -1)); +} + +//CHECK#3 +if (-1 / 1 !== -1) { + throw new Test262Error('#3: -1 / 1 === -1. Actual: ' + (-1 / 1)); +} + +//CHECK#4 +if (-1 / -1 !== 1) { + throw new Test262Error('#4: -1 / -1 === 1. Actual: ' + (-1 / -1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T3.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T3.js new file mode 100644 index 0000000000..50db587553 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T3 +description: > + Division of an infinity by a zero results in an infinity of + appropriate sign +---*/ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY / 0 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1: Infinity / 0 === Infinity. Actual: ' + (Infinity / 0)); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY / -0 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: -Infinity / -0 === Infinity. Actual: ' + (-Infinity / -0)); +} + +//CHECK#3 +if (Number.POSITIVE_INFINITY / 0 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: Infinity / 0 === Infinity. Actual: ' + (Infinity / 0)); +} + +//CHECK#4 +if (Number.POSITIVE_INFINITY / -0 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4: Infinity / -0 === -Infinity. Actual: ' + (Infinity / -0)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T4.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T4.js new file mode 100644 index 0000000000..f64ccdf70f --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T4 +description: Division of an infinity by an infinity results in NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#1: -Infinity / -Infinity === Not-a-Number. Actual: ' + (-Infinity / -Infinity)); +} + +//CHECK#2 +if (isNaN(Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#2: Infinity / Infinity === Not-a-Number. Actual: ' + (Infinity / Infinity)); +} + +//CHECK#3 +if (isNaN(Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#3: -Infinity / Infinity === Not-a-Number. Actual: ' + (-Infinity / Infinity)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: Infinity / -Infinity === Not-a-Number. Actual: ' + (Infinity / -Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T5.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T5.js new file mode 100644 index 0000000000..15fe744142 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T5.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T5 +description: > + Division of an infinity by a finite non-zero value results in a + signed infinity +---*/ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY / 1 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1: -Infinity / 1 === -Infinity. Actual: ' + (-Infinity / 1)); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY / -1 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: -Infinity / -1 === Infinity. Actual: ' + (-Infinity / -1)); +} + +//CHECK#3 +if (Number.POSITIVE_INFINITY / 1 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: Infinity / 1 === Infinity. Actual: ' + (Infinity / 1)); +} + +//CHECK#4 +if (Number.POSITIVE_INFINITY / -1 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4: Infinity / -1 === -Infinity. Actual: ' + (Infinity / -1)); +} + +//CHECK#5 +if (Number.POSITIVE_INFINITY / -Number.MAX_VALUE !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#5: Infinity / -Number.MAX_VALUE === -Infinity. Actual: ' + (Infinity / -Number.MAX_VALUE)); +} + +//CHECK#6 +if (Number.NEGATIVE_INFINITY / Number.MIN_VALUE !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#6: -Infinity / Number.MIN_VALUE === -Infinity. Actual: ' + (-Infinity / Number.MIN_VALUE)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T6.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T6.js new file mode 100644 index 0000000000..d9332ce1f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T6.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T6 +description: > + Division of a finite value by an infinity results in zero of + appropriate sign +---*/ + +//CHECK#1 +if (1 / Number.NEGATIVE_INFINITY !== -0) { + throw new Test262Error('#1.1: 1 / -Infinity === 0. Actual: ' + (1 / -Infinity)); +} else { + if (1 / (1 / Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: 1 / -Infinity === - 0. Actual: +0'); + } +} + +//CHECK#2 +if (-1 / Number.NEGATIVE_INFINITY !== +0) { + throw new Test262Error('#2.1: -1 / -Infinity === 0. Actual: ' + (-1 / -Infinity)); +} else { + if (1 / (-1 / Number.NEGATIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: -1 / -Infinity === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (1 / Number.POSITIVE_INFINITY !== +0) { + throw new Test262Error('#3.1: 1 / Infinity === 0. Actual: ' + (1 / Infinity)); +} else { + if (1 / (1 / Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3.2: 1 / Infinity === + 0. Actual: -0'); + } +} + +//CHECK#4 +if (-1 / Number.POSITIVE_INFINITY !== -0) { + throw new Test262Error('#4.1: -1 / Infinity === 0. Actual: ' + (-1 / Infinity)); +} else { + if (1 / (-1 / Number.POSITIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4.2: -1 / Infinity === - 0. Actual: +0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T7.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T7.js new file mode 100644 index 0000000000..a6fa127cdc --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T7 +description: Division of a zero by a zero results in NaN +---*/ + +//CHECK#1 +if (isNaN(+0 / +0) !== true) { + throw new Test262Error('#1: +0 / +0 === Not-a-Number. Actual: ' + (+0 / +0)); +} + +//CHECK#2 +if (isNaN(-0 / +0) !== true) { + throw new Test262Error('#2: -0 / +0 === Not-a-Number. Actual: ' + (-0 / +0)); +} + +//CHECK#3 +if (isNaN(+0 / -0) !== true) { + throw new Test262Error('#3: +0 / -0 === Not-a-Number. Actual: ' + (+0 / -0)); +} + +//CHECK#4 +if (isNaN(-0 / -0) !== true) { + throw new Test262Error('#4: -0 / -0 === Not-a-Number. Actual: ' + (-0 / -0)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T8.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T8.js new file mode 100644 index 0000000000..899de572ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T8.js @@ -0,0 +1,68 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T8 +description: > + Division of a zero by any non-zero finite value -0 results in zero + of appropriate sign +---*/ + +//CHECK#1 +if (-0 / 1 !== -0) { + throw new Test262Error('#1.1: -0 / 1 === 0. Actual: ' + (-0 / 1)); +} else { + if (1 / (-0 / 1) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: -0 / 1 === - 0. Actual: +0'); + } +} + +//CHECK#2 +if (-0 / -1 !== +0) { + throw new Test262Error('#2.1: -0 / -1 === 0. Actual: ' + (-0 / -1)); +} else { + if (1 / (-0 / -1) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: -0 / -1 === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (+0 / 1 !== +0) { + throw new Test262Error('#3.1: +0 / 1 === 0. Actual: ' + (+0 / 1)); +} else { + if (1 / (+0 / 1) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3.2: +0 / 1 === + 0. Actual: -0'); + } +} + +//CHECK#4 +if (+0 / -1 !== -0) { + throw new Test262Error('#4.1: +0 / -1 === 0. Actual: ' + (+0 / -1)); +} else { + if (1 / (+0 / -1) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4.2: +0 / -1 === - 0. Actual: +0'); + } +} + +//CHECK#5 +if (+0 / -Number.MAX_VALUE !== -0) { + throw new Test262Error('#5.1: 0 / -Number.MAX_VALUE === 0. Actual: ' + (0 / -Number.MAX_VALUE)); +} else { + if (1 / (+0 / -Number.MAX_VALUE) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#5.2: +0 / -Number.MAX_VALUE === - 0. Actual: +0'); + } +} + +//CHECK#6 +if (-0 / Number.MIN_VALUE !== -0) { + throw new Test262Error('#6.1: -0 / Number.MIN_VALUE === 0. Actual: ' + (-0 / Number.MIN_VALUE)); +} else { + if (1 / (-0 / Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#6.2: -0 / Number.MIN_VALUE === - 0. Actual: +0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T9.js b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T9.js new file mode 100644 index 0000000000..373babae37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/S11.5.2_A4_T9.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of division is determined by the specification of IEEE 754 + arithmetics +es5id: 11.5.2_A4_T9 +description: > + If the magnitude is too large to represent, the result is then an + infinity of appropriate sign +---*/ + +//CHECK#1 +if (Number.MAX_VALUE / 0.9 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: Number.MAX_VALUE / 0.9 === Number.POSITIVE_INFINITY. Actual: ' + (Number.MAX_VALUE / 0.9)); +} + +//CHECK#2 +if (Number.MAX_VALUE / -0.9 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2: Number.MAX_VALUE / -0.9 === Number.NEGATIVE_INFINITY. Actual: ' + (Number.MAX_VALUE / -0.9)); +} + +//CHECK#3 +if (Number.MAX_VALUE / 1 !== Number.MAX_VALUE) { + throw new Test262Error('#3: Number.MAX_VALUE / 1 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE / 1)); +} + +//CHECK#4 +if (Number.MAX_VALUE / -1 !== -Number.MAX_VALUE) { + throw new Test262Error('#4: Number.MAX_VALUE / -1 === -Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE / -1)); +} + +//CHECK#5 +if (Number.MAX_VALUE / (Number.MAX_VALUE / 0.9) === (Number.MAX_VALUE / Number.MAX_VALUE) / 0.9) { + throw new Test262Error('#5: Number.MAX_VALUE / (Number.MAX_VALUE / 0.9) !== (Number.MAX_VALUE / Number.MAX_VALUE) / 0.9'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/bigint-and-number.js b/js/src/tests/test262/language/expressions/division/bigint-and-number.js new file mode 100644 index 0000000000..c6048d6594 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for division operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n / 1; +}, '1n / 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 / 1n; +}, '1 / 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) / 1; +}, 'Object(1n) / 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 / Object(1n); +}, '1 / Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n / Object(1); +}, '1n / Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) / 1n; +}, 'Object(1) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) / Object(1); +}, 'Object(1n) / Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) / Object(1n); +}, 'Object(1) / Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n / NaN; +}, '1n / NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN / 1n; +}, 'NaN / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / Infinity; +}, '1n / Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity / 1n; +}, 'Infinity / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / true; +}, '1n / true throws TypeError'); + +assert.throws(TypeError, function() { + true / 1n; +}, 'true / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / '1'; +}, '1n / "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' / 1n; +}, '"1" / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / null; +}, '1n / null throws TypeError'); + +assert.throws(TypeError, function() { + null / 1n; +}, 'null / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n / undefined; +}, '1n / undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined / 1n; +}, 'undefined / 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/bigint-arithmetic.js b/js/src/tests/test262/language/expressions/division/bigint-arithmetic.js new file mode 100644 index 0000000000..b10eb14b93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/bigint-arithmetic.js @@ -0,0 +1,1072 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: BigInt division arithmetic +features: [BigInt] +---*/ +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA9876543210n, + 0x1n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA98n, + 0x100000000n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0xFEDCBA97n, + 0x100000001n, + 'The result of (0xFEDCBA9876543210n / 0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x1234n, + 0xE0042813BE5DCn, + 'The result of (0xFEDCBA9876543210n / 0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x3n, + 0x54F43E32D21C10B0n, + 'The result of (0xFEDCBA9876543210n / 0x3n) is 0x54F43E32D21C10B0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x2n, + 0x7F6E5D4C3B2A1908n, + 'The result of (0xFEDCBA9876543210n / 0x2n) is 0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n / 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x1n, + -0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n / -0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x2n, + -0x7F6E5D4C3B2A1908n, + 'The result of (0xFEDCBA9876543210n / -0x2n) is -0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x3n, + -0x54F43E32D21C10B0n, + 'The result of (0xFEDCBA9876543210n / -0x3n) is -0x54F43E32D21C10B0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0x1234n, + -0xE0042813BE5DCn, + 'The result of (0xFEDCBA9876543210n / -0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA97n, + -0x100000001n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA98n, + -0x100000000n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n / -0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA9876543210n / -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA98n, + 0x100000000n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0xFEDCBA97n, + 0x100000001n, + 'The result of (0xFEDCBA987654320Fn / 0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x1234n, + 0xE0042813BE5DCn, + 'The result of (0xFEDCBA987654320Fn / 0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x3n, + 0x54F43E32D21C10AFn, + 'The result of (0xFEDCBA987654320Fn / 0x3n) is 0x54F43E32D21C10AFn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x2n, + 0x7F6E5D4C3B2A1907n, + 'The result of (0xFEDCBA987654320Fn / 0x2n) is 0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / 0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn / 0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x1n, + -0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn / -0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x2n, + -0x7F6E5D4C3B2A1907n, + 'The result of (0xFEDCBA987654320Fn / -0x2n) is -0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x3n, + -0x54F43E32D21C10AFn, + 'The result of (0xFEDCBA987654320Fn / -0x3n) is -0x54F43E32D21C10AFn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0x1234n, + -0xE0042813BE5DCn, + 'The result of (0xFEDCBA987654320Fn / -0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA97n, + -0x100000001n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA98n, + -0x100000000n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA98n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA98n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA98n, + 0x1n, + 'The result of (0xFEDCBA98n / 0xFEDCBA98n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n / 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / 0x1234n, + 0xE0042n, + 'The result of (0xFEDCBA98n / 0x1234n) is 0xE0042n' +); + +assert.sameValue( + 0xFEDCBA98n / 0x3n, + 0x54F43E32n, + 'The result of (0xFEDCBA98n / 0x3n) is 0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA98n / 0x2n, + 0x7F6E5D4Cn, + 'The result of (0xFEDCBA98n / 0x2n) is 0x7F6E5D4Cn' +); + +assert.sameValue( + 0xFEDCBA98n / 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n / 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n / -0x1n, + -0xFEDCBA98n, + 'The result of (0xFEDCBA98n / -0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n / -0x2n, + -0x7F6E5D4Cn, + 'The result of (0xFEDCBA98n / -0x2n) is -0x7F6E5D4Cn' +); + +assert.sameValue( + 0xFEDCBA98n / -0x3n, + -0x54F43E32n, + 'The result of (0xFEDCBA98n / -0x3n) is -0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA98n / -0x1234n, + -0xE0042n, + 'The result of (0xFEDCBA98n / -0x1234n) is -0xE0042n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA97n, + -0x1n, + 'The result of (0xFEDCBA98n / -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA98n / -0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA98n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA98n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA97n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA97n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA97n / 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA97n / 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA97n / 0x1234n, + 0xE0042n, + 'The result of (0xFEDCBA97n / 0x1234n) is 0xE0042n' +); + +assert.sameValue( + 0xFEDCBA97n / 0x3n, + 0x54F43E32n, + 'The result of (0xFEDCBA97n / 0x3n) is 0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA97n / 0x2n, + 0x7F6E5D4Bn, + 'The result of (0xFEDCBA97n / 0x2n) is 0x7F6E5D4Bn' +); + +assert.sameValue( + 0xFEDCBA97n / 0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n / 0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n / -0x1n, + -0xFEDCBA97n, + 'The result of (0xFEDCBA97n / -0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n / -0x2n, + -0x7F6E5D4Bn, + 'The result of (0xFEDCBA97n / -0x2n) is -0x7F6E5D4Bn' +); + +assert.sameValue( + 0xFEDCBA97n / -0x3n, + -0x54F43E32n, + 'The result of (0xFEDCBA97n / -0x3n) is -0x54F43E32n' +); + +assert.sameValue( + 0xFEDCBA97n / -0x1234n, + -0xE0042n, + 'The result of (0xFEDCBA97n / -0x1234n) is -0xE0042n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA97n, + -0x1n, + 'The result of (0xFEDCBA97n / -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA97n / -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA97n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA97n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1234n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1234n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1234n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1234n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x1234n / 0xFEDCBA98n, 0x0n, 'The result of (0x1234n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x1234n / 0xFEDCBA97n, 0x0n, 'The result of (0x1234n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1234n / 0x1234n, 0x1n, 'The result of (0x1234n / 0x1234n) is 0x1n'); +assert.sameValue(0x1234n / 0x3n, 0x611n, 'The result of (0x1234n / 0x3n) is 0x611n'); +assert.sameValue(0x1234n / 0x2n, 0x91An, 'The result of (0x1234n / 0x2n) is 0x91An'); +assert.sameValue(0x1234n / 0x1n, 0x1234n, 'The result of (0x1234n / 0x1n) is 0x1234n'); +assert.sameValue(0x1234n / -0x1n, -0x1234n, 'The result of (0x1234n / -0x1n) is -0x1234n'); +assert.sameValue(0x1234n / -0x2n, -0x91An, 'The result of (0x1234n / -0x2n) is -0x91An'); +assert.sameValue(0x1234n / -0x3n, -0x611n, 'The result of (0x1234n / -0x3n) is -0x611n'); +assert.sameValue(0x1234n / -0x1234n, -0x1n, 'The result of (0x1234n / -0x1234n) is -0x1n'); +assert.sameValue(0x1234n / -0xFEDCBA97n, 0x0n, 'The result of (0x1234n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1234n / -0xFEDCBA98n, 0x0n, 'The result of (0x1234n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x1234n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1234n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x1234n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1234n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x3n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x3n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x3n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x3n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x3n / 0xFEDCBA98n, 0x0n, 'The result of (0x3n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x3n / 0xFEDCBA97n, 0x0n, 'The result of (0x3n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x3n / 0x1234n, 0x0n, 'The result of (0x3n / 0x1234n) is 0x0n'); +assert.sameValue(0x3n / 0x3n, 0x1n, 'The result of (0x3n / 0x3n) is 0x1n'); +assert.sameValue(0x3n / 0x2n, 0x1n, 'The result of (0x3n / 0x2n) is 0x1n'); +assert.sameValue(0x3n / 0x1n, 0x3n, 'The result of (0x3n / 0x1n) is 0x3n'); +assert.sameValue(0x3n / -0x1n, -0x3n, 'The result of (0x3n / -0x1n) is -0x3n'); +assert.sameValue(0x3n / -0x2n, -0x1n, 'The result of (0x3n / -0x2n) is -0x1n'); +assert.sameValue(0x3n / -0x3n, -0x1n, 'The result of (0x3n / -0x3n) is -0x1n'); +assert.sameValue(0x3n / -0x1234n, 0x0n, 'The result of (0x3n / -0x1234n) is 0x0n'); +assert.sameValue(0x3n / -0xFEDCBA97n, 0x0n, 'The result of (0x3n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x3n / -0xFEDCBA98n, 0x0n, 'The result of (0x3n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x3n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x3n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x3n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x3n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x2n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x2n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x2n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x2n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x2n / 0xFEDCBA98n, 0x0n, 'The result of (0x2n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x2n / 0xFEDCBA97n, 0x0n, 'The result of (0x2n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x2n / 0x1234n, 0x0n, 'The result of (0x2n / 0x1234n) is 0x0n'); +assert.sameValue(0x2n / 0x3n, 0x0n, 'The result of (0x2n / 0x3n) is 0x0n'); +assert.sameValue(0x2n / 0x2n, 0x1n, 'The result of (0x2n / 0x2n) is 0x1n'); +assert.sameValue(0x2n / 0x1n, 0x2n, 'The result of (0x2n / 0x1n) is 0x2n'); +assert.sameValue(0x2n / -0x1n, -0x2n, 'The result of (0x2n / -0x1n) is -0x2n'); +assert.sameValue(0x2n / -0x2n, -0x1n, 'The result of (0x2n / -0x2n) is -0x1n'); +assert.sameValue(0x2n / -0x3n, 0x0n, 'The result of (0x2n / -0x3n) is 0x0n'); +assert.sameValue(0x2n / -0x1234n, 0x0n, 'The result of (0x2n / -0x1234n) is 0x0n'); +assert.sameValue(0x2n / -0xFEDCBA97n, 0x0n, 'The result of (0x2n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x2n / -0xFEDCBA98n, 0x0n, 'The result of (0x2n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x2n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x2n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x2n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x2n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0x1n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(0x1n / 0xFEDCBA98n, 0x0n, 'The result of (0x1n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(0x1n / 0xFEDCBA97n, 0x0n, 'The result of (0x1n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1n / 0x1234n, 0x0n, 'The result of (0x1n / 0x1234n) is 0x0n'); +assert.sameValue(0x1n / 0x3n, 0x0n, 'The result of (0x1n / 0x3n) is 0x0n'); +assert.sameValue(0x1n / 0x2n, 0x0n, 'The result of (0x1n / 0x2n) is 0x0n'); +assert.sameValue(0x1n / 0x1n, 0x1n, 'The result of (0x1n / 0x1n) is 0x1n'); +assert.sameValue(0x1n / -0x1n, -0x1n, 'The result of (0x1n / -0x1n) is -0x1n'); +assert.sameValue(0x1n / -0x2n, 0x0n, 'The result of (0x1n / -0x2n) is 0x0n'); +assert.sameValue(0x1n / -0x3n, 0x0n, 'The result of (0x1n / -0x3n) is 0x0n'); +assert.sameValue(0x1n / -0x1234n, 0x0n, 'The result of (0x1n / -0x1234n) is 0x0n'); +assert.sameValue(0x1n / -0xFEDCBA97n, 0x0n, 'The result of (0x1n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x1n / -0xFEDCBA98n, 0x0n, 'The result of (0x1n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x1n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x1n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x1n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x1n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x1n / 0xFEDCBA98n, 0x0n, 'The result of (-0x1n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x1n / 0xFEDCBA97n, 0x0n, 'The result of (-0x1n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1n / 0x1234n, 0x0n, 'The result of (-0x1n / 0x1234n) is 0x0n'); +assert.sameValue(-0x1n / 0x3n, 0x0n, 'The result of (-0x1n / 0x3n) is 0x0n'); +assert.sameValue(-0x1n / 0x2n, 0x0n, 'The result of (-0x1n / 0x2n) is 0x0n'); +assert.sameValue(-0x1n / 0x1n, -0x1n, 'The result of (-0x1n / 0x1n) is -0x1n'); +assert.sameValue(-0x1n / -0x1n, 0x1n, 'The result of (-0x1n / -0x1n) is 0x1n'); +assert.sameValue(-0x1n / -0x2n, 0x0n, 'The result of (-0x1n / -0x2n) is 0x0n'); +assert.sameValue(-0x1n / -0x3n, 0x0n, 'The result of (-0x1n / -0x3n) is 0x0n'); +assert.sameValue(-0x1n / -0x1234n, 0x0n, 'The result of (-0x1n / -0x1234n) is 0x0n'); +assert.sameValue(-0x1n / -0xFEDCBA97n, 0x0n, 'The result of (-0x1n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1n / -0xFEDCBA98n, 0x0n, 'The result of (-0x1n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x1n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x1n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x2n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x2n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x2n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x2n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x2n / 0xFEDCBA98n, 0x0n, 'The result of (-0x2n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x2n / 0xFEDCBA97n, 0x0n, 'The result of (-0x2n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x2n / 0x1234n, 0x0n, 'The result of (-0x2n / 0x1234n) is 0x0n'); +assert.sameValue(-0x2n / 0x3n, 0x0n, 'The result of (-0x2n / 0x3n) is 0x0n'); +assert.sameValue(-0x2n / 0x2n, -0x1n, 'The result of (-0x2n / 0x2n) is -0x1n'); +assert.sameValue(-0x2n / 0x1n, -0x2n, 'The result of (-0x2n / 0x1n) is -0x2n'); +assert.sameValue(-0x2n / -0x1n, 0x2n, 'The result of (-0x2n / -0x1n) is 0x2n'); +assert.sameValue(-0x2n / -0x2n, 0x1n, 'The result of (-0x2n / -0x2n) is 0x1n'); +assert.sameValue(-0x2n / -0x3n, 0x0n, 'The result of (-0x2n / -0x3n) is 0x0n'); +assert.sameValue(-0x2n / -0x1234n, 0x0n, 'The result of (-0x2n / -0x1234n) is 0x0n'); +assert.sameValue(-0x2n / -0xFEDCBA97n, 0x0n, 'The result of (-0x2n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x2n / -0xFEDCBA98n, 0x0n, 'The result of (-0x2n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x2n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x2n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x2n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x2n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x3n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x3n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x3n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x3n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x3n / 0xFEDCBA98n, 0x0n, 'The result of (-0x3n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x3n / 0xFEDCBA97n, 0x0n, 'The result of (-0x3n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x3n / 0x1234n, 0x0n, 'The result of (-0x3n / 0x1234n) is 0x0n'); +assert.sameValue(-0x3n / 0x3n, -0x1n, 'The result of (-0x3n / 0x3n) is -0x1n'); +assert.sameValue(-0x3n / 0x2n, -0x1n, 'The result of (-0x3n / 0x2n) is -0x1n'); +assert.sameValue(-0x3n / 0x1n, -0x3n, 'The result of (-0x3n / 0x1n) is -0x3n'); +assert.sameValue(-0x3n / -0x1n, 0x3n, 'The result of (-0x3n / -0x1n) is 0x3n'); +assert.sameValue(-0x3n / -0x2n, 0x1n, 'The result of (-0x3n / -0x2n) is 0x1n'); +assert.sameValue(-0x3n / -0x3n, 0x1n, 'The result of (-0x3n / -0x3n) is 0x1n'); +assert.sameValue(-0x3n / -0x1234n, 0x0n, 'The result of (-0x3n / -0x1234n) is 0x0n'); +assert.sameValue(-0x3n / -0xFEDCBA97n, 0x0n, 'The result of (-0x3n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x3n / -0xFEDCBA98n, 0x0n, 'The result of (-0x3n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x3n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x3n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x3n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x3n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1234n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1234n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0x1234n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1234n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue(-0x1234n / 0xFEDCBA98n, 0x0n, 'The result of (-0x1234n / 0xFEDCBA98n) is 0x0n'); +assert.sameValue(-0x1234n / 0xFEDCBA97n, 0x0n, 'The result of (-0x1234n / 0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1234n / 0x1234n, -0x1n, 'The result of (-0x1234n / 0x1234n) is -0x1n'); +assert.sameValue(-0x1234n / 0x3n, -0x611n, 'The result of (-0x1234n / 0x3n) is -0x611n'); +assert.sameValue(-0x1234n / 0x2n, -0x91An, 'The result of (-0x1234n / 0x2n) is -0x91An'); +assert.sameValue(-0x1234n / 0x1n, -0x1234n, 'The result of (-0x1234n / 0x1n) is -0x1234n'); +assert.sameValue(-0x1234n / -0x1n, 0x1234n, 'The result of (-0x1234n / -0x1n) is 0x1234n'); +assert.sameValue(-0x1234n / -0x2n, 0x91An, 'The result of (-0x1234n / -0x2n) is 0x91An'); +assert.sameValue(-0x1234n / -0x3n, 0x611n, 'The result of (-0x1234n / -0x3n) is 0x611n'); +assert.sameValue(-0x1234n / -0x1234n, 0x1n, 'The result of (-0x1234n / -0x1234n) is 0x1n'); +assert.sameValue(-0x1234n / -0xFEDCBA97n, 0x0n, 'The result of (-0x1234n / -0xFEDCBA97n) is 0x0n'); +assert.sameValue(-0x1234n / -0xFEDCBA98n, 0x0n, 'The result of (-0x1234n / -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + -0x1234n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0x1234n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0x1234n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0x1234n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / 0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA97n / 0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA97n / 0x1234n, + -0xE0042n, + 'The result of (-0xFEDCBA97n / 0x1234n) is -0xE0042n' +); + +assert.sameValue( + -0xFEDCBA97n / 0x3n, + -0x54F43E32n, + 'The result of (-0xFEDCBA97n / 0x3n) is -0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA97n / 0x2n, + -0x7F6E5D4Bn, + 'The result of (-0xFEDCBA97n / 0x2n) is -0x7F6E5D4Bn' +); + +assert.sameValue( + -0xFEDCBA97n / 0x1n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n / 0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n / -0x1n, + 0xFEDCBA97n, + 'The result of (-0xFEDCBA97n / -0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n / -0x2n, + 0x7F6E5D4Bn, + 'The result of (-0xFEDCBA97n / -0x2n) is 0x7F6E5D4Bn' +); + +assert.sameValue( + -0xFEDCBA97n / -0x3n, + 0x54F43E32n, + 'The result of (-0xFEDCBA97n / -0x3n) is 0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA97n / -0x1234n, + 0xE0042n, + 'The result of (-0xFEDCBA97n / -0x1234n) is 0xE0042n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA97n, + 0x1n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA97n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA98n, + -0x1n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / 0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n / 0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / 0x1234n, + -0xE0042n, + 'The result of (-0xFEDCBA98n / 0x1234n) is -0xE0042n' +); + +assert.sameValue( + -0xFEDCBA98n / 0x3n, + -0x54F43E32n, + 'The result of (-0xFEDCBA98n / 0x3n) is -0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA98n / 0x2n, + -0x7F6E5D4Cn, + 'The result of (-0xFEDCBA98n / 0x2n) is -0x7F6E5D4Cn' +); + +assert.sameValue( + -0xFEDCBA98n / 0x1n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n / 0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n / -0x1n, + 0xFEDCBA98n, + 'The result of (-0xFEDCBA98n / -0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n / -0x2n, + 0x7F6E5D4Cn, + 'The result of (-0xFEDCBA98n / -0x2n) is 0x7F6E5D4Cn' +); + +assert.sameValue( + -0xFEDCBA98n / -0x3n, + 0x54F43E32n, + 'The result of (-0xFEDCBA98n / -0x3n) is 0x54F43E32n' +); + +assert.sameValue( + -0xFEDCBA98n / -0x1234n, + 0xE0042n, + 'The result of (-0xFEDCBA98n / -0x1234n) is 0xE0042n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA97n, + 0x1n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA98n, + 0x1n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA98n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA98n / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA98n, + -0x100000000n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0xFEDCBA97n, + -0x100000001n, + 'The result of (-0xFEDCBA987654320Fn / 0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x1234n, + -0xE0042813BE5DCn, + 'The result of (-0xFEDCBA987654320Fn / 0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x3n, + -0x54F43E32D21C10AFn, + 'The result of (-0xFEDCBA987654320Fn / 0x3n) is -0x54F43E32D21C10AFn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x2n, + -0x7F6E5D4C3B2A1907n, + 'The result of (-0xFEDCBA987654320Fn / 0x2n) is -0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / 0x1n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn / 0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x1n, + 0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn / -0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x2n, + 0x7F6E5D4C3B2A1907n, + 'The result of (-0xFEDCBA987654320Fn / -0x2n) is 0x7F6E5D4C3B2A1907n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x3n, + 0x54F43E32D21C10AFn, + 'The result of (-0xFEDCBA987654320Fn / -0x3n) is 0x54F43E32D21C10AFn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0x1234n, + 0xE0042813BE5DCn, + 'The result of (-0xFEDCBA987654320Fn / -0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA97n, + 0x100000001n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA98n, + 0x100000000n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn / -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn / -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA9876543210n, + -0x1n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA98n, + -0x100000000n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA98n) is -0x100000000n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0xFEDCBA97n, + -0x100000001n, + 'The result of (-0xFEDCBA9876543210n / 0xFEDCBA97n) is -0x100000001n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x1234n, + -0xE0042813BE5DCn, + 'The result of (-0xFEDCBA9876543210n / 0x1234n) is -0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x3n, + -0x54F43E32D21C10B0n, + 'The result of (-0xFEDCBA9876543210n / 0x3n) is -0x54F43E32D21C10B0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x2n, + -0x7F6E5D4C3B2A1908n, + 'The result of (-0xFEDCBA9876543210n / 0x2n) is -0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / 0x1n, + -0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA9876543210n / 0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x1n, + 0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA9876543210n / -0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x2n, + 0x7F6E5D4C3B2A1908n, + 'The result of (-0xFEDCBA9876543210n / -0x2n) is 0x7F6E5D4C3B2A1908n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x3n, + 0x54F43E32D21C10B0n, + 'The result of (-0xFEDCBA9876543210n / -0x3n) is 0x54F43E32D21C10B0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0x1234n, + 0xE0042813BE5DCn, + 'The result of (-0xFEDCBA9876543210n / -0x1234n) is 0xE0042813BE5DCn' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA97n, + 0x100000001n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA97n) is 0x100000001n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA98n, + 0x100000000n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA98n) is 0x100000000n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n / -0xFEDCBA9876543210n, + 0x1n, + 'The result of (-0xFEDCBA9876543210n / -0xFEDCBA9876543210n) is 0x1n' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/bigint-complex-infinity.js b/js/src/tests/test262/language/expressions/division/bigint-complex-infinity.js new file mode 100644 index 0000000000..a587da0b40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/bigint-complex-infinity.js @@ -0,0 +1,37 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: BigInt division of complex infinity (1/0) +esid: sec-multiplicative-operators-runtime-semantics-evaluation +info: | + Runtime Semantics: Evaluation + + MultiplicativeExpression: MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + ... + 11. If MultiplicativeOperator is /, return T::divide(lnum, rnum). + ... + + BigInt::divide (x, y) + + 1. If y is 0n, throw a RangeError exception. + ... +features: [BigInt] +---*/ +assert.throws(RangeError, function() { + 1n / 0n; +}, '1n / 0n throws RangeError'); + +assert.throws(RangeError, function() { + 10n / 0n; +}, '10n / 0n throws RangeError'); + +assert.throws(RangeError, function() { + 0n / 0n; +}, '0n / 0n throws RangeError'); + +assert.throws(RangeError, function() { + 1000000000000000000n / 0n; +}, '1000000000000000000n / 0n throws RangeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/bigint-errors.js b/js/src/tests/test262/language/expressions/division/bigint-errors.js new file mode 100644 index 0000000000..80212117c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: division operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') / 1n; +}, 'Symbol("1") / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / Symbol('1'); +}, '0n / Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) / 1n; +}, 'Object(Symbol("1")) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / Object(Symbol('1')); +}, '0n / Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) / 1n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n / {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) / 1n; +}, '({valueOf: function() {return Symbol("1");}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n / {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) / 1n; +}, '({toString: function() {return Symbol("1");}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + toString: function() { + return Symbol('1'); + } + }; +}, '0n / {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/division/bigint-toprimitive.js new file mode 100644 index 0000000000..6bf678c89e --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: division operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) / 2n) is 1n'); + +assert.sameValue(2n / { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} / 2n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) / 2n) is 1n'); + +assert.sameValue(2n / { + valueOf: function() { + return 2n; + }, + + toString: err +}, 1n, 'The result of (2n / {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({toString: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + toString: function() { + return 2n; + } +}, 1n, 'The result of (2n / {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + valueOf: null, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (2n / {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (2n / {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (2n / {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (2n / {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (2n / {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) / 1n; +}, '({[Symbol.toPrimitive]: 1}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + [Symbol.toPrimitive]: 1 + }; +}, '0n / {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) / 1n; +}, '({[Symbol.toPrimitive]: {}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + [Symbol.toPrimitive]: {} + }; +}, '0n / {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) / 1n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n / {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) / 1n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n / {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) / 1n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) / 1n throws MyError'); + +assert.throws(MyError, function() { + 0n / { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n / {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) / 1n; +}, '({valueOf: function() {throw new MyError();}}) / 1n throws MyError'); + +assert.throws(MyError, function() { + 0n / { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n / {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) / 1n; +}, '({toString: function() {throw new MyError();}}) / 1n throws MyError'); + +assert.throws(MyError, function() { + 0n / { + toString: function() { + throw new MyError(); + } + }; +}, '0n / {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) / 1n; +}, '({valueOf: null, toString: null}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + valueOf: null, + toString: null + }; +}, '0n / {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) / 1n; +}, '({valueOf: 1, toString: 1}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + valueOf: 1, + toString: 1 + }; +}, '0n / {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) / 1n; +}, '({valueOf: {}, toString: {}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + valueOf: {}, + toString: {} + }; +}, '0n / {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) / 1n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n / {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) / 1n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) / 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n / { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n / {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/division/bigint-wrapped-values.js new file mode 100644 index 0000000000..2c85cc987f --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: division operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) / 2n, 1n, 'The result of (Object(2n) / 2n) is 1n'); +assert.sameValue(2n / Object(2n), 1n, 'The result of (2n / Object(2n)) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 1n, 'The result of (2n / {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({valueOf: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (2n / {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} / 2n, 1n, 'The result of (({toString: function() {return 2n;}}) / 2n) is 1n'); + +assert.sameValue(2n / { + toString: function() { + return 2n; + } +}, 1n, 'The result of (2n / {toString: function() {return 2n;}}) is 1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/browser.js b/js/src/tests/test262/language/expressions/division/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/division/line-terminator.js b/js/src/tests/test262/language/expressions/division/line-terminator.js new file mode 100644 index 0000000000..5420b125df --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/line-terminator.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Line terminator between the operands of a division operator +info: | + MultiplicativeExpression[Yield, Await]: + ExponentiationExpression + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + MultiplicativeOperator : one of + * / % +---*/ + +var x = 18 + +/ + +2 + +/ + +9 +; + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/no-magic-asi-from-block-eval.js b/js/src/tests/test262/language/expressions/division/no-magic-asi-from-block-eval.js new file mode 100644 index 0000000000..858431fe73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/no-magic-asi-from-block-eval.js @@ -0,0 +1,23 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: division after block statement (no ASI) +info: | + MultiplicativeExpression[Yield, Await]: + ExponentiationExpression + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + MultiplicativeOperator : one of + * / % +---*/ + +var of = 4; +var g = 2; + +var notRegExp = eval('{[42]}.8/of/g'); + +assert.sameValue(notRegExp, .1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/no-magic-asi.js b/js/src/tests/test262/language/expressions/division/no-magic-asi.js new file mode 100644 index 0000000000..e6f9c876dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/no-magic-asi.js @@ -0,0 +1,24 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: No ASI happening in identifier used as operands +info: | + MultiplicativeExpression[Yield, Await]: + ExponentiationExpression + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + MultiplicativeOperator : one of + * / % +---*/ + +var instance = 60; +var of = 6; +var g = 2; + +var notRegExp = instance/of/g; + +assert.sameValue(notRegExp, 5); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/order-of-evaluation.js b/js/src/tests/test262/language/expressions/division/order-of-evaluation.js new file mode 100644 index 0000000000..0969ee9716 --- /dev/null +++ b/js/src/tests/test262/language/expressions/division/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Type coercion order of operations for division operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() / (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() / (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() / (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() / (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() / (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() / (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/division/shell.js b/js/src/tests/test262/language/expressions/division/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A1.js new file mode 100644 index 0000000000..f7d9b7b8da --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between EqualityExpression and "!=" or + between "!=" and RelationalExpression are allowed +es5id: 11.9.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("true\u0009!=\u00091") !== false) { + throw new Test262Error('#1: (true\\u0009!=\\u00091) === false'); +} + +//CHECK#2 +if (eval("true\u000B!=\u000B1") !== false) { + throw new Test262Error('#2: (true\\u000B!=\\u000B1) === false'); +} + +//CHECK#3 +if (eval("true\u000C!=\u000C1") !== false) { + throw new Test262Error('#3: (true\\u000C!=\\u000C1) === false'); +} + +//CHECK#4 +if (eval("true\u0020!=\u00201") !== false) { + throw new Test262Error('#4: (true\\u0020!=\\u00201) === false'); +} + +//CHECK#5 +if (eval("true\u00A0!=\u00A01") !== false) { + throw new Test262Error('#5: (true\\u00A0!=\\u00A01) === false'); +} + +//CHECK#6 +if (eval("true\u000A!=\u000A1") !== false) { + throw new Test262Error('#6: (true\\u000A!=\\u000A1) === false'); +} + +//CHECK#7 +if (eval("true\u000D!=\u000D1") !== false) { + throw new Test262Error('#7: (true\\u000D!=\\u000D1) === false'); +} + +//CHECK#8 +if (eval("true\u2028!=\u20281") !== false) { + throw new Test262Error('#8: (true\\u2028!=\\u20281) === false'); +} + +//CHECK#9 +if (eval("true\u2029!=\u20291") !== false) { + throw new Test262Error('#9: (true\\u2029!=\\u20291) === false'); +} + +//CHECK#10 +if (eval("true\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029!=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== false) { + throw new Test262Error('#10: (true\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029!=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T1.js new file mode 100644 index 0000000000..83cd3fdae0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x != y uses GetValue +es5id: 11.9.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((1 != 1) !== false) { + throw new Test262Error('#1: (1 != 1) === false'); +} + +//CHECK#2 +var x = 1; +if ((x != 1) !== false) { + throw new Test262Error('#2: var x = 1; (x != 1) === false'); +} + +//CHECK#3 +var y = 1; +if ((1 != y) !== false) { + throw new Test262Error('#3: var y = 1; (1 != y) === false'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if ((x != y) !== false) { + throw new Test262Error('#4: var x = 1; var y = 1; (x != y) === false'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if ((objectx.prop != objecty.prop) !== false) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; (objectx.prop != objecty.prop) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T2.js new file mode 100644 index 0000000000..e50becd278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x != y uses GetValue +es5id: 11.9.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x != 1; + throw new Test262Error('#1.1: x != 1 throw ReferenceError. Actual: ' + (x != 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x != 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T3.js new file mode 100644 index 0000000000..3d5d100b4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x != y uses GetValue +es5id: 11.9.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 != y; + throw new Test262Error('#1: 1 != y throw ReferenceError'); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 != y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T1.js new file mode 100644 index 0000000000..3b5a67dd47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if (((x = 1) != x) !== false) { + throw new Test262Error('#1: var x = 0; ((x = 1) != x) === false'); +} + +//CHECK#2 +var x = 0; +if ((x != (x = 1)) !== true) { + throw new Test262Error('#2: var x = 0; (x != (x = 1)) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T2.js new file mode 100644 index 0000000000..e18e52e742 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() != y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() != y() throw "x". Actual: ' + (x() != y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() != y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T3.js new file mode 100644 index 0000000000..389dfc696e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.2_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x != (x = 1); + throw new Test262Error('#1.1: x != (x = 1) throw ReferenceError. Actual: ' + (x != (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x != (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T4.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T4.js new file mode 100644 index 0000000000..be2b60cd1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.2_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if (((y = 1) != y) !== false) { + throw new Test262Error('#1: ((y = 1) != y) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.1.js new file mode 100644 index 0000000000..65a29aa8d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Return false, if x and y are both true or both false; otherwise, return + true +es5id: 11.9.2_A3.1 +description: x and y are boolean primitives +---*/ + +//CHECK#1 +if ((true != true) !== false) { + throw new Test262Error('#1: (true != true) === false'); +} + +//CHECK#2 +if ((false != false) !== false) { + throw new Test262Error('#2: (false != false) === false'); +} + +//CHECK#3 +if ((true != false) !== true) { + throw new Test262Error('#3: (true != false) === true'); +} + +//CHECK#4 +if ((false != true) !== true) { + throw new Test262Error('#4: (false != true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.2.js new file mode 100644 index 0000000000..e01b897d11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Boolean and Type(y) is Number, + return the result of comparison ToNumber(x) != y +es5id: 11.9.2_A3.2 +description: x is primitive boolean, y is primitive number +---*/ + +//CHECK#1 +if ((true != 1) !== false) { + throw new Test262Error('#1: (true != 1) === false'); +} + +//CHECK#2 +if ((false != "0") !== false) { + throw new Test262Error('#2: (false != "0") === false'); +} + +//CHECK#3 +if ((true != new Boolean(true)) !== false) { + throw new Test262Error('#3: (true != new Boolean(true)) === false'); +} + +//CHECK#4 +if ((true != {valueOf: function () {return 1}}) !== false) { + throw new Test262Error('#4: (true != {valueOf: function () {return 1}}) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.3.js new file mode 100644 index 0000000000..f8446ea92e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A3.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(y) is Number and Type(y) is Boolean, + return the result of comparison x != ToNumber(y) +es5id: 11.9.2_A3.3 +description: x is primitive number, y is primitive boolean +---*/ + +//CHECK#1 +if ((0 != false) !== false) { + throw new Test262Error('#1: (0 != false) === false'); +} + +//CHECK#2 +if (("1" != true) !== false) { + throw new Test262Error('#2: ("1" != true) === false'); +} + +//CHECK#3 +if ((new Boolean(false) != false) !== false) { + throw new Test262Error('#3: (new Boolean(false) != false) === false'); +} + +//CHECK#4 +if (({valueOf: function () {return "0"}} != false) !== false) { + throw new Test262Error('#4: ({valueOf: function () {return "0"}} != false) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T1.js new file mode 100644 index 0000000000..bf3ecb1c03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return true +es5id: 11.9.2_A4.1_T1 +description: x is NaN +---*/ + +//CHECK#1 +if ((Number.NaN != true) !== true) { + throw new Test262Error('#1: (NaN != true) === true'); +} + +//CHECK#2 +if ((Number.NaN != 1) !== true) { + throw new Test262Error('#2: (NaN != 1) === true'); +} + +//CHECK#3 +if ((Number.NaN != Number.NaN) !== true) { + throw new Test262Error('#3: (NaN != NaN) === true'); +} + +//CHECK#4 +if ((Number.NaN != Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: (NaN != +Infinity) === true'); +} + +//CHECK#5 +if ((Number.NaN != Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: (NaN != -Infinity) === true'); +} + +//CHECK#6 +if ((Number.NaN != Number.MAX_VALUE) !== true) { + throw new Test262Error('#6: (NaN != Number.MAX_VALUE) === true'); +} + +//CHECK#7 +if ((Number.NaN != Number.MIN_VALUE) !== true) { + throw new Test262Error('#7: (NaN != Number.MIN_VALUE) === true'); +} + +//CHECK#8 +if ((Number.NaN != "string") !== true) { + throw new Test262Error('#8: (NaN != "string") === true'); +} + +//CHECK#9 +if ((Number.NaN != new Object()) !== true) { + throw new Test262Error('#9: (NaN != new Object()) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T2.js new file mode 100644 index 0000000000..42ea03c030 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.1_T2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return true +es5id: 11.9.2_A4.1_T2 +description: y is NaN +---*/ + +//CHECK#1 +if ((true != Number.NaN) !== true) { + throw new Test262Error('#1: (true != NaN) === true'); +} + +//CHECK#2 +if ((-1 != Number.NaN) !== true) { + throw new Test262Error('#2: (-1 != NaN) === true'); +} + +//CHECK#3 +if ((Number.NaN != Number.NaN) !== true) { + throw new Test262Error('#3: (NaN != NaN) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY != Number.NaN) !== true) { + throw new Test262Error('#4: (+Infinity != NaN) === true'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY != Number.NaN) !== true) { + throw new Test262Error('#5: (-Infinity != NaN) === true'); +} + +//CHECK#6 +if ((Number.MAX_VALUE != Number.NaN) !== true) { + throw new Test262Error('#6: (Number.MAX_VALUE != NaN) === true'); +} + +//CHECK#7 +if ((Number.MIN_VALUE != Number.NaN) !== true) { + throw new Test262Error('#7: (Number.MIN_VALUE != NaN) === true'); +} + +//CHECK#8 +if (("string" != Number.NaN) !== true) { + throw new Test262Error('#8: ("string" != NaN) === true'); +} + +//CHECK#9 +if ((new Object() != Number.NaN) !== true) { + throw new Test262Error('#9: (new Object() != NaN) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.2.js new file mode 100644 index 0000000000..3c421659f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0(-0) and y is -0(+0), return false +es5id: 11.9.2_A4.2 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((+0 != -0) !== false) { + throw new Test262Error('#1: (+0 != -0) === false'); +} + +//CHECK#2 +if ((-0 != +0) !== false) { + throw new Test262Error('#2: (-0 != +0) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.3.js new file mode 100644 index 0000000000..4c867fb43b --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A4.3.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Number-s minus NaN, +0, -0. + Return false, if x is the same number value as y; otherwise, return true +es5id: 11.9.2_A4.3 +description: x and y are primitive numbers +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#1: (+Infinity != +Infinity) === false'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#2: (-Infinity != -Infinity) === false'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY != -Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#3: (+Infinity != -(-Infinity)) === false'); +} + +//CHECK#4 +if ((1 != 0.999999999999) !== true) { + throw new Test262Error('#4: (1 != 0.999999999999) === true'); +} + +//CHECK#5 +if ((1.0 != 1) !== false) { + throw new Test262Error('#5: (1.0 != 1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.1.js new file mode 100644 index 0000000000..69ac924ba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.1.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are String-s. + Return true, if x and y are exactly the same sequence of characters; otherwise, return false +es5id: 11.9.2_A5.1 +description: x and y are primitive strings +---*/ + +//CHECK#1 +if (("" != "") !== false) { + throw new Test262Error('#1: ("" != "") === false'); +} + +//CHECK#2 +if ((" " != " ") !== false) { + throw new Test262Error('#2: " (" != " ") === false'); +} + +//CHECK#3 +if ((" " != "") !== true) { + throw new Test262Error('#3: " (" != "") === true'); +} + +//CHECK#4 +if (("string" != "string") !== false) { + throw new Test262Error('#4: ("string" != "string") === false'); +} + +//CHECK#5 +if ((" string" != "string ") !== true) { + throw new Test262Error('#5: (" string" != "string ") === true'); +} + +//CHECK#6 +if (("1.0" != "1") !== true) { + throw new Test262Error('#6: ("1.0" != "1") === true'); +} + +//CHECK#7 +if (("0xff" != "255") !== true) { + throw new Test262Error('#7: ("0xff" != "255") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.2.js new file mode 100644 index 0000000000..2628bf504a --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Number and Type(y) is String, + return the result of comparison x != ToNumber(y) +es5id: 11.9.2_A5.2 +description: x is primitive number, y is primitive string +---*/ + +//CHECK#1 +if ((1 != "1") !== false) { + throw new Test262Error('#1: (1 != "1") === false'); +} + +//CHECK#2 +if ((1.100 != "+1.10") !== false) { + throw new Test262Error('#2: (1.100 != "+1.10") === false'); +} + +//CHECK#3 +if ((1 != "true") !== true) { + throw new Test262Error('#3: (1 != "true") === true'); +} + +//CHECK#4 +if ((255 != "0xff") !== false) { + throw new Test262Error('#4: (255 != "0xff") === false'); +} + +//CHECK#5 +if ((0 != "") !== false) { + throw new Test262Error('#5: (0 != "") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.3.js new file mode 100644 index 0000000000..2c9d3a33fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A5.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is String and Type(y) is Number, + return the result of comparison ToNumber(x) != y +es5id: 11.9.2_A5.3 +description: x is primitive string, y is primitive number +---*/ + +//CHECK#1 +if (("-1" != -1) !== false) { + throw new Test262Error('#1: ("-1" != -1) === false'); +} + +//CHECK#2 +if (("-1.100" != -1.10) !== false) { + throw new Test262Error('#2: ("-1.100" != -1.10) === false'); +} + +//CHECK#3 +if (("false" != 0) !== true) { + throw new Test262Error('#3: ("false" != 0) === true'); +} + +//CHECK#4 +if (("5e-324" != 5e-324) !== false) { + throw new Test262Error('#4: ("5e-324" != 5e-324) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.1.js new file mode 100644 index 0000000000..bda4c962e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) as well as Type(y) is Undefined or Null, return true +es5id: 11.9.2_A6.1 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((undefined != undefined) !== false) { + throw new Test262Error('#1: (undefined != undefined) === false'); +} + +//CHECK#2 +if ((void 0 != undefined) !== false) { + throw new Test262Error('#2: (void 0 != undefined) === false'); +} + +//CHECK#3 +if ((undefined != eval("var x")) !== false) { + throw new Test262Error('#3: (undefined != eval("var x")) === false'); +} + +//CHECK#4 +if ((undefined != null) !== false) { + throw new Test262Error('#4: (undefined != null) === false'); +} + +//CHECK#5 +if ((null != void 0) !== false) { + throw new Test262Error('#5: (null != void 0) === false'); +} + +//CHECK#6 +if ((null != null) !== false) { + throw new Test262Error('#6: (null != null) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T1.js new file mode 100644 index 0000000000..16f9e70b00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If one expression is undefined or null and another is not, return false +es5id: 11.9.2_A6.2_T1 +description: x is null or undefined, y is not +---*/ + +//CHECK#1 +if ((undefined != true) !== true) { + throw new Test262Error('#1: (undefined != true) === true'); +} + +//CHECK#2 +if ((undefined != 0) !== true) { + throw new Test262Error('#2: (undefined != 0) === true'); +} + +//CHECK#3 +if ((undefined != "undefined") !== true) { + throw new Test262Error('#3: (undefined != "undefined") === true'); +} + +//CHECK#4 +if ((undefined != {}) !== true) { + throw new Test262Error('#4: (undefined != {}) === true'); +} + +//CHECK#5 +if ((null != false) !== true) { + throw new Test262Error('#5: (null != false) === true'); +} + +//CHECK#6 +if ((null != 0) !== true) { + throw new Test262Error('#6: (null != 0) === true'); +} + +//CHECK#7 +if ((null != "null") !== true) { + throw new Test262Error('#7: (null != "null") === true'); +} + +//CHECK#8 +if ((null != {}) !== true) { + throw new Test262Error('#8: (null != {}) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T2.js new file mode 100644 index 0000000000..563edcb2ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A6.2_T2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If one expression is undefined or null and another is not, return false +es5id: 11.9.2_A6.2_T2 +description: y is null or undefined, x is not +---*/ + +//CHECK#1 +if ((false != undefined) !== true) { + throw new Test262Error('#1: (false != undefined) === true'); +} + +//CHECK#2 +if ((Number.NaN != undefined) !== true) { + throw new Test262Error('#2: (Number.NaN != undefined) === true'); +} + +//CHECK#3 +if (("undefined" != undefined) !== true) { + throw new Test262Error('#3: ("undefined" != undefined) === true'); +} + +//CHECK#4 +if (({} != undefined) !== true) { + throw new Test262Error('#4: ({} != undefined) === true'); +} + +//CHECK#5 +if ((false != null) !== true) { + throw new Test262Error('#5: (false != null) === true'); +} + +//CHECK#6 +if ((0 != null) !== true) { + throw new Test262Error('#6: (0 != null) === true'); +} + +//CHECK#7 +if (("null" != null) !== true) { + throw new Test262Error('#7: ("null" != null) === true'); +} + +//CHECK#8 +if (({} != null) !== true) { + throw new Test262Error('#8: ({} != null) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.1.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.1.js new file mode 100644 index 0000000000..5a71fe993d --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.1.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Object-s. + Return true, if x and y are references to the same Object; otherwise, return false +es5id: 11.9.2_A7.1 +description: > + Checking Boolean object, Number object, String object, Object + object +---*/ + +//CHECK#1 +if ((new Boolean(true) != new Boolean(true)) !== true) { + throw new Test262Error('#1: (new Boolean(true) != new Boolean(true)) === true'); +} + +//CHECK#2 +if ((new Number(1) != new Number(1)) !== true) { + throw new Test262Error('#2: (new Number(1) != new Number(1)) === true'); +} + +//CHECK#3 +if ((new String("x") != new String("x")) !== true) { + throw new Test262Error('#3: (new String("x") != new String("x")) === true'); +} + +//CHECK#4 +if ((new Object() != new Object()) !== true) { + throw new Test262Error('#4: (new Object() != new Object()) === true'); +} + +//CHECK#5 +var x, y; +x = {}; +y = x; +if ((x != y) !== false) { + throw new Test262Error('#5: x = {}; y = x; (x != y) === false'); +} + +//CHECK#6 +if ((new Boolean(true) != new Number(1)) !== true) { + throw new Test262Error('#6 (new Boolean(true) != new Number(1)) === true'); +} + +//CHECK#7 +if ((new Number(1) != new String("1")) !== true) { + throw new Test262Error('#7: (new Number(1) != new String("1")) === true'); +} + +//CHECK#8 +if ((new String("1") != new Boolean(true)) !== true) { + throw new Test262Error('#8: (new String("x") != new Boolean(true)) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.2.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.2.js new file mode 100644 index 0000000000..59f12daec2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is Boolean, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.2 +description: x is object, y is primitive boolean +---*/ + +//CHECK#1 +if ((new Boolean(true) != true) !== false) { + throw new Test262Error('#1: (new Boolean(true) != true) === false'); +} + +//CHECK#2 +if ((new Number(1) != true) !== false) { + throw new Test262Error('#2: (new Number(1) != true) === false'); +} + +//CHECK#3 +if ((new String("1") != true) !== false) { + throw new Test262Error('#3: (new String("1") != true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.3.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.3.js new file mode 100644 index 0000000000..7c7f876f5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Boolean and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.3 +description: y is object, x is primitive boolean +---*/ + +//CHECK#1 +if ((true != new Boolean(true)) !== false) { + throw new Test262Error('#1: (true != new Boolean(true)) === false'); +} + +//CHECK#2 +if ((true != new Number(1)) !== false) { + throw new Test262Error('#2: (true != new Number(1)) === false'); +} + +//CHECK#3 +if ((true != new String("+1")) !== false) { + throw new Test262Error('#3: (true != new String("+1")) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.4.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.4.js new file mode 100644 index 0000000000..1f330ca59e --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.4.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is Number, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.4 +description: x is object, y is primitive number +---*/ + +//CHECK#1 +if ((new Boolean(true) != 1) !== false) { + throw new Test262Error('#1: (new Boolean(true) != 1) === false'); +} + +//CHECK#2 +if ((new Number(-1) != -1) !== false) { + throw new Test262Error('#2: (new Number(-1) != -1) === false'); +} + +//CHECK#3 +if ((new String("-1") != -1) !== false) { + throw new Test262Error('#3: (new String("-1") != -1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.5.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.5.js new file mode 100644 index 0000000000..769c4df786 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.5.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Number and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.5 +description: y is object, x is primitive number +---*/ + +//CHECK#1 +if ((1 != new Boolean(true)) !== false) { + throw new Test262Error('#1: (1 != new Boolean(true)) === false'); +} + +//CHECK#2 +if ((-1 != new Number(-1)) !== false) { + throw new Test262Error('#2: (-1 != new Number(-1)) === false'); +} + +//CHECK#3 +if ((-1 != new String("-1")) !== false) { + throw new Test262Error('#3: (-1 != new String("-1")) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.6.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.6.js new file mode 100644 index 0000000000..e7a9173c35 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.6.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is String, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.6 +description: x is object, y is primitive string +---*/ + +//CHECK#1 +if ((new Boolean(true) != "1") !== false) { + throw new Test262Error('#1: (new Boolean(true) != "1") === false'); +} + +//CHECK#2 +if ((new Number(-1) != "-1") !== false) { + throw new Test262Error('#2: (new Number(-1) != "-1") === false'); +} + +//CHECK#3 +if ((new String("x") != "x") !== false) { + throw new Test262Error('#3: (new String("x") != "x") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.7.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.7.js new file mode 100644 index 0000000000..ed94e09700 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.7.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is String and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.7 +description: y is object, x is primitive string +---*/ + +//CHECK#1 +if (("1" != new Boolean(true)) !== false) { + throw new Test262Error('#1: ("1" != new Boolean(true)) === false'); +} + +//CHECK#2 +if (("-1" != new Number(-1)) !== false) { + throw new Test262Error('#2: ("-1" != new Number(-1)) === false'); +} + +//CHECK#3 +if (("x" != new String("x")) !== false) { + throw new Test262Error('#3: ("x" != new String("x")) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.8.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.8.js new file mode 100644 index 0000000000..307604cf20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.8.js @@ -0,0 +1,77 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is primitive type, + return ToPrimitive(x) != y +es5id: 11.9.2_A7.8 +description: x is object, y is primtitive +---*/ + +//CHECK#1 +if ((true != {valueOf: function() {return 1}}) !== false) { + throw new Test262Error('#1: (true != {valueOf: function() {return 1}}) === false'); +} + +//CHECK#2 +if ((1 != {valueOf: function() {return 1}, toString: function() {return 0}}) !== false) { + throw new Test262Error('#2: (1 != {valueOf: function() {return 1}, toString: function() {return 0}}) === false'); +} + +//CHECK#3 +if (("+1" != {valueOf: function() {return 1}, toString: function() {return {}}}) !== false) { + throw new Test262Error('#3: ("+1" != {valueOf: function() {return 1}, toString: function() {return {}}}) === false'); +} + +//CHECK#4 +try { + if ((true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) !== false) { + throw new Test262Error('#4.1: (true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) === false'); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: (true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) not throw "error"'); + } else { + throw new Test262Error('#4.3: (true != {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if ((1 != {toString: function() {return "+1"}}) !== false) { + throw new Test262Error('#5: (1 != {toString: function() {return "+1"}}) === false'); +} + +//CHECK#6 +if (("1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) !== true) { + throw new Test262Error('#6.1: ("1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) === true'); +} else { + if (("+1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) !== false) { + throw new Test262Error('#6.2: ("+1" != {valueOf: function() {return {}}, toString: function() {return "+1"}}) === false'); + } +} + +//CHECK#7 +try { + (1 != {valueOf: function() {throw "error"}, toString: function() {return 1}}); + throw new Test262Error('#7: (1 != {valueOf: function() {throw "error"}, toString: function() {return 1}}) throw "error"'); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7: (1 != {valueOf: function() {throw "error"}, toString: function() {return 1}}) throw "error"'); + } +} + +//CHECK#8 +try { + (1 != {valueOf: function() {return {}}, toString: function() {return {}}}); + throw new Test262Error('#8: (1 != {valueOf: function() {return {}}, toString: function() {return {}}}) throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8: (1 != {valueOf: function() {return {}}, toString: function() {return {}}}) throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.9.js b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.9.js new file mode 100644 index 0000000000..7d5d9a2fa8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/S11.9.2_A7.9.js @@ -0,0 +1,77 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is primitive type and Type(y) is Object, + return x != ToPrimitive(y) +es5id: 11.9.2_A7.9 +description: y is object, x is primtitive +---*/ + +//CHECK#1 +if (({valueOf: function() {return 1}} != true) !== false) { + throw new Test262Error('#1: ({valueOf: function() {return 1}} != true) === false'); +} + +//CHECK#2 +if (({valueOf: function() {return 1}, toString: function() {return 0}} != 1) !== false) { + throw new Test262Error('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} != 1) === false'); +} + +//CHECK#3 +if (({valueOf: function() {return 1}, toString: function() {return {}}} != "+1") !== false) { + throw new Test262Error('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} != "+1") === false'); +} + +//CHECK#4 +try { + if (({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) !== false) { + throw new Test262Error('#4.1: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) === false'); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) not throw "error"'); + } else { + throw new Test262Error('#4.3: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} != true) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (({toString: function() {return "+1"}} != 1) !== false) { + throw new Test262Error('#5: ({toString: function() {return "+1"}} != 1) === false'); +} + +//CHECK#6 +if (({valueOf: function() {return {}}, toString: function() {return "+1"}} != "1") !== true) { + throw new Test262Error('#6.1: ({valueOf: function() {return {}}, toString: function() {return "+1"}} != "1") === true'); +} else { + if (({valueOf: function() {return {}}, toString: function() {return "+1"}} != "+1") !== false) { + throw new Test262Error('#6.2: ({valueOf: function() {return {}}, toString: function() {return "+1"}} != "+1") === false'); + } +} + +//CHECK#7 +try { + ({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1); + throw new Test262Error('#7.1: ({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1) throw "error". Actual: ' + (({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1))); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: ({valueOf: function() {throw "error"}, toString: function() {return 1}} != 1) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + ({valueOf: function() {return {}}, toString: function() {return {}}} != 1); + throw new Test262Error('#8.1: ({valueOf: function() {return {}}, toString: function() {return {}}} != 1) throw TypeError. Actual: ' + (({valueOf: function() {return {}}, toString: function() {return {}}} != 1))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: ({valueOf: function() {return {}}, toString: function() {return {}}} != 1) throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-bigint.js new file mode 100644 index 0000000000..6d247f6a2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-bigint.js @@ -0,0 +1,173 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt values +esid: sec-abstract-equality-comparison +info: | + 1. If Type(x) is the same as Type(y), then + a. Return the result of performing Strict Equality Comparison x === y. + + sec-numeric-types-bigint-equal + BigInt::equal (x, y) + + The abstract operation BigInt::equal with two arguments x and y of BigInt type returns true if x and y have the same mathematical integer value and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n != 0n, false, 'The result of (0n != 0n) is false'); +assert.sameValue(1n != 1n, false, 'The result of (1n != 1n) is false'); +assert.sameValue(-1n != -1n, false, 'The result of (-1n != -1n) is false'); +assert.sameValue(0n != -0n, false, 'The result of (0n != -0n) is false'); +assert.sameValue(-0n != 0n, false, 'The result of (-0n != 0n) is false'); +assert.sameValue(0n != 1n, true, 'The result of (0n != 1n) is true'); +assert.sameValue(1n != 0n, true, 'The result of (1n != 0n) is true'); +assert.sameValue(0n != -1n, true, 'The result of (0n != -1n) is true'); +assert.sameValue(-1n != 0n, true, 'The result of (-1n != 0n) is true'); +assert.sameValue(1n != -1n, true, 'The result of (1n != -1n) is true'); +assert.sameValue(-1n != 1n, true, 'The result of (-1n != 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n != 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff01n != 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x1fffffffffffff01n != 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n != 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n != 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n != 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n != -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff01n != -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n != -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n != -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n != -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n != -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n != 0n, + true, + 'The result of (0x10000000000000000n != 0n) is true' +); + +assert.sameValue( + 0n != 0x10000000000000000n, + true, + 'The result of (0n != 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n != 1n, + true, + 'The result of (0x10000000000000000n != 1n) is true' +); + +assert.sameValue( + 1n != 0x10000000000000000n, + true, + 'The result of (1n != 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n != -1n, + true, + 'The result of (0x10000000000000000n != -1n) is true' +); + +assert.sameValue( + -1n != 0x10000000000000000n, + true, + 'The result of (-1n != 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n != 0n, + true, + 'The result of (0x10000000000000001n != 0n) is true' +); + +assert.sameValue( + 0n != 0x10000000000000001n, + true, + 'The result of (0n != 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n != 0n, + true, + 'The result of (-0x10000000000000000n != 0n) is true' +); + +assert.sameValue( + 0n != -0x10000000000000000n, + true, + 'The result of (0n != -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n != 1n, + true, + 'The result of (-0x10000000000000000n != 1n) is true' +); + +assert.sameValue( + 1n != -0x10000000000000000n, + true, + 'The result of (1n != -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n != -1n, + true, + 'The result of (-0x10000000000000000n != -1n) is true' +); + +assert.sameValue( + -1n != -0x10000000000000000n, + true, + 'The result of (-1n != -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n != 0n, + true, + 'The result of (-0x10000000000000001n != 0n) is true' +); + +assert.sameValue( + 0n != -0x10000000000000001n, + true, + 'The result of (0n != -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n != 0x100000000n, + true, + 'The result of (0x10000000000000000n != 0x100000000n) is true' +); + +assert.sameValue( + 0x100000000n != 0x10000000000000000n, + true, + 'The result of (0x100000000n != 0x10000000000000000n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-boolean.js new file mode 100644 index 0000000000..56074998a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-boolean.js @@ -0,0 +1,33 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and Boolean values +esid: sec-abstract-equality-comparison +info: | + 8. If Type(x) is Boolean, return the result of the comparison ToNumber(x) == y. + 9. If Type(y) is Boolean, return the result of the comparison x == ToNumber(y). + ... + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + ... + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false. + +features: [BigInt] +---*/ +assert.sameValue(-1n != false, true, 'The result of (-1n != false) is true'); +assert.sameValue(false != -1n, true, 'The result of (false != -1n) is true'); +assert.sameValue(-1n != true, true, 'The result of (-1n != true) is true'); +assert.sameValue(true != -1n, true, 'The result of (true != -1n) is true'); +assert.sameValue(0n != false, false, 'The result of (0n != false) is false'); +assert.sameValue(false != 0n, false, 'The result of (false != 0n) is false'); +assert.sameValue(0n != true, true, 'The result of (0n != true) is true'); +assert.sameValue(true != 0n, true, 'The result of (true != 0n) is true'); +assert.sameValue(1n != false, true, 'The result of (1n != false) is true'); +assert.sameValue(false != 1n, true, 'The result of (false != 1n) is true'); +assert.sameValue(1n != true, false, 'The result of (1n != true) is false'); +assert.sameValue(true != 1n, false, 'The result of (true != 1n) is false'); +assert.sameValue(2n != false, true, 'The result of (2n != false) is true'); +assert.sameValue(false != 2n, true, 'The result of (false != 2n) is true'); +assert.sameValue(2n != true, true, 'The result of (2n != true) is true'); +assert.sameValue(true != 2n, true, 'The result of (true != 2n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js new file mode 100644 index 0000000000..d042ba53f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-incomparable-primitive.js @@ -0,0 +1,27 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and miscellaneous primitive values +esid: sec-equality-operators-runtime-semantics-evaluation +info: | + EqualityExpression : EqualityExpression != RelationalExpression + ... + 5. Return the result of performing Abstract Equality Comparison rval == lval. + 6. If r is true, return false. Otherwise, return true. + +features: [BigInt, Symbol] +---*/ +assert.sameValue(0n != undefined, true, 'The result of (0n != undefined) is true'); +assert.sameValue(undefined != 0n, true, 'The result of (undefined != 0n) is true'); +assert.sameValue(1n != undefined, true, 'The result of (1n != undefined) is true'); +assert.sameValue(undefined != 1n, true, 'The result of (undefined != 1n) is true'); +assert.sameValue(0n != null, true, 'The result of (0n != null) is true'); +assert.sameValue(null != 0n, true, 'The result of (null != 0n) is true'); +assert.sameValue(1n != null, true, 'The result of (1n != null) is true'); +assert.sameValue(null != 1n, true, 'The result of (null != 1n) is true'); +assert.sameValue(0n != Symbol('1'), true, 'The result of (0n != Symbol("1")) is true'); +assert.sameValue(Symbol('1') != 0n, true, 'The result of (Symbol("1") != 0n) is true'); +assert.sameValue(1n != Symbol('1'), true, 'The result of (1n != Symbol("1")) is true'); +assert.sameValue(Symbol('1') != 1n, true, 'The result of (Symbol("1") != 1n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-non-finite.js new file mode 100644 index 0000000000..fece08b149 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and non-finite Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + a. If x or y are any of NaN, +∞, or -∞, return false. + +features: [BigInt] +---*/ +assert.sameValue(0n != Infinity, true, 'The result of (0n != Infinity) is true'); +assert.sameValue(Infinity != 0n, true, 'The result of (Infinity != 0n) is true'); +assert.sameValue(1n != Infinity, true, 'The result of (1n != Infinity) is true'); +assert.sameValue(Infinity != 1n, true, 'The result of (Infinity != 1n) is true'); +assert.sameValue(-1n != Infinity, true, 'The result of (-1n != Infinity) is true'); +assert.sameValue(Infinity != -1n, true, 'The result of (Infinity != -1n) is true'); +assert.sameValue(0n != -Infinity, true, 'The result of (0n != -Infinity) is true'); +assert.sameValue(-Infinity != 0n, true, 'The result of (-Infinity != 0n) is true'); +assert.sameValue(1n != -Infinity, true, 'The result of (1n != -Infinity) is true'); +assert.sameValue(-Infinity != 1n, true, 'The result of (-Infinity != 1n) is true'); +assert.sameValue(-1n != -Infinity, true, 'The result of (-1n != -Infinity) is true'); +assert.sameValue(-Infinity != -1n, true, 'The result of (-Infinity != -1n) is true'); +assert.sameValue(0n != NaN, true, 'The result of (0n != NaN) is true'); +assert.sameValue(NaN != 0n, true, 'The result of (NaN != 0n) is true'); +assert.sameValue(1n != NaN, true, 'The result of (1n != NaN) is true'); +assert.sameValue(NaN != 1n, true, 'The result of (NaN != 1n) is true'); +assert.sameValue(-1n != NaN, true, 'The result of (-1n != NaN) is true'); +assert.sameValue(NaN != -1n, true, 'The result of (NaN != -1n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number-extremes.js new file mode 100644 index 0000000000..471b66fb69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number-extremes.js @@ -0,0 +1,53 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and large Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false. + +features: [BigInt] +---*/ +assert.sameValue(1n != Number.MAX_VALUE, true, 'The result of (1n != Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE != 1n, true, 'The result of (Number.MAX_VALUE != 1n) is true'); +assert.sameValue(1n != -Number.MAX_VALUE, true, 'The result of (1n != -Number.MAX_VALUE) is true'); +assert.sameValue(-Number.MAX_VALUE != 1n, true, 'The result of (-Number.MAX_VALUE != 1n) is true'); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn != Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn != Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE != 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + true, + 'The result of (Number.MAX_VALUE != 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n != Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + false, + 'The result of (Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is false' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n != Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n != Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + true, + 'The result of (Number.MAX_VALUE != 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number.js new file mode 100644 index 0000000000..5c6a12bf8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-number.js @@ -0,0 +1,43 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false. + +features: [BigInt] +---*/ +assert.sameValue(0n != 0, false, 'The result of (0n != 0) is false'); +assert.sameValue(0 != 0n, false, 'The result of (0 != 0n) is false'); +assert.sameValue(0n != -0, false, 'The result of (0n != -0) is false'); +assert.sameValue(-0 != 0n, false, 'The result of (-0 != 0n) is false'); +assert.sameValue(0n != 0.000000000001, true, 'The result of (0n != 0.000000000001) is true'); +assert.sameValue(0.000000000001 != 0n, true, 'The result of (0.000000000001 != 0n) is true'); +assert.sameValue(0n != 1, true, 'The result of (0n != 1) is true'); +assert.sameValue(1 != 0n, true, 'The result of (1 != 0n) is true'); +assert.sameValue(1n != 0, true, 'The result of (1n != 0) is true'); +assert.sameValue(0 != 1n, true, 'The result of (0 != 1n) is true'); +assert.sameValue(1n != 0.999999999999, true, 'The result of (1n != 0.999999999999) is true'); +assert.sameValue(0.999999999999 != 1n, true, 'The result of (0.999999999999 != 1n) is true'); +assert.sameValue(1n != 1, false, 'The result of (1n != 1) is false'); +assert.sameValue(1 != 1n, false, 'The result of (1 != 1n) is false'); +assert.sameValue(0n != Number.MIN_VALUE, true, 'The result of (0n != Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE != 0n, true, 'The result of (Number.MIN_VALUE != 0n) is true'); +assert.sameValue(0n != -Number.MIN_VALUE, true, 'The result of (0n != -Number.MIN_VALUE) is true'); +assert.sameValue(-Number.MIN_VALUE != 0n, true, 'The result of (-Number.MIN_VALUE != 0n) is true'); + +assert.sameValue( + -10n != Number.MIN_VALUE, + true, + 'The result of (-10n != Number.MIN_VALUE) is true' +); + +assert.sameValue( + Number.MIN_VALUE != -10n, + true, + 'The result of (Number.MIN_VALUE != -10n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-object.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-object.js new file mode 100644 index 0000000000..8f75671b76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-object.js @@ -0,0 +1,136 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt values and non-primitive objects +esid: sec-abstract-equality-comparison +info: | + 10. If Type(x) is either String, Number, BigInt, or Symbol and Type(y) is Object, return the result of the comparison x == ? ToPrimitive(y). + 11. If Type(x) is Object and Type(y) is either String, Number, BigInt, or Symbol, return the result of the comparison ? ToPrimitive(x) == y. + + then after the recursion: + + 1. If Type(x) is the same as Type(y), then + a. Return the result of performing Strict Equality Comparison x === y. + ... + 6. If Type(x) is BigInt and Type(y) is String, + a. Let n be StringToBigInt(y). + b. If n is NaN, return false. + c. Return the result of x == n. + 7. If Type(x) is String and Type(y) is BigInt, return the result of y == x. + +features: [BigInt] +---*/ +assert.sameValue(0n != Object(0n), false, 'The result of (0n != Object(0n)) is false'); +assert.sameValue(Object(0n) != 0n, false, 'The result of (Object(0n) != 0n) is false'); +assert.sameValue(0n != Object(1n), true, 'The result of (0n != Object(1n)) is true'); +assert.sameValue(Object(1n) != 0n, true, 'The result of (Object(1n) != 0n) is true'); +assert.sameValue(1n != Object(0n), true, 'The result of (1n != Object(0n)) is true'); +assert.sameValue(Object(0n) != 1n, true, 'The result of (Object(0n) != 1n) is true'); +assert.sameValue(1n != Object(1n), false, 'The result of (1n != Object(1n)) is false'); +assert.sameValue(Object(1n) != 1n, false, 'The result of (Object(1n) != 1n) is false'); +assert.sameValue(2n != Object(0n), true, 'The result of (2n != Object(0n)) is true'); +assert.sameValue(Object(0n) != 2n, true, 'The result of (Object(0n) != 2n) is true'); +assert.sameValue(2n != Object(1n), true, 'The result of (2n != Object(1n)) is true'); +assert.sameValue(Object(1n) != 2n, true, 'The result of (Object(1n) != 2n) is true'); +assert.sameValue(2n != Object(2n), false, 'The result of (2n != Object(2n)) is false'); +assert.sameValue(Object(2n) != 2n, false, 'The result of (Object(2n) != 2n) is false'); +assert.sameValue(0n != {}, true, 'The result of (0n != {}) is true'); +assert.sameValue({} != 0n, true, 'The result of (({}) != 0n) is true'); + +assert.sameValue(0n != { + valueOf: function() { + return 0n; + } +}, false, 'The result of (0n != {valueOf: function() {return 0n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} != 0n, false, 'The result of (({valueOf: function() {return 0n;}}) != 0n) is false'); + +assert.sameValue(0n != { + valueOf: function() { + return 1n; + } +}, true, 'The result of (0n != {valueOf: function() {return 1n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} != 0n, true, 'The result of (({valueOf: function() {return 1n;}}) != 0n) is true'); + +assert.sameValue(0n != { + toString: function() { + return '0'; + } +}, false, 'The result of (0n != {toString: function() {return "0";}}) is false'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} != 0n, false, 'The result of (({toString: function() {return "0";}}) != 0n) is false'); + +assert.sameValue(0n != { + toString: function() { + return '1'; + } +}, true, 'The result of (0n != {toString: function() {return "1";}}) is true'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} != 0n, true, 'The result of (({toString: function() {return "1";}}) != 0n) is true'); + +assert.sameValue(900719925474099101n != { + valueOf: function() { + return 900719925474099101n; + } +}, false, 'The result of (900719925474099101n != {valueOf: function() {return 900719925474099101n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} != 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099101n;}}) != 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n != { + valueOf: function() { + return 900719925474099102n; + } +}, true, 'The result of (900719925474099101n != {valueOf: function() {return 900719925474099102n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} != 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099102n;}}) != 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n != { + toString: function() { + return '900719925474099101'; + } +}, false, 'The result of (900719925474099101n != {toString: function() {return "900719925474099101";}}) is false'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} != 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099101";}}) != 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n != { + toString: function() { + return '900719925474099102'; + } +}, true, 'The result of (900719925474099101n != {toString: function() {return "900719925474099102";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} != 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099102";}}) != 900719925474099101n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-string.js b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-string.js new file mode 100644 index 0000000000..a16d382ae7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/does-not-equals/bigint-and-string.js @@ -0,0 +1,68 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict inequality comparison of BigInt and String values +esid: sec-abstract-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n != '', false, 'The result of (0n != "") is false'); +assert.sameValue('' != 0n, false, 'The result of ("" != 0n) is false'); +assert.sameValue(0n != '-0', false, 'The result of (0n != "-0") is false'); +assert.sameValue('-0' != 0n, false, 'The result of ("-0" != 0n) is false'); +assert.sameValue(0n != '0', false, 'The result of (0n != "0") is false'); +assert.sameValue('0' != 0n, false, 'The result of ("0" != 0n) is false'); +assert.sameValue(0n != '-1', true, 'The result of (0n != "-1") is true'); +assert.sameValue('-1' != 0n, true, 'The result of ("-1" != 0n) is true'); +assert.sameValue(0n != '1', true, 'The result of (0n != "1") is true'); +assert.sameValue('1' != 0n, true, 'The result of ("1" != 0n) is true'); +assert.sameValue(0n != 'foo', true, 'The result of (0n != "foo") is true'); +assert.sameValue('foo' != 0n, true, 'The result of ("foo" != 0n) is true'); +assert.sameValue(1n != '', true, 'The result of (1n != "") is true'); +assert.sameValue('' != 1n, true, 'The result of ("" != 1n) is true'); +assert.sameValue(1n != '-0', true, 'The result of (1n != "-0") is true'); +assert.sameValue('-0' != 1n, true, 'The result of ("-0" != 1n) is true'); +assert.sameValue(1n != '0', true, 'The result of (1n != "0") is true'); +assert.sameValue('0' != 1n, true, 'The result of ("0" != 1n) is true'); +assert.sameValue(1n != '-1', true, 'The result of (1n != "-1") is true'); +assert.sameValue('-1' != 1n, true, 'The result of ("-1" != 1n) is true'); +assert.sameValue(1n != '1', false, 'The result of (1n != "1") is false'); +assert.sameValue('1' != 1n, false, 'The result of ("1" != 1n) is false'); +assert.sameValue(1n != 'foo', true, 'The result of (1n != "foo") is true'); +assert.sameValue('foo' != 1n, true, 'The result of ("foo" != 1n) is true'); +assert.sameValue(-1n != '-', true, 'The result of (-1n != "-") is true'); +assert.sameValue('-' != -1n, true, 'The result of ("-" != -1n) is true'); +assert.sameValue(-1n != '-0', true, 'The result of (-1n != "-0") is true'); +assert.sameValue('-0' != -1n, true, 'The result of ("-0" != -1n) is true'); +assert.sameValue(-1n != '-1', false, 'The result of (-1n != "-1") is false'); +assert.sameValue('-1' != -1n, false, 'The result of ("-1" != -1n) is false'); +assert.sameValue(-1n != '-foo', true, 'The result of (-1n != "-foo") is true'); +assert.sameValue('-foo' != -1n, true, 'The result of ("-foo" != -1n) is true'); + +assert.sameValue( + 900719925474099101n != '900719925474099101', + false, + 'The result of (900719925474099101n != "900719925474099101") is false' +); + +assert.sameValue( + '900719925474099101' != 900719925474099101n, + false, + 'The result of ("900719925474099101" != 900719925474099101n) is false' +); + +assert.sameValue( + 900719925474099102n != '900719925474099101', + true, + 'The result of (900719925474099102n != "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' != 900719925474099102n, + true, + 'The result of ("900719925474099101" != 900719925474099102n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/does-not-equals/browser.js b/js/src/tests/test262/language/expressions/does-not-equals/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/does-not-equals/shell.js b/js/src/tests/test262/language/expressions/does-not-equals/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/always-create-new-promise.js b/js/src/tests/test262/language/expressions/dynamic-import/always-create-new-promise.js new file mode 100644 index 0000000000..cb21cda819 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/always-create-new-promise.js @@ -0,0 +1,36 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall returns a new instance of Promise +esid: sec-import-call-runtime-semantics-evaluation +info: | + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. +features: [dynamic-import] +---*/ + +const p1 = import('./dynamic-import-module_FIXTURE.js'); +const p2 = import('./dynamic-import-module_FIXTURE.js'); + +assert.notSameValue(p1, p2, 'the returned promises are not the same, regardless the reference and specifier pair'); + +assert.sameValue(p1.constructor, Promise, 'p1 constructor is %Promise%'); +assert.sameValue(Object.getPrototypeOf(p1), Promise.prototype, 'p1 prototype is %PromisePrototype%'); + +assert.sameValue(p2.constructor, Promise, 'p2 constructor is %Promise%'); +assert.sameValue(Object.getPrototypeOf(p2), Promise.prototype, 'p2 prototype is %PromisePrototype%'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assign-expr-get-value-abrupt-throws.js b/js/src/tests/test262/language/expressions/dynamic-import/assign-expr-get-value-abrupt-throws.js new file mode 100644 index 0000000000..905ae09099 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assign-expr-get-value-abrupt-throws.js @@ -0,0 +1,39 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Return Abrupt from the GetValue evaluation on the given AssignmentExpression +esid: sec-import-call-runtime-semantics-evaluation +info: | + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. +features: [dynamic-import] +---*/ + +const obj = { + get err() { + throw new Test262Error('catpure this on evaluation') + } +} + +assert.throws(Test262Error, function() { + import(obj.err); +}, 'Custom Error getting property value'); + +assert.throws(ReferenceError, function() { + import(refErr); +}, 'bad reference'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/additive-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/additive-expr.js new file mode 100644 index 0000000000..ecc3941d33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/additive-expr.js @@ -0,0 +1,42 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (Additive Expression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +let x = './module-code'; +let y = './module-code'; + +const a = '_FIXTURE.js'; +const b = '-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(x + a); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(y + b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/array-literal.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/array-literal.js new file mode 100644 index 0000000000..27021f2c20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/array-literal.js @@ -0,0 +1,40 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (Array Literal) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import([a]); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + Array.prototype.toString = () => b; + const ns2 = await import([]); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/arrow-function.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/arrow-function.js new file mode 100644 index 0000000000..21257df6be --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/arrow-function.js @@ -0,0 +1,33 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (ArrowFunction) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +Function.prototype.toString = () => './module-code_FIXTURE.js'; + +async function fn() { + const ns = await import(() => {}); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns.local1, 'Test262'); + assert.sameValue(ns.default, 42); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-expr.js new file mode 100644 index 0000000000..8bb7275fc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-expr.js @@ -0,0 +1,39 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (AwaitExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(await a); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(await b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-identifier.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-identifier.js new file mode 100644 index 0000000000..48217172a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/await-identifier.js @@ -0,0 +1,35 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (IdentifierReference: await) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const await = './module-code_FIXTURE.js'; + +const getpromise = () => import(await); // import('./module-code_FIXTURE.js') + +async function fn() { + const ns1 = await getpromise(); + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js new file mode 100644 index 0000000000..480f06a4ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-arguments.js @@ -0,0 +1,47 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (CallExpression Arguments) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] + + 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, +Tagged] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = () => () => './module-code_FIXTURE.js'; +const b = () => () => './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(a()()); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(b()()); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js new file mode 100644 index 0000000000..95f78fa1bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-expr.js @@ -0,0 +1,46 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (CallExpression [ Expression ]) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] + + 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, +Tagged] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = () => ['./module-code_FIXTURE.js', './module-code-other_FIXTURE.js']; + +async function fn() { + const ns1 = await import(a()[0]); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(a()[0, 1]); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js new file mode 100644 index 0000000000..f099a06f36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/call-expr-identifier.js @@ -0,0 +1,49 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (CallExpression . IdentifierName) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] + + 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, +Tagged] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = () => ({ + x: './module-code_FIXTURE.js', + y: './module-code-other_FIXTURE.js' +}); + +async function fn() { + const ns1 = await import(a().x); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(a().y); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js new file mode 100644 index 0000000000..9b38fb1fe2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-call-expr.js @@ -0,0 +1,47 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (CoverCallExpressionAndAsyncArrowHeadn) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] + + 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, +Tagged] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = () => './module-code_FIXTURE.js'; +const b = () => './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(a()); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(b()); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js new file mode 100644 index 0000000000..d2c07d2173 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/cover-parenthesized-expr.js @@ -0,0 +1,39 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] + + CoverParenthesizedExpressionAndArrowParameterList[Yield, Await]: + (Expression[+In, ?Yield, ?Await]) +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +async function fn() { + const ns1 = await import((((((('./module-code_FIXTURE.js'))))))); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import((1, 0, './module-code-other_FIXTURE.js')); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/identifier.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/identifier.js new file mode 100644 index 0000000000..18e738b197 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/identifier.js @@ -0,0 +1,39 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (Identifier) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(a); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/import-meta.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/import-meta.js new file mode 100644 index 0000000000..ab8463fc69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/import-meta.js @@ -0,0 +1,37 @@ +// |reftest| module async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (ImportMeta) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + Runtime Semantics: Evaluation + + ImportCall : import ( AssignmentExpression ) + + ... + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). +features: [dynamic-import, import.meta] +flags: [module, async] +---*/ + +const p = import(import.meta); + +// We can at least assert p is a promise. +assert.sameValue(Promise.resolve(p), p, 'Assert that p is a promise'); + +// The keys of import.meta are implementation defined, but we know its +// [[Prototype]] is null. In this case, import() should reject the +// promise it returns, unless a toPrimitive related method is set. +if (!Object.prototype.hasOwnProperty.call(import.meta, 'toString') && + !Object.prototype.hasOwnProperty.call(import.meta, 'valueOf') && + !Object.prototype.hasOwnProperty.call(import.meta, Symbol.toPrimitive)) { + p.catch(error => assert.sameValue(error.constructor, TypeError, 'import() cannot resolve import.meta')).then($DONE, $DONE); +} else { + $DONE(); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js new file mode 100644 index 0000000000..b6713b5da0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-assign-operator-assign-expr.js @@ -0,0 +1,42 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (LHS Expr AssignmentOperator AssignmentExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +let x = './module-code'; +let y = './module-code'; + +const a = '_FIXTURE.js'; +const b = '-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(x += a); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(y += b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js new file mode 100644 index 0000000000..66dd1e3061 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr-nostrict.js @@ -0,0 +1,38 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (LHS Expr = AssignmentExpression) + Using a frozen object property +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async, noStrict] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const y = { + z: 0 +}; +Object.freeze(y); +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns2 = await import(y.z = b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js new file mode 100644 index 0000000000..7a961379e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/lhs-eq-assign-expr.js @@ -0,0 +1,43 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (LHS Expr = AssignmentExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +let x = 'foo'; +const y = { + z: 0 +}; +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(x = a); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(y.z = b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js new file mode 100644 index 0000000000..30a3b3babc --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-and-expr.js @@ -0,0 +1,40 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (LogicalANDExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(b && a); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + // mix it in with Unary Expressions + const ns2 = await import(delete void typeof +-~! 0 && b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js new file mode 100644 index 0000000000..c31b41905d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/logical-or-expr.js @@ -0,0 +1,39 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (LogicalORExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(a || b); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(false || b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/member-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/member-expr.js new file mode 100644 index 0000000000..564c859f97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/member-expr.js @@ -0,0 +1,43 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (Object properties from MemberExpressions) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const obj = { + a: './module-code_FIXTURE.js', + b: './module-code-other_FIXTURE.js' +} + +async function fn() { + // MemberExpression [ Expression ] + const ns1 = await import(obj['a']); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + // MemberExpression . IdentifierName + const ns2 = await import(obj.b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code-other_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code-other_FIXTURE.js new file mode 100644 index 0000000000..81c39fd6e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code-other_FIXTURE.js @@ -0,0 +1,11 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +// exports: default === 1612, local1 === 'one six one two', renamed === 'star', indirect === 'one six one two' + +export var local1 = 'one six one two'; +var local2 = 'star'; +export { local2 as renamed }; +export { local1 as indirect } from './module-code-other_FIXTURE.js'; +export default 1612; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code_FIXTURE.js new file mode 100644 index 0000000000..bfe3fbce80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/module-code_FIXTURE.js @@ -0,0 +1,11 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +// exports: default === 42, local1 === 'Test262', renamed === 'TC39', indirect === 'Test262' + +export var local1 = 'Test262'; +var local2 = 'TC39'; +export { local2 as renamed }; +export { local1 as indirect } from './module-code_FIXTURE.js'; +export default 42; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/new-target.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/new-target.js new file mode 100644 index 0000000000..b8464ac074 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/new-target.js @@ -0,0 +1,37 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (NewTarget) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import, new.target] +includes: [asyncHelpers.js] +---*/ + +function ctor() { + return import(new.target); // import('./module-code_FIXTURE.js') +} + +ctor.toString = () => './module-code_FIXTURE.js'; + +async function fn() { + const ns = await new ctor(); + + assert.sameValue(ns.local1, 'Test262'); + assert.sameValue(ns.default, 42); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/object-literal.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/object-literal.js new file mode 100644 index 0000000000..a51850f9a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/object-literal.js @@ -0,0 +1,40 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (Object Literal) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import({ toString() { return a; } }); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + Object.prototype.toString = () => b; + const ns2 = await import({}); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js new file mode 100644 index 0000000000..f3692389f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/tagged-function-call.js @@ -0,0 +1,36 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (MemberExpression TemplateLiteral) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +function tag(arg) { + return arg[0]; +} + +async function fn() { + // MemberExpression TemplateLiteral + const ns = await import(tag`./module-code-other_FIXTURE.js`); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns.local1, 'one six one two'); + assert.sameValue(ns.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/ternary.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/ternary.js new file mode 100644 index 0000000000..e290379d5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/ternary.js @@ -0,0 +1,39 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (Ternary) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +async function fn() { + const ns1 = await import(true ? a : b); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + const ns2 = await import(false ? a : b); // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/this.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/this.js new file mode 100644 index 0000000000..2839a9858c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/this.js @@ -0,0 +1,33 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (this) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] + + PrimaryExpression[Yield, Await]: + this +flags: [async] +features: [dynamic-import] +---*/ + +async function fn() { + const ns1 = await import(this); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); +} + +fn.call('./module-code_FIXTURE.js').then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/unary-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/unary-expr.js new file mode 100644 index 0000000000..88aa3dbcb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/unary-expr.js @@ -0,0 +1,34 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (UnaryExpressions) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +features: [dynamic-import] +---*/ + +const obj = { + prop: 42 +}; + +import(delete obj.prop); +import(void 0); +import(typeof {}); +import(+void 0); +import(-void 0); +import(!void 0); +import(~void 0); +import(delete void typeof +-~! 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js new file mode 100644 index 0000000000..b691719701 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-assign-expr.js @@ -0,0 +1,49 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (yield [no LineTerminator here] AssignmentExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +function *g() { + return import(yield 42); +} + +async function fn() { + let iter = g(); + assert.sameValue(iter.next().value, 42); + + const ns1 = await iter.next(a).value; // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + iter = g(); + assert.sameValue(iter.next().value, 42); + + const ns2 = await iter.next(b).value; // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-expr.js new file mode 100644 index 0000000000..913ff22807 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-expr.js @@ -0,0 +1,49 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (YieldExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const a = './module-code_FIXTURE.js'; +const b = './module-code-other_FIXTURE.js'; + +function *g() { + return import(yield); +} + +async function fn() { + let iter = g(); + iter.next(); + + const ns1 = await iter.next(a).value; // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); + + iter = g(); + iter.next(); + + const ns2 = await iter.next(b).value; // import('./module-code-other_FIXTURE.js') + + assert.sameValue(ns2.local1, 'one six one two'); + assert.sameValue(ns2.default, 1612); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-identifier.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-identifier.js new file mode 100644 index 0000000000..e917bd1705 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-identifier.js @@ -0,0 +1,33 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (IdentifierReference: yield) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +flags: [async, noStrict] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +const yield = './module-code_FIXTURE.js'; + +async function fn() { + const ns1 = await import(yield); // import('./module-code_FIXTURE.js') + + assert.sameValue(ns1.local1, 'Test262'); + assert.sameValue(ns1.default, 42); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-star.js b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-star.js new file mode 100644 index 0000000000..8fba54b388 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/assignment-expression/yield-star.js @@ -0,0 +1,26 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import receives an AssignmentExpression (yield [no LineTerminator here] AssignmentExpression) +esid: prod-ImportCall +info: | + ImportCall [Yield]: + import ( AssignmentExpression[+In, ?Yield] ) + + AssignmentExpression[In, Yield, Await]: + ConditionalExpression[?In, ?Yield, ?Await] + [+Yield]YieldExpression[?In, ?Await] + ArrowFunction[?In, ?Yield, ?Await] + AsyncArrowFunction[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] + LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] +features: [dynamic-import] +---*/ + +// Asserts valid syntax, return is not asserted for the undefined value of yield * +function *g() { + import(yield * ['Roberta Flack', 'Donny Hathaway', 'Frank Sinatra']); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation.js b/js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation.js new file mode 100644 index 0000000000..9507b313e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation.js @@ -0,0 +1,25 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import should await for evaluation +esid: sec-finishdynamicimport +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 2. Otherwise, + a. Assert: completion is a normal completion and completion.[[Value]] is undefined. + b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). + c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. +flags: [async] +features: [dynamic-import] +---*/ + +var startTime = Date.now(); + +import('./await-import-evaluation_FIXTURE.js').then(imported => { + var endTime = Date.now() - startTime; + assert(imported.time > 100, `${String(imported.time)} > 100`); + assert(imported.time <= endTime, `${String(imported.time)} > ${String(endTime)}`); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation_FIXTURE.js new file mode 100644 index 0000000000..32c76261d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/await-import-evaluation_FIXTURE.js @@ -0,0 +1,15 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +var startTime = Date.now(); +var endTime; + +export { endTime as time } + +while (true) { + endTime = Date.now() - startTime; + if (endTime > 100) { + break; + } +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-type_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-type_FIXTURE.js new file mode 100644 index 0000000000..ed8e35d49b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-type_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +throw new TypeError(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-uri_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-uri_FIXTURE.js new file mode 100644 index 0000000000..56f5cc162b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/eval-rqstd-abrupt-err-uri_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +throw new URIError(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-1_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-1_FIXTURE.js new file mode 100644 index 0000000000..6a4a7279cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-1_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-2_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-2_FIXTURE.js new file mode 100644 index 0000000000..6a4a7279cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-2_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-export_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-export_FIXTURE.js new file mode 100644 index 0000000000..db2aa324e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous-export_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export { x } from './instn-iee-err-ambiguous_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous_FIXTURE.js new file mode 100644 index 0000000000..4b3b26c4af --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-ambiguous_FIXTURE.js @@ -0,0 +1,6 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export * from './instn-iee-err-ambiguous-1_FIXTURE.js'; +export * from './instn-iee-err-ambiguous-2_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-1_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-1_FIXTURE.js new file mode 100644 index 0000000000..a0c1522359 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-1_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export { x } from './instn-iee-err-circular-2_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-2_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-2_FIXTURE.js new file mode 100644 index 0000000000..984fd64bcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/instn-iee-err-circular-2_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export { x } from './instn-iee-err-circular-1_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..b0f6177951 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let f = () => { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..3234fceb45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let f = () => { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-script-code-target.js new file mode 100644 index 0000000000..0451ba56c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +let f = () => { + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..d4c322bf71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +let f = () => { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..4f579cbc9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +let f = () => { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..fe92fa68dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +let f = () => { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..a96320514f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-arrow-import-catch-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-arrow.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +let f = () => { + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +}; + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..0e848bb81d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-arrow-fn-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +const f = async () => { + await import('./eval-rqstd-abrupt-err-type_FIXTURE.js'); +} + +f().catch(error => { + + assert.sameValue(error.name, 'TypeError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..ed6a5e15e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-arrow-fn-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +const f = async () => { + await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js'); +} + +f().catch(error => { + + assert.sameValue(error.name, 'URIError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-script-code-target.js new file mode 100644 index 0000000000..82bc91c42b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-async-arrow-fn-await.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +const f = async () => { + await import('./script-code_FIXTURE.js'); +} + +f().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-file-does-not-exist.js new file mode 100644 index 0000000000..ce2ed961e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-arrow-fn-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +const f = async () => { + await import('./THIS_FILE_DOES_NOT_EXIST.js'); +} + +f().catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..07243b7223 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-arrow-fn-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +const f = async () => { + await import('./instn-iee-err-ambiguous-export_FIXTURE.js'); +} + +f().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-circular.js new file mode 100644 index 0000000000..3b9cc2e39d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-arrow-fn-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +const f = async () => { + await import('./instn-iee-err-circular-1_FIXTURE.js'); +} + +f().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..378de8edc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-await-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-async-arrow-fn-await.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +const f = async () => { + await import(obj); +} + +f().catch(error => { + + assert.sameValue(error, 'custom error'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..d0aafad8cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +const f = async () => await import('./eval-rqstd-abrupt-err-type_FIXTURE.js'); + +f().catch(error => { + + assert.sameValue(error.name, 'TypeError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..ad5ecfe175 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +const f = async () => await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js'); + +f().catch(error => { + + assert.sameValue(error.name, 'URIError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-script-code-target.js new file mode 100644 index 0000000000..8ad97b66a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-eval-script-code-target.js @@ -0,0 +1,41 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +const f = async () => await import('./script-code_FIXTURE.js'); + +f().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-file-does-not-exist.js new file mode 100644 index 0000000000..7219ab9846 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-file-does-not-exist.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +const f = async () => await import('./THIS_FILE_DOES_NOT_EXIST.js'); + +f().catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..249b4f22a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +const f = async () => await import('./instn-iee-err-ambiguous-export_FIXTURE.js'); + +f().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-circular.js new file mode 100644 index 0000000000..a4f2124c39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-instn-iee-err-circular.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +const f = async () => await import('./instn-iee-err-circular-1_FIXTURE.js'); + +f().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..1d197ee9ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-arrow-function-return-await-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-async-arrow-fn-return-await.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +const f = async () => await import(obj); + +f().catch(error => { + + assert.sameValue(error, 'custom error'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..e2d753e26f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + await import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..3c71efd02d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-script-code-target.js new file mode 100644 index 0000000000..52c8b083dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +async function f() { + await import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-file-does-not-exist.js new file mode 100644 index 0000000000..4dd1dfa128 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function f() { + await import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..34f41a7145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function f() { + await import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js new file mode 100644 index 0000000000..b052a1b151 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function f() { + await import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..25bee5f54d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-await-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-async-function-await.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +async function f() { + await import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..772ed642ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..a6fc8ba9c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-script-code-target.js new file mode 100644 index 0000000000..19108654b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-eval-script-code-target.js @@ -0,0 +1,44 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +async function f() { + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-file-does-not-exist.js new file mode 100644 index 0000000000..807fbb1bd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-file-does-not-exist.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function f() { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..1546e84bac --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-ambiguous-import.js @@ -0,0 +1,63 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function f() { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js new file mode 100644 index 0000000000..332d182703 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-instn-iee-err-circular.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function f() { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..0fc9a06e02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + return await import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..d06b257cec --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function f() { + return await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-script-code-target.js new file mode 100644 index 0000000000..b525c8f46f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +async function f() { + return await import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist.js new file mode 100644 index 0000000000..bbb84657a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function f() { + return await import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..c3dde0e636 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function f() { + return await import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js new file mode 100644 index 0000000000..78092b90ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function f() { + return await import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..d0d178de56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-return-await-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-async-function-return-await.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +async function f() { + return await import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..b483e9b870 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-function-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,57 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-async-function.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +async function f() { + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +} + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..6356057cbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-generator-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function * f() { + await import('./eval-rqstd-abrupt-err-type_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'TypeError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..6eb4f99317 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-generator-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function * f() { + await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'URIError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target.js new file mode 100644 index 0000000000..f915824639 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-async-generator-await.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +async function * f() { + await import('./script-code_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-file-does-not-exist.js new file mode 100644 index 0000000000..615b9c9dde --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-generator-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function * f() { + await import('./THIS_FILE_DOES_NOT_EXIST.js'); +} + +f().next().catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..40ef9d67b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-generator-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function * f() { + await import('./instn-iee-err-ambiguous-export_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular.js new file mode 100644 index 0000000000..6ef0121e9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-generator-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function * f() { + await import('./instn-iee-err-circular-1_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..e375828ab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-await-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-async-generator-await.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +async function * f() { + await import(obj); +} + +f().next().catch(error => { + + assert.sameValue(error, 'custom error'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..cb69156522 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-async-generator-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function * f() { + return await import('./eval-rqstd-abrupt-err-type_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'TypeError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..c0357f7fd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-async-generator-return-await.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +async function * f() { + return await import('./eval-rqstd-abrupt-err-uri_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'URIError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target.js new file mode 100644 index 0000000000..e06101ffc1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-async-generator-return-await.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +async function * f() { + return await import('./script-code_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-file-does-not-exist.js new file mode 100644 index 0000000000..a94d18c02d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-async-generator-return-await.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +async function * f() { + return await import('./THIS_FILE_DOES_NOT_EXIST.js'); +} + +f().next().catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..3e28f5556a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-async-generator-return-await.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +async function * f() { + return await import('./instn-iee-err-ambiguous-export_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular.js new file mode 100644 index 0000000000..2aac8ada71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-async-generator-return-await.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +async function * f() { + return await import('./instn-iee-err-circular-1_FIXTURE.js'); +} + +f().next().catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..0a4160e729 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-async-gen-return-await-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-async-generator-return-await.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +async function * f() { + return await import(obj); +} + +f().next().catch(error => { + + assert.sameValue(error, 'custom error'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..ebed848018 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +{ + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..1e60bdc385 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +{ + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-script-code-target.js new file mode 100644 index 0000000000..c97ad71414 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-eval-script-code-target.js @@ -0,0 +1,41 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +{ + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..ce3bb80386 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-file-does-not-exist.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +{ + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..dafbbf979e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +{ + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..4c73ba1327 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-instn-iee-err-circular.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +{ + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..4932a6e510 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-import-catch-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-block.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +{ + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..62070c7c50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +label: { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..d99ea40d60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +label: { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-script-code-target.js new file mode 100644 index 0000000000..666ad40630 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-eval-script-code-target.js @@ -0,0 +1,41 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +label: { + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-file-does-not-exist.js new file mode 100644 index 0000000000..e870fd8641 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-file-does-not-exist.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +label: { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..5de4d7527f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-ambiguous-import.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +label: { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js new file mode 100644 index 0000000000..a76501b2ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-instn-iee-err-circular.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +label: { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..ad5f8ef163 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-block-labeled-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-block-labeled.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +label: { + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..5edafcabf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +do { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..e6f597abfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +do { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-script-code-target.js new file mode 100644 index 0000000000..f57015fa52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-eval-script-code-target.js @@ -0,0 +1,41 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +do { + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-file-does-not-exist.js new file mode 100644 index 0000000000..296dd49280 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-file-does-not-exist.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +do { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..8f3ba9df14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-ambiguous-import.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +do { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js new file mode 100644 index 0000000000..cc7e7c0f03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-instn-iee-err-circular.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +do { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..7313d3e107 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-do-while-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-do-while.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +do { + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..e38c896c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (false) { + +} else { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..d38be82e7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (false) { + +} else { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-script-code-target.js new file mode 100644 index 0000000000..05788278f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +if (false) { + +} else { + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..99f4582851 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +if (false) { + +} else { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..45b867507e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +if (false) { + +} else { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..64340639f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +if (false) { + +} else { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..406fb4d763 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-else-import-catch-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-else.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +if (false) { + +} else { + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..6587cf5b0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +function f() { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..58e75bdbe4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +function f() { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-script-code-target.js new file mode 100644 index 0000000000..f9e58e6991 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-eval-script-code-target.js @@ -0,0 +1,42 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +function f() { + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..c04bd34a90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-file-does-not-exist.js @@ -0,0 +1,37 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +function f() { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..8adaac6bea --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +function f() { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..f91d576cbf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-instn-iee-err-circular.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +function f() { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..2ce2fe3e9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-function-import-catch-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-function.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +function f() { + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..70d5a15208 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (true) { + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..27a1d8571a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +if (true) { + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-script-code-target.js new file mode 100644 index 0000000000..fdd51266f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-eval-script-code-target.js @@ -0,0 +1,41 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +if (true) { + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..a1e79038a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-file-does-not-exist.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +if (true) { + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..56eb24bd8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +if (true) { + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..ae24b1cd67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-instn-iee-err-circular.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +if (true) { + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..15218afc1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-if-import-catch-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-if.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +if (true) { + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..d46eca3903 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..455b8cfafd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-script-code-target.js new file mode 100644 index 0000000000..3c116c4202 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-eval-script-code-target.js @@ -0,0 +1,43 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..d5ec851522 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-file-does-not-exist.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..bf64ab4f8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,62 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +let x = 0; +while (!x) { + x++; + import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..83dc5da77a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-instn-iee-err-circular.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..e0355edb92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/nested-while-import-catch-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/nested-while.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +let x = 0; +while (!x) { + x++; + import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + + }).then($DONE, $DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/script-code_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/script-code_FIXTURE.js new file mode 100644 index 0000000000..bc7ce2680e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/script-code_FIXTURE.js @@ -0,0 +1,8 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +// This is still valid in script code and strict and non strict modes +// This is invalid as module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js new file mode 100644 index 0000000000..3686644674 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-typeerror.js @@ -0,0 +1,37 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-typeerror.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +import('./eval-rqstd-abrupt-err-type_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'TypeError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js new file mode 100644 index 0000000000..e755d45539 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-rqstd-abrupt-urierror.js @@ -0,0 +1,37 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-rqstd-abrupt-urierror.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: Abrupt completion during module evaluation precludes further evaluation (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 6. For each String required that is an element of + module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + +---*/ + +import('./eval-rqstd-abrupt-err-uri_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'URIError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-script-code-target.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-script-code-target.js new file mode 100644 index 0000000000..20ecc5b859 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-eval-script-code-target.js @@ -0,0 +1,39 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-target.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: import() from a module code can load a file with script code, but the target is resolved into a Module Record (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, module, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Modules + + Static Semantics: Early Errors + + ModuleBody : ModuleItemList + - It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList containsany duplicate entries. + - It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList. + +---*/ + +import('./script-code_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-file-does-not-exist.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-file-does-not-exist.js new file mode 100644 index 0000000000..d0f89294d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-file-does-not-exist.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/file-does-not-exist.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: Non existent file can't resolve to a Script or Module Record (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + If a Module Record corresponding to the pair referencingModulereferencingScriptOrModule, + specifier does not exist or cannot be created, an exception must be thrown. + +---*/ + +import('./THIS_FILE_DOES_NOT_EXIST.js').catch(error => { + + assert.notSameValue(typeof error, 'undefined'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js new file mode 100644 index 0000000000..ae26f2534e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-ambiguous-import.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-ambiguous-import.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: IndirectExportEntries validation - ambiguous imported bindings (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 9. Let starResolution be null. + 10. For each ExportEntry Record e in module.[[StarExportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + e.[[ModuleRequest]]). + b. Let resolution be ? importedModule.ResolveExport(exportName, + resolveSet, exportStarSet). + c. If resolution is "ambiguous", return "ambiguous". + d. If resolution is not null, then + i. If starResolution is null, let starResolution be resolution. + ii. Else, + 1. Assert: there is more than one * import that includes the + requested name. + 2. If resolution.[[Module]] and starResolution.[[Module]] are + not the same Module Record or + SameValue(resolution.[[BindingName]], + starResolution.[[BindingName]]) is false, return "ambiguous". + +---*/ + +import('./instn-iee-err-ambiguous-export_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js new file mode 100644 index 0000000000..9e57a9a87e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-instn-iee-err-circular.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/instn-iee-err-circular.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: IndirectExportEntries validation - circular imported bindings (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + [...] + 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do + a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »). + b. If resolution is null or resolution is "ambiguous", throw a + SyntaxError exception. + [...] + + 15.2.1.16.3 ResolveExport + + [...] + 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do: + a. If module and r.[[Module]] are the same Module Record and + SameValue(exportName, r.[[ExportName]]) is true, then + i. Assert: this is a circular import request. + ii. Return null. + +---*/ + +import('./instn-iee-err-circular-1_FIXTURE.js').catch(error => { + + assert.sameValue(error.name, 'SyntaxError'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-specifier-tostring-abrupt-rejects.js b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-specifier-tostring-abrupt-rejects.js new file mode 100644 index 0000000000..2d32b6fa09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/catch/top-level-import-catch-specifier-tostring-abrupt-rejects.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring-abrupt-rejects.case +// - src/dynamic-import/catch/top-level.template +/*--- +description: Abrupt from ToString(specifier) rejects the promise (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +const obj = { + toString() { + throw 'custom error'; + } +}; + + +import(obj).catch(error => { + + assert.sameValue(error, 'custom error'); + +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/custom-primitive.js b/js/src/tests/test262/language/expressions/dynamic-import/custom-primitive.js new file mode 100644 index 0000000000..50a2f6adf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/custom-primitive.js @@ -0,0 +1,34 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Import a custom toString and valueOf bindings +esid: sec-finishdynamicimport +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 2. Otherwise, + a. Assert: completion is a normal completion and completion.[[Value]] is undefined. + b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). + c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. + d. Let namespace be GetModuleNamespace(moduleRecord). + ... + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +async function fn() { + const str = await import('./custom-tostring_FIXTURE.js'); + const value = await import('./custom-valueof_FIXTURE.js'); + + assert.sameValue(String(str), '1612', 'namespace uses the imported toString'); + assert.sameValue(Number(str), 1612, 'namespace fallsback to toString as its prototype is null'); + + assert.sameValue(Number(value), 42, 'namespace uses the imported valueOf'); + assert.sameValue(String(value), '42', 'namespace fallsback to valueOf as its prototype is null'); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/custom-tostring_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/custom-tostring_FIXTURE.js new file mode 100644 index 0000000000..52b880b6d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/custom-tostring_FIXTURE.js @@ -0,0 +1,7 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export function toString() { + return '1612'; +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/custom-valueof_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/custom-valueof_FIXTURE.js new file mode 100644 index 0000000000..cb4b8689a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/custom-valueof_FIXTURE.js @@ -0,0 +1,7 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export function valueOf() { + return 42; +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/dynamic-import-module_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/dynamic-import-module_FIXTURE.js new file mode 100644 index 0000000000..fe34b3bfee --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/dynamic-import-module_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x = 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/empty_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/empty_FIXTURE.js new file mode 100644 index 0000000000..9200e13455 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/empty_FIXTURE.js @@ -0,0 +1,3 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. diff --git a/js/src/tests/test262/language/expressions/dynamic-import/escape-sequence-import.js b/js/src/tests/test262/language/expressions/dynamic-import/escape-sequence-import.js new file mode 100644 index 0000000000..8ea95c112c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/escape-sequence-import.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions +description: > + "import" must not contain escape sequences. +info: | + 5.1.5 Grammar Notation + + Terminal symbols are shown in fixed width + font, both in the productions of the grammars and throughout this specification whenever the + text directly refers to such a terminal symbol. These are to appear in a script exactly as + written. All terminal symbol code points specified in this way are to be understood as the + appropriate Unicode code points from the Basic Latin range, as opposed to any similar-looking + code points from other Unicode ranges. + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + ImportCall : + import( AssignmentExpression ) +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +im\u0070ort('./empty_FIXTURE.js'); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js new file mode 100644 index 0000000000..13775daf88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-anon.js @@ -0,0 +1,37 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default "anonymous" class declaration is correctly initialized upon + evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default class { valueOf() { return 45; } } +import('./eval-export-dflt-cls-anon.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-name-meth.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-name-meth.js new file mode 100644 index 0000000000..00d19d983f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-name-meth.js @@ -0,0 +1,35 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default "anonymous" class declaration containing a static `name` method is + correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default class { static name() { return 'name method'; } } +import('./eval-export-dflt-cls-name-meth.js').then(imported => { + assert.sameValue(imported.default.name(), 'name method', '`name` property is not over-written'); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-named.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-named.js new file mode 100644 index 0000000000..28d4a15710 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-cls-named.js @@ -0,0 +1,37 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default "named" class declaration is correctly initialized upon + evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default class cName { valueOf() { return 45; } } +import('./eval-export-dflt-cls-named.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'cName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-anon.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-anon.js new file mode 100644 index 0000000000..708b9ebf8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-anon.js @@ -0,0 +1,35 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + class declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (class { valueOf() { return 45; } }); +import('./eval-export-dflt-expr-cls-anon.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth.js new file mode 100644 index 0000000000..9f767d1406 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-name-meth.js @@ -0,0 +1,36 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + class declaration with a static `name` method) is correctly initialized + upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default ClassDeclaration + + [...] + 3. Let className be the sole element of BoundNames of ClassDeclaration. + 4. If className is "*default*", then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + c. Let env be the running execution context's LexicalEnvironment. + d. Perform ? InitializeBoundName("*default*", value, env). + 5. Return NormalCompletion(empty). +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (class { static name() { return 'name method'; } }); +import('./eval-export-dflt-expr-cls-name-meth.js').then(imported => { + assert.sameValue(imported.default.name(), 'name method', '`name` property is not over-written'); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-named.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-named.js new file mode 100644 index 0000000000..c846aa18f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-cls-named.js @@ -0,0 +1,35 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as a "named" class + declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (class cName { valueOf() { return 45; } }); +import('./eval-export-dflt-expr-cls-named.js').then(imported => { + assert.sameValue(new imported.default().valueOf(), 45, 'binding initialized'); + assert.sameValue(imported.default.name, 'cName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-anon.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-anon.js new file mode 100644 index 0000000000..160b99365a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-anon.js @@ -0,0 +1,35 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + function declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (function() { return 99; }); +import('./eval-export-dflt-expr-fn-anon.js').then(imported => { + assert.sameValue(imported.default(), 99, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-named.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-named.js new file mode 100644 index 0000000000..e1849193e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-fn-named.js @@ -0,0 +1,35 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as a "named" function + declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import] +---*/ + +export default (function fName() { return 7; }); +import('./eval-export-dflt-expr-fn-named.js').then(imported => { + assert.sameValue(imported.default(), 7, 'binding initialized'); + assert.sameValue(imported.default.name, 'fName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-anon.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-anon.js new file mode 100644 index 0000000000..eb6fe1de61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-anon.js @@ -0,0 +1,36 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as an "anonymous" + generator function declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import, generators] +---*/ + +export default (function* () { return 24601; }); +import('./eval-export-dflt-expr-gen-anon.js').then(imported => { + assert.sameValue(imported.default().next().value, 24601, 'binding initialized'); + assert.sameValue(imported.default.name, 'default', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-named.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-named.js new file mode 100644 index 0000000000..52789a0e59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-gen-named.js @@ -0,0 +1,35 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Default AssignmentExpression (which can be recognized as a "named" + generator function declaration) is correctly initialized upon evaluation +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3.11 Runtime Semantics: Evaluation + + ExportDeclaration : export default AssignmentExpression; + + [...] + 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be ? HasOwnProperty(value, "name"). + b. If hasNameProperty is false, perform SetFunctionName(value, + "default"). + 4. Let env be the running execution context's LexicalEnvironment. + 5. Perform ? InitializeBoundName("*default*", value, env). + [...] +flags: [async, module] +features: [dynamic-import, generators] +---*/ + +export default (function* gName() { return 42; }); +import('./eval-export-dflt-expr-gen-named.js').then(imported => { + assert.sameValue(imported.default().next().value, 42, 'binding initialized'); + assert.sameValue(imported.default.name, 'gName', 'correct name is assigned'); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-in.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-in.js new file mode 100644 index 0000000000..27c559f0fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-export-dflt-expr-in.js @@ -0,0 +1,29 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + The `in` operator may occur within an exported AssignmentExpression +esid: sec-moduleevaluation +info: | + [...] + 16. Let result be the result of evaluating module.[[ECMAScriptCode]]. + [...] + + 15.2.3 Exports + + Syntax + + ExportDeclaration : + + export default [lookahead ∉ { function, class }] AssignmentExpression[In]; +flags: [async, module] +features: [dynamic-import] +---*/ +var x = { x: true }; + +export default 'x' in x; +import('./eval-export-dflt-expr-in.js').then(imported => { + assert.sameValue(imported.default, true); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once.js new file mode 100644 index 0000000000..a2893b1f11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once.js @@ -0,0 +1,32 @@ +// |reftest| async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Requested modules are evaluated exactly once +esid: sec-moduleevaluation +info: | + [...] + 4. If module.[[Evaluated]] is true, return undefined. + 5. Set module.[[Evaluated]] to true. + 6. For each String required that is an element of module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + [...] +includes: [fnGlobalObject.js] +flags: [async] +features: [dynamic-import] +---*/ + +var global = fnGlobalObject(); + +Promise.all([ + import('./eval-rqstd-once_FIXTURE.js'), + import('./eval-rqstd-once_FIXTURE.js'), +]).then(async () => { + // Use await to serialize imports + await import('./eval-rqstd-once_FIXTURE.js'); + await import('./eval-rqstd-once_FIXTURE.js'); + + assert.sameValue(global.test262, 262, 'global property was defined'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once_FIXTURE.js new file mode 100644 index 0000000000..7a26638e77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-rqstd-once_FIXTURE.js @@ -0,0 +1,16 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export default null; +var global = Function('return this;')(); + +if (global.test262) { + throw new Error('Module was evaluated more than once.'); +} + +global.test262 = 262; + +if (global.test262 !== 262) { + throw new Error('Module was unable to signal evaluation.'); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-module.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-module.js new file mode 100644 index 0000000000..b835d36cf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-module.js @@ -0,0 +1,40 @@ +// |reftest| module async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Module is evaluated exactly once +esid: sec-moduleevaluation +info: | + [...] + 4. If module.[[Evaluated]] is true, return undefined. + 5. Set module.[[Evaluated]] to true. + 6. For each String required that is an element of module.[[RequestedModules]] do, + a. Let requiredModule be ? HostResolveImportedModule(module, required). + b. Perform ? requiredModule.ModuleEvaluation(). + [...] + + This test is meant to be flagged as module code, it should not initially + run as script code or the result will not be the same. +includes: [fnGlobalObject.js] +flags: [async, module] +features: [dynamic-import] +---*/ + +var global = fnGlobalObject(); + +if (typeof global.evaluated === 'undefined') { + global.evaluated = 0; +} + +global.evaluated++; + +Promise.all([ + import('./eval-self-once-module.js'), + import('./eval-self-once-module.js'), +]).then(async () => { + // Use await to serialize imports + await import('./eval-self-once-module.js'); + await import('./eval-self-once-module.js'); + + assert.sameValue(global.evaluated, 1, 'global property was defined and incremented only once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-script.js b/js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-script.js new file mode 100644 index 0000000000..a95c6b6976 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/eval-self-once-script.js @@ -0,0 +1,44 @@ +// |reftest| async +// Copyright (C) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Script is evaluated exactly once after loaded by import +esid: sec-hostimportmoduledynamically +info: | + Success path + + The completion value of any subsequent call to HostResolveImportedModule after + FinishDynamicImport has completed, given the arguments referencingScriptOrModule + and specifier, must be a module which has already been evaluated, i.e. whose + Evaluate concrete method has already been called and returned a normal completion. + + This test is meant to __not__ be flagged as module code, it should not initially + run as module code or the result will not be the same. +includes: [fnGlobalObject.js] +flags: [async] +features: [dynamic-import] +---*/ + +var global = fnGlobalObject(); + +var isFirstScript = typeof global.evaluated === 'undefined'; +if (isFirstScript) { + global.evaluated = 0; +} + +global.evaluated++; + +var p = Promise.all([ + import('./eval-self-once-script.js'), + import('./eval-self-once-script.js'), +]).then(async () => { + // Use await to serialize imports + await import('./eval-self-once-script.js'); + await import('./eval-self-once-script.js'); + + assert.sameValue(global.evaluated, 2, 'global property was defined once and incremented twice'); +}); + +if (isFirstScript) { + p.then($DONE, $DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-a_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-a_FIXTURE.js new file mode 100644 index 0000000000..fd08cf9a4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-a_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x = 42; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js new file mode 100644 index 0000000000..edbb72e683 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen-yield.js @@ -0,0 +1,71 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Resolve multiple imports through a for await loop in an async generator yielding imports +esid: sec-finishdynamicimport +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 2. Otherwise, + a. Assert: completion is a normal completion and completion.[[Value]] is undefined. + b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). + c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. + d. Let namespace be GetModuleNamespace(moduleRecord). + ... + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). +flags: [async] +features: [dynamic-import, async-iteration] +includes: [asyncHelpers.js] +---*/ + +async function * agen1() { + yield import('./for-await-resolution-and-error-a_FIXTURE.js'); + yield import('./for-await-resolution-and-error-b_FIXTURE.js'); + yield import('./for-await-resolution-and-error-poisoned_FIXTURE.js'); +} + +async function * agen2() { + yield await import('./for-await-resolution-and-error-a_FIXTURE.js'); + yield await import('./for-await-resolution-and-error-b_FIXTURE.js'); + yield await import('./for-await-resolution-and-error-poisoned_FIXTURE.js'); +} + +var aiter1 = agen1(); +var aiter2 = agen2(); + +async function fn() { + var a = aiter1.next(); + var b = aiter1.next(); + var c = aiter1.next(); + var d = aiter2.next(); + var e = aiter2.next(); + var f = aiter2.next(); + + assert.sameValue((await a).value.x, 42, 'a'); + assert.sameValue((await b).value.x, 39, 'b'); + + var error; + try { + await c; + } catch (err) { + error = err; + } + + assert.sameValue(error, 'foo', 'c'); + + assert.sameValue((await d).value.x, 42, 'd'); + assert.sameValue((await e).value.x, 39, 'e'); + + error = null; + try { + await f; + } catch (err) { + error = err; + } + + assert.sameValue(error, 'foo', 'f'); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js new file mode 100644 index 0000000000..7b7c4062a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-agen.js @@ -0,0 +1,53 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Resolve multiple imports through a for await loop in an async generator +esid: sec-finishdynamicimport +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 2. Otherwise, + a. Assert: completion is a normal completion and completion.[[Value]] is undefined. + b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). + c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. + d. Let namespace be GetModuleNamespace(moduleRecord). + ... + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). +flags: [async] +features: [dynamic-import, async-iteration] +includes: [asyncHelpers.js] +---*/ + +async function * agen() { + for await (let imported of [ + import('./for-await-resolution-and-error-a_FIXTURE.js'), + import('./for-await-resolution-and-error-b_FIXTURE.js'), + import('./for-await-resolution-and-error-poisoned_FIXTURE.js'), + ]) { + yield imported.x; + } +} + +var aiter = agen(); + +async function fn() { + var a = aiter.next(); + var b = aiter.next(); + var c = aiter.next(); + + assert.sameValue((await a).value, 42); + assert.sameValue((await b).value, 39); + + var error; + try { + await c; + } catch (e) { + error = e; + } + + assert.sameValue(error, 'foo'); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-b_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-b_FIXTURE.js new file mode 100644 index 0000000000..82afd1390a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-b_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x = 39; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-poisoned_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-poisoned_FIXTURE.js new file mode 100644 index 0000000000..df8930c102 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error-poisoned_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +throw 'foo'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error.js b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error.js new file mode 100644 index 0000000000..b80bee8ceb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/for-await-resolution-and-error.js @@ -0,0 +1,38 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Resolve multiple imports through a for await loop +esid: sec-finishdynamicimport +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 2. Otherwise, + a. Assert: completion is a normal completion and completion.[[Value]] is undefined. + b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). + c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. + d. Let namespace be GetModuleNamespace(moduleRecord). + ... + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). +flags: [async] +features: [dynamic-import] +includes: [compareArray.js] +---*/ + +let r = []; +async function aiter() { + for await (let imported of [ + import('./for-await-resolution-and-error-a_FIXTURE.js'), + import('./for-await-resolution-and-error-b_FIXTURE.js'), + import('./for-await-resolution-and-error-poisoned_FIXTURE.js'), + import('./for-await-resolution-and-error-a_FIXTURE.js'), // this should be ignored + ]) { + r.push(imported.x); + } +} + +aiter().then(() => { throw 'The async function should not resolve' }, error => { + assert.compareArray(r, [42, 39]); + assert.sameValue(error, 'foo'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js new file mode 100644 index 0000000000..90d312a0b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-abrupt.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Reports abrupt completions produced by attributes enumeration +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + iii. IfAbruptRejectPromise(keys, promiseCapability). + [...] +features: [dynamic-import, import-assertions, Proxy] +flags: [async] +---*/ + +var thrown = new Test262Error(); +var options = { + assert: new Proxy({}, { + ownKeys: function() { + throw thrown; + }, + }) +}; + +import('./2nd-param_FIXTURE.js', options) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but promise was fulfilled.'); + }, function(error) { + assert.sameValue(error, thrown); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js new file mode 100644 index 0000000000..a4bc49e2de --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration-enumerable.js @@ -0,0 +1,61 @@ +// |reftest| skip async -- json-modules is not supported +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Follows the semantics of the EnumerableOwnPropertyNames abstract operation + during attributes enumeration +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + [...] +features: [dynamic-import, import-assertions, json-modules, Symbol, Proxy] +includes: [compareArray.js] +flags: [async] +---*/ + +var symbol = Symbol(''); +var target = { + type: "json" +}; +var descriptors = { + type: {configurable: true, enumerable: true} +}; +var log = []; + +var options = { + assert: new Proxy({}, { + ownKeys: function() { + return ["type"]; + }, + get(_, name) { + log.push(name); + return "json"; + }, + getOwnPropertyDescriptor(target, name) { + return {configurable: true, enumerable: true, value: "json"}; + }, + }) +}; + +import('./2nd-param_FIXTURE.json', options) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); + +assert.compareArray(log, ['type']); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js new file mode 100644 index 0000000000..047728d123 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-enumeration.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Follows the semantics of the EnumerableOwnPropertyNames abstract operation + during attributes enumeration +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + [...] +features: [dynamic-import, import-assertions, Symbol, Proxy] +flags: [async] +---*/ + +var symbol = Symbol(''); +var target = { + [symbol]: '', + unreported: '', + nonEnumerable: '' +}; +var descriptors = { + [symbol]: {configurable: true, enumerable: true}, + nonEnumerable: {configurable: true, enumerable: false} +}; + +var options = { + assert: new Proxy({}, { + ownKeys: function() { + return [symbol, 'nonEnumerable', 'absent']; + }, + get() { + throw new Error("Should not be called"); + }, + getOwnPropertyDescriptor(target, name) { + return descriptors[name]; + } + }) +}; + +import('./2nd-param_FIXTURE.js', options) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-non-object.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-non-object.js new file mode 100644 index 0000000000..da7235879e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-non-object.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when the `assert` property of the second argument is neither + undefined nor an object +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + 1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a + newly created TypeError object »). + 2. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-assertions, Symbol, BigInt] +flags: [async] +---*/ + +function test(promise, valueType) { + return promise.then(function() { + throw new Test262Error('Promise for ' + valueType + ' was not rejected.'); + }, function(error) { + assert.sameValue(error.constructor, TypeError, valueType); + }); +} + +Promise.all([ + test(import('./2nd-param_FIXTURE.js', {assert:null}), 'null'), + test(import('./2nd-param_FIXTURE.js', {assert:false}), 'boolean'), + test(import('./2nd-param_FIXTURE.js', {assert:23}), 'number'), + test(import('./2nd-param_FIXTURE.js', {assert:''}), 'string'), + test(import('./2nd-param_FIXTURE.js', {assert:Symbol('')}), 'symbol'), + test(import('./2nd-param_FIXTURE.js', {assert:23n}), 'bigint') + ]) + .then(function() {}) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-undefined.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-undefined.js new file mode 100644 index 0000000000..1173b460a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-undefined.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Accepts undefined for the `assert` property of the second argument +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + 1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a + newly created TypeError object »). + 2. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-assertions, Symbol, BigInt] +flags: [async] +---*/ + +Promise.all([ + import('./2nd-param_FIXTURE.js', {}), + import('./2nd-param_FIXTURE.js', {assert:undefined}), + ]) + .then(function(values) { + assert.sameValue(values[0].default, 262); + assert.sameValue(values[1].default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-abrupt.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-abrupt.js new file mode 100644 index 0000000000..770cd15f29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-abrupt.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when retrieving a value of the `assert` object produces an + abrupt completion +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 10. If options is not undefined, then + [...] + d. If assertionsObj is not undefined, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + iii. IfAbruptRejectPromise(keys, promiseCapability). + iv. Let supportedAssertions be ! HostGetSupportedImportAssertions(). + v. For each String key of keys, + 1. Let value be Get(assertionsObj, key). + 2. IfAbruptRejectPromise(value, promiseCapability). + [...] +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +var thrown = new Test262Error(); + +import('./2nd-param_FIXTURE.js', {assert:{get ''() { throw thrown; }}}) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but it was fulfilled'); + }, function(error) { + assert.sameValue(error, thrown); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-non-string.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-non-string.js new file mode 100644 index 0000000000..ab8c3a93de --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-assert-value-non-string.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when any property of the `assert` object is not a string +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 10. If options is not undefined, then + [...] + d. If assertionsObj is not undefined, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + iii. IfAbruptRejectPromise(keys, promiseCapability). + iv. Let supportedAssertions be ! HostGetSupportedImportAssertions(). + v. For each String key of keys, + 1. Let value be Get(assertionsObj, key). + 2. IfAbruptRejectPromise(value, promiseCapability). + 3. If Type(value) is not String, then + a. Perform ! Call(promiseCapability.[[Reject]], undefined, « a + newly created TypeError object »). + b. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-assertions, Symbol, BigInt] +flags: [async] +---*/ + +function test(promise, valueType) { + return promise.then(function() { + throw new Test262Error('Promise for ' + valueType + ' was not rejected.'); + }, function(error) { + assert.sameValue(error.constructor, TypeError, valueType); + }); +} + +Promise.all([ + test(import('./2nd-param_FIXTURE.js', {assert:{'': undefined}}), 'undefined'), + test(import('./2nd-param_FIXTURE.js', {assert:{'': null}}), 'null'), + test(import('./2nd-param_FIXTURE.js', {assert:{'': false}}), 'boolean'), + test(import('./2nd-param_FIXTURE.js', {assert:{'': 23}}), 'number'), + test(import('./2nd-param_FIXTURE.js', {assert:{'': Symbol('')}}), 'symbol'), + test(import('./2nd-param_FIXTURE.js', {assert:{'': 23n}}), 'bigint'), + test(import('./2nd-param_FIXTURE.js', {assert:{'': {}}}), 'object') + ]) + .then(function() {}) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-expr.js new file mode 100644 index 0000000000..1a0a3ba58f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-expr.js @@ -0,0 +1,22 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Await production parameter - AwaitExpression +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions, async-functions] +flags: [async] +---*/ + +(async function () { + return import('./2nd-param_FIXTURE.js', await undefined); +}()) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-ident.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-ident.js new file mode 100644 index 0000000000..8d1ecfc86e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-await-ident.js @@ -0,0 +1,22 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Await production parameter - IdentifierReference +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions, async-functions] +flags: [async] +---*/ + +function await() {} + +import('./2nd-param_FIXTURE.js', await(undefined)) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-return.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-return.js new file mode 100644 index 0000000000..e396f7cb3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-return.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Forwards "return" completion when evaluating second parameter +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let specifierRef be the result of evaluating specifierExpression. + 3. Let specifier be ? GetValue(specifierRef). + 4. If optionsExpression is present, then + a. Let optionsRef be the result of evaluating optionsExpression. + b. Let options be ? GetValue(optionsRef). + [...] +features: [dynamic-import, import-assertions] +---*/ + +var beforeCount = 0; +var afterCount = 0; +var iter = function*() { + beforeCount += 1, import('', yield), afterCount += 1; +}(); + +iter.next(); +var result = iter.return(595); + +assert.sameValue(result.done, true); +assert.sameValue(result.value, 595); +assert.sameValue(beforeCount, 1); +assert.sameValue(afterCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-throw.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-throw.js new file mode 100644 index 0000000000..bd504dfa43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-abrupt-throw.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Forwards "throw" completion when evaluating second parameter +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let specifierRef be the result of evaluating specifierExpression. + 3. Let specifier be ? GetValue(specifierRef). + 4. If optionsExpression is present, then + a. Let optionsRef be the result of evaluating optionsExpression. + b. Let options be ? GetValue(optionsRef). + [...] +features: [dynamic-import, import-assertions] +---*/ + +var beforeCount = 0; +var afterCount = 0; +function throwError() { + throw new Test262Error(); +} + +assert.throws(Test262Error, function() { + beforeCount += 1, import('', throwError()), afterCount += 1; +}); + +assert.sameValue(beforeCount, 1); +assert.sameValue(afterCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-sequence.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-sequence.js new file mode 100644 index 0000000000..e6d4f4a33d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-evaluation-sequence.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Evaluates parameters in correct sequence +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let specifierRef be the result of evaluating specifierExpression. + 3. Let specifier be ? GetValue(specifierRef). + 4. If optionsExpression is present, then + a. Let optionsRef be the result of evaluating optionsExpression. + b. Let options be ? GetValue(optionsRef). + [...] +features: [dynamic-import, import-assertions] +---*/ + +var log = []; + +import(log.push('first'), (log.push('second'), undefined)) + .then(null, function() {}); + +assert.sameValue(log.length, 2); +assert.sameValue(log[0], 'first'); +assert.sameValue(log[1], 'second'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-get-assert-error.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-get-assert-error.js new file mode 100644 index 0000000000..9d3ed7e852 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-get-assert-error.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Rejects promise when accessing "assert" property throws an error +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + [...] +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +var thrown = new Test262Error(); +var options = { + get assert() { + throw thrown; + } +}; + +import('./2nd-param_FIXTURE.js', options) + .then(function() { + throw new Test262Error('Expected an error, but observed no error'); + }, function(caught) { + assert.sameValue(thrown, caught); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-in.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-in.js new file mode 100644 index 0000000000..1538f2dab5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-in.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: ImportCall parameter list enables the Yield production parameter +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +var promise; + +for (promise = import('./2nd-param_FIXTURE.js', 'test262' in {} || undefined); false; ) ; + +promise + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-non-object.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-non-object.js new file mode 100644 index 0000000000..0dae07a409 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-non-object.js @@ -0,0 +1,41 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when the second argument is neither undefined nor an object +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + i. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »). + ii. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-assertions, Symbol, BigInt] +flags: [async] +---*/ + +function test(promise, valueType) { + return promise.then(function() { + throw new Test262Error('Promise for ' + valueType + ' was not rejected.'); + }, function(error) { + assert.sameValue(error.constructor, TypeError, valueType); + }); +} + +Promise.all([ + test(import('./2nd-param_FIXTURE.js', null), 'null'), + test(import('./2nd-param_FIXTURE.js', false), 'boolean'), + test(import('./2nd-param_FIXTURE.js', 23), 'number'), + test(import('./2nd-param_FIXTURE.js', ''), 'string'), + test(import('./2nd-param_FIXTURE.js', Symbol('')), 'symbol'), + test(import('./2nd-param_FIXTURE.js', 23n), 'bigint') + ]) + .then(function() {}) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-fulfill.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-fulfill.js new file mode 100644 index 0000000000..f1d7256ef9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-fulfill.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (fulfillment + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +import('./2nd-param_FIXTURE.js', {},) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-reject.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-reject.js new file mode 100644 index 0000000000..d4443c9002 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-trailing-comma-reject.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (rejection + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +var thrown = new Test262Error(); + +import({toString: function() { throw thrown; } }, {},) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but it was fulfilled.'); + }, function(caught) { + assert.sameValue(thrown, caught); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-expr.js new file mode 100644 index 0000000000..808a369721 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-expr.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Yield production parameter - YieldExpression +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +var promise; + +var iter = (function * () { + promise = import('./2nd-param_FIXTURE.js', yield); +}()); + +iter.next(); + +assert.sameValue(promise, undefined); + +iter.next(); + +promise + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..6ddd9c5691 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-invalid-strict.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Yield production parameter - invalid IdentifierReference +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ +$DONOTEVALUATE(); + +import('./empty_FIXTURE.js', yield); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-valid.js new file mode 100644 index 0000000000..a8a359be03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param-yield-ident-valid.js @@ -0,0 +1,22 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Yield production parameter - valid IdentifierReference +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [async, noStrict] +---*/ + +var yield; + +import('./2nd-param_FIXTURE.js', yield) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.js new file mode 100644 index 0000000000..9e8a871054 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.js @@ -0,0 +1,4 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +export default 262; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json new file mode 100644 index 0000000000..5484d82917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/2nd-param_FIXTURE.json @@ -0,0 +1 @@ +262 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/README.md b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/README.md new file mode 100644 index 0000000000..d80cf27f8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/README.md @@ -0,0 +1,2 @@ +Make sure to keep the tests in this folder aligned +with the tests in the import-attributes folder. diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-fulfill.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-fulfill.js new file mode 100644 index 0000000000..4f271f22bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-fulfill.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (fulfillment + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +import('./2nd-param_FIXTURE.js',) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-reject.js b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-reject.js new file mode 100644 index 0000000000..bae7a0a46a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-assertions/trailing-comma-reject.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (rejection + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-assertions] +flags: [async] +---*/ + +var thrown = new Test262Error(); + +import({toString: function() { throw thrown; } },) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but it was fulfilled.'); + }, function(caught) { + assert.sameValue(thrown, caught); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-expr.js new file mode 100644 index 0000000000..f6cdbaf421 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-expr.js @@ -0,0 +1,22 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Await production parameter - AwaitExpression +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes, async-functions] +flags: [async] +---*/ + +(async function () { + return import('./2nd-param_FIXTURE.js', await undefined); +}()) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-ident.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-ident.js new file mode 100644 index 0000000000..edeef31086 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-await-ident.js @@ -0,0 +1,22 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Await production parameter - IdentifierReference +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes, async-functions] +flags: [async] +---*/ + +function await() {} + +import('./2nd-param_FIXTURE.js', await(undefined)) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-return.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-return.js new file mode 100644 index 0000000000..0079beae65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-return.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Forwards "return" completion when evaluating second parameter +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let specifierRef be the result of evaluating specifierExpression. + 3. Let specifier be ? GetValue(specifierRef). + 4. If optionsExpression is present, then + a. Let optionsRef be the result of evaluating optionsExpression. + b. Let options be ? GetValue(optionsRef). + [...] +features: [dynamic-import, import-attributes] +---*/ + +var beforeCount = 0; +var afterCount = 0; +var iter = function*() { + beforeCount += 1, import('', yield), afterCount += 1; +}(); + +iter.next(); +var result = iter.return(595); + +assert.sameValue(result.done, true); +assert.sameValue(result.value, 595); +assert.sameValue(beforeCount, 1); +assert.sameValue(afterCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-throw.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-throw.js new file mode 100644 index 0000000000..e55e7010f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-abrupt-throw.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Forwards "throw" completion when evaluating second parameter +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let specifierRef be the result of evaluating specifierExpression. + 3. Let specifier be ? GetValue(specifierRef). + 4. If optionsExpression is present, then + a. Let optionsRef be the result of evaluating optionsExpression. + b. Let options be ? GetValue(optionsRef). + [...] +features: [dynamic-import, import-attributes] +---*/ + +var beforeCount = 0; +var afterCount = 0; +function throwError() { + throw new Test262Error(); +} + +assert.throws(Test262Error, function() { + beforeCount += 1, import('', throwError()), afterCount += 1; +}); + +assert.sameValue(beforeCount, 1); +assert.sameValue(afterCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-sequence.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-sequence.js new file mode 100644 index 0000000000..1b1c3c253c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-evaluation-sequence.js @@ -0,0 +1,28 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Evaluates parameters in correct sequence +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let specifierRef be the result of evaluating specifierExpression. + 3. Let specifier be ? GetValue(specifierRef). + 4. If optionsExpression is present, then + a. Let optionsRef be the result of evaluating optionsExpression. + b. Let options be ? GetValue(optionsRef). + [...] +features: [dynamic-import, import-attributes] +---*/ + +var log = []; + +import(log.push('first'), (log.push('second'), undefined)) + .then(null, function() {}); + +assert.sameValue(log.length, 2); +assert.sameValue(log[0], 'first'); +assert.sameValue(log[1], 'second'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-get-with-error.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-get-with-error.js new file mode 100644 index 0000000000..a1c1775a02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-get-with-error.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Rejects promise when accessing "assert" property throws an error +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + [...] +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +var thrown = new Test262Error(); +var options = { + get with() { + throw thrown; + } +}; + +import('./2nd-param_FIXTURE.js', options) + .then(function() { + throw new Test262Error('Expected an error, but observed no error'); + }, function(caught) { + assert.sameValue(thrown, caught); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-in.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-in.js new file mode 100644 index 0000000000..e15f48f7b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-in.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: ImportCall parameter list enables the Yield production parameter +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +var promise; + +for (promise = import('./2nd-param_FIXTURE.js', 'test262' in {} || undefined); false; ) ; + +promise + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-non-object.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-non-object.js new file mode 100644 index 0000000000..4aeea58142 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-non-object.js @@ -0,0 +1,41 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when the second argument is neither undefined nor an object +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + i. Perform ! Call(promiseCapability.[[Reject]], undefined, « a newly created TypeError object »). + ii. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-attributes, Symbol, BigInt] +flags: [async] +---*/ + +function test(promise, valueType) { + return promise.then(function() { + throw new Test262Error('Promise for ' + valueType + ' was not rejected.'); + }, function(error) { + assert.sameValue(error.constructor, TypeError, valueType); + }); +} + +Promise.all([ + test(import('./2nd-param_FIXTURE.js', null), 'null'), + test(import('./2nd-param_FIXTURE.js', false), 'boolean'), + test(import('./2nd-param_FIXTURE.js', 23), 'number'), + test(import('./2nd-param_FIXTURE.js', ''), 'string'), + test(import('./2nd-param_FIXTURE.js', Symbol('')), 'symbol'), + test(import('./2nd-param_FIXTURE.js', 23n), 'bigint') + ]) + .then(function() {}) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-fulfill.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-fulfill.js new file mode 100644 index 0000000000..70988a7237 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-fulfill.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (fulfillment + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +import('./2nd-param_FIXTURE.js', {},) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-reject.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-reject.js new file mode 100644 index 0000000000..3921ff3fd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-trailing-comma-reject.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (rejection + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +var thrown = new Test262Error(); + +import({toString: function() { throw thrown; } }, {},) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but it was fulfilled.'); + }, function(caught) { + assert.sameValue(thrown, caught); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-abrupt.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-abrupt.js new file mode 100644 index 0000000000..cd4a7708fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-abrupt.js @@ -0,0 +1,44 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Reports abrupt completions produced by attributes enumeration +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + iii. IfAbruptRejectPromise(keys, promiseCapability). + [...] +features: [dynamic-import, import-attributes, Proxy] +flags: [async] +---*/ + +var thrown = new Test262Error(); +var options = { + with: new Proxy({}, { + ownKeys: function() { + throw thrown; + }, + }) +}; + +import('./2nd-param_FIXTURE.js', options) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but promise was fulfilled.'); + }, function(error) { + assert.sameValue(error, thrown); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-enumerable.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-enumerable.js new file mode 100644 index 0000000000..68f5d91899 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration-enumerable.js @@ -0,0 +1,61 @@ +// |reftest| skip async -- json-modules is not supported +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Follows the semantics of the EnumerableOwnPropertyNames abstract operation + during attributes enumeration +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + [...] +features: [dynamic-import, import-attributes, json-modules, Symbol, Proxy] +flags: [async] +---*/ + +var symbol = Symbol(''); +var target = { + type: "json" +}; +var descriptors = { + type: {configurable: true, enumerable: true} +}; +var log = []; + +var options = { + with: new Proxy({}, { + ownKeys: function() { + return ["type"]; + }, + get(_, name) { + log.push(name); + return "json"; + }, + getOwnPropertyDescriptor(target, name) { + return {configurable: true, enumerable: true, value: "json"}; + }, + }) +}; + +import('./2nd-param_FIXTURE.json', options) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); + +assert.sameValue(log.length, 1); +assert.sameValue(log[0], "type") diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration.js new file mode 100644 index 0000000000..9aa106b47e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-enumeration.js @@ -0,0 +1,59 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Follows the semantics of the EnumerableOwnPropertyNames abstract operation + during attributes enumeration +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + [...] +features: [dynamic-import, import-attributes, Symbol, Proxy] +flags: [async] +---*/ + +var symbol = Symbol(''); +var target = { + [symbol]: '', + unreported: '', + nonEnumerable: '' +}; +var descriptors = { + [symbol]: {configurable: true, enumerable: true}, + nonEnumerable: {configurable: true, enumerable: false} +}; + +var options = { + with: new Proxy({}, { + ownKeys: function() { + return [symbol, 'nonEnumerable', 'absent']; + }, + get() { + throw new Error("Should not be called"); + }, + getOwnPropertyDescriptor(target, name) { + return descriptors[name]; + } + }) +}; + +import('./2nd-param_FIXTURE.js', options) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-non-object.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-non-object.js new file mode 100644 index 0000000000..da6a50d725 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-non-object.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when the `assert` property of the second argument is neither + undefined nor an object +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + 1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a + newly created TypeError object »). + 2. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-attributes, Symbol, BigInt] +flags: [async] +---*/ + +function test(promise, valueType) { + return promise.then(function() { + throw new Test262Error('Promise for ' + valueType + ' was not rejected.'); + }, function(error) { + assert.sameValue(error.constructor, TypeError, valueType); + }); +} + +Promise.all([ + test(import('./2nd-param_FIXTURE.js', {with:null}), 'null'), + test(import('./2nd-param_FIXTURE.js', {with:false}), 'boolean'), + test(import('./2nd-param_FIXTURE.js', {with:23}), 'number'), + test(import('./2nd-param_FIXTURE.js', {with:''}), 'string'), + test(import('./2nd-param_FIXTURE.js', {with:Symbol('')}), 'symbol'), + test(import('./2nd-param_FIXTURE.js', {with:23n}), 'bigint') + ]) + .then(function() {}) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-undefined.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-undefined.js new file mode 100644 index 0000000000..32a28fd582 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-undefined.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Accepts undefined for the `assert` property of the second argument +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 6. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 7. Let specifierString be ToString(specifier). + 8. IfAbruptRejectPromise(specifierString, promiseCapability). + 9. Let assertions be a new empty List. + 10. If options is not undefined, then + a. If Type(options) is not Object, + [...] + b. Let assertionsObj be Get(options, "assert"). + c. IfAbruptRejectPromise(assertionsObj, promiseCapability). + d. If assertionsObj is not undefined, + i. If Type(assertionsObj) is not Object, + 1. Perform ! Call(promiseCapability.[[Reject]], undefined, « a + newly created TypeError object »). + 2. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-attributes, Symbol, BigInt] +flags: [async] +---*/ + +Promise.all([ + import('./2nd-param_FIXTURE.js', {}), + import('./2nd-param_FIXTURE.js', {with:undefined}), + ]) + .then(function(values) { + assert.sameValue(values[0].default, 262); + assert.sameValue(values[1].default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-abrupt.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-abrupt.js new file mode 100644 index 0000000000..cc3fe225c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-abrupt.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when retrieving a value of the `assert` object produces an + abrupt completion +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 10. If options is not undefined, then + [...] + d. If assertionsObj is not undefined, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + iii. IfAbruptRejectPromise(keys, promiseCapability). + iv. Let supportedAssertions be ! HostGetSupportedImportAssertions(). + v. For each String key of keys, + 1. Let value be Get(assertionsObj, key). + 2. IfAbruptRejectPromise(value, promiseCapability). + [...] +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +var thrown = new Test262Error(); + +import('./2nd-param_FIXTURE.js', {with:{get ''() { throw thrown; }}}) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but it was fulfilled'); + }, function(error) { + assert.sameValue(error, thrown); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-non-string.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-non-string.js new file mode 100644 index 0000000000..6844fdbcc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-with-value-non-string.js @@ -0,0 +1,48 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Rejects promise when any property of the `assert` object is not a string +esid: sec-import-call-runtime-semantics-evaluation +info: | + 2.1.1.1 EvaluateImportCall ( specifierExpression [ , optionsExpression ] ) + [...] + 10. If options is not undefined, then + [...] + d. If assertionsObj is not undefined, + [...] + ii. Let keys be EnumerableOwnPropertyNames(assertionsObj, key). + iii. IfAbruptRejectPromise(keys, promiseCapability). + iv. Let supportedAssertions be ! HostGetSupportedImportAssertions(). + v. For each String key of keys, + 1. Let value be Get(assertionsObj, key). + 2. IfAbruptRejectPromise(value, promiseCapability). + 3. If Type(value) is not String, then + a. Perform ! Call(promiseCapability.[[Reject]], undefined, « a + newly created TypeError object »). + b. Return promiseCapability.[[Promise]]. + [...] +features: [dynamic-import, import-attributes, Symbol, BigInt] +flags: [async] +---*/ + +function test(promise, valueType) { + return promise.then(function() { + throw new Test262Error('Promise for ' + valueType + ' was not rejected.'); + }, function(error) { + assert.sameValue(error.constructor, TypeError, valueType); + }); +} + +Promise.all([ + test(import('./2nd-param_FIXTURE.js', {with:{'': undefined}}), 'undefined'), + test(import('./2nd-param_FIXTURE.js', {with:{'': null}}), 'null'), + test(import('./2nd-param_FIXTURE.js', {with:{'': false}}), 'boolean'), + test(import('./2nd-param_FIXTURE.js', {with:{'': 23}}), 'number'), + test(import('./2nd-param_FIXTURE.js', {with:{'': Symbol('')}}), 'symbol'), + test(import('./2nd-param_FIXTURE.js', {with:{'': 23n}}), 'bigint'), + test(import('./2nd-param_FIXTURE.js', {with:{'': {}}}), 'object') + ]) + .then(function() {}) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-expr.js new file mode 100644 index 0000000000..f17fe835cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-expr.js @@ -0,0 +1,32 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Yield production parameter - YieldExpression +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +var promise; + +var iter = (function * () { + promise = import('./2nd-param_FIXTURE.js', yield); +}()); + +iter.next(); + +assert.sameValue(promise, undefined); + +iter.next(); + +promise + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-invalid-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-invalid-strict.js new file mode 100644 index 0000000000..6c17a4f049 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-invalid-strict.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) error:SyntaxError -- requires shell-options +'use strict'; +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Yield production parameter - invalid IdentifierReference +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ +$DONOTEVALUATE(); + +import('./empty_FIXTURE.js', yield); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-valid.js new file mode 100644 index 0000000000..72e8f0f73b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param-yield-ident-valid.js @@ -0,0 +1,22 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list forwards the Yield production parameter - valid IdentifierReference +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [async, noStrict] +---*/ + +var yield; + +import('./2nd-param_FIXTURE.js', yield) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.js new file mode 100644 index 0000000000..9e8a871054 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.js @@ -0,0 +1,4 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +export default 262; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.json b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.json new file mode 100644 index 0000000000..5484d82917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/2nd-param_FIXTURE.json @@ -0,0 +1 @@ +262 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/README.md b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/README.md new file mode 100644 index 0000000000..bf4a0de27f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/README.md @@ -0,0 +1,2 @@ +Make sure to keep the tests in this folder aligned +with the tests in the import-assertions folder. diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-fulfill.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-fulfill.js new file mode 100644 index 0000000000..3f558342fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-fulfill.js @@ -0,0 +1,21 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (fulfillment + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +import('./2nd-param_FIXTURE.js',) + .then(function(module) { + assert.sameValue(module.default, 262); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-reject.js b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-reject.js new file mode 100644 index 0000000000..988eb5e01b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/import-attributes/trailing-comma-reject.js @@ -0,0 +1,25 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) async -- requires shell-options +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall parameter list supports an optional trailing comma (rejection + semantics) +esid: sec-import-call-runtime-semantics-evaluation +info: | + ImportCall[Yield, Await]: + import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) +features: [dynamic-import, import-attributes] +flags: [async] +---*/ + +var thrown = new Test262Error(); + +import({toString: function() { throw thrown; } },) + .then(function() { + throw new Test262Error('Expected promise to be rejected, but it was fulfilled.'); + }, function(caught) { + assert.sameValue(thrown, caught); + }) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/imported-self-update.js b/js/src/tests/test262/language/expressions/dynamic-import/imported-self-update.js new file mode 100644 index 0000000000..3908428dac --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/imported-self-update.js @@ -0,0 +1,34 @@ +// |reftest| module async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Imported self bindings should update the references +esid: sec-finishdynamicimport +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 2. Otherwise, + a. Assert: completion is a normal completion and completion.[[Value]] is undefined. + b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). + c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. + d. Let namespace be GetModuleNamespace(moduleRecord). + ... + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). +flags: [async, module] +features: [dynamic-import] +---*/ + +let x = 0; +export { x, x as y }; +async function fn() { + var imported = await import('./imported-self-update.js'); + assert.sameValue(imported.x, 0, 'original value, direct binding'); + assert.sameValue(imported.y, 0, 'original value, indirect binding'); + x = 1; + assert.sameValue(imported.x, 1, 'updated value, direct binding'); + assert.sameValue(imported.y, 1, 'updated value, indirect binding'); +} + +// Do not use asyncTest: when self imported, $DONE is not defined, asyncTest will throw +fn().then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-1_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-1_FIXTURE.js new file mode 100644 index 0000000000..d444979caa --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-1_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export default import('./indirect-resolution-2_FIXTURE.js'); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-2_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-2_FIXTURE.js new file mode 100644 index 0000000000..6438084e34 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution-2_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export default 42; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution.js b/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution.js new file mode 100644 index 0000000000..7479c5ab0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/indirect-resolution.js @@ -0,0 +1,32 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Dynamic Import should resolve another import call +esid: sec-import-call-runtime-semantics-evaluation +info: | + Runtime Semantics: Evaluation + + ImportCall : import ( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. +flags: [async] +features: [dynamic-import] +---*/ + +import('./indirect-resolution-1_FIXTURE.js').then(async imported => { + assert.sameValue(Promise.resolve(imported.default), imported.default, 'default is Promise instance'); + assert.sameValue(Object.getPrototypeOf(imported.default), Promise.prototype, 'default proto is Promise.prototype'); + assert.sameValue(imported.default.constructor, Promise, 'default.constructor is Promise'); + + var indirect = await imported.default; + assert.sameValue(indirect.default, 42); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/module-code_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/module-code_FIXTURE.js new file mode 100644 index 0000000000..bfe3fbce80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/module-code_FIXTURE.js @@ -0,0 +1,11 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +// exports: default === 42, local1 === 'Test262', renamed === 'TC39', indirect === 'Test262' + +export var local1 = 'Test262'; +var local2 = 'TC39'; +export { local2 as renamed }; +export { local1 as indirect } from './module-code_FIXTURE.js'; +export default 42; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-Symbol-toStringTag.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-Symbol-toStringTag.js new file mode 100644 index 0000000000..aae5b44618 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-Symbol-toStringTag.js @@ -0,0 +1,99 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-Symbol-toStringTag.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Module namespace objects have a Symbol.toStringTag (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: false }. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(ns[Symbol.toStringTag], 'Module'); + + // propertyHelper.js is not appropriate for this test because it assumes that + // the object exposes the ordinary object's implementation of [[Get]], [[Set]], +// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic +// object does not. +var desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag); + +assert.sameValue(desc.enumerable, false, 'reports as non-enumerable'); +assert.sameValue(desc.writable, false, 'reports as non-writable'); +assert.sameValue(desc.configurable, false, 'reports as non-configurable'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-define-own-property.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-define-own-property.js new file mode 100644 index 0000000000..932af290d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-define-own-property.js @@ -0,0 +1,178 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-define-own-property.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[DefineOwnProperty]] internal method returns `true` if no change is requested, and `false` otherwise. (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol.iterator, Reflect, Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ +var sym = Symbol('test262'); + +const exported = ['local1', 'renamed', 'indirect']; + + +async function fn() { + const ns = await import('./define-own-property_FIXTURE.js'); + + // Non-existant properties. + + for (const key of ['local2', 0, sym, Symbol.iterator]) { + assert.sameValue( + Reflect.defineProperty(ns, key, {}), + false, + 'Reflect.defineProperty: ' + key.toString() + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, key, {}); + }, 'Object.defineProperty: ' + key.toString()); + } + + // Own properties. No change requested. + + for (const key of ([...exported, Symbol.toStringTag])) { + assert.sameValue( + Reflect.defineProperty(ns, key, {}), + true, + `No change requested, Reflect.defineProperty: ${key.toString()}` + ); + assert.sameValue( + Object.defineProperty(ns, key, {}), + ns, + `No change requested, Object.defineProperty: ${key.toString()}` + ); + + } + + assert.sameValue( + Reflect.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: false}), + true, + 'Reflect.defineProperty: indirect' + ); + assert.sameValue( + Object.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: false}), + ns, + 'Object.defineProperty: indirect' + ); + + assert.sameValue( + Reflect.defineProperty(ns, Symbol.toStringTag, + {value: "Module", writable: false, enumerable: false, + configurable: false}), + true, + 'Reflect.defineProperty: Symbol.toStringTag' + ); + assert.sameValue( + Object.defineProperty(ns, Symbol.toStringTag, + {value: "Module", writable: false, enumerable: false, + configurable: false}), + ns, + 'Object.defineProperty: Symbol.toStringTag' + ); + + + // Own properties. Change requested. + + for (const key of ([...exported, Symbol.toStringTag])) { + assert.sameValue( + Reflect.defineProperty(ns, key, {value: 123}), + false, + `Change requested, Reflect.defineProperty: ${key.toString()}` + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, key, {value: 123}); + }, `Change requested, Object.defineProperty: ${key.toString()}`); + } + + assert.sameValue( + Reflect.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: true}), + false, + 'Reflect.defineProperty: indirect' + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: true}); + }, 'Object.defineProperty: indirect'); + + assert.sameValue( + Reflect.defineProperty(ns, Symbol.toStringTag, + {value: "module", writable: false, enumerable: false, + configurable: false}), + false, + 'Reflect.defineProperty: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, Symbol.toStringTag, + {value: "module", writable: false, enumerable: false, + configurable: false}); + }, 'Object.defineProperty: Symbol.toStringTag'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-no-strict.js new file mode 100644 index 0000000000..740073d0e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-no-strict.js @@ -0,0 +1,113 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-exported-init-no-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Delete]] behavior for a key that describes an initialized exported binding on non strict mode (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(delete ns.default, false, 'delete: default'); + assert.sameValue( + Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default' + ); + assert.sameValue(ns.default, 42, 'binding unmodified: default'); + + assert.sameValue(delete ns.local1, false, 'delete: local1'); + assert.sameValue( + Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1' + ); + assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1'); + + assert.sameValue(delete ns.renamed, false, 'delete: renamed'); + assert.sameValue( + Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed' + ); + assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed'); + + assert.sameValue(delete ns.indirect, false, 'delete: indirect'); + assert.sameValue( + Reflect.deleteProperty(ns, 'indirect'), + false, + 'Reflect.deleteProperty: indirect' + ); + assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-strict-strict.js new file mode 100644 index 0000000000..da01dce614 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-exported-init-strict-strict.js @@ -0,0 +1,122 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-exported-init-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Delete]] behavior for a key that describes an initialized exported binding on strict mode (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.throws(TypeError, function() { + delete ns.default; + }, 'delete: default'); + assert.sameValue( + Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default' + ); + assert.sameValue(ns.default, 42, 'binding unmodified: default'); + + assert.throws(TypeError, function() { + delete ns.local1; + }, 'delete: local1'); + assert.sameValue( + Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1' + ); + assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1'); + + assert.throws(TypeError, function() { + delete ns.renamed; + }, 'delete: renamed'); + assert.sameValue( + Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed' + ); + assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed'); + + assert.throws(TypeError, function() { + delete ns.indirect; + }, 'delete: indirect'); + assert.sameValue( + Reflect.deleteProperty(ns, 'indirect'), + false, + 'Reflect.deleteProperty: indirect' + ); + assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-no-strict.js new file mode 100644 index 0000000000..0dd0b94205 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-no-strict.js @@ -0,0 +1,105 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-non-exported-no-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Delete]] behavior for a key that does not describe an exported binding (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +async function fn() { + const ns = await import('./empty_FIXTURE.js'); + + assert(delete ns.undef, 'delete: undef'); + assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef'); + + assert(delete ns.default, 'delete: default'); + assert( + Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default' + ); + + assert.sameValue(delete ns[Symbol.toStringTag], false, 'delete: Symbol.toStringTag'); + assert.sameValue( + Reflect.deleteProperty(ns, Symbol.toStringTag), false, + 'Reflect.deleteProperty: Symbol.toStringTag' + ); + + var sym = Symbol('test262'); + assert(delete ns[sym], 'delete: symbol'); + assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-strict-strict.js new file mode 100644 index 0000000000..9351afcc43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-delete-non-exported-strict-strict.js @@ -0,0 +1,106 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-non-exported-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Delete]] behavior for a key that does not describe an exported binding (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +async function fn() { + const ns = await import('./empty_FIXTURE.js'); + + assert(delete ns.undef, 'delete: undef'); + assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef'); + + assert(delete ns.default, 'delete: default'); + assert( + Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default' + ); + + assert.sameValue( + Reflect.deleteProperty(ns, Symbol.toStringTag), false, + 'Reflect.deleteProperty: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag'); + + var sym = Symbol('test262'); + assert(delete ns[sym], 'delete: symbol'); + assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-extensible.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-extensible.js new file mode 100644 index 0000000000..3b91635e73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-extensible.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-extensible.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Module namespace objects are not extensible. (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(Object.isExtensible(ns), false); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-direct.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-direct.js new file mode 100644 index 0000000000..183c3ab36e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-direct.js @@ -0,0 +1,127 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-nested-namespace-dflt-direct.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Direct Default exports are included in an imported module namespace object when a namespace object is created. (value from await resolving) +esid: sec-finishdynamicimport +features: [export-star-as-namespace-from-module, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 6. Let binding be ! m.ResolveExport(P, « »). + 7. Assert: binding is a ResolvedBinding Record. + 8. Let targetModule be binding.[[Module]]. + 9. Assert: targetModule is not undefined. + 10. If binding.[[BindingName]] is "*namespace*", then + 11. Return ? GetModuleNamespace(targetModule). + + Runtime Semantics: GetModuleNamespace + [...] + 3. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, + i. Let resolution be ? module.ResolveExport(name, « », « »). + ii. If resolution is null, throw a SyntaxError exception. + iii. If resolution is not "ambiguous", append name to + unambiguousNames. + d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames). + [...] + +---*/ + +async function fn() { + const ns = await import('./get-nested-namespace-dflt-skip-prod_FIXTURE.js'); + + var desc = Object.getOwnPropertyDescriptor(ns, 'productionNS2'); + + assert.sameValue(desc.enumerable, true, 'ns.productionNS2: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.productionNS2: is writable'); + assert.sameValue(desc.configurable, false, 'ns.productionNS2: is non-configurable'); + + var keys = Object.getOwnPropertyNames(ns.productionNS2); + + assert.sameValue(keys.length, 2); + assert.sameValue(keys[0], 'default'); + assert.sameValue(keys[1], 'productionOther'); + + desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'productionOther'); + + assert.sameValue(desc.value, null, 'ns.productionNS2.productionOther: value is null'); + assert.sameValue(desc.enumerable, true, 'ns.productionNS2.productionOther: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.productionNS2.productionOther: is writable'); + assert.sameValue(desc.configurable, false, 'ns.productionNS2.productionOther: is non-configurable'); + + desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'default'); + + assert.sameValue(desc.value, 42, 'ns.productionNS2.default value is 42'); + assert.sameValue(desc.enumerable, true, 'ns.productionNS2.default is enumerable'); + assert.sameValue(desc.writable, true, 'ns.productionNS2.default is writable'); + assert.sameValue(desc.configurable, false, 'ns.productionNS2.default is non-configurable'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-indirect.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-indirect.js new file mode 100644 index 0000000000..809fe7a8d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-dflt-indirect.js @@ -0,0 +1,127 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-nested-namespace-dflt-indirect.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Inirect Default exports are included in an imported module namespace object when a namespace object is created. (value from await resolving) +esid: sec-finishdynamicimport +features: [export-star-as-namespace-from-module, dynamic-import] +flags: [generated, module, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 6. Let binding be ! m.ResolveExport(P, « »). + 7. Assert: binding is a ResolvedBinding Record. + 8. Let targetModule be binding.[[Module]]. + 9. Assert: targetModule is not undefined. + 10. If binding.[[BindingName]] is "*namespace*", then + 11. Return ? GetModuleNamespace(targetModule). + + Runtime Semantics: GetModuleNamespace + [...] + 3. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, + i. Let resolution be ? module.ResolveExport(name, « », « »). + ii. If resolution is null, throw a SyntaxError exception. + iii. If resolution is not "ambiguous", append name to + unambiguousNames. + d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames). + [...] + +---*/ + +async function fn() { + const ns = await import('./get-nested-namespace-dflt-skip-named_FIXTURE.js'); + + var desc = Object.getOwnPropertyDescriptor(ns, 'namedNS2'); + + assert.sameValue(desc.enumerable, true, 'ns.namedNS2: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.namedNS2: is writable'); + assert.sameValue(desc.configurable, false, 'ns.namedNS2: is non-configurable'); + + var keys = Object.getOwnPropertyNames(ns.namedNS2); + + assert.sameValue(keys.length, 2); + assert.sameValue(keys[0], 'default'); + assert.sameValue(keys[1], 'namedOther'); + + desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'namedOther'); + + assert.sameValue(desc.value, null, 'ns.namedNS2.namedOther value is null'); + assert.sameValue(desc.enumerable, true, 'ns.namedNS2.namedOther: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.namedNS2.namedOther: is writable'); + assert.sameValue(desc.configurable, false, 'ns.namedNS2.namedOther: is non-configurable'); + + desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'default'); + + assert.sameValue(desc.value, 42, 'ns.namedNS2.default value is 42'); + assert.sameValue(desc.enumerable, true, 'ns.namedNS2.default is enumerable'); + assert.sameValue(desc.writable, true, 'ns.namedNS2.default is writable'); + assert.sameValue(desc.configurable, false, 'ns.namedNS2.default is non-configurable'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-props-nrml.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-props-nrml.js new file mode 100644 index 0000000000..6b9af79015 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-nested-namespace-props-nrml.js @@ -0,0 +1,124 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-nested-namespace-props-nrml.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Module namespace object reports properties for all ExportEntries of all dependencies. (value from await resolving) +esid: sec-finishdynamicimport +features: [export-star-as-namespace-from-module, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 12. For each ImportEntry Record in in module.[[ImportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + in.[[ModuleRequest]]). + b. If in.[[ImportName]] is "*", then + i. Let namespace be ? GetModuleNamespace(importedModule). + [...] + + Runtime Semantics: GetModuleNamespace + 3. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, + i. Let resolution be ? module.ResolveExport(name, « », « »). + ii. If resolution is null, throw a SyntaxError exception. + iii. If resolution is not "ambiguous", append name to + unambiguousNames. + d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames). + +---*/ +function hasOwnProperty(obj, property) { + return Object.prototype.hasOwnProperty.call(obj, property); +} + + +async function fn() { + const ns = await import('./get-nested-namespace-props-nrml-1_FIXTURE.js'); + + // Export entries defined by a re-exported as exportns module + assert(hasOwnProperty(ns.exportns, 'starAsVarDecl'), 'starssVarDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsLetDecl'), 'starSsLetDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsConstDecl'), 'starSsConstDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsFuncDecl'), 'starAsFuncDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsGenDecl'), 'starAsGenDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsClassDecl'), 'starAsClassDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsBindingId'), 'starAsBindingId'); + assert(hasOwnProperty(ns.exportns, 'starIdName'), 'starIdName'); + assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName'), 'starAsIndirectIdName'); + assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName2'), 'starAsIndirectIdName2'); + assert(hasOwnProperty(ns.exportns, 'namespaceBinding'), 'namespaceBinding'); + + // Bindings that were not exported from any module + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedVar'), false, 'nonExportedVar'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedLet'), false, 'nonExportedLet'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedConst'), false, 'nonExportedConst'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedFunc'), false, 'nonExportedFunc'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedGen'), false, 'nonExportedGen'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedClass'), false, 'nonExportedClass'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-found-init.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-found-init.js new file mode 100644 index 0000000000..99066796a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-found-init.js @@ -0,0 +1,125 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-own-property-str-found-init.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[GetOwnProperty]] internal method with a string argument describing an initialized binding (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P). + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is not an element of exports, return undefined. + 4. Let value be ? O.[[Get]](P, O). + 5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true, + [[Enumerable]]: true, [[Configurable]]: false }. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + var desc; + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'local1'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'local1'); + assert.sameValue(desc.value, 'Test262'); + assert.sameValue(desc.enumerable, true, 'local1 enumerable'); + assert.sameValue(desc.writable, true, 'local1 writable'); + assert.sameValue(desc.configurable, false, 'local1 configurable'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'renamed'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'renamed'); + assert.sameValue(desc.value, 'TC39'); + assert.sameValue(desc.enumerable, true, 'renamed enumerable'); + assert.sameValue(desc.writable, true, 'renamed writable'); + assert.sameValue(desc.configurable, false, 'renamed configurable'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'indirect'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'indirect'); + assert.sameValue(desc.value, 'Test262'); + assert.sameValue(desc.enumerable, true, 'indirect enumerable'); + assert.sameValue(desc.writable, true, 'indirect writable'); + assert.sameValue(desc.configurable, false, 'indirect configurable'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'default'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'default'); + assert.sameValue(desc.value, 42); + assert.sameValue(desc.enumerable, true, 'default enumerable'); + assert.sameValue(desc.writable, true, 'default writable'); + assert.sameValue(desc.configurable, false, 'default configurable'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-not-found.js new file mode 100644 index 0000000000..2936f3f6c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-str-not-found.js @@ -0,0 +1,118 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-own-property-str-not-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[GetOwnProperty]] internal method with a string argument describing a binding that cannot be found (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P). + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is not an element of exports, return undefined. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + var desc; + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'local2'), + false, + 'hasOwnProperty: local2' + ); + desc = Object.getOwnPropertyDescriptor(ns, 'local2'); + assert.sameValue(desc, undefined, 'property descriptor for "local2"'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'toStringTag'), + false, + 'hasOwnProperty: toStringTag' + ); + desc = Object.getOwnPropertyDescriptor(ns, 'toStringTag'); + assert.sameValue(desc, undefined, 'property descriptor for "toStringTag"'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'iterator'), + false, + 'hasOwnProperty: iterator' + ); + desc = Object.getOwnPropertyDescriptor(ns, 'iterator'); + assert.sameValue(desc, undefined, 'property descriptor for "iterator"'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, '__proto__'), + false, + 'hasOwnProperty: __proto__' + ); + desc = Object.getOwnPropertyDescriptor(ns, '__proto__'); + assert.sameValue(desc, undefined, 'property descriptor for "__proto__"'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-sym.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-sym.js new file mode 100644 index 0000000000..fe14dbc8a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-own-property-sym.js @@ -0,0 +1,96 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-own-property-sym.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[GetOwnProperty]] internal method with a Symbol argument (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ +var notFound = Symbol('test262'); + + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + var desc; + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, Symbol.toStringTag), true + ); + desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag); + assert.sameValue(desc.value, ns[Symbol.toStringTag]); + assert.sameValue(desc.enumerable, false, 'Symbol.toStringTag enumerable'); + assert.sameValue(desc.writable, false, 'Symbol.toStringTag writable'); + assert.sameValue(desc.configurable, false, 'Symbol.toStringTag configurable'); + + assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false); + desc = Object.getOwnPropertyDescriptor(ns, notFound); + assert.sameValue(desc, undefined); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-found.js new file mode 100644 index 0000000000..799ccd0f3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-found.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-str-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[Get]] internal method with a string argument for exported initialized bindings. (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 12. Let targetEnvRec be targetEnv's EnvironmentRecord. + 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true). + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(ns.local1, 'Test262'); + assert.sameValue(ns.renamed, 'TC39'); + assert.sameValue(ns.indirect, 'Test262'); + assert.sameValue(ns.default, 42); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-not-found.js new file mode 100644 index 0000000000..01bb5f092d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-str-not-found.js @@ -0,0 +1,91 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-str-not-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[Get]] internal method with a string argument for non-exported bindings (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 3. Let exports be the value of O's [[Exports]] internal slot. + 4. If P is not an element of exports, return undefined. + +---*/ +var local2; // not used + + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(ns.local2, undefined, 'key: local2'); + assert.sameValue(ns.toStringTag, undefined, 'key: toStringTag'); + assert.sameValue(ns.iterator, undefined, 'key: iterator'); + assert.sameValue(ns.__proto__, undefined, 'key: __proto__'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-found.js new file mode 100644 index 0000000000..dedf63a112 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-found.js @@ -0,0 +1,86 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-sym-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[Get]] internal method with a symbol argument that can be found (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryGet(O, P, Receiver). + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(typeof ns[Symbol.toStringTag], 'string'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-not-found.js new file mode 100644 index 0000000000..807056b97c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-get-sym-not-found.js @@ -0,0 +1,86 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-sym-not-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[Get]] internal method with a symbol argument that cannot be found (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryGet(O, P, Receiver). + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(ns[Symbol('test262')], undefined, 'Symbol: test262'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-found-init.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-found-init.js new file mode 100644 index 0000000000..9cff22d38d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-found-init.js @@ -0,0 +1,96 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-str-found-init.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a string argument for exported initialized bindings. (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is an element of exports, return true. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert('local1' in ns, 'in: local1'); + assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1'); + + assert('renamed' in ns, 'in: renamed'); + assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed'); + + assert('indirect' in ns, 'in: indirect'); + assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect'); + + assert('default' in ns, 'in: default'); + assert(Reflect.has(ns, 'default'), 'Reflect.has: default'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-not-found.js new file mode 100644 index 0000000000..4308486bb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-str-not-found.js @@ -0,0 +1,103 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-str-not-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a string argument for non-exported bindings (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is an element of exports, return true. + 4. Return false. + +---*/ +var local2; // not used + + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue('local2' in ns, false, 'in: local2'); + assert.sameValue(Reflect.has(ns, 'local2'), false, 'Reflect.has: local2'); + + assert.sameValue('toStringTag' in ns, false, 'in: toStringTag'); + assert.sameValue( + Reflect.has(ns, 'toStringTag'), false, 'Reflect.has: toStringTag' + ); + + assert.sameValue('iterator' in ns, false, 'in: iterator'); + assert.sameValue(Reflect.has(ns, 'iterator'), false, 'Reflect.has: iterator'); + + assert.sameValue('__proto__' in ns, false, 'in: __proto__'); + assert.sameValue( + Reflect.has(ns, '__proto__'), false, 'Reflect.has: __proto__' + ); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-found.js new file mode 100644 index 0000000000..b60f319f42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-found.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-sym-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a symbol argument that can be found (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P). + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag'); + assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-not-found.js new file mode 100644 index 0000000000..e139111c7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-has-property-sym-not-found.js @@ -0,0 +1,87 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-sym-not-found.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a symbol argument that cannot be found (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P). + +---*/ +var sym = Symbol('test262'); + + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(sym in ns, false, 'in'); + assert.sameValue(Reflect.has(ns, sym), false, 'Reflect.has'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-no-iterator.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-no-iterator.js new file mode 100644 index 0000000000..59f216ce0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-no-iterator.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-no-iterator.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Module namespace objects lack a Symbol.toStringTag (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol.iterator, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), false); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js new file mode 100644 index 0000000000..92c54f3994 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-own-property-keys-sort.js @@ -0,0 +1,131 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-own-property-keys-sort.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[OwnPropertyKeys]] internal method reflects the sorted order (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Let exports be a copy of the value of O's [[Exports]] internal slot. + 2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O). + 3. Append all the entries of symbolKeys to the end of exports. + 4. Return exports. + +---*/ + +async function fn() { + const ns = await import('./own-keys-sort_FIXTURE.js'); + + var stringKeys = Object.getOwnPropertyNames(ns); + + assert.sameValue(stringKeys.length, 16); + assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"'); + assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"'); + assert.sameValue(stringKeys[2], 'A', 'stringKeys[2] === "A"'); + assert.sameValue(stringKeys[3], 'Z', 'stringKeys[3] === "Z"'); + assert.sameValue(stringKeys[4], '_', 'stringKeys[4] === "_"'); + assert.sameValue(stringKeys[5], '__', 'stringKeys[5] === "__"'); + assert.sameValue(stringKeys[6], 'a', 'stringKeys[6] === "a"'); + assert.sameValue(stringKeys[7], 'aa', 'stringKeys[7] === "aa"'); + assert.sameValue(stringKeys[8], 'az', 'stringKeys[8] === "az"'); + assert.sameValue(stringKeys[9], 'default', 'stringKeys[9] === "default"'); + assert.sameValue(stringKeys[10], 'z', 'stringKeys[10] === "z"'); + assert.sameValue(stringKeys[11], 'za', 'stringKeys[11] === "za"'); + assert.sameValue(stringKeys[12], 'zz', 'stringKeys[12] === "zz"'); + assert.sameValue(stringKeys[13], '\u03bb', 'stringKeys[13] === "\u03bb"'); + assert.sameValue(stringKeys[14], '\u03bc', 'stringKeys[14] === "\u03bc"'); + assert.sameValue(stringKeys[15], '\u03c0', 'stringKeys[15] === "\u03c0"'); + + var allKeys = Reflect.ownKeys(ns); + assert( + allKeys.length >= 17, + 'at least as many keys as defined by the module and the specification' + ); + assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"'); + assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"'); + assert.sameValue(allKeys[2], 'A', 'allKeys[2] === "A"'); + assert.sameValue(allKeys[3], 'Z', 'allKeys[3] === "Z"'); + assert.sameValue(allKeys[4], '_', 'allKeys[4] === "_"'); + assert.sameValue(allKeys[5], '__', 'allKeys[5] === "__"'); + assert.sameValue(allKeys[6], 'a', 'allKeys[6] === "a"'); + assert.sameValue(allKeys[7], 'aa', 'allKeys[7] === "aa"'); + assert.sameValue(allKeys[8], 'az', 'allKeys[8] === "az"'); + assert.sameValue(allKeys[9], 'default', 'allKeys[9] === "default"'); + assert.sameValue(allKeys[10], 'z', 'allKeys[10] === "z"'); + assert.sameValue(allKeys[11], 'za', 'allKeys[11] === "za"'); + assert.sameValue(allKeys[12], 'zz', 'allKeys[12] === "zz"'); + assert.sameValue(allKeys[13], '\u03bb', 'allKeys[13] === "\u03bb"'); + assert.sameValue(allKeys[14], '\u03bc', 'allKeys[14] === "\u03bc"'); + assert.sameValue(allKeys[15], '\u03c0', 'allKeys[15] === "\u03c0"'); + assert( + allKeys.indexOf(Symbol.toStringTag) > 15, + 'keys array includes Symbol.toStringTag' + ); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-object.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-object.js new file mode 100644 index 0000000000..c8ceab4c44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-object.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prevent-extensions-object.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[PreventExtensions]] internal method returns `true` (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./empty_FIXTURE.js'); + + // This invocation should not throw an exception + Object.preventExtensions(ns); + + assert.sameValue(Reflect.preventExtensions(ns), true); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-reflect.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-reflect.js new file mode 100644 index 0000000000..647a3041b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prevent-extensions-reflect.js @@ -0,0 +1,81 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prevent-extensions-reflect.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[PreventExtensions]] internal method returns `true` (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./empty_FIXTURE.js'); + + assert.sameValue(Reflect.preventExtensions(ns), true); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prop-descs.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prop-descs.js new file mode 100644 index 0000000000..f1f8f52cad --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prop-descs.js @@ -0,0 +1,111 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prop-descs.case +// - src/dynamic-import/namespace/await.template +/*--- +description: imported object properties descriptors (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + // propertyHelper.js is not appropriate for this test because it assumes that + // the object exposes the ordinary object's implementation of [[Get]], [[Set]], +// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic +// object does not. +var desc = Object.getOwnPropertyDescriptor(ns, 'default'); + +assert.sameValue(desc.value, 42, 'default: value is 42'); +assert.sameValue(desc.enumerable, true, 'default: is enumerable'); +assert.sameValue(desc.writable, true, 'default: is writable'); +assert.sameValue(desc.configurable, false, 'default: is non-configurable'); + +desc = Object.getOwnPropertyDescriptor(ns, 'local1'); + +assert.sameValue(desc.value, 'Test262', 'local1: value is "Test262"'); +assert.sameValue(desc.enumerable, true, 'local1: is enumerable'); +assert.sameValue(desc.writable, true, 'local1: is writable'); +assert.sameValue(desc.configurable, false, 'local1: is non-configurable'); + +desc = Object.getOwnPropertyDescriptor(ns, 'renamed'); + +assert.sameValue(desc.value, 'TC39', 'renamed: value is TC39"'); +assert.sameValue(desc.enumerable, true, 'renamed: is enumerable'); +assert.sameValue(desc.writable, true, 'renamed: is writable'); +assert.sameValue(desc.configurable, false, 'renamed: is non-configurable'); + +desc = Object.getOwnPropertyDescriptor(ns, 'indirect'); + +assert.sameValue(desc.value, 'Test262', 'indirect: value is Test262"'); +assert.sameValue(desc.enumerable, true, 'indirect: is enumerable'); +assert.sameValue(desc.writable, true, 'indirect: is writable'); +assert.sameValue(desc.configurable, false, 'indirect: is non-configurable'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prototype.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prototype.js new file mode 100644 index 0000000000..e3d3d107a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-prototype.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prototype.case +// - src/dynamic-import/namespace/await.template +/*--- +description: Module namespace object prototype is null (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(ns instanceof Object, false); + assert.sameValue(Object.getPrototypeOf(ns), null, 'prototype is null'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-no-strict.js new file mode 100644 index 0000000000..1e0f8f6c92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-no-strict.js @@ -0,0 +1,109 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-no-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Set]] internal method consistently returns `false`, No Strict Mode (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ +var sym = Symbol('test262'); + + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1'); + assert.sameValue(ns.local1 = null, null, 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2'); + assert.sameValue(ns.local2 = null, null, 'AssignmentExpression: local2'); + + assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed'); + assert.sameValue(ns.renamed = null, null, 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect'); + assert.sameValue(ns.indirect = null, null, 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default'); + assert.sameValue(ns.default = null, null, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, null), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.sameValue(ns[Symbol.toStringTag] = null, null, 'AssignmentExpression: Symbol.toStringTag'); + + assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym'); + assert.sameValue(ns[sym] = null, null, 'AssignmentExpression: sym'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of-null.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of-null.js new file mode 100644 index 0000000000..d8fae22d3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of-null.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-prototype-of-null.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[SetPrototypeOf]] internal method returns `true` if passed `null` (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./empty_FIXTURE.js'); + + assert.sameValue(typeof Object.setPrototypeOf, 'function'); + assert.sameValue(ns, Object.setPrototypeOf(ns, null)); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of.js new file mode 100644 index 0000000000..8d295cd2cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-prototype-of.js @@ -0,0 +1,87 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-prototype-of.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[SetPrototypeOf]] internal method returns `false` (value from await resolving) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + var newProto = {}; + + assert.sameValue(typeof Object.setPrototypeOf, 'function'); + + assert.throws(TypeError, function() { + Object.setPrototypeOf(ns, newProto); + }); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-no-strict.js new file mode 100644 index 0000000000..7556eb86a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-no-strict.js @@ -0,0 +1,101 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-same-values-no-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Set]] internal method consistently returns `false` even setting the same value - No Strict Mode (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1'); + assert.sameValue(ns.local1 = 'Test262', 'Test262', 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed'); + assert.sameValue(ns.renamed = 'TC39', 'TC39', 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect'); + assert.sameValue(ns.indirect = 'Test262', 'Test262', 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default'); + assert.sameValue(ns.default = 42, 42, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.sameValue(ns[Symbol.toStringTag] = ns[Symbol.toStringTag], 'Module', 'AssignmentExpression: Symbol.toStringTag'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-strict-strict.js new file mode 100644 index 0000000000..6973c733dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-same-values-strict-strict.js @@ -0,0 +1,112 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-same-values-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Set]] internal method consistently returns `false` even setting the same value - Strict Mode (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1'); + assert.throws(TypeError, function() { + ns.local1 = 'Test262'; + }, 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed'); + assert.throws(TypeError, function() { + ns.renamed = 'TC39'; + }, 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect'); + assert.throws(TypeError, function() { + ns.indirect = 'Test262'; + }, 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default'); + assert.throws(TypeError, function() { + ns.default = 42; + }, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { + ns[Symbol.toStringTag] = ns[Symbol.toStringTag]; + }, 'AssignmentExpression: Symbol.toStringTag'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-strict-strict.js new file mode 100644 index 0000000000..5119a5d350 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/await-ns-set-strict-strict.js @@ -0,0 +1,124 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-strict.case +// - src/dynamic-import/namespace/await.template +/*--- +description: The [[Set]] internal method consistently returns `false`, Strict Mode (value from await resolving) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ +var sym = Symbol('test262'); + + +async function fn() { + const ns = await import('./module-code_FIXTURE.js'); + + assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1'); + assert.throws(TypeError, function() { + ns.local1 = null; + }, 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2'); + assert.throws(TypeError, function() { + ns.local2 = null; + }, 'AssignmentExpression: local2'); + + assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed'); + assert.throws(TypeError, function() { + ns.renamed = null; + }, 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect'); + assert.throws(TypeError, function() { + ns.indirect = null; + }, 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default'); + assert.throws(TypeError, function() { + ns.default = null; + }, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, null), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { + ns[Symbol.toStringTag] = null; + }, 'AssignmentExpression: Symbol.toStringTag'); + + assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym'); + assert.throws(TypeError, function() { + ns[sym] = null; + }, 'AssignmentExpression: sym'); +} + +fn().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/default-property-not-set-own.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/default-property-not-set-own.js new file mode 100644 index 0000000000..ca08d02709 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/default-property-not-set-own.js @@ -0,0 +1,34 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: The default property is not set the if the module doesn't export any default +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + ... + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. +---*/ + +import('./empty_FIXTURE.js').then(ns => { + + assert.sameValue(Object.prototype.hasOwnProperty.call(ns, 'default'), false); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/define-own-property_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/define-own-property_FIXTURE.js new file mode 100644 index 0000000000..5dbd9208c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/define-own-property_FIXTURE.js @@ -0,0 +1,8 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var local1; +var local2; +export { local2 as renamed }; +export { local1 as indirect } from './define-own-property_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/empty_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/empty_FIXTURE.js new file mode 100644 index 0000000000..9200e13455 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/empty_FIXTURE.js @@ -0,0 +1,3 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named-end_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named-end_FIXTURE.js new file mode 100644 index 0000000000..270996ee52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named-end_FIXTURE.js @@ -0,0 +1,7 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +var x = 42; +export var namedOther = null; +export { x as default }; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named_FIXTURE.js new file mode 100644 index 0000000000..55135279d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-named_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export * as namedNS2 from './get-nested-namespace-dflt-skip-named-end_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js new file mode 100644 index 0000000000..56f2668efe --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js @@ -0,0 +1,6 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var productionOther = null; +export default 42; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod_FIXTURE.js new file mode 100644 index 0000000000..15458ce109 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-dflt-skip-prod_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export * as productionNS2 from './get-nested-namespace-dflt-skip-prod-end_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-1_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-1_FIXTURE.js new file mode 100644 index 0000000000..3eb0886e15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-1_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export * as exportns from './get-nested-namespace-props-nrml-2_FIXTURE.js'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-2_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-2_FIXTURE.js new file mode 100644 index 0000000000..7ec2cc2b4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-2_FIXTURE.js @@ -0,0 +1,24 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +var notExportedVar; +let notExportedLet; +const notExportedConst = null; +function notExportedFunc() {} +function* notExportedGen() {} +class notExportedClass {} + +var starAsBindingId; + +export var starAsVarDecl; +export let starAsLetDecl; +export const starAsConstDecl = null; +export function starAsFuncDecl() {} +export function* starAsGenDecl() {} +export class starAsClassDecl {} +export { starAsBindingId }; +export { starAsBindingId as starIdName }; +export { starAsIndirectIdName } from './get-nested-namespace-props-nrml-3_FIXTURE.js'; +export { starAsIndirectIdName as starAsIndirectIdName2 } from './get-nested-namespace-props-nrml-3_FIXTURE.js'; +export * as namespaceBinding from './get-nested-namespace-props-nrml-3_FIXTURE.js';; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-3_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-3_FIXTURE.js new file mode 100644 index 0000000000..11ccdef663 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/get-nested-namespace-props-nrml-3_FIXTURE.js @@ -0,0 +1,6 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var indirectIdName; +export var starAsIndirectIdName; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/module-code_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/module-code_FIXTURE.js new file mode 100644 index 0000000000..bfe3fbce80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/module-code_FIXTURE.js @@ -0,0 +1,11 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +// exports: default === 42, local1 === 'Test262', renamed === 'TC39', indirect === 'Test262' + +export var local1 = 'Test262'; +var local2 = 'TC39'; +export { local2 as renamed }; +export { local1 as indirect } from './module-code_FIXTURE.js'; +export default 42; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/own-keys-sort_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/own-keys-sort_FIXTURE.js new file mode 100644 index 0000000000..6f21dacdbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/own-keys-sort_FIXTURE.js @@ -0,0 +1,21 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +var x; +export { x as π }; // u03c0 +export { x as az }; +export { x as __ }; +export { x as za }; +export { x as Z }; +export { x as \u03bc }; +export { x as z }; +export { x as zz }; +export { x as a }; +export { x as A }; +export { x as aa }; +export { x as λ }; // u03bb +export { x as _ }; +export { x as $$ }; +export { x as $ }; +export default null; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-Symbol-toStringTag.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-Symbol-toStringTag.js new file mode 100644 index 0000000000..64cb2e8f88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-Symbol-toStringTag.js @@ -0,0 +1,97 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-Symbol-toStringTag.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Module namespace objects have a Symbol.toStringTag (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: false }. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(ns[Symbol.toStringTag], 'Module'); + + // propertyHelper.js is not appropriate for this test because it assumes that + // the object exposes the ordinary object's implementation of [[Get]], [[Set]], +// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic +// object does not. +var desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag); + +assert.sameValue(desc.enumerable, false, 'reports as non-enumerable'); +assert.sameValue(desc.writable, false, 'reports as non-writable'); +assert.sameValue(desc.configurable, false, 'reports as non-configurable'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-define-own-property.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-define-own-property.js new file mode 100644 index 0000000000..03547833e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-define-own-property.js @@ -0,0 +1,176 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-define-own-property.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[DefineOwnProperty]] internal method returns `true` if no change is requested, and `false` otherwise. (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol.iterator, Reflect, Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ +var sym = Symbol('test262'); + +const exported = ['local1', 'renamed', 'indirect']; + + +import('./define-own-property_FIXTURE.js').then(ns => { + + // Non-existant properties. + + for (const key of ['local2', 0, sym, Symbol.iterator]) { + assert.sameValue( + Reflect.defineProperty(ns, key, {}), + false, + 'Reflect.defineProperty: ' + key.toString() + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, key, {}); + }, 'Object.defineProperty: ' + key.toString()); + } + + // Own properties. No change requested. + + for (const key of ([...exported, Symbol.toStringTag])) { + assert.sameValue( + Reflect.defineProperty(ns, key, {}), + true, + `No change requested, Reflect.defineProperty: ${key.toString()}` + ); + assert.sameValue( + Object.defineProperty(ns, key, {}), + ns, + `No change requested, Object.defineProperty: ${key.toString()}` + ); + + } + + assert.sameValue( + Reflect.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: false}), + true, + 'Reflect.defineProperty: indirect' + ); + assert.sameValue( + Object.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: false}), + ns, + 'Object.defineProperty: indirect' + ); + + assert.sameValue( + Reflect.defineProperty(ns, Symbol.toStringTag, + {value: "Module", writable: false, enumerable: false, + configurable: false}), + true, + 'Reflect.defineProperty: Symbol.toStringTag' + ); + assert.sameValue( + Object.defineProperty(ns, Symbol.toStringTag, + {value: "Module", writable: false, enumerable: false, + configurable: false}), + ns, + 'Object.defineProperty: Symbol.toStringTag' + ); + + + // Own properties. Change requested. + + for (const key of ([...exported, Symbol.toStringTag])) { + assert.sameValue( + Reflect.defineProperty(ns, key, {value: 123}), + false, + `Change requested, Reflect.defineProperty: ${key.toString()}` + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, key, {value: 123}); + }, `Change requested, Object.defineProperty: ${key.toString()}`); + } + + assert.sameValue( + Reflect.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: true}), + false, + 'Reflect.defineProperty: indirect' + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, 'indirect', + {writable: true, enumerable: true, configurable: true}); + }, 'Object.defineProperty: indirect'); + + assert.sameValue( + Reflect.defineProperty(ns, Symbol.toStringTag, + {value: "module", writable: false, enumerable: false, + configurable: false}), + false, + 'Reflect.defineProperty: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { + Object.defineProperty(ns, Symbol.toStringTag, + {value: "module", writable: false, enumerable: false, + configurable: false}); + }, 'Object.defineProperty: Symbol.toStringTag'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-no-strict.js new file mode 100644 index 0000000000..5b67e2fc80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-no-strict.js @@ -0,0 +1,111 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-exported-init-no-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Delete]] behavior for a key that describes an initialized exported binding on non strict mode (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(delete ns.default, false, 'delete: default'); + assert.sameValue( + Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default' + ); + assert.sameValue(ns.default, 42, 'binding unmodified: default'); + + assert.sameValue(delete ns.local1, false, 'delete: local1'); + assert.sameValue( + Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1' + ); + assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1'); + + assert.sameValue(delete ns.renamed, false, 'delete: renamed'); + assert.sameValue( + Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed' + ); + assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed'); + + assert.sameValue(delete ns.indirect, false, 'delete: indirect'); + assert.sameValue( + Reflect.deleteProperty(ns, 'indirect'), + false, + 'Reflect.deleteProperty: indirect' + ); + assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-strict-strict.js new file mode 100644 index 0000000000..f804eb8e97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-exported-init-strict-strict.js @@ -0,0 +1,120 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-exported-init-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Delete]] behavior for a key that describes an initialized exported binding on strict mode (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.throws(TypeError, function() { + delete ns.default; + }, 'delete: default'); + assert.sameValue( + Reflect.deleteProperty(ns, 'default'), false, 'Reflect.deleteProperty: default' + ); + assert.sameValue(ns.default, 42, 'binding unmodified: default'); + + assert.throws(TypeError, function() { + delete ns.local1; + }, 'delete: local1'); + assert.sameValue( + Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1' + ); + assert.sameValue(ns.local1, 'Test262', 'binding unmodified: local1'); + + assert.throws(TypeError, function() { + delete ns.renamed; + }, 'delete: renamed'); + assert.sameValue( + Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed' + ); + assert.sameValue(ns.renamed, 'TC39', 'binding unmodified: renamed'); + + assert.throws(TypeError, function() { + delete ns.indirect; + }, 'delete: indirect'); + assert.sameValue( + Reflect.deleteProperty(ns, 'indirect'), + false, + 'Reflect.deleteProperty: indirect' + ); + assert.sameValue(ns.indirect, 'Test262', 'binding unmodified: indirect'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-no-strict.js new file mode 100644 index 0000000000..3ea0e7e799 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-no-strict.js @@ -0,0 +1,103 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-non-exported-no-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Delete]] behavior for a key that does not describe an exported binding (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +import('./empty_FIXTURE.js').then(ns => { + + assert(delete ns.undef, 'delete: undef'); + assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef'); + + assert(delete ns.default, 'delete: default'); + assert( + Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default' + ); + + assert.sameValue(delete ns[Symbol.toStringTag], false, 'delete: Symbol.toStringTag'); + assert.sameValue( + Reflect.deleteProperty(ns, Symbol.toStringTag), false, + 'Reflect.deleteProperty: Symbol.toStringTag' + ); + + var sym = Symbol('test262'); + assert(delete ns[sym], 'delete: symbol'); + assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-strict-strict.js new file mode 100644 index 0000000000..782360533d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-delete-non-exported-strict-strict.js @@ -0,0 +1,104 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-delete-non-exported-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Delete]] behavior for a key that does not describe an exported binding (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryDelete(O, P). + 3. Let exports be O.[[Exports]]. + 4. If P is an element of exports, return false. + 5. Return true. + +---*/ + +import('./empty_FIXTURE.js').then(ns => { + + assert(delete ns.undef, 'delete: undef'); + assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef'); + + assert(delete ns.default, 'delete: default'); + assert( + Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default' + ); + + assert.sameValue( + Reflect.deleteProperty(ns, Symbol.toStringTag), false, + 'Reflect.deleteProperty: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag'); + + var sym = Symbol('test262'); + assert(delete ns[sym], 'delete: symbol'); + assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-extensible.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-extensible.js new file mode 100644 index 0000000000..5978629216 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-extensible.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-extensible.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Module namespace objects are not extensible. (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(Object.isExtensible(ns), false); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-direct.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-direct.js new file mode 100644 index 0000000000..2c7205228b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-direct.js @@ -0,0 +1,125 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-nested-namespace-dflt-direct.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Direct Default exports are included in an imported module namespace object when a namespace object is created. (value from promise then) +esid: sec-finishdynamicimport +features: [export-star-as-namespace-from-module, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 6. Let binding be ! m.ResolveExport(P, « »). + 7. Assert: binding is a ResolvedBinding Record. + 8. Let targetModule be binding.[[Module]]. + 9. Assert: targetModule is not undefined. + 10. If binding.[[BindingName]] is "*namespace*", then + 11. Return ? GetModuleNamespace(targetModule). + + Runtime Semantics: GetModuleNamespace + [...] + 3. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, + i. Let resolution be ? module.ResolveExport(name, « », « »). + ii. If resolution is null, throw a SyntaxError exception. + iii. If resolution is not "ambiguous", append name to + unambiguousNames. + d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames). + [...] + +---*/ + +import('./get-nested-namespace-dflt-skip-prod_FIXTURE.js').then(ns => { + + var desc = Object.getOwnPropertyDescriptor(ns, 'productionNS2'); + + assert.sameValue(desc.enumerable, true, 'ns.productionNS2: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.productionNS2: is writable'); + assert.sameValue(desc.configurable, false, 'ns.productionNS2: is non-configurable'); + + var keys = Object.getOwnPropertyNames(ns.productionNS2); + + assert.sameValue(keys.length, 2); + assert.sameValue(keys[0], 'default'); + assert.sameValue(keys[1], 'productionOther'); + + desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'productionOther'); + + assert.sameValue(desc.value, null, 'ns.productionNS2.productionOther: value is null'); + assert.sameValue(desc.enumerable, true, 'ns.productionNS2.productionOther: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.productionNS2.productionOther: is writable'); + assert.sameValue(desc.configurable, false, 'ns.productionNS2.productionOther: is non-configurable'); + + desc = Object.getOwnPropertyDescriptor(ns.productionNS2, 'default'); + + assert.sameValue(desc.value, 42, 'ns.productionNS2.default value is 42'); + assert.sameValue(desc.enumerable, true, 'ns.productionNS2.default is enumerable'); + assert.sameValue(desc.writable, true, 'ns.productionNS2.default is writable'); + assert.sameValue(desc.configurable, false, 'ns.productionNS2.default is non-configurable'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-indirect.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-indirect.js new file mode 100644 index 0000000000..57330345b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-dflt-indirect.js @@ -0,0 +1,125 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-nested-namespace-dflt-indirect.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Inirect Default exports are included in an imported module namespace object when a namespace object is created. (value from promise then) +esid: sec-finishdynamicimport +features: [export-star-as-namespace-from-module, dynamic-import] +flags: [generated, module, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 6. Let binding be ! m.ResolveExport(P, « »). + 7. Assert: binding is a ResolvedBinding Record. + 8. Let targetModule be binding.[[Module]]. + 9. Assert: targetModule is not undefined. + 10. If binding.[[BindingName]] is "*namespace*", then + 11. Return ? GetModuleNamespace(targetModule). + + Runtime Semantics: GetModuleNamespace + [...] + 3. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, + i. Let resolution be ? module.ResolveExport(name, « », « »). + ii. If resolution is null, throw a SyntaxError exception. + iii. If resolution is not "ambiguous", append name to + unambiguousNames. + d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames). + [...] + +---*/ + +import('./get-nested-namespace-dflt-skip-named_FIXTURE.js').then(ns => { + + var desc = Object.getOwnPropertyDescriptor(ns, 'namedNS2'); + + assert.sameValue(desc.enumerable, true, 'ns.namedNS2: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.namedNS2: is writable'); + assert.sameValue(desc.configurable, false, 'ns.namedNS2: is non-configurable'); + + var keys = Object.getOwnPropertyNames(ns.namedNS2); + + assert.sameValue(keys.length, 2); + assert.sameValue(keys[0], 'default'); + assert.sameValue(keys[1], 'namedOther'); + + desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'namedOther'); + + assert.sameValue(desc.value, null, 'ns.namedNS2.namedOther value is null'); + assert.sameValue(desc.enumerable, true, 'ns.namedNS2.namedOther: is enumerable'); + assert.sameValue(desc.writable, true, 'ns.namedNS2.namedOther: is writable'); + assert.sameValue(desc.configurable, false, 'ns.namedNS2.namedOther: is non-configurable'); + + desc = Object.getOwnPropertyDescriptor(ns.namedNS2, 'default'); + + assert.sameValue(desc.value, 42, 'ns.namedNS2.default value is 42'); + assert.sameValue(desc.enumerable, true, 'ns.namedNS2.default is enumerable'); + assert.sameValue(desc.writable, true, 'ns.namedNS2.default is writable'); + assert.sameValue(desc.configurable, false, 'ns.namedNS2.default is non-configurable'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-props-nrml.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-props-nrml.js new file mode 100644 index 0000000000..07d0fd4f67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-nested-namespace-props-nrml.js @@ -0,0 +1,122 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-nested-namespace-props-nrml.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Module namespace object reports properties for all ExportEntries of all dependencies. (value from promise then) +esid: sec-finishdynamicimport +features: [export-star-as-namespace-from-module, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 12. For each ImportEntry Record in in module.[[ImportEntries]], do + a. Let importedModule be ? HostResolveImportedModule(module, + in.[[ModuleRequest]]). + b. If in.[[ImportName]] is "*", then + i. Let namespace be ? GetModuleNamespace(importedModule). + [...] + + Runtime Semantics: GetModuleNamespace + 3. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, + i. Let resolution be ? module.ResolveExport(name, « », « »). + ii. If resolution is null, throw a SyntaxError exception. + iii. If resolution is not "ambiguous", append name to + unambiguousNames. + d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames). + +---*/ +function hasOwnProperty(obj, property) { + return Object.prototype.hasOwnProperty.call(obj, property); +} + + +import('./get-nested-namespace-props-nrml-1_FIXTURE.js').then(ns => { + + // Export entries defined by a re-exported as exportns module + assert(hasOwnProperty(ns.exportns, 'starAsVarDecl'), 'starssVarDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsLetDecl'), 'starSsLetDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsConstDecl'), 'starSsConstDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsFuncDecl'), 'starAsFuncDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsGenDecl'), 'starAsGenDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsClassDecl'), 'starAsClassDecl'); + assert(hasOwnProperty(ns.exportns, 'starAsBindingId'), 'starAsBindingId'); + assert(hasOwnProperty(ns.exportns, 'starIdName'), 'starIdName'); + assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName'), 'starAsIndirectIdName'); + assert(hasOwnProperty(ns.exportns, 'starAsIndirectIdName2'), 'starAsIndirectIdName2'); + assert(hasOwnProperty(ns.exportns, 'namespaceBinding'), 'namespaceBinding'); + + // Bindings that were not exported from any module + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedVar'), false, 'nonExportedVar'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedLet'), false, 'nonExportedLet'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedConst'), false, 'nonExportedConst'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedFunc'), false, 'nonExportedFunc'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedGen'), false, 'nonExportedGen'); + assert.sameValue(hasOwnProperty(ns.exportns, 'nonExportedClass'), false, 'nonExportedClass'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-found-init.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-found-init.js new file mode 100644 index 0000000000..c71519dfe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-found-init.js @@ -0,0 +1,123 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-own-property-str-found-init.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[GetOwnProperty]] internal method with a string argument describing an initialized binding (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P). + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is not an element of exports, return undefined. + 4. Let value be ? O.[[Get]](P, O). + 5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true, + [[Enumerable]]: true, [[Configurable]]: false }. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + var desc; + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'local1'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'local1'); + assert.sameValue(desc.value, 'Test262'); + assert.sameValue(desc.enumerable, true, 'local1 enumerable'); + assert.sameValue(desc.writable, true, 'local1 writable'); + assert.sameValue(desc.configurable, false, 'local1 configurable'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'renamed'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'renamed'); + assert.sameValue(desc.value, 'TC39'); + assert.sameValue(desc.enumerable, true, 'renamed enumerable'); + assert.sameValue(desc.writable, true, 'renamed writable'); + assert.sameValue(desc.configurable, false, 'renamed configurable'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'indirect'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'indirect'); + assert.sameValue(desc.value, 'Test262'); + assert.sameValue(desc.enumerable, true, 'indirect enumerable'); + assert.sameValue(desc.writable, true, 'indirect writable'); + assert.sameValue(desc.configurable, false, 'indirect configurable'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'default'), true + ); + desc = Object.getOwnPropertyDescriptor(ns, 'default'); + assert.sameValue(desc.value, 42); + assert.sameValue(desc.enumerable, true, 'default enumerable'); + assert.sameValue(desc.writable, true, 'default writable'); + assert.sameValue(desc.configurable, false, 'default configurable'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-not-found.js new file mode 100644 index 0000000000..b171ee36a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-str-not-found.js @@ -0,0 +1,116 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-own-property-str-not-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[GetOwnProperty]] internal method with a string argument describing a binding that cannot be found (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P). + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is not an element of exports, return undefined. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + var desc; + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'local2'), + false, + 'hasOwnProperty: local2' + ); + desc = Object.getOwnPropertyDescriptor(ns, 'local2'); + assert.sameValue(desc, undefined, 'property descriptor for "local2"'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'toStringTag'), + false, + 'hasOwnProperty: toStringTag' + ); + desc = Object.getOwnPropertyDescriptor(ns, 'toStringTag'); + assert.sameValue(desc, undefined, 'property descriptor for "toStringTag"'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, 'iterator'), + false, + 'hasOwnProperty: iterator' + ); + desc = Object.getOwnPropertyDescriptor(ns, 'iterator'); + assert.sameValue(desc, undefined, 'property descriptor for "iterator"'); + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, '__proto__'), + false, + 'hasOwnProperty: __proto__' + ); + desc = Object.getOwnPropertyDescriptor(ns, '__proto__'); + assert.sameValue(desc, undefined, 'property descriptor for "__proto__"'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-sym.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-sym.js new file mode 100644 index 0000000000..7cec74f55d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-own-property-sym.js @@ -0,0 +1,94 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-own-property-sym.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[GetOwnProperty]] internal method with a Symbol argument (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ +var notFound = Symbol('test262'); + + +import('./module-code_FIXTURE.js').then(ns => { + + var desc; + + assert.sameValue( + Object.prototype.hasOwnProperty.call(ns, Symbol.toStringTag), true + ); + desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag); + assert.sameValue(desc.value, ns[Symbol.toStringTag]); + assert.sameValue(desc.enumerable, false, 'Symbol.toStringTag enumerable'); + assert.sameValue(desc.writable, false, 'Symbol.toStringTag writable'); + assert.sameValue(desc.configurable, false, 'Symbol.toStringTag configurable'); + + assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false); + desc = Object.getOwnPropertyDescriptor(ns, notFound); + assert.sameValue(desc, undefined); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-found.js new file mode 100644 index 0000000000..e3945478e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-found.js @@ -0,0 +1,87 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-str-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[Get]] internal method with a string argument for exported initialized bindings. (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 12. Let targetEnvRec be targetEnv's EnvironmentRecord. + 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true). + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(ns.local1, 'Test262'); + assert.sameValue(ns.renamed, 'TC39'); + assert.sameValue(ns.indirect, 'Test262'); + assert.sameValue(ns.default, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-not-found.js new file mode 100644 index 0000000000..fc013a8e6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-str-not-found.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-str-not-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[Get]] internal method with a string argument for non-exported bindings (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 3. Let exports be the value of O's [[Exports]] internal slot. + 4. If P is not an element of exports, return undefined. + +---*/ +var local2; // not used + + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(ns.local2, undefined, 'key: local2'); + assert.sameValue(ns.toStringTag, undefined, 'key: toStringTag'); + assert.sameValue(ns.iterator, undefined, 'key: iterator'); + assert.sameValue(ns.__proto__, undefined, 'key: __proto__'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-found.js new file mode 100644 index 0000000000..847c9a0568 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-found.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-sym-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[Get]] internal method with a symbol argument that can be found (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryGet(O, P, Receiver). + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(typeof ns[Symbol.toStringTag], 'string'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-not-found.js new file mode 100644 index 0000000000..b887351ee5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-get-sym-not-found.js @@ -0,0 +1,84 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-get-sym-not-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[Get]] internal method with a symbol argument that cannot be found (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. If Type(P) is Symbol, then + a. Return ? OrdinaryGet(O, P, Receiver). + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(ns[Symbol('test262')], undefined, 'Symbol: test262'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-found-init.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-found-init.js new file mode 100644 index 0000000000..eb8d24df60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-found-init.js @@ -0,0 +1,94 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-str-found-init.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a string argument for exported initialized bindings. (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is an element of exports, return true. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert('local1' in ns, 'in: local1'); + assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1'); + + assert('renamed' in ns, 'in: renamed'); + assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed'); + + assert('indirect' in ns, 'in: indirect'); + assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect'); + + assert('default' in ns, 'in: default'); + assert(Reflect.has(ns, 'default'), 'Reflect.has: default'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-not-found.js new file mode 100644 index 0000000000..fc548a6afa --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-str-not-found.js @@ -0,0 +1,101 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-str-not-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a string argument for non-exported bindings (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + [...] + 2. Let exports be the value of O's [[Exports]] internal slot. + 3. If P is an element of exports, return true. + 4. Return false. + +---*/ +var local2; // not used + + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue('local2' in ns, false, 'in: local2'); + assert.sameValue(Reflect.has(ns, 'local2'), false, 'Reflect.has: local2'); + + assert.sameValue('toStringTag' in ns, false, 'in: toStringTag'); + assert.sameValue( + Reflect.has(ns, 'toStringTag'), false, 'Reflect.has: toStringTag' + ); + + assert.sameValue('iterator' in ns, false, 'in: iterator'); + assert.sameValue(Reflect.has(ns, 'iterator'), false, 'Reflect.has: iterator'); + + assert.sameValue('__proto__' in ns, false, 'in: __proto__'); + assert.sameValue( + Reflect.has(ns, '__proto__'), false, 'Reflect.has: __proto__' + ); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-found.js new file mode 100644 index 0000000000..f22014c83a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-found.js @@ -0,0 +1,83 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-sym-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a symbol argument that can be found (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P). + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag'); + assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-not-found.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-not-found.js new file mode 100644 index 0000000000..4fa6d5493d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-has-property-sym-not-found.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-has-property-sym-not-found.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Behavior of the [[HasProperty]] internal method with a symbol argument that cannot be found (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P). + +---*/ +var sym = Symbol('test262'); + + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(sym in ns, false, 'in'); + assert.sameValue(Reflect.has(ns, sym), false, 'Reflect.has'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-no-iterator.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-no-iterator.js new file mode 100644 index 0000000000..b15ff59470 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-no-iterator.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-no-iterator.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Module namespace objects lack a Symbol.toStringTag (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol.iterator, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), false); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js new file mode 100644 index 0000000000..cf0cf65c9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-own-property-keys-sort.js @@ -0,0 +1,129 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-own-property-keys-sort.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[OwnPropertyKeys]] internal method reflects the sorted order (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol.toStringTag, dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Let exports be a copy of the value of O's [[Exports]] internal slot. + 2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O). + 3. Append all the entries of symbolKeys to the end of exports. + 4. Return exports. + +---*/ + +import('./own-keys-sort_FIXTURE.js').then(ns => { + + var stringKeys = Object.getOwnPropertyNames(ns); + + assert.sameValue(stringKeys.length, 16); + assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"'); + assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"'); + assert.sameValue(stringKeys[2], 'A', 'stringKeys[2] === "A"'); + assert.sameValue(stringKeys[3], 'Z', 'stringKeys[3] === "Z"'); + assert.sameValue(stringKeys[4], '_', 'stringKeys[4] === "_"'); + assert.sameValue(stringKeys[5], '__', 'stringKeys[5] === "__"'); + assert.sameValue(stringKeys[6], 'a', 'stringKeys[6] === "a"'); + assert.sameValue(stringKeys[7], 'aa', 'stringKeys[7] === "aa"'); + assert.sameValue(stringKeys[8], 'az', 'stringKeys[8] === "az"'); + assert.sameValue(stringKeys[9], 'default', 'stringKeys[9] === "default"'); + assert.sameValue(stringKeys[10], 'z', 'stringKeys[10] === "z"'); + assert.sameValue(stringKeys[11], 'za', 'stringKeys[11] === "za"'); + assert.sameValue(stringKeys[12], 'zz', 'stringKeys[12] === "zz"'); + assert.sameValue(stringKeys[13], '\u03bb', 'stringKeys[13] === "\u03bb"'); + assert.sameValue(stringKeys[14], '\u03bc', 'stringKeys[14] === "\u03bc"'); + assert.sameValue(stringKeys[15], '\u03c0', 'stringKeys[15] === "\u03c0"'); + + var allKeys = Reflect.ownKeys(ns); + assert( + allKeys.length >= 17, + 'at least as many keys as defined by the module and the specification' + ); + assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"'); + assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"'); + assert.sameValue(allKeys[2], 'A', 'allKeys[2] === "A"'); + assert.sameValue(allKeys[3], 'Z', 'allKeys[3] === "Z"'); + assert.sameValue(allKeys[4], '_', 'allKeys[4] === "_"'); + assert.sameValue(allKeys[5], '__', 'allKeys[5] === "__"'); + assert.sameValue(allKeys[6], 'a', 'allKeys[6] === "a"'); + assert.sameValue(allKeys[7], 'aa', 'allKeys[7] === "aa"'); + assert.sameValue(allKeys[8], 'az', 'allKeys[8] === "az"'); + assert.sameValue(allKeys[9], 'default', 'allKeys[9] === "default"'); + assert.sameValue(allKeys[10], 'z', 'allKeys[10] === "z"'); + assert.sameValue(allKeys[11], 'za', 'allKeys[11] === "za"'); + assert.sameValue(allKeys[12], 'zz', 'allKeys[12] === "zz"'); + assert.sameValue(allKeys[13], '\u03bb', 'allKeys[13] === "\u03bb"'); + assert.sameValue(allKeys[14], '\u03bc', 'allKeys[14] === "\u03bc"'); + assert.sameValue(allKeys[15], '\u03c0', 'allKeys[15] === "\u03c0"'); + assert( + allKeys.indexOf(Symbol.toStringTag) > 15, + 'keys array includes Symbol.toStringTag' + ); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-object.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-object.js new file mode 100644 index 0000000000..20f425acee --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-object.js @@ -0,0 +1,82 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prevent-extensions-object.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[PreventExtensions]] internal method returns `true` (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./empty_FIXTURE.js').then(ns => { + + // This invocation should not throw an exception + Object.preventExtensions(ns); + + assert.sameValue(Reflect.preventExtensions(ns), true); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-reflect.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-reflect.js new file mode 100644 index 0000000000..afbdc8e7df --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prevent-extensions-reflect.js @@ -0,0 +1,79 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prevent-extensions-reflect.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[PreventExtensions]] internal method returns `true` (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./empty_FIXTURE.js').then(ns => { + + assert.sameValue(Reflect.preventExtensions(ns), true); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prop-descs.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prop-descs.js new file mode 100644 index 0000000000..5cf35f9427 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prop-descs.js @@ -0,0 +1,109 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prop-descs.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: imported object properties descriptors (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + // propertyHelper.js is not appropriate for this test because it assumes that + // the object exposes the ordinary object's implementation of [[Get]], [[Set]], +// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic +// object does not. +var desc = Object.getOwnPropertyDescriptor(ns, 'default'); + +assert.sameValue(desc.value, 42, 'default: value is 42'); +assert.sameValue(desc.enumerable, true, 'default: is enumerable'); +assert.sameValue(desc.writable, true, 'default: is writable'); +assert.sameValue(desc.configurable, false, 'default: is non-configurable'); + +desc = Object.getOwnPropertyDescriptor(ns, 'local1'); + +assert.sameValue(desc.value, 'Test262', 'local1: value is "Test262"'); +assert.sameValue(desc.enumerable, true, 'local1: is enumerable'); +assert.sameValue(desc.writable, true, 'local1: is writable'); +assert.sameValue(desc.configurable, false, 'local1: is non-configurable'); + +desc = Object.getOwnPropertyDescriptor(ns, 'renamed'); + +assert.sameValue(desc.value, 'TC39', 'renamed: value is TC39"'); +assert.sameValue(desc.enumerable, true, 'renamed: is enumerable'); +assert.sameValue(desc.writable, true, 'renamed: is writable'); +assert.sameValue(desc.configurable, false, 'renamed: is non-configurable'); + +desc = Object.getOwnPropertyDescriptor(ns, 'indirect'); + +assert.sameValue(desc.value, 'Test262', 'indirect: value is Test262"'); +assert.sameValue(desc.enumerable, true, 'indirect: is enumerable'); +assert.sameValue(desc.writable, true, 'indirect: is writable'); +assert.sameValue(desc.configurable, false, 'indirect: is non-configurable'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prototype.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prototype.js new file mode 100644 index 0000000000..7ab7e524e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-prototype.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-prototype.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: Module namespace object prototype is null (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(ns instanceof Object, false); + assert.sameValue(Object.getPrototypeOf(ns), null, 'prototype is null'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-no-strict.js new file mode 100644 index 0000000000..cdd3bfb82e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-no-strict.js @@ -0,0 +1,107 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-no-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Set]] internal method consistently returns `false`, No Strict Mode (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ +var sym = Symbol('test262'); + + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1'); + assert.sameValue(ns.local1 = null, null, 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2'); + assert.sameValue(ns.local2 = null, null, 'AssignmentExpression: local2'); + + assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed'); + assert.sameValue(ns.renamed = null, null, 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect'); + assert.sameValue(ns.indirect = null, null, 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default'); + assert.sameValue(ns.default = null, null, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, null), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.sameValue(ns[Symbol.toStringTag] = null, null, 'AssignmentExpression: Symbol.toStringTag'); + + assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym'); + assert.sameValue(ns[sym] = null, null, 'AssignmentExpression: sym'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of-null.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of-null.js new file mode 100644 index 0000000000..f5416c4e5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of-null.js @@ -0,0 +1,80 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-prototype-of-null.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[SetPrototypeOf]] internal method returns `true` if passed `null` (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./empty_FIXTURE.js').then(ns => { + + assert.sameValue(typeof Object.setPrototypeOf, 'function'); + assert.sameValue(ns, Object.setPrototypeOf(ns, null)); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of.js new file mode 100644 index 0000000000..6ad38c4bc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-prototype-of.js @@ -0,0 +1,85 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-prototype-of.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[SetPrototypeOf]] internal method returns `false` (value from promise then) +esid: sec-finishdynamicimport +features: [dynamic-import] +flags: [generated, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + var newProto = {}; + + assert.sameValue(typeof Object.setPrototypeOf, 'function'); + + assert.throws(TypeError, function() { + Object.setPrototypeOf(ns, newProto); + }); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-no-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-no-strict.js new file mode 100644 index 0000000000..436c90da33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-no-strict.js @@ -0,0 +1,99 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-same-values-no-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Set]] internal method consistently returns `false` even setting the same value - No Strict Mode (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, noStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1'); + assert.sameValue(ns.local1 = 'Test262', 'Test262', 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed'); + assert.sameValue(ns.renamed = 'TC39', 'TC39', 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect'); + assert.sameValue(ns.indirect = 'Test262', 'Test262', 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default'); + assert.sameValue(ns.default = 42, 42, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.sameValue(ns[Symbol.toStringTag] = ns[Symbol.toStringTag], 'Module', 'AssignmentExpression: Symbol.toStringTag'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-strict-strict.js new file mode 100644 index 0000000000..8cfce72270 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-same-values-strict-strict.js @@ -0,0 +1,110 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-same-values-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Set]] internal method consistently returns `false` even setting the same value - Strict Mode (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(Reflect.set(ns, 'local1', 'Test262'), false, 'Reflect.set: local1'); + assert.throws(TypeError, function() { + ns.local1 = 'Test262'; + }, 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'renamed', 'TC39'), false, 'Reflect.set: renamed'); + assert.throws(TypeError, function() { + ns.renamed = 'TC39'; + }, 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect', 'Test262'), false, 'Reflect.set: indirect'); + assert.throws(TypeError, function() { + ns.indirect = 'Test262'; + }, 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default', 42), false, 'Reflect.set: default'); + assert.throws(TypeError, function() { + ns.default = 42; + }, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, ns[Symbol.toStringTag]), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { + ns[Symbol.toStringTag] = ns[Symbol.toStringTag]; + }, 'AssignmentExpression: Symbol.toStringTag'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-strict-strict.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-strict-strict.js new file mode 100644 index 0000000000..02ad976bee --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/namespace/promise-then-ns-set-strict-strict.js @@ -0,0 +1,122 @@ +// |reftest| async +'use strict'; +// This file was procedurally generated from the following sources: +// - src/dynamic-import/ns-set-strict.case +// - src/dynamic-import/namespace/promise.template +/*--- +description: The [[Set]] internal method consistently returns `false`, Strict Mode (value from promise then) +esid: sec-finishdynamicimport +features: [Symbol, Symbol.toStringTag, dynamic-import] +flags: [generated, onlyStrict, async] +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + a. Let exportedNames be ? module.GetExportedNames(« »). + b. Let unambiguousNames be a new empty List. + c. For each name that is an element of exportedNames, do + i. Let resolution be ? module.ResolveExport(name, « »). + ii. If resolution is a ResolvedBinding Record, append name to unambiguousNames. + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. + + ModuleNamespaceCreate ( module, exports ) + + ... + 4. Let M be a newly created object. + 5. Set M's essential internal methods to the definitions specified in 9.4.6. + 7. Let sortedExports be a new List containing the same values as the list exports where the + values are ordered as if an Array of the same values had been sorted using Array.prototype.sort + using undefined as comparefn. + 8. Set M.[[Exports]] to sortedExports. + 9. Create own properties of M corresponding to the definitions in 26.3. + 10. Set module.[[Namespace]] to M. + 11. Return M. + + 26.3 Module Namespace Objects + + A Module Namespace Object is a module namespace exotic object that provides runtime + property-based access to a module's exported bindings. There is no constructor function for + Module Namespace Objects. Instead, such an object is created for each module that is imported + by an ImportDeclaration that includes a NameSpaceImport. + + In addition to the properties specified in 9.4.6 each Module Namespace Object has the + following own property: + + 26.3.1 @@toStringTag + + The initial value of the @@toStringTag property is the String value "Module". + + This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. + + Module Namespace Exotic Objects + + A module namespace object is an exotic object that exposes the bindings exported from an + ECMAScript Module (See 15.2.3). There is a one-to-one correspondence between the String-keyed + own properties of a module namespace exotic object and the binding names exported by the + Module. The exported bindings include any bindings that are indirectly exported using export * + export items. Each String-valued own property key is the StringValue of the corresponding + exported binding name. These are the only String-keyed properties of a module namespace exotic + object. Each such property has the attributes { [[Writable]]: true, [[Enumerable]]: true, + [[Configurable]]: false }. Module namespace objects are not extensible. + + + 1. Return false. + +---*/ +var sym = Symbol('test262'); + + +import('./module-code_FIXTURE.js').then(ns => { + + assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1'); + assert.throws(TypeError, function() { + ns.local1 = null; + }, 'AssignmentExpression: local1'); + + assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2'); + assert.throws(TypeError, function() { + ns.local2 = null; + }, 'AssignmentExpression: local2'); + + assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed'); + assert.throws(TypeError, function() { + ns.renamed = null; + }, 'AssignmentExpression: renamed'); + + assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect'); + assert.throws(TypeError, function() { + ns.indirect = null; + }, 'AssignmentExpression: indirect'); + + assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default'); + assert.throws(TypeError, function() { + ns.default = null; + }, 'AssignmentExpression: default'); + + assert.sameValue( + Reflect.set(ns, Symbol.toStringTag, null), + false, + 'Reflect.set: Symbol.toStringTag' + ); + assert.throws(TypeError, function() { + ns[Symbol.toStringTag] = null; + }, 'AssignmentExpression: Symbol.toStringTag'); + + assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym'); + assert.throws(TypeError, function() { + ns[sym] = null; + }, 'AssignmentExpression: sym'); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/namespace/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/namespace/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/returns-promise.js b/js/src/tests/test262/language/expressions/dynamic-import/returns-promise.js new file mode 100644 index 0000000000..e184297af9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/returns-promise.js @@ -0,0 +1,55 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall returns a promise +esid: sec-import-call-runtime-semantics-evaluation +info: | + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. +features: [dynamic-import] +includes: [fnGlobalObject.js] +---*/ + +const originalPromise = Promise; + +fnGlobalObject().Promise = function() { + throw "This should not be called"; +}; + +const p = import('./dynamic-import-module_FIXTURE.js'); + +assert.sameValue(p.constructor, originalPromise, 'constructor is %Promise%'); +assert.sameValue(Object.getPrototypeOf(p), originalPromise.prototype, 'prototype is %PromisePrototype%'); +assert.sameValue(p.then, originalPromise.prototype.then, 'preserves the original `then` method'); +assert.sameValue(p.catch, originalPromise.prototype.catch, 'preserves the original `catch` method'); +assert.sameValue(p.finally, originalPromise.prototype.finally, 'preserves the original `finally` method'); + +assert.sameValue( + Object.prototype.hasOwnProperty.call(p, 'then'), false, + 'returned promise has no own property then' +); + +assert.sameValue( + Object.prototype.hasOwnProperty.call(p, 'catch'), false, + 'returned promise has no own property catch' +); + +assert.sameValue( + Object.prototype.hasOwnProperty.call(p, 'finally'), false, + 'returned promise has no own property finally' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-import.js b/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-import.js new file mode 100644 index 0000000000..92b2a36307 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-import.js @@ -0,0 +1,39 @@ +// |reftest| module async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Reuse the resolved namespace object already imported from a static import +esid: sec-import-call-runtime-semantics-evaluation +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + ... + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. +features: [dynamic-import] +flags: [async, module] +---*/ + +import * as ns from './module-code_FIXTURE.js'; + +Promise.all([ + import('./module-code_FIXTURE.js'), + import('./module-code_FIXTURE.js'), +]).then(([a, b]) => { + assert.sameValue(a, b, 'it returns the same namespace are the same'); + assert.sameValue(a, ns, 'dynamic imported a is the same object as ns'); + assert.sameValue(b, ns, 'dynamic imported b is the same object as ns'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-script.js b/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-script.js new file mode 100644 index 0000000000..c95e9fc569 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object-from-script.js @@ -0,0 +1,37 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Reuse the resolved namespace object from a script code. +esid: sec-import-call-runtime-semantics-evaluation +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + ... + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. +features: [dynamic-import] +flags: [async] +---*/ + +// empty_FIXTURE.js does not export anything, so it wouldn't suit for a module code exported namespace +// we use this to assume it's a close example to a script code imported. +Promise.all([ + import('./empty_FIXTURE.js'), + import('./empty_FIXTURE.js'), +]).then(([a, b]) => { + assert.sameValue(a, b, 'it returns the same namespace are the same'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object.js b/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object.js new file mode 100644 index 0000000000..bd1d5dfdf5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/reuse-namespace-object.js @@ -0,0 +1,35 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Reuse the resolved namespace object instead of creating a new one +esid: sec-import-call-runtime-semantics-evaluation +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 1. If completion is an abrupt completion, ... + 2. Otherwise, + ... + d. Let namespace be GetModuleNamespace(moduleRecord). + e. If namespace is an abrupt completion, perform ! Call(promiseCapability.[[Reject]], undefined, « namespace.[[Value]] »). + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). + + Runtime Semantics: GetModuleNamespace ( module ) + + ... + 3. Let namespace be module.[[Namespace]]. + 4. If namespace is undefined, then + ... + d. Set namespace to ModuleNamespaceCreate(module, unambiguousNames). + 5. Return namespace. +features: [dynamic-import] +flags: [async] +---*/ + +Promise.all([ + import('./dynamic-import-module_FIXTURE.js'), + import('./dynamic-import-module_FIXTURE.js'), +]).then(([a, b]) => { + assert.sameValue(a, b, 'it returns the same namespace are the same'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/shell.js new file mode 100644 index 0000000000..d109217fc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/shell.js @@ -0,0 +1,127 @@ +// GENERATED, DO NOT EDIT +// file: asyncHelpers.js +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + A collection of assertion and wrapper functions for testing asynchronous built-ins. +defines: [asyncTest] +---*/ + +function asyncTest(testFunc) { + if (!Object.hasOwn(globalThis, "$DONE")) { + throw new Test262Error("asyncTest called without async flag"); + } + if (typeof testFunc !== "function") { + $DONE(new Test262Error("asyncTest called with non-function argument")); + return; + } + try { + testFunc().then( + function () { + $DONE(); + }, + function (error) { + $DONE(error); + } + ); + } catch (syncError) { + $DONE(syncError); + } +} + +assert.throwsAsync = async function (expectedErrorConstructor, func, message) { + var innerThenable; + if (message === undefined) { + message = ""; + } else { + message += " "; + } + if (typeof func === "function") { + try { + innerThenable = func(); + if ( + innerThenable === null || + typeof innerThenable !== "object" || + typeof innerThenable.then !== "function" + ) { + message += + "Expected to obtain an inner promise that would reject with a" + + expectedErrorConstructor.name + + " but result was not a thenable"; + throw new Test262Error(message); + } + } catch (thrown) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise"; + throw new Test262Error(message); + } + } else { + message += + "assert.throwsAsync called with an argument that is not a function"; + throw new Test262Error(message); + } + + try { + return innerThenable.then( + function () { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but no exception was thrown at all"; + throw new Test262Error(message); + }, + function (thrown) { + var expectedName, actualName; + if (typeof thrown !== "object" || thrown === null) { + message += "Thrown value was not an object!"; + throw new Test262Error(message); + } else if (thrown.constructor !== expectedErrorConstructor) { + expectedName = expectedErrorConstructor.name; + actualName = thrown.constructor.name; + if (expectedName === actualName) { + message += + "Expected a " + + expectedName + + " but got a different error constructor with the same name"; + } else { + message += + "Expected a " + expectedName + " but got a " + actualName; + } + throw new Test262Error(message); + } + } + ); + } catch (thrown) { + if (typeof thrown !== "object" || thrown === null) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object "; + } else { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but a " + + thrown.constructor.name + + " was thrown synchronously"; + } + throw new Test262Error(message); + } +}; + +// file: fnGlobalObject.js +// Copyright (C) 2017 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + Produce a reliable global object +defines: [fnGlobalObject] +---*/ + +var __globalObject = Function("return this;")(); +function fnGlobalObject() { + return __globalObject; +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-1-update-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-1-update-expression.js new file mode 100644 index 0000000000..aba3604ece --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-1-update-expression.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and UpdateExpression, but it is an invalid + AssginmentTargetType then it should throw a ReferenceError if used in some + UpdateExpressions +esid: prod-ImportCall +info: | + Update Expressions + Static Semantics: Early Errors + + UpdateExpression: + LeftHandSideExpression++ + LeftHandSideExpression-- + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('')++ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-10-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-10-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..3b9ef13e19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-10-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') -= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-11-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-11-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..8434417f8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-11-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') <<= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-12-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-12-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..6ae1cbcba2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-12-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') >>= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-13-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-13-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..6d4cb08c69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-13-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') >>>= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-14-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-14-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..70b785c26e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-14-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') &= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-15-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-15-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..42b88838da --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-15-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') ^= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-16-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-16-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..2741ceb85c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-16-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') |= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-17-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-17-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..38ef80c35e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-17-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import, exponentiation] +---*/ + +$DONOTEVALUATE(); + +import('') **= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-2-update-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-2-update-expression.js new file mode 100644 index 0000000000..2903e33be1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-2-update-expression.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and UpdateExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + UpdateExpressions +esid: prod-ImportCall +info: | + Update Expressions + Static Semantics: Early Errors + + UpdateExpression: + LeftHandSideExpression++ + LeftHandSideExpression-- + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('')-- diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-3-update-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-3-update-expression.js new file mode 100644 index 0000000000..3b1a82524d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-3-update-expression.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and UnaryExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + UpdateExpressions +esid: prod-ImportCall +info: | + Update Expressions + Static Semantics: Early Errors + + UpdateExpression: + ++UnaryExpression + --UnaryExpression + + - It is an early Syntax Error if AssignmentTargetType of UnaryExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +++import('') diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-4-update-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-4-update-expression.js new file mode 100644 index 0000000000..bb16f24300 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-4-update-expression.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and UnaryExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + UpdateExpressions +esid: prod-ImportCall +info: | + Update Expressions + Static Semantics: Early Errors + + UpdateExpression: + ++UnaryExpression + --UnaryExpression + + - It is an early Syntax Error if AssignmentTargetType of UnaryExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +--import('') diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-5-lhs-equals-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-5-lhs-equals-assignment-expression.js new file mode 100644 index 0000000000..bac627ea43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-5-lhs-equals-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') = 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-6-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-6-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..5f25575406 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-6-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') *= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-7-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-7-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..77a203add2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-7-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') /= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-8-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-8-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..a4626d5107 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-8-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') %= 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-9-lhs-assignment-operator-assignment-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-9-lhs-assignment-operator-assignment-expression.js new file mode 100644 index 0000000000..b33e06f591 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/invalid-assignmenttargettype-syntax-error-9-lhs-assignment-operator-assignment-expression.js @@ -0,0 +1,49 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a valid CallExpression and LHSExpression, but it is an invalid + AssginmentTargetType then it should throw a SyntaxError if used in some + LHS Expression of a AssignmentExpression production +esid: prod-ImportCall +info: | + Assignment Operators + Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + - It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression + + - It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. + + LeftHandSideExpression: + NewExpression + CallExpression + + CallExpression: + ImportCall + + Left-Hand-Side Expressions + Static Semantics: AssignmentTargetType + #sec-static-semantics-static-semantics-assignmenttargettype + + CallExpression : + MemberExpressionArguments + SuperCall + ImportCall + CallExpressionArguments + CallExpressionTemplateLiteral + + 1. Return invalid +negative: + phase: parse + type: SyntaxError +features: [dynamic-import] +---*/ + +$DONOTEVALUATE(); + +import('') += 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js new file mode 100644 index 0000000000..cb1acc4acb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-arrow.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +let f = () => { + import(); +}; + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js new file mode 100644 index 0000000000..23712cb4cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-assignment-expr-not-optional.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +let f = () => import(); + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-new-call-expression.js new file mode 100644 index 0000000000..7cd4d3e324 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-new-call-expression.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +let f = () => new import(''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param.js new file mode 100644 index 0000000000..8f04fe283d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-no-rest-param.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +let f = () => import(...['']); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args.js new file mode 100644 index 0000000000..1112b567a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-assignment-expression-not-extensible-args.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +let f = () => import('./empty_FIXTURE.js', {}, ''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-new-call-expression.js new file mode 100644 index 0000000000..145fd3672e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-arrow.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +let f = () => { + new import(''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-rest-param.js new file mode 100644 index 0000000000..e8d1ffc39c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-arrow.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +let f = () => { + import(...['']); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args.js new file mode 100644 index 0000000000..61c1a044ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-arrow-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-arrow.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +let f = () => { + import('./empty_FIXTURE.js', {}, ''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-assignment-expr-not-optional.js new file mode 100644 index 0000000000..5cd10e9d93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +(async () => { + await import() +}); + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-new-call-expression.js new file mode 100644 index 0000000000..c06d34440d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +(async () => { + await new import('') +}); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-rest-param.js new file mode 100644 index 0000000000..222812680e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +(async () => { + await import(...['']) +}); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-args.js new file mode 100644 index 0000000000..61955088c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-await-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall is not extensible - no arguments list (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +(async () => { + await import('./empty_FIXTURE.js', {}, '') +}); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-assignment-expr-not-optional.js new file mode 100644 index 0000000000..a349b15fc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-assignment-expr-not-optional.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +(async () => await import()) + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-new-call-expression.js new file mode 100644 index 0000000000..6b33cf2e47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-new-call-expression.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +(async () => await new import('')) diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-rest-param.js new file mode 100644 index 0000000000..19d0cd94b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-no-rest-param.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +(async () => await import(...[''])) diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-args.js new file mode 100644 index 0000000000..9b123543f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-arrow-function-return-await-not-extensible-args.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall is not extensible - no arguments list (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +(async () => await import('./empty_FIXTURE.js', {}, '')) diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js new file mode 100644 index 0000000000..f41d9ff14d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-assignment-expr-not-optional.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function f() { + import(); +} + + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js new file mode 100644 index 0000000000..d1bf625e57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function f() { + await import(); +} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-new-call-expression.js new file mode 100644 index 0000000000..01d36264f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-async-function-await.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function f() { + await new import(''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-rest-param.js new file mode 100644 index 0000000000..dbf1c62cfa --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-async-function-await.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +async function f() { + await import(...['']); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args.js new file mode 100644 index 0000000000..62ec93fe04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-await-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-function-await.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +async function f() { + await import('./empty_FIXTURE.js', {}, ''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-new-call-expression.js new file mode 100644 index 0000000000..0f1c9fe21b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-new-call-expression.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function f() { + new import(''); +} + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-rest-param.js new file mode 100644 index 0000000000..d63e9c9c5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-no-rest-param.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +async function f() { + import(...['']); +} + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args.js new file mode 100644 index 0000000000..1373d34d56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-not-extensible-args.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-function.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +async function f() { + import('./empty_FIXTURE.js', {}, ''); +} + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js new file mode 100644 index 0000000000..a78a8a821b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-assignment-expr-not-optional.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function f() { + return await import(); +} + + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-new-call-expression.js new file mode 100644 index 0000000000..af7017f8e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-new-call-expression.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function f() { + return await new import(''); +} + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-rest-param.js new file mode 100644 index 0000000000..48d4cc8c50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-no-rest-param.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +async function f() { + return await import(...['']); +} + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args.js new file mode 100644 index 0000000000..c0e5b889e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-function-return-await-not-extensible-args.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-function-return-await.template +/*--- +description: ImportCall is not extensible - no arguments list (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +async function f() { + return await import('./empty_FIXTURE.js', {}, ''); +} + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-assignment-expr-not-optional.js new file mode 100644 index 0000000000..3c0354c367 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-async-generator-await.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function * f() { + await import() +} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-new-call-expression.js new file mode 100644 index 0000000000..a180c76d2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-async-generator-await.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +async function * f() { + await new import('') +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-rest-param.js new file mode 100644 index 0000000000..3a36475b66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-async-generator-await.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +async function * f() { + await import(...['']) +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-args.js new file mode 100644 index 0000000000..bbabf51ae2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-async-gen-await-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-async-generator-await.template +/*--- +description: ImportCall is not extensible - no arguments list (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +async function * f() { + await import('./empty_FIXTURE.js', {}, '') +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js new file mode 100644 index 0000000000..7452bd129a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-block.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +{ + import(); +}; + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js new file mode 100644 index 0000000000..d0315f0f99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-block-labeled.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +label: { + import(); +}; + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-new-call-expression.js new file mode 100644 index 0000000000..e7d2e7b772 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-block-labeled.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +label: { + new import(''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-rest-param.js new file mode 100644 index 0000000000..256450971b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-block-labeled.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +label: { + import(...['']); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args.js new file mode 100644 index 0000000000..7628fe57a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-labeled-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-block-labeled.template +/*--- +description: ImportCall is not extensible - no arguments list (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +label: { + import('./empty_FIXTURE.js', {}, ''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-new-call-expression.js new file mode 100644 index 0000000000..6e519ad4a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-block.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +{ + new import(''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-rest-param.js new file mode 100644 index 0000000000..d7cf1caee1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-block.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +{ + import(...['']); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-args.js new file mode 100644 index 0000000000..5ecf856ba0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-block-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-block.template +/*--- +description: ImportCall is not extensible - no arguments list (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +{ + import('./empty_FIXTURE.js', {}, ''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js new file mode 100644 index 0000000000..f8b900e5f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-do-while.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +do { + import(); +} while (false); + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-new-call-expression.js new file mode 100644 index 0000000000..7d7c6a03f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-do-while.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +do { + new import(''); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-rest-param.js new file mode 100644 index 0000000000..d13e754090 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-do-while.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +do { + import(...['']); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args.js new file mode 100644 index 0000000000..27f71c5e48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-do-while-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-do-while.template +/*--- +description: ImportCall is not extensible - no arguments list (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +do { + import('./empty_FIXTURE.js', {}, ''); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js new file mode 100644 index 0000000000..c5e65e3052 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-assignment-expr-not-optional.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else { + import(); +} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js new file mode 100644 index 0000000000..37dba7bca7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-else-braceless.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else import(); + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-new-call-expression.js new file mode 100644 index 0000000000..c889b7640d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-else-braceless.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else new import(''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-rest-param.js new file mode 100644 index 0000000000..7bbc550c01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-else-braceless.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else import(...['']); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args.js new file mode 100644 index 0000000000..7a8b48ae28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-braceless-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-else-braceless.template +/*--- +description: ImportCall is not extensible - no arguments list (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else import('./empty_FIXTURE.js', {}, ''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-new-call-expression.js new file mode 100644 index 0000000000..77a98f9879 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-new-call-expression.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else { + new import(''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-rest-param.js new file mode 100644 index 0000000000..6175daa818 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-no-rest-param.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else { + import(...['']); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-args.js new file mode 100644 index 0000000000..73ca520a21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-else-not-extensible-args.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-else.template +/*--- +description: ImportCall is not extensible - no arguments list (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +if (false) { + +} else { + import('./empty_FIXTURE.js', {}, ''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js new file mode 100644 index 0000000000..733ddc3d12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-function.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +function fn() { + import(); +} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-new-call-expression.js new file mode 100644 index 0000000000..a5de34d505 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-function.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +function fn() { + new import(''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-rest-param.js new file mode 100644 index 0000000000..b559e84511 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-function.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +function fn() { + import(...['']); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-args.js new file mode 100644 index 0000000000..7b29890555 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-function.template +/*--- +description: ImportCall is not extensible - no arguments list (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +function fn() { + import('./empty_FIXTURE.js', {}, ''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js new file mode 100644 index 0000000000..d3e7f516d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-function-return.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +function fn() { + return import(); +} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-new-call-expression.js new file mode 100644 index 0000000000..cd075b0620 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-function-return.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +function fn() { + return new import(''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-rest-param.js new file mode 100644 index 0000000000..480fa1dca4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-function-return.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +function fn() { + return import(...['']); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args.js new file mode 100644 index 0000000000..c53f093c8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-function-return-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-function-return.template +/*--- +description: ImportCall is not extensible - no arguments list (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +function fn() { + return import('./empty_FIXTURE.js', {}, ''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js new file mode 100644 index 0000000000..111d3ccb1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-if.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (true) { + import(); +} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js new file mode 100644 index 0000000000..574c1f8d5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-assignment-expr-not-optional.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-if-braceless.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (true) import(); + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-new-call-expression.js new file mode 100644 index 0000000000..b893a436bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-new-call-expression.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-if-braceless.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (true) new import(''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-rest-param.js new file mode 100644 index 0000000000..3eb570d65e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-no-rest-param.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-if-braceless.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +if (true) import(...['']); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args.js new file mode 100644 index 0000000000..ffd265c1e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-braceless-not-extensible-args.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-if-braceless.template +/*--- +description: ImportCall is not extensible - no arguments list (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +if (true) import('./empty_FIXTURE.js', {}, ''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-new-call-expression.js new file mode 100644 index 0000000000..dffc90d5b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-if.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +if (true) { + new import(''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-rest-param.js new file mode 100644 index 0000000000..bedc90ae57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-if.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +if (true) { + import(...['']); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-args.js new file mode 100644 index 0000000000..b03b6f2c27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-if-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-if.template +/*--- +description: ImportCall is not extensible - no arguments list (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +if (true) { + import('./empty_FIXTURE.js', {}, ''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js new file mode 100644 index 0000000000..3824f66655 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-assignment-expr-not-optional.js @@ -0,0 +1,40 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +let x = 0; +while (!x) { + x++; + import(); +}; + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-new-call-expression.js new file mode 100644 index 0000000000..cea4fd2a3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-new-call-expression.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +let x = 0; +while (!x) { + x++; + new import(''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-rest-param.js new file mode 100644 index 0000000000..adc7101b5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-no-rest-param.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +let x = 0; +while (!x) { + x++; + import(...['']); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-args.js new file mode 100644 index 0000000000..d23f297759 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-while-not-extensible-args.js @@ -0,0 +1,43 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-while.template +/*--- +description: ImportCall is not extensible - no arguments list (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +let x = 0; +while (!x) { + x++; + import('./empty_FIXTURE.js', {}, ''); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional.js new file mode 100644 index 0000000000..1efe4f35a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-assignment-expr-not-optional.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-with.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +with ({}) { + import(); +} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-assignment-expr-not-optional.js new file mode 100644 index 0000000000..525d257b32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-assignment-expr-not-optional.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/nested-with-expression.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +with (import()) {} + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-new-call-expression.js new file mode 100644 index 0000000000..b06217b806 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-new-call-expression.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-with-expression.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +with (new import('')) {} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-rest-param.js new file mode 100644 index 0000000000..5d54855328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-no-rest-param.js @@ -0,0 +1,42 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-with-expression.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +with (import(...[''])) {} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-args.js new file mode 100644 index 0000000000..88a4b771ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-expression-not-extensible-args.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-with-expression.template +/*--- +description: ImportCall is not extensible - no arguments list (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +with (import('./empty_FIXTURE.js', {}, '')) {} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-new-call-expression.js new file mode 100644 index 0000000000..9fb213a434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-new-call-expression.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/nested-with.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +with ({}) { + new import(''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-rest-param.js new file mode 100644 index 0000000000..b0e2175d60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-no-rest-param.js @@ -0,0 +1,44 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/nested-with.template +/*--- +description: ImportCall is not extensible - no rest parameter (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +with ({}) { + import(...['']); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-args.js new file mode 100644 index 0000000000..f185ca7b4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/nested-with-not-extensible-args.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/nested-with.template +/*--- +description: ImportCall is not extensible - no arguments list (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +with ({}) { + import('./empty_FIXTURE.js', {}, ''); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js new file mode 100644 index 0000000000..8e8cf5e3a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-assignment-expr-not-optional.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/assignment-expr-not-optional.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: It's a SyntaxError if AssignmentExpression is omitted (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +import(); + +/* The params region intentionally empty */ diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-new-call-expression.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-new-call-expression.js new file mode 100644 index 0000000000..f76970cdda --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-new-call-expression.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-new-call-expression.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: ImportCall is a CallExpression, it can't be preceded by the new keyword (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) +---*/ + +$DONOTEVALUATE(); + +new import(''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-rest-param.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-rest-param.js new file mode 100644 index 0000000000..27490e9c1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-no-rest-param.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/no-rest-param.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: ImportCall is not extensible - no rest parameter (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + Forbidden Extensions + + - ImportCall must not be extended. + + This production doesn't allow the following production from ArgumentsList: + + ... AssignmentExpression +---*/ + +$DONOTEVALUATE(); + +import(...['']); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-args.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-args.js new file mode 100644 index 0000000000..755f44eb17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/invalid/top-level-not-extensible-args.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dynamic-import/not-extensible-args.case +// - src/dynamic-import/syntax/invalid/top-level.template +/*--- +description: ImportCall is not extensible - no arguments list (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + + Forbidden Extensions + + - ImportCall must not be extended. +---*/ + +$DONOTEVALUATE(); + +import('./empty_FIXTURE.js', {}, ''); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-arguments.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-arguments.js new file mode 100644 index 0000000000..365c6a7db6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-arguments.js @@ -0,0 +1,33 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a CallExpression and can be used before arguments +esid: prod-ImportCall +info: | + CallExpression: + ImportCall + CallExpression TemplateLiteral + CallExpression Arguments +features: [dynamic-import] +---*/ + +// valid syntax, but fails on runtime evaluation + +assert.throws(TypeError, () => { + import('./empty_FIXTURE.js')(); +}, 'empty arguments'); + +assert.throws(TypeError, () => { + import('./empty_FIXTURE.js')(1,); +}, 'arguments with trailing comma'); + +assert.throws(TypeError, () => { + import('./empty_FIXTURE.js')(1, 2); +}, '2 arguments'); + +assert.throws(TypeError, () => { + import('./empty_FIXTURE.js')(...[]); +}, 'spread args'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-templateliteral.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-templateliteral.js new file mode 100644 index 0000000000..16a6d044ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/callexpression-templateliteral.js @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a CallExpression and can be used before a template literal +esid: prod-ImportCall +info: | + CallExpression: + ImportCall + CallExpression TemplateLiteral + CallExpression Arguments +features: [dynamic-import] +---*/ + +// valid syntax, but fails on runtime evaluation + +assert.throws(TypeError, () => { + import('./empty_FIXTURE.js')``; +}); + +assert.throws(TypeError, () => { + import('./empty_FIXTURE.js')`something`; +}); + +assert.throws(TypeError, () => { + import('./empty_FIXTURE.js')`${42}`; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/empty_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/empty_FIXTURE.js new file mode 100644 index 0000000000..92eb2c370f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/empty_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +// empty code diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..c650286fc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => import(''); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..9f4b9da1e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-first.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..639c6ee789 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-assertions-trailing-comma-second.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..8708975017 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-first.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..b9e6fb5c4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-import-attributes-trailing-comma-second.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports.js new file mode 100644 index 0000000000..169b868865 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => import(import(import('./empty_FIXTURE.js'))); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid.js new file mode 100644 index 0000000000..401ff2f1cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-assignment-expression-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-arrow-assignment-expression.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +let f = () => import('./empty_FIXTURE.js'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..190bd0ab8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => { + import(''); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..c29e891b2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => { + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..b8dfde0a51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => { + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..58c47da25d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => { + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..38fe73eeea --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let f = () => { + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-nested-imports.js new file mode 100644 index 0000000000..25fcab91d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => { + import(import(import('./empty_FIXTURE.js'))); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-script-code-valid.js new file mode 100644 index 0000000000..1ea0f9cdc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-arrow-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-arrow.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +let f = () => { + import('./empty_FIXTURE.js'); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..29ef2dac58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: Calling import('') (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +(async () => { + await import('') +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..0ef3ea1a17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => { + await import('./empty_FIXTURE.js',) +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..33d631a25a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => { + await import('./empty_FIXTURE.js', {},) +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..bcf8cbc91a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => { + await import('./empty_FIXTURE.js',) +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..3016f4c7c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => { + await import('./empty_FIXTURE.js', {},) +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-nested-imports.js new file mode 100644 index 0000000000..f41acd5ced --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +(async () => { + await import(import(import('./empty_FIXTURE.js'))) +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-script-code-valid.js new file mode 100644 index 0000000000..313a43a174 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-await-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-await.template +/*--- +description: import() can be used in script code (nested in async arrow function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +(async () => { + await import('./empty_FIXTURE.js') +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..307a929f46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: Calling import('') (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +(async () => await import('')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..3ddac112e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-first.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => await import('./empty_FIXTURE.js',)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..a75425cdf4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-assertions-trailing-comma-second.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => await import('./empty_FIXTURE.js', {},)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..a486d0bd14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-first.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => await import('./empty_FIXTURE.js',)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..37ea1e4456 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-import-attributes-trailing-comma-second.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +(async () => await import('./empty_FIXTURE.js', {},)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-nested-imports.js new file mode 100644 index 0000000000..00b4d723a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +(async () => await import(import(import('./empty_FIXTURE.js')))); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-script-code-valid.js new file mode 100644 index 0000000000..b32347f0de --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-arrow-function-return-await-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-arrow-fn-return-await.template +/*--- +description: import() can be used in script code (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +(async () => await import('./empty_FIXTURE.js')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..1f328bd435 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + await import(''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..bc6d853695 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + await import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..da2e80ef0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + await import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..dc7701bb1b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + await import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..1a97e8b145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + await import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-nested-imports.js new file mode 100644 index 0000000000..8402882b1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + await import(import(import('./empty_FIXTURE.js'))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid.js new file mode 100644 index 0000000000..d31afbed8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-await-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function-await.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function f() { + await import('./empty_FIXTURE.js'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..de56a1fd38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-empty-str-is-valid-assign-expr.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + import(''); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..ebeb2cb744 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-first.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + import('./empty_FIXTURE.js',); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..18ad6993bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-assertions-trailing-comma-second.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + import('./empty_FIXTURE.js', {},); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..a3f41de5c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-first.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + import('./empty_FIXTURE.js',); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..016147183c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-import-attributes-trailing-comma-second.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + import('./empty_FIXTURE.js', {},); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-nested-imports.js new file mode 100644 index 0000000000..899288c4a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-nested-imports.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + import(import(import('./empty_FIXTURE.js'))); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..d2682ffd3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: Calling import('') (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + return await import(''); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..e1a6c11203 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-first.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + return await import('./empty_FIXTURE.js',); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..9f42ad9a23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-assertions-trailing-comma-second.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + return await import('./empty_FIXTURE.js', {},); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..e69f744dad --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-first.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + return await import('./empty_FIXTURE.js',); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..971c5f1647 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-import-attributes-trailing-comma-second.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function f() { + return await import('./empty_FIXTURE.js', {},); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports.js new file mode 100644 index 0000000000..46c01feaf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-nested-imports.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + return await import(import(import('./empty_FIXTURE.js'))); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid.js new file mode 100644 index 0000000000..3ffff8c906 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-return-await-script-code-valid.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function-return-await.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function f() { + return await import('./empty_FIXTURE.js'); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-script-code-valid.js new file mode 100644 index 0000000000..73a79f768e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-function-script-code-valid.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-function.template +/*--- +description: import() can be used in script code (nested arrow syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function f() { + import('./empty_FIXTURE.js'); +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..19c05edf72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: Calling import('') (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function * f() { + await import('') +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..1a1de33d8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import, async-iteration] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function * f() { + await import('./empty_FIXTURE.js',) +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..9f977bff90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import, async-iteration] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function * f() { + await import('./empty_FIXTURE.js', {},) +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..8a216af856 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: ImportCall trailing comma following first parameter (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import, async-iteration] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function * f() { + await import('./empty_FIXTURE.js',) +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..c46b4e1198 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: ImportCall trailing comma following second parameter (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import, async-iteration] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +async function * f() { + await import('./empty_FIXTURE.js', {},) +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-nested-imports.js new file mode 100644 index 0000000000..0989cc413a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function * f() { + await import(import(import('./empty_FIXTURE.js'))) +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-script-code-valid.js new file mode 100644 index 0000000000..287f15f1d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-async-gen-await-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-async-generator-await.template +/*--- +description: import() can be used in script code (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function * f() { + await import('./empty_FIXTURE.js') +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..5a35d2f60b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: Calling import('') (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +{ + import(''); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..28fa4544a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: ImportCall trailing comma following first parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +{ + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..e097031cf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: ImportCall trailing comma following second parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +{ + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..fdfba7eb9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: ImportCall trailing comma following first parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +{ + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..005f16974b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: ImportCall trailing comma following second parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +{ + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..ee883d4d4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: Calling import('') (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +label: { + import(''); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..a0be4f8f45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: ImportCall trailing comma following first parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +label: { + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..38e1ed8cde --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: ImportCall trailing comma following second parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +label: { + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..44f850dbf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: ImportCall trailing comma following first parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +label: { + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..d610caf1d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: ImportCall trailing comma following second parameter (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +label: { + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-nested-imports.js new file mode 100644 index 0000000000..daa1739922 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +label: { + import(import(import('./empty_FIXTURE.js'))); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid.js new file mode 100644 index 0000000000..9f03faff96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-labeled-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-block-labeled.template +/*--- +description: import() can be used in script code (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +label: { + import('./empty_FIXTURE.js'); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-nested-imports.js new file mode 100644 index 0000000000..527feea701 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +{ + import(import(import('./empty_FIXTURE.js'))); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-script-code-valid.js new file mode 100644 index 0000000000..3e66d21eaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-block-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-block.template +/*--- +description: import() can be used in script code (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +{ + import('./empty_FIXTURE.js'); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..d287067c52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: Calling import('') (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +do { + import(''); +} while (false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..da97f1aff1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: ImportCall trailing comma following first parameter (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +do { + import('./empty_FIXTURE.js',); +} while (false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..5affd6218e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: ImportCall trailing comma following second parameter (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +do { + import('./empty_FIXTURE.js', {},); +} while (false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..293395c9da --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: ImportCall trailing comma following first parameter (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +do { + import('./empty_FIXTURE.js',); +} while (false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..d370e9105c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: ImportCall trailing comma following second parameter (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +do { + import('./empty_FIXTURE.js', {},); +} while (false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-nested-imports.js new file mode 100644 index 0000000000..72abae9eae --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +do { + import(import(import('./empty_FIXTURE.js'))); +} while (false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-script-code-valid.js new file mode 100644 index 0000000000..895c31876c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-do-while-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-do-while.template +/*--- +description: import() can be used in script code (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +do { + import('./empty_FIXTURE.js'); +} while (false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..98c720413f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: Calling import('') (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else import(''); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..4fcd241943 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: ImportCall trailing comma following first parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..9bdea8900d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: ImportCall trailing comma following second parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..7959b78b3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: ImportCall trailing comma following first parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..7346fb646b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: ImportCall trailing comma following second parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-nested-imports.js new file mode 100644 index 0000000000..96cff127d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else import(import(import('./empty_FIXTURE.js'))); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid.js new file mode 100644 index 0000000000..490ddb8376 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-braceless-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-else-braceless.template +/*--- +description: import() can be used in script code (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +if (false) { + +} else import('./empty_FIXTURE.js'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..aa6b70d4c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-empty-str-is-valid-assign-expr.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: Calling import('') (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else { + import(''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..aa0e2e085c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-first.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: ImportCall trailing comma following first parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..0e341f4d79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-assertions-trailing-comma-second.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: ImportCall trailing comma following second parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..e8afb50437 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-first.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: ImportCall trailing comma following first parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..11eff64e25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-import-attributes-trailing-comma-second.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: ImportCall trailing comma following second parameter (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (false) { + +} else { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-nested-imports.js new file mode 100644 index 0000000000..7f4b901353 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-nested-imports.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else { + import(import(import('./empty_FIXTURE.js'))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-script-code-valid.js new file mode 100644 index 0000000000..0f06d08854 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-else-script-code-valid.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-else.template +/*--- +description: import() can be used in script code (nested else syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +if (false) { + +} else { + import('./empty_FIXTURE.js'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..18c1356099 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: Calling import('') (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function fn() { + import(''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..71d1cf4ef7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: ImportCall trailing comma following first parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..c2a6af71cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: ImportCall trailing comma following second parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..0a30f53005 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: ImportCall trailing comma following first parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..e15198a3d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: ImportCall trailing comma following second parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-nested-imports.js new file mode 100644 index 0000000000..1bc3735c70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function fn() { + import(import(import('./empty_FIXTURE.js'))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..8fe6a994f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: Calling import('') (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function fn() { + return import(''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..d397d7ac6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: ImportCall trailing comma following first parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + return import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..858a2248be --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: ImportCall trailing comma following second parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + return import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..78f032870d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: ImportCall trailing comma following first parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + return import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..ae352f15e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: ImportCall trailing comma following second parameter (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +function fn() { + return import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-nested-imports.js new file mode 100644 index 0000000000..bc945e953d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function fn() { + return import(import(import('./empty_FIXTURE.js'))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-script-code-valid.js new file mode 100644 index 0000000000..ccf53416d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-return-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-function-return.template +/*--- +description: import() can be used in script code (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +function fn() { + return import('./empty_FIXTURE.js'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-script-code-valid.js new file mode 100644 index 0000000000..fcbddb51a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-function-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-function.template +/*--- +description: import() can be used in script code (nested function syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +function fn() { + import('./empty_FIXTURE.js'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..ba443c0e7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-empty-str-is-valid-assign-expr.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: Calling import('') (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) import(''); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..91848a7183 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-first.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: ImportCall trailing comma following first parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..b53c5c9db7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-assertions-trailing-comma-second.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: ImportCall trailing comma following second parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..16b4a6a3c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-first.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: ImportCall trailing comma following first parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..59f6b64cc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-import-attributes-trailing-comma-second.js @@ -0,0 +1,33 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: ImportCall trailing comma following second parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-nested-imports.js new file mode 100644 index 0000000000..f3a595c7a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-nested-imports.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) import(import(import('./empty_FIXTURE.js'))); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid.js new file mode 100644 index 0000000000..ff1be2a13b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-braceless-script-code-valid.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-if-braceless.template +/*--- +description: import() can be used in script code (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +if (true) import('./empty_FIXTURE.js'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..0ea110f2cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: Calling import('') (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) { + import(''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..7c7a8c50c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: ImportCall trailing comma following first parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..bd20bc4994 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: ImportCall trailing comma following second parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..d3b066be74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: ImportCall trailing comma following first parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..b7c56ae236 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: ImportCall trailing comma following second parameter (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +if (true) { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-nested-imports.js new file mode 100644 index 0000000000..ed17aaaab9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) { + import(import(import('./empty_FIXTURE.js'))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-script-code-valid.js new file mode 100644 index 0000000000..2edbfa5a45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-if-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-if.template +/*--- +description: import() can be used in script code (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +if (true) { + import('./empty_FIXTURE.js'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..1a723acfce --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-empty-str-is-valid-assign-expr.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: Calling import('') (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import(''); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..d9fd806fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-first.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: ImportCall trailing comma following first parameter (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let x = 0; +while (!x) { + x++; + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..2ff4072e36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-assertions-trailing-comma-second.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: ImportCall trailing comma following second parameter (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let x = 0; +while (!x) { + x++; + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..b85e27f011 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-first.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: ImportCall trailing comma following first parameter (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let x = 0; +while (!x) { + x++; + import('./empty_FIXTURE.js',); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..c61da3ff69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-import-attributes-trailing-comma-second.js @@ -0,0 +1,37 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: ImportCall trailing comma following second parameter (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +let x = 0; +while (!x) { + x++; + import('./empty_FIXTURE.js', {},); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-nested-imports.js new file mode 100644 index 0000000000..f8678b2781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-nested-imports.js @@ -0,0 +1,31 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import(import(import('./empty_FIXTURE.js'))); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-script-code-valid.js new file mode 100644 index 0000000000..df6ab305b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-while-script-code-valid.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-while.template +/*--- +description: import() can be used in script code (nested while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +let x = 0; +while (!x) { + x++; + import('./empty_FIXTURE.js'); +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..b2e183f89b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-empty-str-is-valid-assign-expr.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: Calling import('') (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +with ({}) { + import(''); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..b56964f75f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-empty-str-is-valid-assign-expr.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: Calling import('') (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +with (import('')) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..fb6c4fbb78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-first.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: ImportCall trailing comma following first parameter (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with (import('./empty_FIXTURE.js',)) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..7845851a93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-assertions-trailing-comma-second.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: ImportCall trailing comma following second parameter (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with (import('./empty_FIXTURE.js', {},)) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..bb5b350f46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-first.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: ImportCall trailing comma following first parameter (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with (import('./empty_FIXTURE.js',)) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..d2599830e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-import-attributes-trailing-comma-second.js @@ -0,0 +1,36 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: ImportCall trailing comma following second parameter (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with (import('./empty_FIXTURE.js', {},)) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-nested-imports.js new file mode 100644 index 0000000000..df51415c42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-nested-imports.js @@ -0,0 +1,30 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +with (import(import(import('./empty_FIXTURE.js')))) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-script-code-valid.js new file mode 100644 index 0000000000..62feb5dcbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-expression-script-code-valid.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-with-expression.template +/*--- +description: import() can be used in script code (nested with syntax in the expression position) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +with (import('./empty_FIXTURE.js')) { + assert.sameValue(then, Promise.prototype.then); + assert.sameValue(constructor, Promise); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..a4e4af9ec9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: ImportCall trailing comma following first parameter (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with ({}) { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..72e86d4b4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-assertions-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: ImportCall trailing comma following second parameter (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with ({}) { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..c55329ae40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-first.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: ImportCall trailing comma following first parameter (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with ({}) { + import('./empty_FIXTURE.js',); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..b255d41d65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-import-attributes-trailing-comma-second.js @@ -0,0 +1,35 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: ImportCall trailing comma following second parameter (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +with ({}) { + import('./empty_FIXTURE.js', {},); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-nested-imports.js new file mode 100644 index 0000000000..059f0242bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-nested-imports.js @@ -0,0 +1,29 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +with ({}) { + import(import(import('./empty_FIXTURE.js'))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-script-code-valid.js new file mode 100644 index 0000000000..bfd0c6886f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/nested-with-script-code-valid.js @@ -0,0 +1,33 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/nested-with.template +/*--- +description: import() can be used in script code (nested with syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, noStrict] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +with ({}) { + import('./empty_FIXTURE.js'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/new-covered-expression-is-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/new-covered-expression-is-valid.js new file mode 100644 index 0000000000..a91af559b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/new-covered-expression-is-valid.js @@ -0,0 +1,41 @@ +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall is a CallExpression and Expression, so it can be wrapped + for new expressions, while the same production is not possible without + the parentheses wrapping. +esid: prod-ImportCall +info: | + CallExpression: + ImportCall + + ImportCall : + import( AssignmentExpression[+In, ?Yield] ) + + NewExpression : + MemberExpression + new NewExpression + + MemberExpression : + PrimaryExpression + + PrimaryExpression : + CoverParenthesizedExpressionAndArrowParameterList +features: [dynamic-import] +---*/ + +assert.throws(TypeError, () => { + new (import('')) +}); + +assert.throws(TypeError, () => { + new (function() {}, import('')) +}); + +assert.sameValue( + typeof new (import(''), function() {}), + 'object', +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js new file mode 100644 index 0000000000..c23fe700a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-empty-str-is-valid-assign-expr.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/empty-str-is-valid-assign-expr.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: Calling import('') (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ + +import(''); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-first.js new file mode 100644 index 0000000000..2e4e518d53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-first.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: ImportCall trailing comma following first parameter (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-second.js new file mode 100644 index 0000000000..eb2b17c6b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-assertions-trailing-comma-second.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-assertions-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: ImportCall trailing comma following second parameter (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-assertions, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-first.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-first.js new file mode 100644 index 0000000000..191256c2ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-first.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-first.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: ImportCall trailing comma following first parameter (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +import('./empty_FIXTURE.js',); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-second.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-second.js new file mode 100644 index 0000000000..bbb4a36f30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-import-attributes-trailing-comma-second.js @@ -0,0 +1,23 @@ +// |reftest| shell-option(--enable-import-attributes) skip-if(!xulRuntime.shell) -- requires shell-options +// This file was procedurally generated from the following sources: +// - src/dynamic-import/import-attributes-trailing-comma-second.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: ImportCall trailing comma following second parameter (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [import-attributes, dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + + + ImportCall : + import( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + import( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) + +---*/ + +import('./empty_FIXTURE.js', {},); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-nested-imports.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-nested-imports.js new file mode 100644 index 0000000000..04a080241d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-nested-imports.js @@ -0,0 +1,17 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/nested-imports.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: ImportCall is a CallExpression can be nested in other import calls (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ + +import(import(import('./empty_FIXTURE.js'))); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-script-code-valid.js b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-script-code-valid.js new file mode 100644 index 0000000000..749506f019 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/syntax/valid/top-level-script-code-valid.js @@ -0,0 +1,21 @@ +// This file was procedurally generated from the following sources: +// - src/dynamic-import/script-code-valid.case +// - src/dynamic-import/syntax/valid/top-level.template +/*--- +description: import() can be used in script code (top level syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated] +info: | + ImportCall : + import( AssignmentExpression ) + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +import('./empty_FIXTURE.js'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import-other_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import-other_FIXTURE.js new file mode 100644 index 0000000000..9232455f91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import-other_FIXTURE.js @@ -0,0 +1,9 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +var global = Function('return this;')(); + +global.test262Update('other'); + +export default 42; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import.js b/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import.js new file mode 100644 index 0000000000..d1a9469ed5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import.js @@ -0,0 +1,33 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + Resolve imports after a binding update +esid: sec-finishdynamicimport +info: | + Runtime Semantics: FinishDynamicImport ( referencingScriptOrModule, specifier, promiseCapability, completion ) + + 2. Otherwise, + a. Assert: completion is a normal completion and completion.[[Value]] is undefined. + b. Let moduleRecord be ! HostResolveImportedModule(referencingScriptOrModule, specifier). + c. Assert: Evaluate has already been invoked on moduleRecord and successfully completed. + d. Let namespace be GetModuleNamespace(moduleRecord). + ... + f. Otherwise, perform ! Call(promiseCapability.[[Resolve]], undefined, « namespace.[[Value]] »). +flags: [async] +features: [dynamic-import] +includes: [asyncHelpers.js] +---*/ + +async function fn() { + const first = await import('./update-to-dynamic-import_FIXTURE.js'); + assert.sameValue(first.x, 'first', 'the other module has not been evaluated yet'); + + const other = await first.default(); + + assert.sameValue(first.x, 'other', 'the other module is only evaluated after calling import()'); + assert.sameValue(other.default, 42); +} + +asyncTest(fn); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import_FIXTURE.js new file mode 100644 index 0000000000..0212cef806 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/update-to-dynamic-import_FIXTURE.js @@ -0,0 +1,11 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +Function('return this;')().test262Update = name => x = name; + +export default function() { + return import('./update-to-dynamic-import-other_FIXTURE.js'); +} + +export var x = 'first'; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage-from-eval.js b/js/src/tests/test262/language/expressions/dynamic-import/usage-from-eval.js new file mode 100644 index 0000000000..c49b9f8770 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage-from-eval.js @@ -0,0 +1,37 @@ +// |reftest| async +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: > + ImportCall can be used from eval code +esid: sec-import-call-runtime-semantics-evaluation +info: | + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. +features: [dynamic-import] +flags: [async] +---*/ + +const p = eval("import('./module-code_FIXTURE.js');"); + +assert.sameValue(Promise.resolve(p), p, 'constructor is %Promise%'); +assert.sameValue(Object.getPrototypeOf(p), Promise.prototype, 'prototype is %PromisePrototype%'); + +p.then(imported => { + assert.sameValue(imported.default, 42); + assert.sameValue(imported.local1, 'Test262'); + assert.sameValue(imported.renamed, 'TC39'); + assert.sameValue(imported.indirect, 'Test262'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/browser.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/dynamic-import-module_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/dynamic-import-module_FIXTURE.js new file mode 100644 index 0000000000..fe34b3bfee --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/dynamic-import-module_FIXTURE.js @@ -0,0 +1,5 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var x = 1; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update-dflt_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update-dflt_FIXTURE.js new file mode 100644 index 0000000000..635bcbb682 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update-dflt_FIXTURE.js @@ -0,0 +1,8 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export default function fn() { + fn = 2; + return 1; +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update_FIXTURE.js new file mode 100644 index 0000000000..37a51bb18b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/eval-gtbndng-indirect-update_FIXTURE.js @@ -0,0 +1,10 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +var x = 1; +export { x }; + +Function('return this;')().test262update = function() { + x = 2; +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/module-code_FIXTURE.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/module-code_FIXTURE.js new file mode 100644 index 0000000000..4bf5708b92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/module-code_FIXTURE.js @@ -0,0 +1,9 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +const x = 'Test262'; +const y = 42; + +export default y; +export { x, y as z }; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..50736c6248 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..34cdc1fc5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-gtbndng-indirect-update.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..1ed49170be --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: import() from a script code can load a file with module code (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +let f = () => import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..aa725080a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-is-call-expression-square-brackets.js @@ -0,0 +1,35 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +let f = () => import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-returns-thenable.js new file mode 100644 index 0000000000..3e2ac9da05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-returns-thenable.js @@ -0,0 +1,33 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: Dynamic import() returns a thenable object. (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-specifier-tostring.js new file mode 100644 index 0000000000..744d782b86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-assignment-expression-specifier-tostring.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-arrow-assign-expr.template +/*--- +description: ToString value of specifier (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +let f = () => import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}); + + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..aab6224945 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => { + return import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..9460fcac47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let f = () => { + return import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..3a8ce9e1b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: import() from a script code can load a file with module code (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +let f = () => { + return import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..0f241e07c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,37 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +let f = () => { + return import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-returns-thenable.js new file mode 100644 index 0000000000..59f7f933ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-returns-thenable.js @@ -0,0 +1,35 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: Dynamic import() returns a thenable object. (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let f = () => { + return import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-specifier-tostring.js new file mode 100644 index 0000000000..e3e83a9720 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-arrow-import-then-specifier-tostring.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-arrow.template +/*--- +description: ToString value of specifier (nested arrow) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +let f = () => { + return import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; + +f(); + diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..b1d6857af4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-arrow-fn-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +const f = async () => { + await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..d6e8dc8104 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-arrow-fn-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +const f = async () => { + await import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..25de6fab42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-async-arrow-fn-await.template +/*--- +description: import() from a script code can load a file with module code (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +const f = async () => { + await import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..70ada1125b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-is-call-expression-square-brackets.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-arrow-fn-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +const f = async () => { + await import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-returns-thenable.js new file mode 100644 index 0000000000..2fd456876b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-returns-thenable.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-async-arrow-fn-await.template +/*--- +description: Dynamic import() returns a thenable object. (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +const f = async () => { + await import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-specifier-tostring.js new file mode 100644 index 0000000000..219f5fb0e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-await-specifier-tostring.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-async-arrow-fn-await.template +/*--- +description: ToString value of specifier (nested in async arrow function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +const f = async () => { + await import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..536d11ab88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-arrow-fn-return-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +const f = async () => await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js'); + +f().then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..44adb202ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-arrow-fn-return-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +const f = async () => await import('./eval-gtbndng-indirect-update_FIXTURE.js'); + +f().then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..db72fe4aa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-async-arrow-fn-return-await.template +/*--- +description: import() from a script code can load a file with module code (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +const f = async () => await import('./module-code_FIXTURE.js'); + +f().then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..43591dfff6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-is-call-expression-square-brackets.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-arrow-fn-return-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +const f = async () => await import('./dynamic-import-module_FIXTURE.js')['then'](x => x); + +f().then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-returns-thenable.js new file mode 100644 index 0000000000..fdb7c287fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-returns-thenable.js @@ -0,0 +1,32 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-async-arrow-fn-return-await.template +/*--- +description: Dynamic import() returns a thenable object. (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +const f = async () => await import('./dynamic-import-module_FIXTURE.js'); + +f().then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-specifier-tostring.js new file mode 100644 index 0000000000..fe6f558bc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-arrow-function-return-await-specifier-tostring.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-async-arrow-fn-return-await.template +/*--- +description: ToString value of specifier (nested in async arrow function, returned) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +const f = async () => await import(obj); + +f().then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..c854e79a33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..9876af748e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + await import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..372fb54337 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: import() from a script code can load a file with module code (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function f() { + await import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..b38d1d0831 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-is-call-expression-square-brackets.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +async function f() { + await import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-returns-thenable.js new file mode 100644 index 0000000000..590e478092 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-returns-thenable.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: Dynamic import() returns a thenable object. (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + await import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-specifier-tostring.js new file mode 100644 index 0000000000..9b9b1ec91c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-await-specifier-tostring.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-async-function-await.template +/*--- +description: ToString value of specifier (nested in async function, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +async function f() { + await import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }); +} + +f().then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..f8bad5fa23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..ca1ed65a21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..184e025505 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: import() from a script code can load a file with module code (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function f() { + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..c976697930 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-is-call-expression-square-brackets.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +async function f() { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..c47e86b5dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + return await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js'); +} + +f().then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..a1840cf04f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function f() { + return await import('./eval-gtbndng-indirect-update_FIXTURE.js'); +} + +f().then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..d081e9c34e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: import() from a script code can load a file with module code (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function f() { + return await import('./module-code_FIXTURE.js'); +} + +f().then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..5625149770 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-is-call-expression-square-brackets.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +async function f() { + return await import('./dynamic-import-module_FIXTURE.js')['then'](x => x); +} + +f().then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-returns-thenable.js new file mode 100644 index 0000000000..e8f85ff4ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-returns-thenable.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: Dynamic import() returns a thenable object. (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + return await import('./dynamic-import-module_FIXTURE.js'); +} + +f().then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-specifier-tostring.js new file mode 100644 index 0000000000..b4df642ef7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-return-await-specifier-tostring.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-async-function-return-await.template +/*--- +description: ToString value of specifier (nested in async function, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +async function f() { + return await import(obj); +} + +f().then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-returns-thenable.js new file mode 100644 index 0000000000..57497529b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-returns-thenable.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: Dynamic import() returns a thenable object. (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function f() { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-specifier-tostring.js new file mode 100644 index 0000000000..7132d0379a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-function-specifier-tostring.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-async-function.template +/*--- +description: ToString value of specifier (nested in async function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +async function f() { + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} + +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..eef782aaf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-generator-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let callCount = 0; + +async function * f() { + await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + callCount++; + }); +} + +f().next().then(() => { + assert.sameValue(callCount, 1); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..b2ea46f892 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-generator-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let callCount = 0; + +async function * f() { + await import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + callCount++; + }); +} + +f().next().then(() => { + assert.sameValue(callCount, 1); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..7ee84dc436 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-async-generator-await.template +/*--- +description: import() from a script code can load a file with module code (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +let callCount = 0; + +async function * f() { + await import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + callCount++; + }); +} + +f().next().then(() => { + assert.sameValue(callCount, 1); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..d964950097 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-is-call-expression-square-brackets.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-generator-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +let callCount = 0; + +async function * f() { + await import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + callCount++; + }); +} + +f().next().then(() => { + assert.sameValue(callCount, 1); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable.js new file mode 100644 index 0000000000..9b848fd3a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-returns-thenable.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-async-generator-await.template +/*--- +description: Dynamic import() returns a thenable object. (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let callCount = 0; + +async function * f() { + await import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + callCount++; + }); +} + +f().next().then(() => { + assert.sameValue(callCount, 1); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring.js new file mode 100644 index 0000000000..63de7a0fd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-await-specifier-tostring.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-async-generator-await.template +/*--- +description: ToString value of specifier (nested in async generator, awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +let callCount = 0; + +async function * f() { + await import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + callCount++; + }); +} + +f().next().then(() => { + assert.sameValue(callCount, 1); +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..63efe9655c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-async-generator-return-await.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function * f() { + return await import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js'); +} + +f().next().then(({value: imported}) => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..7fb7d61be5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-async-generator-return-await.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +async function * f() { + return await import('./eval-gtbndng-indirect-update_FIXTURE.js'); +} + +f().next().then(({value: imported}) => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..e59a5c1973 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-async-generator-return-await.template +/*--- +description: import() from a script code can load a file with module code (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +async function * f() { + return await import('./module-code_FIXTURE.js'); +} + +f().next().then(({value: imported}) => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..fe7999ca48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-is-call-expression-square-brackets.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-async-generator-return-await.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +async function * f() { + return await import('./dynamic-import-module_FIXTURE.js')['then'](x => x); +} + +f().next().then(({value: imported}) => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable.js new file mode 100644 index 0000000000..10e780a61e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-returns-thenable.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-async-generator-return-await.template +/*--- +description: Dynamic import() returns a thenable object. (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +async function * f() { + return await import('./dynamic-import-module_FIXTURE.js'); +} + +f().next().then(({value: imported}) => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring.js new file mode 100644 index 0000000000..6860f6c7de --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-async-gen-return-await-specifier-tostring.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-async-generator-return-await.template +/*--- +description: ToString value of specifier (nested in async generator, returns awaited) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import, async-iteration] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +async function * f() { + return await import(obj); +} + +f().next().then(({value: imported}) => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..39560bd174 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +{ + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..6b9869e0d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +{ + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..ed0e01e870 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: import() from a script code can load a file with module code (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +{ + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..5b1853896f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +{ + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-returns-thenable.js new file mode 100644 index 0000000000..debb765143 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-returns-thenable.js @@ -0,0 +1,32 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: Dynamic import() returns a thenable object. (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +{ + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-specifier-tostring.js new file mode 100644 index 0000000000..588e930e9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-block-import-then-specifier-tostring.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-block.template +/*--- +description: ToString value of specifier (nested block) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +{ + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..9afd803e7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +do { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..730b3c8d2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-gtbndng-indirect-update.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +do { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..40d3557911 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: import() from a script code can load a file with module code (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +do { + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..617924bbb4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-is-call-expression-square-brackets.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +do { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-returns-thenable.js new file mode 100644 index 0000000000..8cbb6ca6bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-returns-thenable.js @@ -0,0 +1,32 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: Dynamic import() returns a thenable object. (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +do { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-specifier-tostring.js new file mode 100644 index 0000000000..8f46054a7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-do-while-specifier-tostring.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-do-while.template +/*--- +description: ToString value of specifier (nested do while syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +do { + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} while (false); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..75113b7b62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (false) { + +} else { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..c6e86a47c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (false) { + +} else { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..0f77bf936e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: import() from a script code can load a file with module code (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +if (false) { + +} else { + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..1a30aaa94f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +if (false) { + +} else { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-returns-thenable.js new file mode 100644 index 0000000000..f0da24a6fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-returns-thenable.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: Dynamic import() returns a thenable object. (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (false) { + +} else { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-specifier-tostring.js new file mode 100644 index 0000000000..3c9c8e1e95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-else-import-then-specifier-tostring.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-else.template +/*--- +description: ToString value of specifier (nested else) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +if (false) { + +} else { + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..6c4c5bc1db --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +function f() { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..eb0b4e8037 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +function f() { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..b2ef5536fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,39 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: import() from a script code can load a file with module code (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +function f() { + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..026df1da22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,35 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +function f() { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-returns-thenable.js new file mode 100644 index 0000000000..607aa740a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-returns-thenable.js @@ -0,0 +1,33 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: Dynamic import() returns a thenable object. (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +function f() { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-specifier-tostring.js new file mode 100644 index 0000000000..b88c1dbf0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-function-import-then-specifier-tostring.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-function.template +/*--- +description: ToString value of specifier (nested function) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +function f() { + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} +f(); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..fd149270b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..2b5176e069 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-gtbndng-indirect-update.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..de8ca0aa1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: import() from a script code can load a file with module code (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +if (true) import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..efa7c68353 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-is-call-expression-square-brackets.js @@ -0,0 +1,32 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +if (true) import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-returns-thenable.js new file mode 100644 index 0000000000..abcab19f64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-returns-thenable.js @@ -0,0 +1,30 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: Dynamic import() returns a thenable object. (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-specifier-tostring.js new file mode 100644 index 0000000000..fbcf4498e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-braceless-specifier-tostring.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-if-braceless.template +/*--- +description: ToString value of specifier (nested if syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +if (true) import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..9bd7b9ee2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..04c4edd41a --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +if (true) { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..bf587991d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: import() from a script code can load a file with module code (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +if (true) { + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..81041264df --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +if (true) { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-returns-thenable.js new file mode 100644 index 0000000000..a787e7a935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-returns-thenable.js @@ -0,0 +1,32 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: Dynamic import() returns a thenable object. (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +if (true) { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-specifier-tostring.js new file mode 100644 index 0000000000..29689a00db --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-if-import-then-specifier-tostring.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-if.template +/*--- +description: ToString value of specifier (nested if) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +if (true) { + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +} diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..4db59a8d73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..d6c1f720b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +let x = 0; +while (!x) { + x++; + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..784b590666 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: import() from a script code can load a file with module code (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +let x = 0; +while (!x) { + x++; + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..02949eafeb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +let x = 0; +while (!x) { + x++; + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-returns-thenable.js new file mode 100644 index 0000000000..4acb7c0b42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-returns-thenable.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: Dynamic import() returns a thenable object. (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +let x = 0; +while (!x) { + x++; + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-specifier-tostring.js new file mode 100644 index 0000000000..5e964f4b24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/nested-while-import-then-specifier-tostring.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-while.template +/*--- +description: ToString value of specifier (nested while) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +let x = 0; +while (!x) { + x++; + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/shell.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..c71c7402f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,45 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +label: { + import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..b4ebb1d9a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-gtbndng-indirect-update.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +label: { + import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..0ee09bea19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,38 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: import() from a script code can load a file with module code (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +label: { + import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..191f0422f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-is-call-expression-square-brackets.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +label: { + import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-returns-thenable.js new file mode 100644 index 0000000000..f5be52f78c --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-returns-thenable.js @@ -0,0 +1,32 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: Dynamic import() returns a thenable object. (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +label: { + import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-specifier-tostring.js new file mode 100644 index 0000000000..2278032e10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/syntax-nested-block-labeled-specifier-tostring.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/nested-block-labeled.template +/*--- +description: ToString value of specifier (nested block syntax) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +label: { + import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + + }).then($DONE, $DONE).catch($DONE); +}; diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js new file mode 100644 index 0000000000..af2f900476 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update-dflt.js @@ -0,0 +1,43 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update-dflt.case +// - src/dynamic-import/default/top-level.template +/*--- +description: Modifications to default binding that occur after dependency has been evaluated are reflected in local binding (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +import('./eval-gtbndng-indirect-update-dflt_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default(), 1); + assert.sameValue(imported.default, 2); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js new file mode 100644 index 0000000000..e0edaa0862 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-gtbndng-indirect-update.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-gtbndng-indirect-update.case +// - src/dynamic-import/default/top-level.template +/*--- +description: Modifications to named bindings that occur after dependency has been evaluated are reflected in local binding (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +includes: [fnGlobalObject.js] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + GetBindingValue (N, S) + + [...] + 3. If the binding for N is an indirect binding, then + a. Let M and N2 be the indirection values provided when this binding for + N was created. + b. Let targetEnv be M.[[Environment]]. + c. If targetEnv is undefined, throw a ReferenceError exception. + d. Let targetER be targetEnv's EnvironmentRecord. + e. Return ? targetER.GetBindingValue(N2, S). + +---*/ + +import('./eval-gtbndng-indirect-update_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + + // This function is exposed on the global scope (instead of as an exported + // binding) in order to avoid possible false positives from assuming correct + // behavior of the semantics under test. + fnGlobalObject().test262update(); + + assert.sameValue(imported.x, 2); + + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-script-code-host-resolves-module-code.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-script-code-host-resolves-module-code.js new file mode 100644 index 0000000000..d9eb3d4010 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-eval-script-code-host-resolves-module-code.js @@ -0,0 +1,36 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/eval-script-code-host-resolves-module-code.case +// - src/dynamic-import/default/top-level.template +/*--- +description: import() from a script code can load a file with module code (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// This is still valid in script code, and should not be valid for module code +// https://tc39.github.io/ecma262/#sec-scripts-static-semantics-lexicallydeclarednames +var smoosh; function smoosh() {} + + +import('./module-code_FIXTURE.js').then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js new file mode 100644 index 0000000000..4ec4bfd6bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-is-call-expression-square-brackets.js @@ -0,0 +1,32 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/is-call-expression-square-brackets.case +// - src/dynamic-import/default/top-level.template +/*--- +description: ImportCall is a CallExpression, it can be followed by square brackets (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ +// import('./dynamic-import-module_FIXTURE.js') + + +import('./dynamic-import-module_FIXTURE.js')['then'](x => x).then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-returns-thenable.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-returns-thenable.js new file mode 100644 index 0000000000..8824ea0b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-returns-thenable.js @@ -0,0 +1,30 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/returns-thenable.case +// - src/dynamic-import/default/top-level.template +/*--- +description: Dynamic import() returns a thenable object. (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + +---*/ + +import('./dynamic-import-module_FIXTURE.js').then(imported => { + + assert.sameValue(imported.x, 1); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-specifier-tostring.js b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-specifier-tostring.js new file mode 100644 index 0000000000..2958212116 --- /dev/null +++ b/js/src/tests/test262/language/expressions/dynamic-import/usage/top-level-import-then-specifier-tostring.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dynamic-import/specifier-tostring.case +// - src/dynamic-import/default/top-level.template +/*--- +description: ToString value of specifier (top level) +esid: sec-import-call-runtime-semantics-evaluation +features: [dynamic-import] +flags: [generated, async] +info: | + ImportCall : + import( AssignmentExpression ) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Assert: referencingScriptOrModule is a Script Record or Module Record (i.e. is not null). + 3. Let argRef be the result of evaluating AssignmentExpression. + 4. Let specifier be ? GetValue(argRef). + 5. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 6. Let specifierString be ToString(specifier). + 7. IfAbruptRejectPromise(specifierString, promiseCapability). + 8. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 9. Return promiseCapability.[[Promise]]. + + + Import Calls + + Runtime Semantics: Evaluation + + ImportCall : import(AssignmentExpression) + + 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). + 2. Let argRef be the result of evaluating AssignmentExpression. + 3. Let specifier be ? GetValue(argRef). + 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). + 5. Let specifierString be ToString(specifier). + 6. IfAbruptRejectPromise(specifierString, promiseCapability). + 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). + 8. Return promiseCapability.[[Promise]]. + +---*/ +// import('./module-code_FIXTURE.js') + +const obj = { + toString() { + return './module-code_FIXTURE.js'; + } +}; + + +import(obj).then(imported => { + + assert.sameValue(imported.default, 42); + assert.sameValue(imported.x, 'Test262'); + assert.sameValue(imported.z, 42); + +}).then($DONE, $DONE).catch($DONE); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A1.js new file mode 100644 index 0000000000..1e8f33661d --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between EqualityExpression and "==" or + between "==" and RelationalExpression are allowed +es5id: 11.9.1_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("true\u0009==\u00091") !== true) { + throw new Test262Error('#1: (true\\u0009==\\u00091) === true'); +} + +//CHECK#2 +if (eval("true\u000B==\u000B1") !== true) { + throw new Test262Error('#2: (true\\u000B==\\u000B1) === true'); +} + +//CHECK#3 +if (eval("true\u000C==\u000C1") !== true) { + throw new Test262Error('#3: (true\\u000C==\\u000C1) === true'); +} + +//CHECK#4 +if (eval("true\u0020==\u00201") !== true) { + throw new Test262Error('#4: (true\\u0020==\\u00201) === true'); +} + +//CHECK#5 +if (eval("true\u00A0==\u00A01") !== true) { + throw new Test262Error('#5: (true\\u00A0==\\u00A01) === true'); +} + +//CHECK#6 +if (eval("true\u000A==\u000A1") !== true) { + throw new Test262Error('#6: (true\\u000A==\\u000A1) === true'); +} + +//CHECK#7 +if (eval("true\u000D==\u000D1") !== true) { + throw new Test262Error('#7: (true\\u000D==\\u000D1) === true'); +} + +//CHECK#8 +if (eval("true\u2028==\u20281") !== true) { + throw new Test262Error('#8: (true\\u2028==\\u20281) === true'); +} + +//CHECK#9 +if (eval("true\u2029==\u20291") !== true) { + throw new Test262Error('#9: (true\\u2029==\\u20291) === true'); +} + +//CHECK#10 +if (eval("true\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029==\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== true) { + throw new Test262Error('#10: (true\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029==\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T1.js new file mode 100644 index 0000000000..592b30d231 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x == y uses GetValue +es5id: 11.9.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((1 == 1) !== true) { + throw new Test262Error('#1: (1 == 1) === true'); +} + +//CHECK#2 +var x = 1; +if ((x == 1) !== true) { + throw new Test262Error('#2: var x = 1; (x == 1) === true'); +} + +//CHECK#3 +var y = 1; +if ((1 == y) !== true) { + throw new Test262Error('#3: var y = 1; (1 == y) === true'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if ((x == y) !== true) { + throw new Test262Error('#4: var x = 1; var y = 1; (x == y) === true'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if ((objectx.prop == objecty.prop) !== true) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; (objectx.prop == objecty.prop) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T2.js new file mode 100644 index 0000000000..a35fef3d10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x == y uses GetValue +es5id: 11.9.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x == 1; + throw new Test262Error('#1.1: x == 1 throw ReferenceError. Actual: ' + (x == 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x == 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T3.js new file mode 100644 index 0000000000..4f38543299 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x == y uses GetValue +es5id: 11.9.1_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 == y; + throw new Test262Error('#1.1: 1 == y throw ReferenceError. Actual: ' + (1 == y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 == y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T1.js new file mode 100644 index 0000000000..3cf581ebde --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if (((x = 1) == x) !== true) { + throw new Test262Error('#1: var x = 0; ((x = 1) == x) === true'); +} + +//CHECK#2 +var x = 0; +if ((x == (x = 1)) !== false) { + throw new Test262Error('#2: var x = 0; (x == (x = 1)) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T2.js new file mode 100644 index 0000000000..8227853598 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() == y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() == y() throw "x". Actual: ' + (x() == y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() == y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T3.js new file mode 100644 index 0000000000..4b369e3840 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.1_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x == (x = 1); + throw new Test262Error('#1.1: x == (x = 1) throw ReferenceError. Actual: ' + (x == (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x == (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T4.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T4.js new file mode 100644 index 0000000000..ed9e99302f --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.1_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if (((y = 1) == y) !== true) { + throw new Test262Error('#1: ((y = 1) == y) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.1.js new file mode 100644 index 0000000000..97ec8afe5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Return true, if x and y are both true or both false; otherwise, return + false +es5id: 11.9.1_A3.1 +description: x and y are boolean primitives +---*/ + +//CHECK#1 +if ((true == true) !== true) { + throw new Test262Error('#1: (true == true) === true'); +} + +//CHECK#2 +if ((false == false) !== true) { + throw new Test262Error('#2: (false == false) === true'); +} + +//CHECK#3 +if ((true == false) !== false) { + throw new Test262Error('#3: (true == false) === false'); +} + +//CHECK#4 +if ((false == true) !== false) { + throw new Test262Error('#4: (false == true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.2.js new file mode 100644 index 0000000000..3bb1ae9192 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Boolean and Type(y) is Number, + return the result of comparison ToNumber(x) == y +es5id: 11.9.1_A3.2 +description: x is primitive boolean, y is primitive number +---*/ + +//CHECK#1 +if ((true == 1) !== true) { + throw new Test262Error('#1: (true == 1) === true'); +} + +//CHECK#2 +if ((false == "0") !== true) { + throw new Test262Error('#2: (false == "0") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.3.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.3.js new file mode 100644 index 0000000000..bd434194f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A3.3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(y) is Number and Type(y) is Boolean, + return the result of comparison x == ToNumber(y) +es5id: 11.9.1_A3.3 +description: x is primitive number, y is primitive boolean +---*/ + +//CHECK#1 +if ((0 == false) !== true) { + throw new Test262Error('#1: (0 == false) === true'); +} + +//CHECK#2 +if (("1" == true) !== true) { + throw new Test262Error('#2: ("1" == true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T1.js new file mode 100644 index 0000000000..2d5dfa9fe1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return false +es5id: 11.9.1_A4.1_T1 +description: x is NaN +---*/ + +//CHECK#1 +if ((Number.NaN == true) !== false) { + throw new Test262Error('#1: (NaN == true) === false'); +} + +//CHECK#2 +if ((Number.NaN == 1) !== false) { + throw new Test262Error('#2: (NaN == 1) === false'); +} + +//CHECK#3 +if ((Number.NaN == Number.NaN) !== false) { + throw new Test262Error('#3: (NaN == NaN) === false'); +} + +//CHECK#4 +if ((Number.NaN == Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#4: (NaN == +Infinity) === false'); +} + +//CHECK#5 +if ((Number.NaN == Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#5: (NaN == -Infinity) === false'); +} + +//CHECK#6 +if ((Number.NaN == Number.MAX_VALUE) !== false) { + throw new Test262Error('#6: (NaN == Number.MAX_VALUE) === false'); +} + +//CHECK#7 +if ((Number.NaN == Number.MIN_VALUE) !== false) { + throw new Test262Error('#7: (NaN == Number.MIN_VALUE) === false'); +} + +//CHECK#8 +if ((Number.NaN == "string") !== false) { + throw new Test262Error('#8: (NaN == "string") === false'); +} + +//CHECK#9 +if ((Number.NaN == new Object()) !== false) { + throw new Test262Error('#9: (NaN == new Object()) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T2.js new file mode 100644 index 0000000000..d8ea1f34b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.1_T2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return false +es5id: 11.9.1_A4.1_T2 +description: y is NaN +---*/ + +//CHECK#1 +if ((true == Number.NaN) !== false) { + throw new Test262Error('#1: (true == NaN) === false'); +} + +//CHECK#2 +if ((-1 == Number.NaN) !== false) { + throw new Test262Error('#2: (-1 == NaN) === false'); +} + +//CHECK#3 +if ((Number.NaN == Number.NaN) !== false) { + throw new Test262Error('#3: (NaN == NaN) === false'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY == Number.NaN) !== false) { + throw new Test262Error('#4: (+Infinity == NaN) === false'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY == Number.NaN) !== false) { + throw new Test262Error('#5: (-Infinity == NaN) === false'); +} + +//CHECK#6 +if ((Number.MAX_VALUE == Number.NaN) !== false) { + throw new Test262Error('#6: (Number.MAX_VALUE == NaN) === false'); +} + +//CHECK#7 +if ((Number.MIN_VALUE == Number.NaN) !== false) { + throw new Test262Error('#7: (Number.MIN_VALUE == NaN) === false'); +} + +//CHECK#8 +if (("string" == Number.NaN) !== false) { + throw new Test262Error('#8: ("string" == NaN) === false'); +} + +//CHECK#9 +if ((new Object() == Number.NaN) !== false) { + throw new Test262Error('#9: (new Object() == NaN) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.2.js new file mode 100644 index 0000000000..8aa8c6a508 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0(-0) and y is -0(+0), return true +es5id: 11.9.1_A4.2 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((+0 == -0) !== true) { + throw new Test262Error('#1: (+0 == -0) === true'); +} + +//CHECK#2 +if ((-0 == +0) !== true) { + throw new Test262Error('#2: (-0 == +0) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.3.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.3.js new file mode 100644 index 0000000000..d41ca431db --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A4.3.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Number-s minus NaN, +0, -0. + Return true, if x is the same number value as y; otherwise, return false +es5id: 11.9.1_A4.3 +description: x and y are primitive numbers +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#1: (+Infinity == +Infinity) === true'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#2: (-Infinity == -Infinity) === true'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY == -Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#3: (+Infinity == -(-Infinity)) === true'); +} + +//CHECK#4 +if ((1 == 0.999999999999) !== false) { + throw new Test262Error('#4: (1 == 0.999999999999) === false'); +} + +//CHECK#5 +if ((1.0 == 1) !== true) { + throw new Test262Error('#5: (1.0 == 1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.1.js new file mode 100644 index 0000000000..6197e3c718 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.1.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are String-s. + Return true, if x and y are exactly the same sequence of characters; otherwise, return false +es5id: 11.9.1_A5.1 +description: x and y are primitive string +---*/ + +//CHECK#1 +if (("" == "") !== true) { + throw new Test262Error('#1: ("" == "") === true'); +} + +//CHECK#2 +if ((" " == " ") !== true) { + throw new Test262Error('#2: " (" == " ") === true'); +} + +//CHECK#3 +if ((" " == "") !== false) { + throw new Test262Error('#3: " (" == "") === false'); +} + +//CHECK#4 +if (("string" == "string") !== true) { + throw new Test262Error('#4: ("string" == "string") === true'); +} + +//CHECK#5 +if ((" string" == "string ") !== false) { + throw new Test262Error('#5: (" string" == "string ") === false'); +} + +//CHECK#6 +if (("1.0" == "1") !== false) { + throw new Test262Error('#6: ("1.0" == "1") === false'); +} + +//CHECK#7 +if (("0xff" == "255") !== false) { + throw new Test262Error('#7: ("0xff" == "255") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.2.js new file mode 100644 index 0000000000..b4bd9fcc68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Number and Type(y) is String, + return the result of comparison x == ToNumber(y) +es5id: 11.9.1_A5.2 +description: x is primitive number, y is primitive string +---*/ + +//CHECK#1 +if ((1 == "1") !== true) { + throw new Test262Error('#1: (1 == "1") === true'); +} + +//CHECK#2 +if ((1.100 == "+1.10") !== true) { + throw new Test262Error('#2: (1.100 == "+1.10") === true'); +} + +//CHECK#3 +if ((1 == "true") !== false) { + throw new Test262Error('#3: (1 == "true") === false'); +} + +//CHECK#4 +if ((255 == "0xff") !== true) { + throw new Test262Error('#4: (255 == "0xff") === true'); +} + +//CHECK#5 +if ((0 == "") !== true) { + throw new Test262Error('#5: (0 == "") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.3.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.3.js new file mode 100644 index 0000000000..411c227932 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A5.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is String and Type(y) is Number, + return the result of comparison ToNumber(x) == y +es5id: 11.9.1_A5.3 +description: x is primitive string, y is primitive number +---*/ + +//CHECK#1 +if (("-1" == -1) !== true) { + throw new Test262Error('#1: ("-1" == -1) === true'); +} + +//CHECK#2 +if (("-1.100" == -1.10) !== true) { + throw new Test262Error('#2: ("-1.100" == -1.10) === true'); +} + +//CHECK#3 +if (("false" == 0) !== false) { + throw new Test262Error('#3: ("false" == 0) === false'); +} + +//CHECK#4 +if (("5e-324" == 5e-324) !== true) { + throw new Test262Error('#4: ("5e-324" == 5e-324) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.1.js new file mode 100644 index 0000000000..f0708833b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) as well as Type(y) is undefined or null, return true +es5id: 11.9.1_A6.1 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((undefined == undefined) !== true) { + throw new Test262Error('#1: (undefined == undefined) === true'); +} + +//CHECK#2 +if ((void 0 == undefined) !== true) { + throw new Test262Error('#2: (void 0 == undefined) === true'); +} + +//CHECK#3 +if ((undefined == eval("var x")) !== true) { + throw new Test262Error('#3: (undefined == eval("var x")) === true'); +} + +//CHECK#4 +if ((undefined == null) !== true) { + throw new Test262Error('#4: (undefined == null) === true'); +} + +//CHECK#5 +if ((null == void 0) !== true) { + throw new Test262Error('#5: (null == void 0) === true'); +} + +//CHECK#6 +if ((null == null) !== true) { + throw new Test262Error('#6: (null == null) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T1.js new file mode 100644 index 0000000000..bf7ca5b145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If one expression is undefined or null and another is not, return false +es5id: 11.9.1_A6.2_T1 +description: x is null or undefined, y is not +---*/ + +//CHECK#1 +if ((undefined == true) !== false) { + throw new Test262Error('#1: (undefined == true) === false'); +} + +//CHECK#2 +if ((undefined == 0) !== false) { + throw new Test262Error('#2: (undefined == 0) === false'); +} + +//CHECK#3 +if ((undefined == "undefined") !== false) { + throw new Test262Error('#3: (undefined == "undefined") === false'); +} + +//CHECK#4 +if ((undefined == {}) !== false) { + throw new Test262Error('#4: (undefined == {}) === false'); +} + +//CHECK#5 +if ((null == false) !== false) { + throw new Test262Error('#5: (null == false) === false'); +} + +//CHECK#6 +if ((null == 0) !== false) { + throw new Test262Error('#6: (null == 0) === false'); +} + +//CHECK#7 +if ((null == "null") !== false) { + throw new Test262Error('#7: (null == "null") === false'); +} + +//CHECK#8 +if ((null == {}) !== false) { + throw new Test262Error('#8: (null == {}) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T2.js new file mode 100644 index 0000000000..c80a3934f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A6.2_T2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If one expression is undefined or null and another is not, return false +es5id: 11.9.1_A6.2_T2 +description: y is null or undefined, x is not +---*/ + +//CHECK#1 +if ((false == undefined) !== false) { + throw new Test262Error('#1: (false == undefined) === false'); +} + +//CHECK#2 +if ((Number.NaN == undefined) !== false) { + throw new Test262Error('#2: (Number.NaN == undefined) === false'); +} + +//CHECK#3 +if (("undefined" == undefined) !== false) { + throw new Test262Error('#3: ("undefined" == undefined) === false'); +} + +//CHECK#4 +if (({} == undefined) !== false) { + throw new Test262Error('#4: ({} == undefined) === false'); +} + +//CHECK#5 +if ((false == null) !== false) { + throw new Test262Error('#5: (false == null) === false'); +} + +//CHECK#6 +if ((0 == null) !== false) { + throw new Test262Error('#6: (0 == null) === false'); +} + +//CHECK#7 +if (("null" == null) !== false) { + throw new Test262Error('#7: ("null" == null) === false'); +} + +//CHECK#8 +if (({} == null) !== false) { + throw new Test262Error('#8: ({} == null) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.1.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.1.js new file mode 100644 index 0000000000..e76333d376 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.1.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Object-s. + Return true, if x and y are references to the same Object; otherwise, return false +es5id: 11.9.1_A7.1 +description: > + Checking Boolean object, Number object, String object, Object + object +---*/ + +//CHECK#1 +if ((new Boolean(true) == new Boolean(true)) !== false) { + throw new Test262Error('#1: (new Boolean(true) == new Boolean(true)) === false'); +} + +//CHECK#2 +if ((new Number(1) == new Number(1)) !== false) { + throw new Test262Error('#2: (new Number(1) == new Number(1)) === false'); +} + +//CHECK#3 +if ((new String("x") == new String("x")) !== false) { + throw new Test262Error('#3: (new String("x") == new String("x")) === false'); +} + +//CHECK#4 +if ((new Object() == new Object()) !== false) { + throw new Test262Error('#4: (new Object() == new Object()) === false'); +} + +//CHECK#5 +var x, y; +x = {}; +y = x; +if ((x == y) !== true) { + throw new Test262Error('#5: x = {}; y = x; (x == y) === true'); +} + +//CHECK#6 +if ((new Boolean(true) == new Number(1)) !== false) { + throw new Test262Error('#6 (new Boolean(true) == new Number(1)) === false'); +} + +//CHECK#7 +if ((new Number(1) == new String("1")) !== false) { + throw new Test262Error('#7: (new Number(1) == new String("1")) === false'); +} + +//CHECK#8 +if ((new String("1") == new Boolean(true)) !== false) { + throw new Test262Error('#8: (new String("x") == new Boolean(true)) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.2.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.2.js new file mode 100644 index 0000000000..f1ab3cc4ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is Boolean, + return ToPrimitive(x) == y +es5id: 11.9.1_A7.2 +description: x is object, y is primitive boolean +---*/ + +//CHECK#1 +if ((new Boolean(true) == true) !== true) { + throw new Test262Error('#1: (new Boolean(true) == true) === true'); +} + +//CHECK#2 +if ((new Number(1) == true) !== true) { + throw new Test262Error('#2: (new Number(1) == true) === true'); +} + +//CHECK#3 +if ((new String("1") == true) !== true) { + throw new Test262Error('#3: (new String("1") == true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.3.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.3.js new file mode 100644 index 0000000000..1286eea598 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Boolean and Type(y) is Object, + return x == ToPrimitive(y) +es5id: 11.9.1_A7.3 +description: y is object, x is primitive boolean +---*/ + +//CHECK#1 +if ((true == new Boolean(true)) !== true) { + throw new Test262Error('#1: (true == new Boolean(true)) === true'); +} + +//CHECK#2 +if ((true == new Number(1)) !== true) { + throw new Test262Error('#2: (true == new Number(1)) === true'); +} + +//CHECK#3 +if ((true == new String("+1")) !== true) { + throw new Test262Error('#3: (true == new String("+1")) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.4.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.4.js new file mode 100644 index 0000000000..efbe60f019 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.4.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is Number, + return ToPrimitive(x) == y +es5id: 11.9.1_A7.4 +description: x is object, y is primitive number +---*/ + +//CHECK#1 +if ((new Boolean(true) == 1) !== true) { + throw new Test262Error('#1: (new Boolean(true) == 1) === true'); +} + +//CHECK#2 +if ((new Number(-1) == -1) !== true) { + throw new Test262Error('#2: (new Number(-1) == -1) === true'); +} + +//CHECK#3 +if ((new String("-1") == -1) !== true) { + throw new Test262Error('#3: (new String("-1") == -1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.5.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.5.js new file mode 100644 index 0000000000..f96c7cffa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.5.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Number and Type(y) is Object, + return x == ToPrimitive(y) +es5id: 11.9.1_A7.5 +description: y is object, x is primitive number +---*/ + +//CHECK#1 +if ((1 == new Boolean(true)) !== true) { + throw new Test262Error('#1: (1 == new Boolean(true)) === true'); +} + +//CHECK#2 +if ((-1 == new Number(-1)) !== true) { + throw new Test262Error('#2: (-1 == new Number(-1)) === true'); +} + +//CHECK#3 +if ((-1 == new String("-1")) !== true) { + throw new Test262Error('#3: (-1 == new String("-1")) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.6.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.6.js new file mode 100644 index 0000000000..d4e0801a64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.6.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is String, + return ToPrimitive(x) == y +es5id: 11.9.1_A7.6 +description: x is object, y is primitive string +---*/ + +//CHECK#1 +if ((new Boolean(true) == "1") !== true) { + throw new Test262Error('#1: (new Boolean(true) == "1") === true'); +} + +//CHECK#2 +if ((new Number(-1) == "-1") !== true) { + throw new Test262Error('#2: (new Number(-1) == "-1") === true'); +} + +//CHECK#3 +if ((new String("x") == "x") !== true) { + throw new Test262Error('#3: (new String("x") == "x") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.7.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.7.js new file mode 100644 index 0000000000..3351781822 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.7.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is String and Type(y) is Object, + return x == ToPrimitive(y) +es5id: 11.9.1_A7.7 +description: y is object, x is primitive string +---*/ + +//CHECK#1 +if (("1" == new Boolean(true)) !== true) { + throw new Test262Error('#1: ("1" == new Boolean(true)) === true'); +} + +//CHECK#2 +if (("-1" == new Number(-1)) !== true) { + throw new Test262Error('#2: ("-1" == new Number(-1)) === true'); +} + +//CHECK#3 +if (("x" == new String("x")) !== true) { + throw new Test262Error('#3: ("x" == new String("x")) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.8.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.8.js new file mode 100644 index 0000000000..4b4e37f3b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.8.js @@ -0,0 +1,77 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is Object and Type(y) is primitive type, + return ToPrimitive(x) == y +es5id: 11.9.1_A7.8 +description: x is object, y is primtitive +---*/ + +//CHECK#1 +if (({valueOf: function() {return 1}} == true) !== true) { + throw new Test262Error('#1: ({valueOf: function() {return 1}} == true) === true'); +} + +//CHECK#2 +if (({valueOf: function() {return 1}, toString: function() {return 0}} == 1) !== true) { + throw new Test262Error('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} == 1) === true'); +} + +//CHECK#3 +if (({valueOf: function() {return 1}, toString: function() {return {}}} == "+1") !== true) { + throw new Test262Error('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} == "+1") === true'); +} + +//CHECK#4 +try { + if (({valueOf: function() {return "+1"}, toString: function() {throw "error"}} == true) !== true) { + throw new Test262Error('#4.1: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} == true) === true'); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} == true) not throw "error"'); + } else { + throw new Test262Error('#4.3: ({valueOf: function() {return "+1"}, toString: function() {throw "error"}} == true) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (({toString: function() {return "+1"}} == 1) !== true) { + throw new Test262Error('#5: ({toString: function() {return "+1"}} == 1) === true'); +} + +//CHECK#6 +if (({valueOf: function() {return {}}, toString: function() {return "+1"}} == "1") !== false) { + throw new Test262Error('#6.1: ({valueOf: function() {return {}}, toString: function() {return "+1"}} == "1") === false'); +} else { + if (({valueOf: function() {return {}}, toString: function() {return "+1"}} == "+1") !== true) { + throw new Test262Error('#6.2: ({valueOf: function() {return {}}, toString: function() {return "+1"}} == "+1") === true'); + } +} + +//CHECK#7 +try { + ({valueOf: function() {throw "error"}, toString: function() {return 1}} == 1); + throw new Test262Error('#7.1: ({valueOf: function() {throw "error"}, toString: function() {return 1}} == 1) throw "error". Actual: ' + (({valueOf: function() {throw "error"}, toString: function() {return 1}} == 1))); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: ({valueOf: function() {throw "error"}, toString: function() {return 1}} == 1) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + ({valueOf: function() {return {}}, toString: function() {return {}}} == 1); + throw new Test262Error('#8.1: ({valueOf: function() {return {}}, toString: function() {return {}}} == 1) throw TypeError. Actual: ' + (({valueOf: function() {return {}}, toString: function() {return {}}} == 1))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: ({valueOf: function() {return {}}, toString: function() {return {}}} == 1) throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.9.js b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.9.js new file mode 100644 index 0000000000..6b858ef267 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S11.9.1_A7.9.js @@ -0,0 +1,77 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(x) is primitive type and Type(y) is Object, + return x == ToPrimitive(y) +es5id: 11.9.1_A7.9 +description: y is object, x is primtitive +---*/ + +//CHECK#1 +if ((true == {valueOf: function() {return 1}}) !== true) { + throw new Test262Error('#1: (true == {valueOf: function() {return 1}}) === true'); +} + +//CHECK#2 +if ((1 == {valueOf: function() {return 1}, toString: function() {return 0}}) !== true) { + throw new Test262Error('#2: (1 == {valueOf: function() {return 1}, toString: function() {return 0}}) === true'); +} + +//CHECK#3 +if (("+1" == {valueOf: function() {return 1}, toString: function() {return {}}}) !== true) { + throw new Test262Error('#3: ("+1" == {valueOf: function() {return 1}, toString: function() {return {}}}) === true'); +} + +//CHECK#4 +try { + if ((true == {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) !== true) { + throw new Test262Error('#4.1: (true == {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) === true'); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: (true == {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) not throw "error"'); + } else { + throw new Test262Error('#4.3: (true == {valueOf: function() {return "+1"}, toString: function() {throw "error"}}) not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if ((1 == {toString: function() {return "+1"}}) !== true) { + throw new Test262Error('#5: (1 == {toString: function() {return "+1"}}) === true'); +} + +//CHECK#6 +if (("1" == {valueOf: function() {return {}}, toString: function() {return "+1"}}) !== false) { + throw new Test262Error('#6.1: ("1" == {valueOf: function() {return {}}, toString: function() {return "+1"}}) === false'); +} else { + if (("+1" == {valueOf: function() {return {}}, toString: function() {return "+1"}}) !== true) { + throw new Test262Error('#6.2: ("+1" == {valueOf: function() {return {}}, toString: function() {return "+1"}}) === true'); + } +} + +//CHECK#7 +try { + (1 == {valueOf: function() {throw "error"}, toString: function() {return 1}}); + throw new Test262Error('#7.1: (1 == {valueOf: function() {throw "error"}, toString: function() {return 1}}) throw "error". Actual: ' + ((1 == {valueOf: function() {throw "error"}, toString: function() {return 1}}))); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: (1 == {valueOf: function() {throw "error"}, toString: function() {return 1}}) throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + (1 == {valueOf: function() {return {}}, toString: function() {return {}}}); + throw new Test262Error('#8.1: (1 == {valueOf: function() {return {}}, toString: function() {return {}}}) throw TypeError. Actual: ' + ((1 == {valueOf: function() {return {}}, toString: function() {return {}}}))); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: (1 == {valueOf: function() {return {}}, toString: function() {return {}}}) throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/S9.1_A1_T3.js b/js/src/tests/test262/language/expressions/equals/S9.1_A1_T3.js new file mode 100644 index 0000000000..00fa3e8416 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/S9.1_A1_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of primitive conversion from object is a default value for the + Object +es5id: 9.1_A1_T3 +description: > + Using operator "+". This operator firstly calls ToPrimitive and + then calls ToString or ToNumber +---*/ + +// CHECK#1 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (object + "" !== "1") { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; object + "" === "1". Actual: ' + (object + "")); +} + +// CHECK#2 +var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; +if (object + 0 !== "10") { + throw new Test262Error('#2: var object = {valueOf: function() {return "1"}, toString: function() {return 0}}; object + 0 === "10". Actual: ' + (object + 0)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/equals/bigint-and-bigint.js new file mode 100644 index 0000000000..b5a49281e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-bigint.js @@ -0,0 +1,173 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt values +esid: sec-abstract-equality-comparison +info: | + 1. If Type(x) is the same as Type(y), then + a. Return the result of performing Strict Equality Comparison x === y. + + sec-numeric-types-bigint-equal + BigInt::equal (x, y) + + The abstract operation BigInt::equal with two arguments x and y of BigInt type returns true if x and y have the same mathematical integer value and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n == 0n, true, 'The result of (0n == 0n) is true'); +assert.sameValue(1n == 1n, true, 'The result of (1n == 1n) is true'); +assert.sameValue(-1n == -1n, true, 'The result of (-1n == -1n) is true'); +assert.sameValue(0n == -0n, true, 'The result of (0n == -0n) is true'); +assert.sameValue(-0n == 0n, true, 'The result of (-0n == 0n) is true'); +assert.sameValue(0n == 1n, false, 'The result of (0n == 1n) is false'); +assert.sameValue(1n == 0n, false, 'The result of (1n == 0n) is false'); +assert.sameValue(0n == -1n, false, 'The result of (0n == -1n) is false'); +assert.sameValue(-1n == 0n, false, 'The result of (-1n == 0n) is false'); +assert.sameValue(1n == -1n, false, 'The result of (1n == -1n) is false'); +assert.sameValue(-1n == 1n, false, 'The result of (-1n == 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n == 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff01n == 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x1fffffffffffff01n == 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n == 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n == 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n == 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n == -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff01n == -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n == -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n == -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n == -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n == -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n == 0n, + false, + 'The result of (0x10000000000000000n == 0n) is false' +); + +assert.sameValue( + 0n == 0x10000000000000000n, + false, + 'The result of (0n == 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n == 1n, + false, + 'The result of (0x10000000000000000n == 1n) is false' +); + +assert.sameValue( + 1n == 0x10000000000000000n, + false, + 'The result of (1n == 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n == -1n, + false, + 'The result of (0x10000000000000000n == -1n) is false' +); + +assert.sameValue( + -1n == 0x10000000000000000n, + false, + 'The result of (-1n == 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n == 0n, + false, + 'The result of (0x10000000000000001n == 0n) is false' +); + +assert.sameValue( + 0n == 0x10000000000000001n, + false, + 'The result of (0n == 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n == 0n, + false, + 'The result of (-0x10000000000000000n == 0n) is false' +); + +assert.sameValue( + 0n == -0x10000000000000000n, + false, + 'The result of (0n == -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n == 1n, + false, + 'The result of (-0x10000000000000000n == 1n) is false' +); + +assert.sameValue( + 1n == -0x10000000000000000n, + false, + 'The result of (1n == -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n == -1n, + false, + 'The result of (-0x10000000000000000n == -1n) is false' +); + +assert.sameValue( + -1n == -0x10000000000000000n, + false, + 'The result of (-1n == -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n == 0n, + false, + 'The result of (-0x10000000000000001n == 0n) is false' +); + +assert.sameValue( + 0n == -0x10000000000000001n, + false, + 'The result of (0n == -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n == 0x100000000n, + false, + 'The result of (0x10000000000000000n == 0x100000000n) is false' +); + +assert.sameValue( + 0x100000000n == 0x10000000000000000n, + false, + 'The result of (0x100000000n == 0x10000000000000000n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/equals/bigint-and-boolean.js new file mode 100644 index 0000000000..6e330d3653 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-boolean.js @@ -0,0 +1,33 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt and Boolean values +esid: sec-abstract-equality-comparison +info: | + 8. If Type(x) is Boolean, return the result of the comparison ToNumber(x) == y. + 9. If Type(y) is Boolean, return the result of the comparison x == ToNumber(y). + ... + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + ... + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false. + +features: [BigInt] +---*/ +assert.sameValue(-1n == false, false, 'The result of (-1n == false) is false'); +assert.sameValue(false == -1n, false, 'The result of (false == -1n) is false'); +assert.sameValue(-1n == true, false, 'The result of (-1n == true) is false'); +assert.sameValue(true == -1n, false, 'The result of (true == -1n) is false'); +assert.sameValue(0n == false, true, 'The result of (0n == false) is true'); +assert.sameValue(false == 0n, true, 'The result of (false == 0n) is true'); +assert.sameValue(0n == true, false, 'The result of (0n == true) is false'); +assert.sameValue(true == 0n, false, 'The result of (true == 0n) is false'); +assert.sameValue(1n == false, false, 'The result of (1n == false) is false'); +assert.sameValue(false == 1n, false, 'The result of (false == 1n) is false'); +assert.sameValue(1n == true, true, 'The result of (1n == true) is true'); +assert.sameValue(true == 1n, true, 'The result of (true == 1n) is true'); +assert.sameValue(2n == false, false, 'The result of (2n == false) is false'); +assert.sameValue(false == 2n, false, 'The result of (false == 2n) is false'); +assert.sameValue(2n == true, false, 'The result of (2n == true) is false'); +assert.sameValue(true == 2n, false, 'The result of (true == 2n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-incomparable-primitive.js b/js/src/tests/test262/language/expressions/equals/bigint-and-incomparable-primitive.js new file mode 100644 index 0000000000..b0c6f900b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-incomparable-primitive.js @@ -0,0 +1,26 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt and miscellaneous primitive values +esid: sec-equality-operators-runtime-semantics-evaluation +info: | + EqualityExpression : EqualityExpression == RelationalExpression + ... + 5. Return the result of performing Abstract Equality Comparison rval == lval. + +features: [BigInt, Symbol] +---*/ +assert.sameValue(0n == undefined, false, 'The result of (0n == undefined) is false'); +assert.sameValue(undefined == 0n, false, 'The result of (undefined == 0n) is false'); +assert.sameValue(1n == undefined, false, 'The result of (1n == undefined) is false'); +assert.sameValue(undefined == 1n, false, 'The result of (undefined == 1n) is false'); +assert.sameValue(0n == null, false, 'The result of (0n == null) is false'); +assert.sameValue(null == 0n, false, 'The result of (null == 0n) is false'); +assert.sameValue(1n == null, false, 'The result of (1n == null) is false'); +assert.sameValue(null == 1n, false, 'The result of (null == 1n) is false'); +assert.sameValue(0n == Symbol('1'), false, 'The result of (0n == Symbol("1")) is false'); +assert.sameValue(Symbol('1') == 0n, false, 'The result of (Symbol("1") == 0n) is false'); +assert.sameValue(1n == Symbol('1'), false, 'The result of (1n == Symbol("1")) is false'); +assert.sameValue(Symbol('1') == 1n, false, 'The result of (Symbol("1") == 1n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/equals/bigint-and-non-finite.js new file mode 100644 index 0000000000..059bcb36d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt and non-finite Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + a. If x or y are any of NaN, +∞, or -∞, return false. + +features: [BigInt] +---*/ +assert.sameValue(0n == Infinity, false, 'The result of (0n == Infinity) is false'); +assert.sameValue(Infinity == 0n, false, 'The result of (Infinity == 0n) is false'); +assert.sameValue(1n == Infinity, false, 'The result of (1n == Infinity) is false'); +assert.sameValue(Infinity == 1n, false, 'The result of (Infinity == 1n) is false'); +assert.sameValue(-1n == Infinity, false, 'The result of (-1n == Infinity) is false'); +assert.sameValue(Infinity == -1n, false, 'The result of (Infinity == -1n) is false'); +assert.sameValue(0n == -Infinity, false, 'The result of (0n == -Infinity) is false'); +assert.sameValue(-Infinity == 0n, false, 'The result of (-Infinity == 0n) is false'); +assert.sameValue(1n == -Infinity, false, 'The result of (1n == -Infinity) is false'); +assert.sameValue(-Infinity == 1n, false, 'The result of (-Infinity == 1n) is false'); +assert.sameValue(-1n == -Infinity, false, 'The result of (-1n == -Infinity) is false'); +assert.sameValue(-Infinity == -1n, false, 'The result of (-Infinity == -1n) is false'); +assert.sameValue(0n == NaN, false, 'The result of (0n == NaN) is false'); +assert.sameValue(NaN == 0n, false, 'The result of (NaN == 0n) is false'); +assert.sameValue(1n == NaN, false, 'The result of (1n == NaN) is false'); +assert.sameValue(NaN == 1n, false, 'The result of (NaN == 1n) is false'); +assert.sameValue(-1n == NaN, false, 'The result of (-1n == NaN) is false'); +assert.sameValue(NaN == -1n, false, 'The result of (NaN == -1n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/equals/bigint-and-number-extremes.js new file mode 100644 index 0000000000..22d56981f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-number-extremes.js @@ -0,0 +1,63 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt and large Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false. + +features: [BigInt] +---*/ +assert.sameValue(1n == Number.MAX_VALUE, false, 'The result of (1n == Number.MAX_VALUE) is false'); +assert.sameValue(Number.MAX_VALUE == 1n, false, 'The result of (Number.MAX_VALUE == 1n) is false'); + +assert.sameValue( + 1n == -Number.MAX_VALUE, + false, + 'The result of (1n == -Number.MAX_VALUE) is false' +); + +assert.sameValue( + -Number.MAX_VALUE == 1n, + false, + 'The result of (-Number.MAX_VALUE == 1n) is false' +); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn == Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn == Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE == 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + false, + 'The result of (Number.MAX_VALUE == 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n == Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n == Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + true, + 'The result of (Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n == Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n == Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + false, + 'The result of (Number.MAX_VALUE == 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-number.js b/js/src/tests/test262/language/expressions/equals/bigint-and-number.js new file mode 100644 index 0000000000..6a2ac3f831 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-number.js @@ -0,0 +1,53 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt and Number values +esid: sec-abstract-equality-comparison +info: | + 12. If Type(x) is BigInt and Type(y) is Number, or if Type(x) is Number and Type(y) is BigInt, + b. If the mathematical value of x is equal to the mathematical value of y, return true, otherwise return false. + +features: [BigInt] +---*/ +assert.sameValue(0n == 0, true, 'The result of (0n == 0) is true'); +assert.sameValue(0 == 0n, true, 'The result of (0 == 0n) is true'); +assert.sameValue(0n == -0, true, 'The result of (0n == -0) is true'); +assert.sameValue(-0 == 0n, true, 'The result of (-0 == 0n) is true'); +assert.sameValue(0n == 0.000000000001, false, 'The result of (0n == 0.000000000001) is false'); +assert.sameValue(0.000000000001 == 0n, false, 'The result of (0.000000000001 == 0n) is false'); +assert.sameValue(0n == 1, false, 'The result of (0n == 1) is false'); +assert.sameValue(1 == 0n, false, 'The result of (1 == 0n) is false'); +assert.sameValue(1n == 0, false, 'The result of (1n == 0) is false'); +assert.sameValue(0 == 1n, false, 'The result of (0 == 1n) is false'); +assert.sameValue(1n == 0.999999999999, false, 'The result of (1n == 0.999999999999) is false'); +assert.sameValue(0.999999999999 == 1n, false, 'The result of (0.999999999999 == 1n) is false'); +assert.sameValue(1n == 1, true, 'The result of (1n == 1) is true'); +assert.sameValue(1 == 1n, true, 'The result of (1 == 1n) is true'); +assert.sameValue(0n == Number.MIN_VALUE, false, 'The result of (0n == Number.MIN_VALUE) is false'); +assert.sameValue(Number.MIN_VALUE == 0n, false, 'The result of (Number.MIN_VALUE == 0n) is false'); + +assert.sameValue( + 0n == -Number.MIN_VALUE, + false, + 'The result of (0n == -Number.MIN_VALUE) is false' +); + +assert.sameValue( + -Number.MIN_VALUE == 0n, + false, + 'The result of (-Number.MIN_VALUE == 0n) is false' +); + +assert.sameValue( + -10n == Number.MIN_VALUE, + false, + 'The result of (-10n == Number.MIN_VALUE) is false' +); + +assert.sameValue( + Number.MIN_VALUE == -10n, + false, + 'The result of (Number.MIN_VALUE == -10n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-object.js b/js/src/tests/test262/language/expressions/equals/bigint-and-object.js new file mode 100644 index 0000000000..f31a5f173e --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-object.js @@ -0,0 +1,136 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt values and non-primitive objects +esid: sec-abstract-equality-comparison +info: | + 10. If Type(x) is either String, Number, BigInt, or Symbol and Type(y) is Object, return the result of the comparison x == ? ToPrimitive(y). + 11. If Type(x) is Object and Type(y) is either String, Number, BigInt, or Symbol, return the result of the comparison ? ToPrimitive(x) == y. + + then after the recursion: + + 1. If Type(x) is the same as Type(y), then + a. Return the result of performing Strict Equality Comparison x === y. + ... + 6. If Type(x) is BigInt and Type(y) is String, + a. Let n be StringToBigInt(y). + b. If n is NaN, return false. + c. Return the result of x == n. + 7. If Type(x) is String and Type(y) is BigInt, return the result of y == x. + +features: [BigInt] +---*/ +assert.sameValue(0n == Object(0n), true, 'The result of (0n == Object(0n)) is true'); +assert.sameValue(Object(0n) == 0n, true, 'The result of (Object(0n) == 0n) is true'); +assert.sameValue(0n == Object(1n), false, 'The result of (0n == Object(1n)) is false'); +assert.sameValue(Object(1n) == 0n, false, 'The result of (Object(1n) == 0n) is false'); +assert.sameValue(1n == Object(0n), false, 'The result of (1n == Object(0n)) is false'); +assert.sameValue(Object(0n) == 1n, false, 'The result of (Object(0n) == 1n) is false'); +assert.sameValue(1n == Object(1n), true, 'The result of (1n == Object(1n)) is true'); +assert.sameValue(Object(1n) == 1n, true, 'The result of (Object(1n) == 1n) is true'); +assert.sameValue(2n == Object(0n), false, 'The result of (2n == Object(0n)) is false'); +assert.sameValue(Object(0n) == 2n, false, 'The result of (Object(0n) == 2n) is false'); +assert.sameValue(2n == Object(1n), false, 'The result of (2n == Object(1n)) is false'); +assert.sameValue(Object(1n) == 2n, false, 'The result of (Object(1n) == 2n) is false'); +assert.sameValue(2n == Object(2n), true, 'The result of (2n == Object(2n)) is true'); +assert.sameValue(Object(2n) == 2n, true, 'The result of (Object(2n) == 2n) is true'); +assert.sameValue(0n == {}, false, 'The result of (0n == {}) is false'); +assert.sameValue({} == 0n, false, 'The result of (({}) == 0n) is false'); + +assert.sameValue(0n == { + valueOf: function() { + return 0n; + } +}, true, 'The result of (0n == {valueOf: function() {return 0n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} == 0n, true, 'The result of (({valueOf: function() {return 0n;}}) == 0n) is true'); + +assert.sameValue(0n == { + valueOf: function() { + return 1n; + } +}, false, 'The result of (0n == {valueOf: function() {return 1n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} == 0n, false, 'The result of (({valueOf: function() {return 1n;}}) == 0n) is false'); + +assert.sameValue(0n == { + toString: function() { + return '0'; + } +}, true, 'The result of (0n == {toString: function() {return "0";}}) is true'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} == 0n, true, 'The result of (({toString: function() {return "0";}}) == 0n) is true'); + +assert.sameValue(0n == { + toString: function() { + return '1'; + } +}, false, 'The result of (0n == {toString: function() {return "1";}}) is false'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} == 0n, false, 'The result of (({toString: function() {return "1";}}) == 0n) is false'); + +assert.sameValue(900719925474099101n == { + valueOf: function() { + return 900719925474099101n; + } +}, true, 'The result of (900719925474099101n == {valueOf: function() {return 900719925474099101n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} == 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099101n;}}) == 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n == { + valueOf: function() { + return 900719925474099102n; + } +}, false, 'The result of (900719925474099101n == {valueOf: function() {return 900719925474099102n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} == 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099102n;}}) == 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n == { + toString: function() { + return '900719925474099101'; + } +}, true, 'The result of (900719925474099101n == {toString: function() {return "900719925474099101";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} == 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099101";}}) == 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n == { + toString: function() { + return '900719925474099102'; + } +}, false, 'The result of (900719925474099101n == {toString: function() {return "900719925474099102";}}) is false'); + +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} == 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099102";}}) == 900719925474099101n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/bigint-and-string.js b/js/src/tests/test262/language/expressions/equals/bigint-and-string.js new file mode 100644 index 0000000000..6da7bd0e43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/bigint-and-string.js @@ -0,0 +1,68 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Non-strict equality comparison of BigInt and String values +esid: sec-abstract-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n == '', true, 'The result of (0n == "") is true'); +assert.sameValue('' == 0n, true, 'The result of ("" == 0n) is true'); +assert.sameValue(0n == '-0', true, 'The result of (0n == "-0") is true'); +assert.sameValue('-0' == 0n, true, 'The result of ("-0" == 0n) is true'); +assert.sameValue(0n == '0', true, 'The result of (0n == "0") is true'); +assert.sameValue('0' == 0n, true, 'The result of ("0" == 0n) is true'); +assert.sameValue(0n == '-1', false, 'The result of (0n == "-1") is false'); +assert.sameValue('-1' == 0n, false, 'The result of ("-1" == 0n) is false'); +assert.sameValue(0n == '1', false, 'The result of (0n == "1") is false'); +assert.sameValue('1' == 0n, false, 'The result of ("1" == 0n) is false'); +assert.sameValue(0n == 'foo', false, 'The result of (0n == "foo") is false'); +assert.sameValue('foo' == 0n, false, 'The result of ("foo" == 0n) is false'); +assert.sameValue(1n == '', false, 'The result of (1n == "") is false'); +assert.sameValue('' == 1n, false, 'The result of ("" == 1n) is false'); +assert.sameValue(1n == '-0', false, 'The result of (1n == "-0") is false'); +assert.sameValue('-0' == 1n, false, 'The result of ("-0" == 1n) is false'); +assert.sameValue(1n == '0', false, 'The result of (1n == "0") is false'); +assert.sameValue('0' == 1n, false, 'The result of ("0" == 1n) is false'); +assert.sameValue(1n == '-1', false, 'The result of (1n == "-1") is false'); +assert.sameValue('-1' == 1n, false, 'The result of ("-1" == 1n) is false'); +assert.sameValue(1n == '1', true, 'The result of (1n == "1") is true'); +assert.sameValue('1' == 1n, true, 'The result of ("1" == 1n) is true'); +assert.sameValue(1n == 'foo', false, 'The result of (1n == "foo") is false'); +assert.sameValue('foo' == 1n, false, 'The result of ("foo" == 1n) is false'); +assert.sameValue(-1n == '-', false, 'The result of (-1n == "-") is false'); +assert.sameValue('-' == -1n, false, 'The result of ("-" == -1n) is false'); +assert.sameValue(-1n == '-0', false, 'The result of (-1n == "-0") is false'); +assert.sameValue('-0' == -1n, false, 'The result of ("-0" == -1n) is false'); +assert.sameValue(-1n == '-1', true, 'The result of (-1n == "-1") is true'); +assert.sameValue('-1' == -1n, true, 'The result of ("-1" == -1n) is true'); +assert.sameValue(-1n == '-foo', false, 'The result of (-1n == "-foo") is false'); +assert.sameValue('-foo' == -1n, false, 'The result of ("-foo" == -1n) is false'); + +assert.sameValue( + 900719925474099101n == '900719925474099101', + true, + 'The result of (900719925474099101n == "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' == 900719925474099101n, + true, + 'The result of ("900719925474099101" == 900719925474099101n) is true' +); + +assert.sameValue( + 900719925474099102n == '900719925474099101', + false, + 'The result of (900719925474099102n == "900719925474099101") is false' +); + +assert.sameValue( + '900719925474099101' == 900719925474099102n, + false, + 'The result of ("900719925474099101" == 900719925474099102n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/browser.js b/js/src/tests/test262/language/expressions/equals/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-err.js b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-err.js new file mode 100644 index 0000000000..7bb8cf0b73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-err.js @@ -0,0 +1,39 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.10.3 +description: > + Behavior when error thrown by invocation of `Symbol.toPrimitive` method + during coercion +info: | + [...] + 7. Return the result of performing Abstract Equality Comparison rval == + lval. + + ES6 Section 7.2.12 Abstract Equality Comparison + + [...] + 10. If Type(x) is either String, Number, or Symbol and Type(y) is Object, + then return the result of the comparison x == ToPrimitive(y). + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + b. ReturnIfAbrupt(result). +features: [Symbol.toPrimitive] +---*/ + +var y = {}; +y[Symbol.toPrimitive] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + 0 == y; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-invocation.js b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-invocation.js new file mode 100644 index 0000000000..01174e4717 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-invocation.js @@ -0,0 +1,50 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.10.3 +description: Invocation of `Symbol.toPrimitive` method during coercion +info: | + [...] + 7. Return the result of performing Abstract Equality Comparison rval == + lval. + + ES6 Section 7.2.12 Abstract Equality Comparison + + [...] + 10. If Type(x) is either String, Number, or Symbol and Type(y) is Object, + then return the result of the comparison x == ToPrimitive(y). + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + 1. If PreferredType was not passed, let hint be "default". + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + [...] +features: [Symbol.toPrimitive] +---*/ + +var y = {}; +var callCount = 0; +var thisVal, args; + +y[Symbol.toPrimitive] = function() { + callCount += 1; + thisVal = this; + args = arguments; +}; + +0 == y; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); +assert.sameValue(thisVal, y, '`this` value is the object being compared'); +assert.sameValue(args.length, 1, 'method invoked with exactly one argument'); +assert.sameValue( + args[0], + 'default', + 'method invoked with the string "default" as the first argument' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-obj.js b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-obj.js new file mode 100644 index 0000000000..6ba1d7fb9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-obj.js @@ -0,0 +1,53 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.10.3 +description: > + Behavior when coercion via `Symbol.toPrimitive` yields an Object +info: | + [...] + 7. Return the result of performing Abstract Equality Comparison rval == + lval. + + ES6 Section 7.2.12 Abstract Equality Comparison + + [...] + 10. If Type(x) is either String, Number, or Symbol and Type(y) is Object, + then return the result of the comparison x == ToPrimitive(y). + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + b. ReturnIfAbrupt(result). + c. If Type(result) is not Object, return result. + d. Throw a TypeError exception. +features: [Symbol.toPrimitive] +---*/ + +var y = {}; +var retVal; + +y[Symbol.toPrimitive] = function() { + return retVal; +}; + +retVal = {}; +assert.throws(TypeError, function() { + 0 == y; +}); + +retVal = new Number(); +assert.throws(TypeError, function() { + 0 == y; +}); + +retVal = new String(); +assert.throws(TypeError, function() { + 0 == y; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-prim.js b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-prim.js new file mode 100644 index 0000000000..30dcfe105c --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/coerce-symbol-to-prim-return-prim.js @@ -0,0 +1,49 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.10.3 +description: > + Behavior when coercion via `Symbol.toPrimitive` yields a primitive value +info: | + [...] + 7. Return the result of performing Abstract Equality Comparison rval == + lval. + + ES6 Section 7.2.12 Abstract Equality Comparison + + [...] + 10. If Type(x) is either String, Number, or Symbol and Type(y) is Object, + then return the result of the comparison x == ToPrimitive(y). + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). + 6. If exoticToPrim is not undefined, then + a. Let result be Call(exoticToPrim, input, «hint»). + b. ReturnIfAbrupt(result). + c. If Type(result) is not Object, return result. +features: [Symbol.toPrimitive] +---*/ + +var y = {}; +var retVal; + +y[Symbol.toPrimitive] = function() { + return retVal; +}; + +retVal = 86; +assert.sameValue(0 == y, false, 'number primitive (not equal)'); +assert.sameValue(86 == y, true, 'number primitive (equal)'); + +retVal = 'str'; +assert.sameValue(0 == y, false, 'string primitive (not equal)'); +assert.sameValue('str' == y, true, 'sting primitive (equal)'); + +retVal = Symbol.toPrimitive; +assert.sameValue(0 == y, false, 'symbol (not equal)'); +assert.sameValue(Symbol.toPrimitive == y, true, 'symbol (equal)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/get-symbol-to-prim-err.js b/js/src/tests/test262/language/expressions/equals/get-symbol-to-prim-err.js new file mode 100644 index 0000000000..bb342d7643 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/get-symbol-to-prim-err.js @@ -0,0 +1,36 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.10.3 +description: > + Behavior when error thrown while accessing `Symbol.toPrimitive` property +info: | + [...] + 7. Return the result of performing Abstract Equality Comparison rval == + lval. + + ES6 Section 7.2.12 Abstract Equality Comparison + + [...] + 10. If Type(x) is either String, Number, or Symbol and Type(y) is Object, + then return the result of the comparison x == ToPrimitive(y). + + ES6 Section 7.1.1 ToPrimitive ( input [, PreferredType] ) + + [...] + 4. Let exoticToPrim be GetMethod(input, @@toPrimitive). + 5. ReturnIfAbrupt(exoticToPrim). +features: [Symbol.toPrimitive] +---*/ + +var y = Object.defineProperty({}, Symbol.toPrimitive, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + 0 == y; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/shell.js b/js/src/tests/test262/language/expressions/equals/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/equals/symbol-abstract-equality-comparison.js b/js/src/tests/test262/language/expressions/equals/symbol-abstract-equality-comparison.js new file mode 100644 index 0000000000..ae8c9ec1e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/symbol-abstract-equality-comparison.js @@ -0,0 +1,23 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 7.2.12 +description: > + Abstract Equality Comparison: Symbol +features: [Symbol] +---*/ +var symA = Symbol('66'); +var symB = Symbol('66'); + +assert.sameValue(symA == symA, true, "The result of `symA == symA` is `true`"); +assert.sameValue(symA == symA.valueOf(), true, "The result of `symA == symA.valueOf()` is `true`"); +assert.sameValue(symA.valueOf() == symA, true, "The result of `symA.valueOf() == symA` is `true`"); + +assert.sameValue(symB == symB, true, "The result of `symB == symB` is `true`"); +assert.sameValue(symB == symB.valueOf(), true, "The result of `symB == symB.valueOf()` is `true`"); +assert.sameValue(symB.valueOf() == symB, true, "The result of `symB.valueOf() == symB` is `true`"); + +assert.sameValue(symA == symB, false, "The result of `symA == symB` is `false`"); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/symbol-strict-equality-comparison.js b/js/src/tests/test262/language/expressions/equals/symbol-strict-equality-comparison.js new file mode 100644 index 0000000000..3e6413f0af --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/symbol-strict-equality-comparison.js @@ -0,0 +1,22 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 7.2.13 +description: > + Strict Equality Comparison: Symbol +features: [Symbol] +---*/ +var symA = Symbol('66'); +var symB = Symbol('66'); + +assert.sameValue(symA === symA, true, "The result of `symA === symA` is `true`"); +assert.sameValue(symA === symA.valueOf(), true, "The result of `symA === symA.valueOf()` is `true`"); +assert.sameValue(symA.valueOf() === symA, true, "The result of `symA.valueOf() === symA` is `true`"); + +assert.sameValue(symB === symB, true, "The result of `symB === symB` is `true`"); +assert.sameValue(symB === symB.valueOf(), true, "The result of `symB === symB.valueOf()` is `true`"); +assert.sameValue(symB.valueOf() === symB, true, "The result of `symB.valueOf() === symB` is `true`"); + +assert.sameValue(symA === symB, false, "The result of `symA === symB` is `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/equals/to-prim-hint.js b/js/src/tests/test262/language/expressions/equals/to-prim-hint.js new file mode 100644 index 0000000000..53e7925c17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/equals/to-prim-hint.js @@ -0,0 +1,37 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-abstract-equality-comparison +description: Object operands coerced without ToPrimitive hint +info: | + 7.2.14 Abstract Equality Comparison + + ... + 6. If Type(x) is Boolean, return the result of the comparison ! + ToNumber(x) == y. + 7. If Type(y) is Boolean, return the result of the comparison x == ! + ToNumber(y). + 8. If Type(x) is either String, Number, or Symbol and Type(y) is + Object, return the result of the comparison x == ToPrimitive(y). + 9. If Type(x) is Object and Type(y) is either String, Number, or + Symbol, return the result of the comparison ToPrimitive(x) == y. + ... +features: [Symbol.toPrimitive] +---*/ + +let count = 0; +let obj = { + [Symbol.toPrimitive](hint) { + count += 1; + assert.sameValue(hint, "default"); + return 1; + } +}; + +assert.sameValue(true == obj, true); +assert.sameValue(count, 1); +assert.sameValue(obj == true, true); +assert.sameValue(count, 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A1.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A1.js new file mode 100644 index 0000000000..13799f60d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A1.js @@ -0,0 +1,31 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If exponent is NaN, the result is NaN. +features: [exponentiation] +---*/ + +var exponent = NaN; +var bases = []; +bases[0] = -Infinity; +bases[1] = -1.7976931348623157E308; //largest (by module) finite number +bases[2] = -0.000000000000001; +bases[3] = -0; +bases[4] = +0 +bases[5] = 0.000000000000001; +bases[6] = 1.7976931348623157E308; //largest finite number +bases[7] = +Infinity; +bases[8] = NaN; + + +for (var i = 0; i < bases.length; i++) { + assert.sameValue( + bases[i] ** exponent, + NaN, + bases[i] + " ** " + exponent + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A10.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A10.js new file mode 100644 index 0000000000..62328f4b5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A10.js @@ -0,0 +1,25 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If abs(base) < 1 and exponent is −∞, the result is +∞. +---*/ + + +var exponent = -Infinity; +var bases = []; +bases[0] = 0.999999999999999; +bases[1] = 0.5; +bases[2] = +0; +bases[3] = -0; +bases[4] = -0.5; +bases[5] = -0.999999999999999; + +for (var i = 0; i < bases.length; i++) { + if (Math.pow(bases[i], exponent) !== +Infinity) { + throw new Test262Error("(" + bases[i] + " ** " + exponent + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A11.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A11.js new file mode 100644 index 0000000000..9cc32051cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A11.js @@ -0,0 +1,24 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is +∞ and exponent > 0, the result is +∞. +features: [exponentiation] +---*/ + + +var base = +Infinity; +var exponents = []; +exponents[3] = Infinity; +exponents[2] = 1.7976931348623157E308; //largest (by module) finite number +exponents[1] = 1; +exponents[0] = 0.000000000000001; + +for (var i = 0; i < exponents.length; i++) { + if (base ** exponents[i] !== +Infinity) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A12.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A12.js new file mode 100644 index 0000000000..fdd51ea96d --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A12.js @@ -0,0 +1,24 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is +∞ and exponent < 0, the result is +0. +features: [exponentiation] +---*/ + + +var base = +Infinity; +var exponents = []; +exponents[0] = -Infinity; +exponents[1] = -1.7976931348623157E308; //largest (by module) finite number +exponents[2] = -1; +exponents[3] = -0.000000000000001; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== +0) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +0"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A13.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A13.js new file mode 100644 index 0000000000..00d8517b6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A13.js @@ -0,0 +1,23 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −∞ and exponent > 0 and exponent is an odd integer, the result is −∞. +features: [exponentiation] +---*/ + + +var base = -Infinity; +var exponents = []; +exponents[0] = 1; +exponents[1] = 111; +exponents[2] = 111111; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== -Infinity) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== -Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A14.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A14.js new file mode 100644 index 0000000000..e486d64ca0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A14.js @@ -0,0 +1,25 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −∞ and exponent > 0 and exponent is not an odd integer, the result is +∞. +features: [exponentiation] +---*/ + + +var base = -Infinity; +var exponents = []; +exponents[0] = 0.000000000000001; +exponents[1] = 2; +exponents[2] = Math.PI; +exponents[3] = 1.7976931348623157E308; //largest finite number +exponents[4] = +Infinity; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== +Infinity) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A15.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A15.js new file mode 100644 index 0000000000..1fb80c4bc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A15.js @@ -0,0 +1,21 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −∞ and exponent < 0 and exponent is an odd integer, the result is −0. +features: [exponentiation] +---*/ + + +var base = -Infinity; +var exponents = []; +exponents[2] = -1; +exponents[1] = -111; +exponents[0] = -111111; + +for (var i = 0; i < exponents.length; i++) { + assert.sameValue(base ** exponents[i], -0, base + " ** " + exponents[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A16.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A16.js new file mode 100644 index 0000000000..64feeec702 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A16.js @@ -0,0 +1,25 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −∞ and exponent < 0 and exponent is not an odd integer, the result is +0. +features: [exponentiation] +---*/ + + +var base = -Infinity; +var exponents = []; +exponents[4] = -0.000000000000001; +exponents[3] = -2; +exponents[2] = -Math.PI; +exponents[1] = -1.7976931348623157E308; //largest (by module) finite number +exponents[0] = -Infinity; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== +0) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +0"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A17.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A17.js new file mode 100644 index 0000000000..be4e07dae6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A17.js @@ -0,0 +1,24 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is +0 and exponent > 0, the result is +0. +features: [exponentiation] +---*/ + + +var base = +0; +var exponents = []; +exponents[3] = Infinity; +exponents[2] = 1.7976931348623157E308; //largest finite number +exponents[1] = 1; +exponents[0] = 0.000000000000001; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== +0) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +0"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A18.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A18.js new file mode 100644 index 0000000000..3dd8266e2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A18.js @@ -0,0 +1,24 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is +0 and exponent < 0, the result is +∞. +features: [exponentiation] +---*/ + + +var base = +0; +var exponents = []; +exponents[0] = -Infinity; +exponents[1] = -1.7976931348623157E308; //largest (by module) finite number +exponents[2] = -1; +exponents[3] = -0.000000000000001; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== +Infinity) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A19.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A19.js new file mode 100644 index 0000000000..dfef9836e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A19.js @@ -0,0 +1,21 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −0 and exponent > 0 and exponent is an odd integer, the result is −0. +features: [exponentiation] +---*/ + + +var base = -0; +var exponents = []; +exponents[0] = 1; +exponents[1] = 111; +exponents[2] = 111111; + +for (var i = 0; i < exponents.length; i++) { + assert.sameValue(base ** exponents[i], -0, base + " ** " + exponents[i]); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A2.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A2.js new file mode 100644 index 0000000000..86344c4ee7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A2.js @@ -0,0 +1,30 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: > + If exponent is +0, the result is 1, even if base is NaN. +features: [exponentiation] +---*/ + + +var exponent = +0; +var bases = []; +bases[0] = -Infinity; +bases[1] = -1.7976931348623157E308; //largest (by module) finite number +bases[2] = -0.000000000000001; +bases[3] = -0; +bases[4] = +0 +bases[5] = 0.000000000000001; +bases[6] = 1.7976931348623157E308; //largest finite number +bases[7] = +Infinity; +bases[8] = NaN; + +for (var i = 0; i < bases.length; i++) { + if ((bases[i] ** exponent) !== 1) { + throw new Test262Error("(" + bases[i] + " ** " + exponent + ") !== 1"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A20.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A20.js new file mode 100644 index 0000000000..c2c4382741 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A20.js @@ -0,0 +1,25 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −0 and exponent > 0 and exponent is not an odd integer, the result is +0. +features: [exponentiation] +---*/ + + +var base = -0; +var exponents = []; +exponents[0] = 0.000000000000001; +exponents[1] = 2; +exponents[2] = Math.PI; +exponents[3] = 1.7976931348623157E308; //largest finite number +exponents[4] = +Infinity; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== +0) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +0"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A21.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A21.js new file mode 100644 index 0000000000..e51cc41f37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A21.js @@ -0,0 +1,23 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −0 and exponent < 0 and exponent is an odd integer, the result is −∞. +features: [exponentiation] +---*/ + + +var base = -0; +var exponents = []; +exponents[2] = -1; +exponents[1] = -111; +exponents[0] = -111111; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== -Infinity) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== -Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A22.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A22.js new file mode 100644 index 0000000000..b11692c8fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A22.js @@ -0,0 +1,25 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is −0 and exponent < 0 and exponent is not an odd integer, the result is +∞. +features: [exponentiation] +---*/ + + +var base = -0; +var exponents = []; +exponents[4] = -0.000000000000001; +exponents[3] = -2; +exponents[2] = -Math.PI; +exponents[1] = -1.7976931348623157E308; //largest (by module) finite number +exponents[0] = -Infinity; + +for (var i = 0; i < exponents.length; i++) { + if ((base ** exponents[i]) !== +Infinity) { + throw new Test262Error("(" + base + " ** " + exponents[i] + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A23.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A23.js new file mode 100644 index 0000000000..c79cb5b758 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A23.js @@ -0,0 +1,38 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base < 0 and base is finite and exponent is finite and exponent is not an integer, the result is NaN. +features: [exponentiation] +---*/ + + +var exponents = []; +var bases = []; +bases[0] = -1.7976931348623157E308; //largest (by module) finite number +bases[1] = -Math.PI; +bases[2] = -1; +bases[3] = -0.000000000000001; + +exponents[0] = -Math.PI; +exponents[1] = -Math.E; +exponents[2] = -1.000000000000001; +exponents[3] = -0.000000000000001; +exponents[4] = 0.000000000000001; +exponents[5] = 1.000000000000001; +exponents[6] = Math.E; +exponents[7] = Math.PI; + +for (var i = 0; i < bases.length; i++) { + for (var j = 0; j < exponents.length; j++) { + assert.sameValue( + bases[i] ** exponents[j], + NaN, + bases[i] + " ** " + exponents[j] + ); + } +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A3.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A3.js new file mode 100644 index 0000000000..e7bdff5882 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A3.js @@ -0,0 +1,30 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: > + If exponent is −0, the result is 1, even if base is NaN. +features: [exponentiation] +---*/ + + +var exponent = -0; +var bases = []; +bases[0] = -Infinity; +bases[1] = -1.7976931348623157E308; //largest (by module) finite number +bases[2] = -0.000000000000001; +bases[3] = -0; +bases[4] = +0 +bases[5] = 0.000000000000001; +bases[6] = 1.7976931348623157E308; //largest finite number +bases[7] = +Infinity; +bases[8] = NaN; + +for (var i = 0; i < bases.length; i++) { + if ((bases[i] ** exponent) !== 1) { + throw new Test262Error("(" + bases[i] + " ** -0) !== 1"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A4.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A4.js new file mode 100644 index 0000000000..83bfb1bb53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A4.js @@ -0,0 +1,29 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If base is NaN and exponent is nonzero, the result is NaN. +features: [exponentiation] +---*/ + + +var base = NaN; +var exponents = []; +exponents[0] = -Infinity; +exponents[1] = -1.7976931348623157E308; //largest (by module) finite number +exponents[2] = -0.000000000000001; +exponents[3] = 0.000000000000001; +exponents[4] = 1.7976931348623157E308; //largest finite number +exponents[5] = +Infinity; +exponents[6] = NaN; + +for (var i = 0; i < exponents.length; i++) { + assert.sameValue( + base ** exponents[i], + NaN, + base + " ** " + exponents[i] + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A5.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A5.js new file mode 100644 index 0000000000..3c98349ff3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A5.js @@ -0,0 +1,26 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If abs(base) > 1 and exponent is +∞, the result is +∞. +features: [exponentiation] +---*/ + + +var exponent = +Infinity; +var bases = []; +bases[0] = -Infinity; +bases[1] = -1.7976931348623157E308; //largest (by module) finite number +bases[2] = -1.000000000000001; +bases[3] = 1.000000000000001; +bases[4] = 1.7976931348623157E308; //largest finite number +bases[5] = +Infinity; + +for (var i = 0; i < bases.length; i++) { + if ((bases[i] ** exponent) !== +Infinity) { + throw new Test262Error("(" + bases[i] + " ** " + exponent + ") !== +Infinity"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A6.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A6.js new file mode 100644 index 0000000000..1c677b6cd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A6.js @@ -0,0 +1,26 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If abs(base) > 1 and exponent is −∞, the result is +0. +features: [exponentiation] +---*/ + + +var exponent = -Infinity; +var bases = []; +bases[0] = -Infinity; +bases[1] = -1.7976931348623157E308; //largest (by module) finite number +bases[2] = -1.000000000000001; +bases[3] = 1.000000000000001; +bases[4] = 1.7976931348623157E308; //largest finite number +bases[5] = +Infinity; + +for (var i = 0; i < bases.length; i++) { + if ((bases[i] ** exponent) !== +0) { + throw new Test262Error("(" + bases[i] + " ** " + exponent + ") !== +0"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A7.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A7.js new file mode 100644 index 0000000000..afcb133f33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A7.js @@ -0,0 +1,24 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If abs(base) is 1 and exponent is +∞, the result is NaN. +features: [exponentiation] +---*/ + + +var exponent = +Infinity; +var bases = []; +bases[0] = -1; +bases[1] = 1 + +for (var i = 0; i < bases.length; i++) { + assert.sameValue( + bases[i] ** exponent, + NaN, + bases[i] + " ** " + exponent + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A8.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A8.js new file mode 100644 index 0000000000..08272fc202 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A8.js @@ -0,0 +1,24 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If abs(base) is 1 and exponent is −∞, the result is NaN. +features: [exponentiation] +---*/ + + +var exponent = -Infinity; +var bases = []; +bases[0] = -1; +bases[1] = 1 + +for (var i = 0; i < bases.length; i++) { + assert.sameValue( + bases[i] ** exponent, + NaN, + bases[i] + " ** " + exponent + ); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A9.js b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A9.js new file mode 100644 index 0000000000..c8fa9e61f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/applying-the-exp-operator_A9.js @@ -0,0 +1,26 @@ +// Copyright 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: If abs(base) < 1 and exponent is +∞, the result is +0. +features: [exponentiation] +---*/ + + +var exponent = +Infinity; +var bases = []; +bases[0] = 0.999999999999999; +bases[1] = 0.5; +bases[2] = +0; +bases[3] = -0; +bases[4] = -0.5; +bases[5] = -0.999999999999999; + +for (var i = 0; i < bases.length; i++) { + if ((bases[i] ** exponent) !== +0) { + throw new Test262Error("(" + bases[i] + " ** " + exponent + ") !== +0"); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/bigint-and-number.js b/js/src/tests/test262/language/expressions/exponentiation/bigint-and-number.js new file mode 100644 index 0000000000..2a8ae8d156 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-exp-operator-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for exponentiation operator +features: [BigInt, exponentiation] +info: | + Let base be ? ToNumeric(leftValue). + Let exponent be ? ToNumeric(rightValue). + If Type(base) does not equal Type(exponent), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n ** 1; +}, '1n ** 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 ** 1n; +}, '1 ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ** 1; +}, 'Object(1n) ** 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 ** Object(1n); +}, '1 ** Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** Object(1); +}, '1n ** Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ** 1n; +}, 'Object(1) ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) ** Object(1); +}, 'Object(1n) ** Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) ** Object(1n); +}, 'Object(1) ** Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** NaN; +}, '1n ** NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN ** 1n; +}, 'NaN ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** Infinity; +}, '1n ** Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity ** 1n; +}, 'Infinity ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** true; +}, '1n ** true throws TypeError'); + +assert.throws(TypeError, function() { + true ** 1n; +}, 'true ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** '1'; +}, '1n ** "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' ** 1n; +}, '"1" ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** null; +}, '1n ** null throws TypeError'); + +assert.throws(TypeError, function() { + null ** 1n; +}, 'null ** 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n ** undefined; +}, '1n ** undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined ** 1n; +}, 'undefined ** 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/bigint-arithmetic.js b/js/src/tests/test262/language/expressions/exponentiation/bigint-arithmetic.js new file mode 100644 index 0000000000..e754501274 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/bigint-arithmetic.js @@ -0,0 +1,77 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-exp-operator-runtime-semantics-evaluation +description: BigInt exponentiation arithmetic +features: [BigInt, exponentiation] +---*/ +assert.sameValue( + 0x123n ** 0x123n, + 0x37AA7FAA38F2F6026AABEFE979EA730BA9EA4CB99E2E3F645D515D3BBE2D84BCD89F8A034BADF3E3DC0CF417258371B31F4555DC0883DA96760AB157DB7DFFF5E3E97A3EAAB8328B2B178060B5A5E4C4DD8BC8D66B7F4D9F0E0B1AC3A566FDE0A15EBF8DBDBD0565C5FBDB7C123CF250E271DF5C38BC6746A1327F09C7FB4B96E0EDA45C429799CA80B1DB039692C70DFFE4E66F1D9CAB4270863B09A7918F774D686F685F560FEDC6B7B85CB45DE5EEEF6A5FE2FC8B5037FB421204641909347C91F2DC252F49B8F310E867E56D1CA2E81EE9A3AA568682C7B8B41D709A2E7F8D9A8D8C56D6BE78B6CA8365E362B81A64974C315FB8FA50CED4F7944F28FA3ECA77B8BCB56DC69814328F891E6065D108EEE7B8E695038090CCA10C0E68DD7A36CFAA1C26CDFEC369FBn, + 'The result of (0x123n ** 0x123n) is 0x37AA7FAA38F2F6026AABEFE979EA730BA9EA4CB99E2E3F645D515D3BBE2D84BCD89F8A034BADF3E3DC0CF417258371B31F4555DC0883DA96760AB157DB7DFFF5E3E97A3EAAB8328B2B178060B5A5E4C4DD8BC8D66B7F4D9F0E0B1AC3A566FDE0A15EBF8DBDBD0565C5FBDB7C123CF250E271DF5C38BC6746A1327F09C7FB4B96E0EDA45C429799CA80B1DB039692C70DFFE4E66F1D9CAB4270863B09A7918F774D686F685F560FEDC6B7B85CB45DE5EEEF6A5FE2FC8B5037FB421204641909347C91F2DC252F49B8F310E867E56D1CA2E81EE9A3AA568682C7B8B41D709A2E7F8D9A8D8C56D6BE78B6CA8365E362B81A64974C315FB8FA50CED4F7944F28FA3ECA77B8BCB56DC69814328F891E6065D108EEE7B8E695038090CCA10C0E68DD7A36CFAA1C26CDFEC369FBn' +); + +assert.sameValue( + 0x123n ** 0xFFn, + 0x8D5BB75861377EC967BF78FDF39CE51696FBD34722999943F8865938772B517167CD5ED775A78987F5106831F4978E0709032B26ED8F13F814699DB8AB3ACD5CF631F2D8B8B706FCF5EF441AAEE745A795EC5CB86A5E8D87D09F648EFC557B98F73E750FEC9AED061D47806F269CCCDFB6D513912A82AE79B171D76AF6D926BC4F4C4DA43A6EFB4D9D1672E356CC1F74A29AF80D53A8F27592F6191AB9B3D57FA2C435CB2CE8F18A3B3448F88F4BAD3606A9878DA9528B569BADAC0C1EC0B1A2B06CD4C64DEEC940807DFD05C56E3E17ADB1A88EDAF0D67C87C1F871BFB5C47CAE8365FE33538317EE2DF4EE52636CE1BDA9E41C7DA72826E4C097A53BD73D8D697E10D28Bn, + 'The result of (0x123n ** 0xFFn) is 0x8D5BB75861377EC967BF78FDF39CE51696FBD34722999943F8865938772B517167CD5ED775A78987F5106831F4978E0709032B26ED8F13F814699DB8AB3ACD5CF631F2D8B8B706FCF5EF441AAEE745A795EC5CB86A5E8D87D09F648EFC557B98F73E750FEC9AED061D47806F269CCCDFB6D513912A82AE79B171D76AF6D926BC4F4C4DA43A6EFB4D9D1672E356CC1F74A29AF80D53A8F27592F6191AB9B3D57FA2C435CB2CE8F18A3B3448F88F4BAD3606A9878DA9528B569BADAC0C1EC0B1A2B06CD4C64DEEC940807DFD05C56E3E17ADB1A88EDAF0D67C87C1F871BFB5C47CAE8365FE33538317EE2DF4EE52636CE1BDA9E41C7DA72826E4C097A53BD73D8D697E10D28Bn' +); + +assert.sameValue(0x123n ** 0x3n, 0x178027Bn, 'The result of (0x123n ** 0x3n) is 0x178027Bn'); +assert.sameValue(0x123n ** 0x2n, 0x14AC9n, 'The result of (0x123n ** 0x2n) is 0x14AC9n'); +assert.sameValue(0x123n ** 0x1n, 0x123n, 'The result of (0x123n ** 0x1n) is 0x123n'); + +assert.sameValue( + 0xFFn ** 0x123n, + 0x51F5CA2E1A36F5FF1ED3D393D76FBC3612B38EB64E00EDAC5E95ADE0D16D0B044C8E9F2B77B3F31AF9159F482205541E9D3BE9D248FF39CE6524874EBCA60E06302E8B505D11EEEEE869C7F801A82B9739C197E6D63A1EB2D29B5AD5EED4773C762106E9F66BFCB6C11450218973C69DED3FE51FF881AD0430675BF54320513EA766117C50C554E86E22A5ACFD8047D5470B4FCBCB9EFC86196CA77C58F1BEB09F76160D641B82E2481BEDAE089207D49FE0FB7DE14B6C4BC82E9C58140746AC8E74C3353AAF5F9CF47ED1F87C52F463C053DB63CD08CC9866EBA274D39B6B357ADADAD4D210167EF7363453D42BC225D90070336861F2D259489D78B7F04B05FE65E29151ADD2B8F4D318011988550CE590DBA4C868AC65AA325051DF613D6C2E22FFn, + 'The result of (0xFFn ** 0x123n) is 0x51F5CA2E1A36F5FF1ED3D393D76FBC3612B38EB64E00EDAC5E95ADE0D16D0B044C8E9F2B77B3F31AF9159F482205541E9D3BE9D248FF39CE6524874EBCA60E06302E8B505D11EEEEE869C7F801A82B9739C197E6D63A1EB2D29B5AD5EED4773C762106E9F66BFCB6C11450218973C69DED3FE51FF881AD0430675BF54320513EA766117C50C554E86E22A5ACFD8047D5470B4FCBCB9EFC86196CA77C58F1BEB09F76160D641B82E2481BEDAE089207D49FE0FB7DE14B6C4BC82E9C58140746AC8E74C3353AAF5F9CF47ED1F87C52F463C053DB63CD08CC9866EBA274D39B6B357ADADAD4D210167EF7363453D42BC225D90070336861F2D259489D78B7F04B05FE65E29151ADD2B8F4D318011988550CE590DBA4C868AC65AA325051DF613D6C2E22FFn' +); + +assert.sameValue( + 0xFFn ** 0xFFn, + 0x5E5C8B0EB95AB08F9D37EF127FC01BD0E33DE52647528396D78D5F8DA31989E67814F6BBA1FB0F0207010FF5F2347B19D5F6598FC91BF5A88F77DAA3D7B382FEC484F3D205C06A34445384C0E7AB0D883788C68C012CB433055EDDA746A48409444EA91147273B79FC3EABB70ECA552AF650C234BB01ED404427F17CDDDD71D08E39EF9C3982E3CE44E670456AA8154C1FDBD9C35947F494636A425C69BF89E9C75AD3B7A0A559AF0F5DA9947C8DEBA64417310713B23E7EF4DE50BB2A3E90BC2AC3DA5201CCA8D6E5DFEA887C4F7A4E92175D9F88BD2779B57F9EB35BE7528F965A06DA0AC41DCB3A34F1D8AB7D8FEE620A94FAA42C395997756B007FFEFFn, + 'The result of (0xFFn ** 0xFFn) is 0x5E5C8B0EB95AB08F9D37EF127FC01BD0E33DE52647528396D78D5F8DA31989E67814F6BBA1FB0F0207010FF5F2347B19D5F6598FC91BF5A88F77DAA3D7B382FEC484F3D205C06A34445384C0E7AB0D883788C68C012CB433055EDDA746A48409444EA91147273B79FC3EABB70ECA552AF650C234BB01ED404427F17CDDDD71D08E39EF9C3982E3CE44E670456AA8154C1FDBD9C35947F494636A425C69BF89E9C75AD3B7A0A559AF0F5DA9947C8DEBA64417310713B23E7EF4DE50BB2A3E90BC2AC3DA5201CCA8D6E5DFEA887C4F7A4E92175D9F88BD2779B57F9EB35BE7528F965A06DA0AC41DCB3A34F1D8AB7D8FEE620A94FAA42C395997756B007FFEFFn' +); + +assert.sameValue(0xFFn ** 0x3n, 0xFD02FFn, 'The result of (0xFFn ** 0x3n) is 0xFD02FFn'); +assert.sameValue(0xFFn ** 0x2n, 0xFE01n, 'The result of (0xFFn ** 0x2n) is 0xFE01n'); +assert.sameValue(0xFFn ** 0x1n, 0xFFn, 'The result of (0xFFn ** 0x1n) is 0xFFn'); + +assert.sameValue( + 0x3n ** 0x123n, + 0x25609213623D7D6219085CF49D306450BF6519835586C19D3A4F3A2C5F35B44A300C8A76E11708B5495B9C3EE756BBF19E3FD15CE625D3C0539Bn, + 'The result of (0x3n ** 0x123n) is 0x25609213623D7D6219085CF49D306450BF6519835586C19D3A4F3A2C5F35B44A300C8A76E11708B5495B9C3EE756BBF19E3FD15CE625D3C0539Bn' +); + +assert.sameValue( + 0x3n ** 0xFFn, + 0x11F1B08E87EC42C5D83C3218FC83C41DCFD9F4428F4F92AF1AAA80AA46162B1F71E981273601F4AD1DD4709B5ACA650265A6ABn, + 'The result of (0x3n ** 0xFFn) is 0x11F1B08E87EC42C5D83C3218FC83C41DCFD9F4428F4F92AF1AAA80AA46162B1F71E981273601F4AD1DD4709B5ACA650265A6ABn' +); + +assert.sameValue(0x3n ** 0x3n, 0x1Bn, 'The result of (0x3n ** 0x3n) is 0x1Bn'); +assert.sameValue(0x3n ** 0x2n, 0x9n, 'The result of (0x3n ** 0x2n) is 0x9n'); +assert.sameValue(0x3n ** 0x1n, 0x3n, 'The result of (0x3n ** 0x1n) is 0x3n'); + +assert.sameValue( + 0x2n ** 0x123n, + 0x8000000000000000000000000000000000000000000000000000000000000000000000000n, + 'The result of (0x2n ** 0x123n) is 0x8000000000000000000000000000000000000000000000000000000000000000000000000n' +); + +assert.sameValue( + 0x2n ** 0xFFn, + 0x8000000000000000000000000000000000000000000000000000000000000000n, + 'The result of (0x2n ** 0xFFn) is 0x8000000000000000000000000000000000000000000000000000000000000000n' +); + +assert.sameValue(0x2n ** 0x3n, 0x8n, 'The result of (0x2n ** 0x3n) is 0x8n'); +assert.sameValue(0x2n ** 0x2n, 0x4n, 'The result of (0x2n ** 0x2n) is 0x4n'); +assert.sameValue(0x2n ** 0x1n, 0x2n, 'The result of (0x2n ** 0x1n) is 0x2n'); +assert.sameValue(0x1n ** 0x123n, 0x1n, 'The result of (0x1n ** 0x123n) is 0x1n'); +assert.sameValue(0x1n ** 0xFFn, 0x1n, 'The result of (0x1n ** 0xFFn) is 0x1n'); +assert.sameValue(0x1n ** 0x3n, 0x1n, 'The result of (0x1n ** 0x3n) is 0x1n'); +assert.sameValue(0x1n ** 0x2n, 0x1n, 'The result of (0x1n ** 0x2n) is 0x1n'); +assert.sameValue(0x1n ** 0x1n, 0x1n, 'The result of (0x1n ** 0x1n) is 0x1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/bigint-errors.js b/js/src/tests/test262/language/expressions/exponentiation/bigint-errors.js new file mode 100644 index 0000000000..bae2a71624 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: exponentiation operator ToNumeric with BigInt operands +esid: sec-exp-operator-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names, exponentiation] +---*/ +assert.throws(TypeError, function() { + Symbol('1') ** 0n; +}, 'Symbol("1") ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** Symbol('1'); +}, '0n ** Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) ** 0n; +}, 'Object(Symbol("1")) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** Object(Symbol('1')); +}, '0n ** Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) ** 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n ** {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) ** 0n; +}, '({valueOf: function() {return Symbol("1");}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n ** {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) ** 0n; +}, '({toString: function() {return Symbol("1");}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + toString: function() { + return Symbol('1'); + } + }; +}, '0n ** {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/bigint-negative-exponent-throws.js b/js/src/tests/test262/language/expressions/exponentiation/bigint-negative-exponent-throws.js new file mode 100644 index 0000000000..4e23375900 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/bigint-negative-exponent-throws.js @@ -0,0 +1,34 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: If the BigInt exponent is < 0, throw a RangeError exception +esid: sec-exp-operator-runtime-semantics-evaluation +info: | + ExponentiationExpression: UpdateExpression ** ExponentiationExpression + + ... + 9. Return ? Type(base)::exponentiate(base, exponent). + + BigInt::exponentiate (base, exponent) + + 1. If exponent < 0, throw a RangeError exception. + ... +features: [BigInt, exponentiation] +---*/ +assert.throws(RangeError, function() { + 1n ** -1n; +}, '1n ** -1n throws RangeError'); + +assert.throws(RangeError, function() { + 0n ** -1n; +}, '0n ** -1n throws RangeError'); + +assert.throws(RangeError, function() { + (-1n) ** -1n; +}, '(-1n) ** -1n throws RangeError'); + +assert.throws(RangeError, function() { + 1n ** -100000000000000000n; +}, '1n ** -100000000000000000n throws RangeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/exponentiation/bigint-toprimitive.js new file mode 100644 index 0000000000..5f2bb567dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: exponentiation operator ToNumeric with BigInt operands +esid: sec-exp-operator-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names, exponentiation] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} ** 1n, 2n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + valueOf: function() { + return 2n; + }, + + toString: err +}, 1n, 'The result of (1n ** {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({toString: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + toString: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + valueOf: null, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) ** 0n; +}, '({[Symbol.toPrimitive]: 1}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + [Symbol.toPrimitive]: 1 + }; +}, '0n ** {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) ** 0n; +}, '({[Symbol.toPrimitive]: {}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + [Symbol.toPrimitive]: {} + }; +}, '0n ** {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) ** 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n ** {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) ** 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n ** {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) ** 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) ** 0n throws MyError'); + +assert.throws(MyError, function() { + 0n ** { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n ** {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) ** 0n; +}, '({valueOf: function() {throw new MyError();}}) ** 0n throws MyError'); + +assert.throws(MyError, function() { + 0n ** { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n ** {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) ** 0n; +}, '({toString: function() {throw new MyError();}}) ** 0n throws MyError'); + +assert.throws(MyError, function() { + 0n ** { + toString: function() { + throw new MyError(); + } + }; +}, '0n ** {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) ** 0n; +}, '({valueOf: null, toString: null}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + valueOf: null, + toString: null + }; +}, '0n ** {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) ** 0n; +}, '({valueOf: 1, toString: 1}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + valueOf: 1, + toString: 1 + }; +}, '0n ** {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) ** 0n; +}, '({valueOf: {}, toString: {}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + valueOf: {}, + toString: {} + }; +}, '0n ** {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) ** 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n ** {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) ** 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) ** 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n ** { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n ** {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/exponentiation/bigint-wrapped-values.js new file mode 100644 index 0000000000..9d272bbdb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: exponentiation operator ToNumeric with BigInt operands +esid: sec-exp-operator-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names, exponentiation] +---*/ +assert.sameValue(Object(2n) ** 1n, 2n, 'The result of (Object(2n) ** 1n) is 2n'); +assert.sameValue(1n ** Object(2n), 1n, 'The result of (1n ** Object(2n)) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({valueOf: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} ** 1n, 2n, 'The result of (({toString: function() {return 2n;}}) ** 1n) is 2n'); + +assert.sameValue(1n ** { + toString: function() { + return 2n; + } +}, 1n, 'The result of (1n ** {toString: function() {return 2n;}}) is 1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js b/js/src/tests/test262/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js new file mode 100644 index 0000000000..903a163ab1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/bigint-zero-base-zero-exponent.js @@ -0,0 +1,22 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: If the BigInt base and exponent are both 0n, return 1n +esid: sec-exp-operator-runtime-semantics-evaluation +info: | + ExponentiationExpression: UpdateExpression ** ExponentiationExpression + + ... + 9. Return ? Type(base)::exponentiate(base, exponent). + + BigInt::exponentiate (base, exponent) + + 1. If exponent < 0, throw a RangeError exception. + 2. If base is 0n and exponent is 0n, return 1n. + 3. Return a BigInt representing the mathematical value of base raised to the power exponent. + ... +features: [BigInt, exponentiation] +---*/ +assert.sameValue(0n ** 0n, 1n, 'The result of (0n ** 0n) is 1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/browser.js b/js/src/tests/test262/language/expressions/exponentiation/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-assignment-operator.js b/js/src/tests/test262/language/expressions/exponentiation/exp-assignment-operator.js new file mode 100644 index 0000000000..90562bbbec --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-assignment-operator.js @@ -0,0 +1,27 @@ +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Compound Exponentiation Assignment Operator +info: | + AssignmentExpression: + LeftHandSideExpression AssignmentOperator AssignmentExpression + + 1. Let lref be the result of evaluating LeftHandSideExpression. + 2. Let lval be ? GetValue(lref). + 3. Let rref be the result of evaluating AssignmentExpression. + 4. Let rval be ? GetValue(rref). + 5. Let op be the @ where AssignmentOperator is @=. + 6. Let r be the result of applying op to lval and rval as if evaluating the expression lval op rval. + 7. Perform ? PutValue(lref, r). + 8. Return r. +features: [exponentiation] +---*/ + +var base = -3; + +assert.sameValue(base **= 3, -27, "(base **= 3) === -27; where base is -3"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-evaluation-order.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-evaluation-order.js new file mode 100644 index 0000000000..93d4e64379 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-evaluation-order.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 Rick Waldron, André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron, André Bargull +esid: sec-exp-operator-runtime-semantics-evaluation +description: Exponentiation Operator expression order of evaluation +info: | + ExponentiationExpression: + UpdateExpression ** ExponentiationExpression + + 1. Let left be the result of evaluating UpdateExpression. + 2. Let leftValue be ? GetValue(left). + 3. Let right be the result of evaluating ExponentiationExpression. + 4. Let rightValue be ? GetValue(right). + 5. Let base be ? ToNumber(leftValue). + 6. Let exponent be ? ToNumber(rightValue). + 7. Return the result of Applying the ** operator with base and exponent as specified in 12.7.3.4. +features: [exponentiation] +---*/ + +var capture = []; +var leftValue = { valueOf() { capture.push("leftValue"); return 3; }}; +var rightValue = { valueOf() { capture.push("rightValue"); return 2; }}; + +(capture.push("left"), leftValue) ** (capture.push("right"), rightValue); + +// Expected per operator evaluation order: "left", "right", "leftValue", "rightValue" + +assert.sameValue(capture[0], "left", "Expected the 1st element captured to be 'left'"); +assert.sameValue(capture[1], "right", "Expected the 2nd element captured to be 'right'"); +assert.sameValue(capture[2], "leftValue", "Expected the 3rd element captured to be 'leftValue'"); +assert.sameValue(capture[3], "rightValue", "Expected the 4th element captured to be 'rightValue'"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js new file mode 100644 index 0000000000..eb52485c4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-unary-expression-semantics.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Operator expression precedence of unary operators +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `delete` UnaryExpression + `void` UnaryExpression + `typeof` UnaryExpression + `+` UnaryExpression + `-` UnaryExpression + `~` UnaryExpression + `!` UnaryExpression +features: [exponentiation] +---*/ + +assert.sameValue(-(3 ** 2), -9, "-(3 ** 2) === -9"); +assert.sameValue(+(3 ** 2), 9, "+(3 ** 2) === 9"); +assert.sameValue(~(3 ** 2), -10, "~(3 ** 2) === -10"); +assert.sameValue(!(3 ** 2), false, "!(3 ** 2) === false"); + + +assert.sameValue(2 ** -2, 0.25); + +var o = { p: 1 }; + +assert.sameValue(2 ** delete o.p, 2, "delete o.p -> true -> ToNumber(true) -> 1"); +assert.sameValue(2 ** void 1, NaN, "void 1 -> undefined -> ToNumber(undefined) -> NaN"); +assert.sameValue(2 ** typeof 1, NaN, "typeof 1 -> 'number' -> ToNumber('number') -> NaN"); + +var s = "2"; +var n = 2; + +assert.sameValue(2 ** +s, 4, "+s -> +'2' -> 2 -> ToNumber(2) -> 2"); +assert.sameValue(2 ** +n, 4, "+s -> +2 -> 2 -> ToNumber(2) -> 2"); + +assert.sameValue(2 ** -s, 0.25, "-s -> -'2' -> -2 -> ToNumber(-2) -> -2"); +assert.sameValue(2 ** -n, 0.25, "-s -> -2 -> -2 -> ToNumber(-2) -> -2"); + +assert.sameValue(2 ** ~s, 0.125, "~s -> ~'2' -> -3 -> ToNumber(-3) -> -3"); +assert.sameValue(2 ** ~n, 0.125, "~s -> ~2 -> -3 -> ToNumber(-3) -> -3"); + +assert.sameValue(2 ** !s, 1, "!s -> !'2' -> false -> ToNumber(false) -> 0"); +assert.sameValue(2 ** !n, 1, "!s -> !2 -> false -> ToNumber(false) -> 0"); + + +var capture = []; +var leftValue = { valueOf() { capture.push("leftValue"); return 3; }}; +var rightValue = { valueOf() { capture.push("rightValue"); return 2; }}; + +(capture.push("left"), leftValue) ** +(capture.push("right"), rightValue); +// ^ +// Changes the order + +// Expected per operator evaluation order: "left", "right", "rightValue", "leftValue" +assert.sameValue(capture[0], "left", "Expected the 1st element captured to be 'left'"); +assert.sameValue(capture[1], "right", "Expected the 2nd element captured to be 'right'"); +assert.sameValue(capture[2], "rightValue", "Expected the 3rd element captured to be 'rightValue'"); +assert.sameValue(capture[3], "leftValue", "Expected the 4th element captured to be 'leftValue'"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js new file mode 100644 index 0000000000..c799fd3422 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-precedence-update-expression-semantics.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-update-expressions +description: Exponentiation Operator expression precedence of update operators +info: | + ExponentiationExpression : + ... + UpdateExpression `**` ExponentiationExpression + + UpdateExpression : + LeftHandSideExpression `++` + LeftHandSideExpression `--` + `++` UnaryExpression + `--` UnaryExpression +features: [exponentiation] +---*/ + +var base = 4; +assert.sameValue(--base ** 2, 9, "(--base ** 2) === 9"); +assert.sameValue(++base ** 2, 16, "(++base ** 2) === 16"); +assert.sameValue(base++ ** 2, 16, "(base++ ** 2) === 16"); +assert.sameValue(base-- ** 2, 25, "(base-- ** 2) === 25"); + +base = 4; + +// --base ** --base ** 2 -> 3 ** 2 ** 2 -> 3 ** (2 ** 2) -> 81 +assert.sameValue( + --base ** --base ** 2, + Math.pow(3, Math.pow(2, 2)), + "(--base ** --base ** 2) === Math.pow(3, Math.pow(2, 2))" +); + +// ++base ** ++base ** 2 -> 3 ** 4 ** 2 -> 3 ** (4 ** 2) -> 43046721 +assert.sameValue( + ++base ** ++base ** 2, + Math.pow(3, Math.pow(4, 2)), + "(++base ** ++base ** 2) === Math.pow(3, Math.pow(4, 2))" +); + +base = 4; + +// base-- ** base-- ** 2 -> 4 ** 3 ** 2 -> 4 ** (3 ** 2) -> 262144 +assert.sameValue( + base-- ** base-- ** 2, + Math.pow(4, Math.pow(3, 2)), + "(base-- ** base-- ** 2) === Math.pow(4, Math.pow(3, 2))" +); + +// base++ ** base++ ** 2 -> 2 ** 3 ** 2 -> 2 ** (3 ** 2) -> 262144 +assert.sameValue( + base++ ** base++ ** 2, + Math.pow(2, Math.pow(3, 2)), + "(base++ ** base++ ** 2) === Math.pow(2, Math.pow(3, 2))" +); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js new file mode 100644 index 0000000000..a2e5f9dd8c --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-bitnot-unary-expression-base.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Expression syntax error, `~` UnaryExpression +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `~` UnaryExpression + ... +features: [exponentiation] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +~3 ** 2; diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js new file mode 100644 index 0000000000..71a1807a02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-delete-unary-expression-base.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Expression syntax error, `delete` UnaryExpression +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `delete` UnaryExpression + ... +features: [exponentiation] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +delete o.p ** 2; diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js new file mode 100644 index 0000000000..8c1eabdeb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-logical-not-unary-expression-base.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Expression syntax error, `!` UnaryExpression +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `!` UnaryExpression + ... +features: [exponentiation] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +!1 ** 2; diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js new file mode 100644 index 0000000000..bf87dc531a --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-negate-unary-expression-base.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Expression syntax error, `-` UnaryExpression +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `-` UnaryExpression + ... +features: [exponentiation] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +-3 ** 2; diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js new file mode 100644 index 0000000000..b15267e339 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-plus-unary-expression-base.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Expression syntax error, `+` UnaryExpression +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `+` UnaryExpression + ... +features: [exponentiation] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); ++1 ** 2; diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js new file mode 100644 index 0000000000..ed1bdbaaf9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-typeof-unary-expression-base.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Expression syntax error, `typeof` UnaryExpression +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `typeof` UnaryExpression + ... +features: [exponentiation] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +typeof 1 ** 2; diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js new file mode 100644 index 0000000000..4322445aff --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator-syntax-error-void-unary-expression-base.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-unary-operators +description: Exponentiation Expression syntax error, `void` UnaryExpression +info: | + ExponentiationExpression : + UnaryExpression + ... + + UnaryExpression : + ... + `void` UnaryExpression + ... +features: [exponentiation] + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +void 1 ** 2; diff --git a/js/src/tests/test262/language/expressions/exponentiation/exp-operator.js b/js/src/tests/test262/language/expressions/exponentiation/exp-operator.js new file mode 100644 index 0000000000..1cb99d0a12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/exp-operator.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Rick Waldron +esid: sec-exp-operator +description: > + Performs exponential calculation on operands. Same algorithm as %MathPow%(base, exponent) +features: [exponentiation] +---*/ + +var exponent = 2; +assert.sameValue(2 ** 3, 8, "(2 ** 3) === 8"); +assert.sameValue(3 * 2 ** 3, 24, "(3 * 2 ** 3) === 24"); +assert.sameValue(2 ** ++exponent, 8, "(2 ** ++exponent) === 8"); +assert.sameValue(2 ** -1 * 2, 1, "(2 ** -1 * 2) === 1"); +assert.sameValue(2 ** 2 * 4, 16, "(2 ** 2 * 4) === 16"); +assert.sameValue(2 ** 2 / 2, 2, "(2 ** 2 / 2) === 2"); +assert.sameValue(2 ** (3 ** 2), 512, "(2 ** (3 ** 2)) === 512"); +assert.sameValue(2 ** 3 ** 2, 512, "(2 ** 3 ** 2) === 512"); +assert.sameValue(16 / 2 ** 2, 4, "(16 / 2 ** 2) === 4"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/int32_min-exponent.js b/js/src/tests/test262/language/expressions/exponentiation/int32_min-exponent.js new file mode 100644 index 0000000000..ae10edbc53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/int32_min-exponent.js @@ -0,0 +1,21 @@ +// Copyright (C) 2018 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-applying-the-exp-operator +description: > + Using -(2**31) as exponent with the exponentiation operator should behave + as expected. +features: [exponentiation] +---*/ + +const INT32_MIN = -2147483648; + +assert.sameValue(2**INT32_MIN, +0.0, + "2**-(gonzo huge exponent > 1074) should be +0 because " + + "2**-1074 is the smallest positive IEEE-754 number"); + +assert.sameValue(1**INT32_MIN, 1, + "1**-(gonzo huge exponent > 1074) should be 1"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/order-of-evaluation.js b/js/src/tests/test262/language/expressions/exponentiation/order-of-evaluation.js new file mode 100644 index 0000000000..f1e5fc82ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/exponentiation/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-exp-operator-runtime-semantics-evaluation +description: Type coercion order of operations for exponentiation operator +features: [Symbol, exponentiation] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() ** (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() ** (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() ** (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() ** (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() ** (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() ** (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/exponentiation/shell.js b/js/src/tests/test262/language/expressions/exponentiation/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/S10.1.1_A1_T2.js b/js/src/tests/test262/language/expressions/function/S10.1.1_A1_T2.js new file mode 100644 index 0000000000..3f0041712e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/S10.1.1_A1_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Program functions are defined in source text by a FunctionDeclaration or created dynamically either + by using a FunctionExpression or by using the built-in Function object as a constructor +es5id: 10.1.1_A1_T2 +description: Creating function dynamically by using a FunctionExpression +---*/ + +//CHECK#1 +var x=function f1(){return 1;}(); +if(x!==1) + throw new Test262Error('#1: Create function dynamically either by using a FunctionExpression'); + +//CHECK#2 +var y=function (){return 2;}(); +if(y!==2){ + throw new Test262Error('#2: Create an anonymous function dynamically either by using a FunctionExpression'); +} + +//CHECK#2 +var z = (function(){return 3;})(); +if(z!==3){ + throw new Test262Error('#3: Create an anonymous function dynamically either by using a FunctionExpression wrapped in a group operator'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/arguments-with-arguments-fn.js b/js/src/tests/test262/language/expressions/function/arguments-with-arguments-fn.js new file mode 100644 index 0000000000..560c24c4f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/arguments-with-arguments-fn.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +es6id: 9.2.12 +description: > + Arguments object is created even when the body contains a lexically-scoped + binding named "arguments" +info: | + [...] + 19. Else if "arguments" is an element of parameterNames, then + a. Let argumentsObjectNeeded be false. + 20. Else if hasParameterExpressions is false, then + a. If "arguments" is an element of functionNames or if "arguments" is an + element of lexicalNames, then + i. Let argumentsObjectNeeded be false. + [...] +flags: [noStrict] +---*/ + +var args; + +var f = function(x = args = arguments) { + function arguments() {} +}; + +f(); + +assert.sameValue(typeof args, 'object'); +assert.sameValue(args.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/arguments-with-arguments-lex.js b/js/src/tests/test262/language/expressions/function/arguments-with-arguments-lex.js new file mode 100644 index 0000000000..4b5d0f083f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/arguments-with-arguments-lex.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +es6id: 9.2.12 +description: > + Arguments object is created even when the body contains a function named + "arguments" +info: | + [...] + 19. Else if "arguments" is an element of parameterNames, then + a. Let argumentsObjectNeeded be false. + 20. Else if hasParameterExpressions is false, then + a. If "arguments" is an element of functionNames or if "arguments" is an + element of lexicalNames, then + i. Let argumentsObjectNeeded be false. + [...] +flags: [noStrict] +---*/ + +var args; + +var f = function (x = args = arguments) { + let arguments; +}; + +f(); + +assert.sameValue(typeof args, 'object'); +assert.sameValue(args.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/function/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..6d667c8c86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/array-destructuring-param-strict-body.js @@ -0,0 +1,133 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/func-expr.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, function([element]) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/function/browser.js b/js/src/tests/test262/language/expressions/function/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/function/dflt-params-abrupt.js new file mode 100644 index 0000000000..5660ab125d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-abrupt.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/func-expr.template +/*--- +description: Abrupt completion returned by evaluation of initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var f; +f = function(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; +}; + +assert.throws(Test262Error, function() { + f(); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/function/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..bf5a756bfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/func-expr.template +/*--- +description: Use of initializer when argument value is not `undefined` (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/function/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..ed533c291f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-arg-val-undefined.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/func-expr.template +/*--- +description: Use of initializer when argument value is `undefined` (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/function/dflt-params-duplicates.js new file mode 100644 index 0000000000..0c10a35d7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-duplicates.js @@ -0,0 +1,62 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/func-expr.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, function(x = 0, x) { + +}; diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/function/dflt-params-ref-later.js new file mode 100644 index 0000000000..99487a3309 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-ref-later.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/func-expr.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var f; +f = function(x = y, y) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/function/dflt-params-ref-prior.js new file mode 100644 index 0000000000..e9a86c1d58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-ref-prior.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/func-expr.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/function/dflt-params-ref-self.js new file mode 100644 index 0000000000..dc35c51de9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-ref-self.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/func-expr.template +/*--- +description: Referencing a parameter from within its own initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var f; +f = function(x = x) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-rest.js b/js/src/tests/test262/language/expressions/function/dflt-params-rest.js new file mode 100644 index 0000000000..faed07a84d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-rest.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/func-expr.template +/*--- +description: RestParameter does not support an initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, function(...x = []) { + +}; diff --git a/js/src/tests/test262/language/expressions/function/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..275cb6745f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dflt-params-trailing-comma.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js new file mode 100644 index 0000000000..ef9cd5e1fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..413a4afa13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Abrupt completion returned by GetIterator (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var f = function([x, y, z]) {}; + +assert.throws(TypeError, function() { + f([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err.js new file mode 100644 index 0000000000..f286cb6592 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Abrupt completion returned by GetIterator (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var f = function([x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js new file mode 100644 index 0000000000..c0db91a6f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/ary-name-iter-val.js new file mode 100644 index 0000000000..0fdfb289ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-name-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding with normal value iteration (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..cf0aef0802 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..19c1d07954 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f([[7, 8, 9]]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..454db5252e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..e2450a165b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var f; +f = function([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f([[]]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..1401ae634b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var f; +f = function([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..41141e6a47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var f; +f = function([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([[23]]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..344413a860 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var f; +f = function([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..19ddb663f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var f; +f = function([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([values]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..1314c9664f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Nested array destructuring with a null value (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var f = function([[x]]) {}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..733d89fe4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Destructuring initializer with an exhausted iterator (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..8e3e750011 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding does assign name to arrow functions (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..315d4c8538 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..c7cdb8f3eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..22ee936236 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..c9624b4eec --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var f; +f = function([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..bbbd4daed1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Destructuring initializer with a "hole" (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f([,]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..abe552c186 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([null, 0, false, '']); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..e27197f2e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Destructuring initializer returns an abrupt completion (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var f = function([x = (function() { throw new Test262Error(); })()]) {}; + +assert.throws(Test262Error, function() { + f([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..a746086945 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Destructuring initializer with an undefined value (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([undefined]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..f095fdb598 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function([ x = unresolvableReference ]) {}; + +assert.throws(ReferenceError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..6e03774969 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding when value iteration completes (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..f95c31ee9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..d40ff3a244 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var f = function([x]) {}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..f918ba42ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var f; +f = function([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..0a960f1b37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function([x]) {}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..5ec9c6c814 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..07bdf9def8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..b1b3746689 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f([{ x: 11, y: 22, z: 33 }]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..4376ca8cb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..ba873ba4e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([{ u: 777, w: 888, y: 999 }]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..e6e7ef21ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Nested object destructuring with a null value (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function([{ x }]) {}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..a511091446 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Nested object destructuring with a value of `undefined` (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function([{ x }]) {}; + +assert.throws(TypeError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..f601a84a67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Elision accepts exhausted iterator (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var f; +f = function([,]) { + + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..7f1fc5107c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-step-err.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Elision advances iterator and forwards abrupt completions (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var f = function([,]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision.js new file mode 100644 index 0000000000..f214aac224 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Elision advances iterator (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(g()); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-empty.js new file mode 100644 index 0000000000..c924d6b660 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-empty.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..75abfebf36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elem.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element containing an array BindingElementList pattern (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f([3, 4, 5]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..9cfcb0e536 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element containing an elision (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f(g()); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..0a7ca0e09b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-empty.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element containing an "empty" array pattern (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f(iter); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..afc6fedad8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-rest.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element containing a rest element (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f(values); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..a91ae6cebe --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-direct.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Lone rest element (direct binding) (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var f; +f = function([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f([1]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..90c16c0c75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Rest element following elision elements (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var f = function([, ...x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..2c737d7500 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element following elision elements (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var f; +f = function([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..7bc02a7e6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: RestElement applied to an exhausted iterator (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var f; +f = function([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f([1, 2]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..6af9a53058 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var f = function([...x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..cbd5d774b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function([...x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js new file mode 100644 index 0000000000..3d82f6f874 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Lone rest element (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..5bec964c48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element (nested array pattern) does not support initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...[ x ] = []]) { + + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..9073e2938a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element (identifier) does not support initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...x = []]) { + + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..011a6bf0b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element (nested object pattern) does not support initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...{ x } = []]) { + + callCount = callCount + 1; +}; + +f([]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..8f08fcc3f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...[x], y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..1c036150d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element (identifier) may not be followed by any element (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...x, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..d64f4630fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...{ x }, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..b571068c3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element containing an object binding pattern (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..1d659a2a31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest element containing an object binding pattern (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var f; +f = function([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f([7, 8, 9]); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/browser.js b/js/src/tests/test262/language/expressions/function/dstr/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..5a7cd2f3bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..0677758d61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var f = function([x, y, z] = [1, 2, 3]) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..2434f8b0f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var f = function([x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..1dbe14c4bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..7d286a97b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-name-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..bb53c433ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..0a7410d00c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..60a88a0839 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..e9e472a0ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var f; +f = function([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..bd8f7aad3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var f; +f = function([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..63b693e69a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var f; +f = function([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..f053301274 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var f; +f = function([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..36e814c2e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var f; +f = function([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..ea52caf041 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Nested array destructuring with a null value (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var f = function([[x]] = [null]) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..9ab1e72d91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..606879c24d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..e455100f33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..303a7ff91b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..b26b8018be --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..1292b732c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var f; +f = function([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..615c76fe1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Destructuring initializer with a "hole" (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..7f383fd9c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..ce744fd4da --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var f = function([x = (function() { throw new Test262Error(); })()] = [undefined]) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..06cbd9f0d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Destructuring initializer with an undefined value (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..4dd14270f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function([ x = unresolvableReference ] = []) {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..f93c353849 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..b79a097fb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..77c450f310 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var f = function([x] = g) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..64234cc410 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var f; +f = function([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..3898e00d48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function([x] = g) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..75a456f786 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..d5da147760 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..4f704d2995 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..9ba50914cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..fe893eff00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..09af32a068 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Nested object destructuring with a null value (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function([{ x }] = [null]) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..4b3a535a2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function([{ x }] = []) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..7792543226 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Elision accepts exhausted iterator (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var f; +f = function([,] = iter) { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..f498125aa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var f = function([,] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..cf230f2386 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Elision advances iterator (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..e19af14d4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-empty.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..861cc8858f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..deda96d7e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element containing an elision (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..bdf7034c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..8c34d5fb01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element containing a rest element (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..477530f12f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Lone rest element (direct binding) (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var f; +f = function([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..73952b8ec5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Rest element following elision elements (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var f = function([, ...x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..58a0567566 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element following elision elements (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var f; +f = function([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..e67b400ba5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var f; +f = function([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..f399cb9547 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var f = function([...x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..3356dec995 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function([...x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..a98268c917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Lone rest element (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..a26e3fcb0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...[ x ] = []] = []) { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..cb6668ccea --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...x = []] = []) { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..b654efce51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...{ x } = []] = []) { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..d3b8c0dc3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..cfefd556a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..80ebd93ce0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..6a708643a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..15497db7b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var f; +f = function([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-null.js new file mode 100644 index 0000000000..39ff450035 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-null.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function({} = null) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-undefined.js new file mode 100644 index 0000000000..067c51ec7f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-undefined.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function({} = undefined) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..ff313f6465 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var f; +f = function({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..df1a49b049 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function({ poisoned } = poisonedProperty) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..f4ed156c43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..26bbfd3130 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..5ca05b670f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..87ebbd0db8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..ce56f7ff23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var f; +f = function({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..0e720d6a6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..bb9cb31969 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function({ x = thrower() } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..1f30fd328d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function({ x = unresolvableReference } = {}) {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..ca164ee83d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..c474937463 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-list-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var f = function({ a, b = thrower(), c = ++initCount } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..94513c1e22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..1082c765a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..b502dccac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..6ba8fca917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..d51f98ee29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function({ [thrower()]: x } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..62b1a90946 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function({ poisoned: x = ++initEvalCount } = poisonedProperty) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..bb5d788af7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..a9b56e6ce1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function({ x: y = thrower() } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..ad657f957c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function({ x: y = unresolvableReference } = {}) {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..4ce963ec7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..45db6b64d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..f947966f79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Binding as specified via property name and identifier (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..a49217e15c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..d323e25d38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..52748be323 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function({ w: { x, y, z } = undefined } = { }) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..3f872708e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..7991ebe7fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var f; +f = function({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..49a97715ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var f; +f = function({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..59fab7659d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/func-expr-dflt.template +/*--- +description: Rest object contains just unextracted data (function expression (default parameter)) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-init-null.js b/js/src/tests/test262/language/expressions/function/dstr/obj-init-null.js new file mode 100644 index 0000000000..22a89be415 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-init-null.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function({}) {}; + +assert.throws(TypeError, function() { + f(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-init-undefined.js b/js/src/tests/test262/language/expressions/function/dstr/obj-init-undefined.js new file mode 100644 index 0000000000..e33f15a702 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-init-undefined.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function({}) {}; + +assert.throws(TypeError, function() { + f(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js new file mode 100644 index 0000000000..670c514037 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: No property access occurs for an "empty" object binding pattern (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var f; +f = function({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f(obj); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..9ba7becf45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-get-value-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function({ poisoned }) {}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..45bfd250f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..8d624ebc9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..77a4382458 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..e26c192533 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..e24a2c0684 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var f; +f = function({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..624c628473 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-skipped.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f({ w: null, x: 0, y: false, z: '' }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..d93fba3d71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error thrown when evaluating the initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function({ x = thrower() }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..3d0fd3ca7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function({ x = unresolvableReference }) {}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..1dda45cabb --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f({ x: 23 }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-list-err.js new file mode 100644 index 0000000000..22862d4f3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-list-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var f = function({ a, b = thrower(), c = ++initCount }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..00a22b17bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..e1562352c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f({ x: [45] }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..c99c84dc32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function({ w: [x, y, z] = [4, 5, 6] }) {}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..d5f5feab97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: [7, undefined, ] }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..876cde65a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-eval-err.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Evaluation of property name returns an abrupt completion (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function({ [thrower()]: x }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..2f403ac7f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function({ poisoned: x = ++initEvalCount }) {}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..b5f3c99e70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f({ s: null, u: 0, w: false, y: '' }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..e3e3745f54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Error thrown when evaluating the initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function({ x: y = thrower() }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..f8db30d45e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function({ x: y = unresolvableReference }) {}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..bcb826d0ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Binding as specified via property name, identifier, and initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..17207afe6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id.js new file mode 100644 index 0000000000..9b75e6791b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Binding as specified via property name and identifier (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..0106390cd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: undefined }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..08942b8e9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..9b11a750cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function({ w: { x, y, z } = undefined }) {}; + +assert.throws(TypeError, function() { + f({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..57e8dcd72e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [destructuring-binding] +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: { x: undefined, z: 7 } }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..4742f63daf --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-getter.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var f; +f = function({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({ get v() { count++; return 2; } }); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..a947afad0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest object doesn't contain non-enumerable properties (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var f; +f = function({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f(o); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..418291f83a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-val-obj.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/func-expr.template +/*--- +description: Rest object contains just unextracted data (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({x: 1, y: 2, a: 5, b: 3}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/dstr/shell.js b/js/src/tests/test262/language/expressions/function/dstr/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/early-body-super-call.js b/js/src/tests/test262/language/expressions/function/early-body-super-call.js new file mode 100644 index 0000000000..84013a0642 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-body-super-call.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions-static-semantics-early-errors +es6id: 14.1.2 +description: Body may not contain a "super" call +info: | + It is a Syntax Error if FunctionBody Contains SuperCall is true. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, function() { + super(); +}; diff --git a/js/src/tests/test262/language/expressions/function/early-body-super-prop.js b/js/src/tests/test262/language/expressions/function/early-body-super-prop.js new file mode 100644 index 0000000000..8a1afa1bd5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-body-super-prop.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions-static-semantics-early-errors +es6id: 14.1.2 +description: Body may not contain a "super" property reference +info: | + It is a Syntax Error if FunctionBody Contains SuperProperty is true. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, function() { + super.x; +}; diff --git a/js/src/tests/test262/language/expressions/function/early-errors/browser.js b/js/src/tests/test262/language/expressions/function/early-errors/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js new file mode 100644 index 0000000000..7f7319cb43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-bad-reference.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-bad-reference.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: bad reference in call expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +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 + + 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 fn = function() { (() => {})().#x }; diff --git a/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-this.js b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-this.js new file mode 100644 index 0000000000..5925936d5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-call-expression-this.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/call-expression-this.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: this evaluated in call expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +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 + + 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 fn = function() { (() => this)().#x }; diff --git a/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js new file mode 100644 index 0000000000..6cdb1ade20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-bad-reference.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-bad-reference.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: bad reference in member expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +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 + + 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 fn = function() { something.#x }; diff --git a/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-this.js b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-this.js new file mode 100644 index 0000000000..50508c02b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-errors/invalid-names-member-expression-this.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/invalid-private-names/member-expression-this.case +// - src/invalid-private-names/default/function-expr.template +/*--- +description: this reference in member expression (Invalid private names should throw a SyntaxError, inside function expression) +esid: sec-static-semantics-early-errors +features: [class-fields-private] +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 + + 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 fn = function() { this.#x }; diff --git a/js/src/tests/test262/language/expressions/function/early-errors/shell.js b/js/src/tests/test262/language/expressions/function/early-errors/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/early-params-super-call.js b/js/src/tests/test262/language/expressions/function/early-params-super-call.js new file mode 100644 index 0000000000..71c684f8dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-params-super-call.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions-static-semantics-early-errors +es6id: 14.1.2 +description: Parameters may not contain a "super" call +info: | + It is a Syntax Error if FormalParameters Contains SuperProperty is true. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, function(x = super()) {}; diff --git a/js/src/tests/test262/language/expressions/function/early-params-super-prop.js b/js/src/tests/test262/language/expressions/function/early-params-super-prop.js new file mode 100644 index 0000000000..9a9c76cf9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/early-params-super-prop.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions-static-semantics-early-errors +es6id: 14.1.2 +description: Parameters may not contain a "super" property reference +info: | + It is a Syntax Error if FunctionBody Contains SuperProperty is true. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, function(x = super.x) {}; diff --git a/js/src/tests/test262/language/expressions/function/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/function/eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..5ad4902157 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/eval-var-scope-syntax-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/func-expr.template +/*--- +description: sloppy direct eval in params introduces var (function expression in sloppy code) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [default-parameters] +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + +var callCount = 0; +var f; +f = function(a = eval("var a = 42")) { + + callCount = callCount + 1; +}; + +assert.throws(SyntaxError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..e08d963d7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template +/*--- +description: Forbidden extension, f.arguments (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var f; +f = function() { + "use strict"; + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +}; + +f(); +assert.sameValue(callCount, 1, 'function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..b5c0b21c67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/func-expr-strict-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template +/*--- +description: Forbidden extension, o.caller (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var f; +f = function() { + "use strict"; + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +}; + +f(); +assert.sameValue(callCount, 1, 'function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..2d1350aee7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/func-expr.template +/*--- +description: Forbidden extension, o.caller (function expression) +esid: sec-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = function() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + + callCount++; +}; +f(); +assert.sameValue(callCount, 1, 'body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..1565c72640 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/func-expr.template +/*--- +description: Forbidden extension, o.caller (function expression) +esid: sec-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = function() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + + callCount++; +}; +f(); +assert.sameValue(callCount, 1, 'body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..4276438d1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/func-expr-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/func-expr.template +/*--- +description: Forbidden extension, o.caller (function expression) +esid: sec-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = function() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + + callCount++; +}; +f(); +assert.sameValue(callCount, 1, 'body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/function/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/length-dflt.js b/js/src/tests/test262/language/expressions/function/length-dflt.js new file mode 100644 index 0000000000..e4827418d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/length-dflt.js @@ -0,0 +1,70 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [default-parameters] +includes: [propertyHelper.js] +---*/ + + +var f1 = function (x = 42) {}; + +verifyProperty(f1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f2 = function (x = 42, y) {}; + +verifyProperty(f2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f3 = function (x, y = 42) {}; + +verifyProperty(f3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var f4 = function (x, y = 42, z) {}; + +verifyProperty(f4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/name-arguments-non-strict.js b/js/src/tests/test262/language/expressions/function/name-arguments-non-strict.js new file mode 100644 index 0000000000..030ad8cecc --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name-arguments-non-strict.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-3-8 +description: > + arguments allowed as function identifier in non-strict function + expression +flags: [noStrict] +---*/ + +(function arguments (){}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/name-arguments-strict-body.js b/js/src/tests/test262/language/expressions/function/name-arguments-strict-body.js new file mode 100644 index 0000000000..95e5452bb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name-arguments-strict-body.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-42-s +description: > + StrictMode - SyntaxError is thrown if 'arguments' occurs as the + Identifier of a FunctionExpression whose FunctionBody is contained + in strict code +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function arguments() {'use strict';}); diff --git a/js/src/tests/test262/language/expressions/function/name-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/function/name-arguments-strict-strict.js new file mode 100644 index 0000000000..593176857d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name-arguments-strict-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-14-s +description: > + StrictMode - SyntaxError is thrown if 'arguments' occurs as the + Identifier of a FunctionExpression in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(function arguments() {}); diff --git a/js/src/tests/test262/language/expressions/function/name-eval-non-strict.js b/js/src/tests/test262/language/expressions/function/name-eval-non-strict.js new file mode 100644 index 0000000000..f01fda4c12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name-eval-non-strict.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-3-2 +description: > + eval allowed as function identifier in non-strict function + expression +flags: [noStrict] +---*/ + +(function eval(){}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/name-eval-strict-body.js b/js/src/tests/test262/language/expressions/function/name-eval-strict-body.js new file mode 100644 index 0000000000..ce9e8f759b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name-eval-strict-body.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-38-s +description: > + StrictMode - SyntaxError is thrown if 'eval' occurs as the + Identifier of a FunctionExpression whose FunctionBody is contained + in strict code +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function eval() {'use strict';}); diff --git a/js/src/tests/test262/language/expressions/function/name-eval-strict-strict.js b/js/src/tests/test262/language/expressions/function/name-eval-strict-strict.js new file mode 100644 index 0000000000..01d55428d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name-eval-strict-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-12-s +description: > + StrictMode - SyntaxError is thrown if 'eval' occurs as the + Identifier of a FunctionExpression in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(function eval() {}); diff --git a/js/src/tests/test262/language/expressions/function/name-eval-stricteval.js b/js/src/tests/test262/language/expressions/function/name-eval-stricteval.js new file mode 100644 index 0000000000..bcfeaac1c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name-eval-stricteval.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-37-s +description: > + StrictMode - SyntaxError is thrown if 'eval' occurs as the + Identifier of a FunctionExpression in strict eval code +flags: [noStrict] +---*/ + + var _13_1_37_s = {}; +assert.throws(SyntaxError, function() { + eval("'use strict'; _13_1_37_s.x = function eval() {};"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/name.js b/js/src/tests/test262/language/expressions/function/name.js new file mode 100644 index 0000000000..f22b407883 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/name.js @@ -0,0 +1,38 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-definitions-runtime-semantics-evaluation +description: Assignment of function `name` attribute +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + 1. Let scope be the LexicalEnvironment of the running execution context. + 2. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, ""). + ... + 5. Return closure. + + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + 1. Let scope be the running execution context's LexicalEnvironment. + 2. Let funcEnv be NewDeclarativeEnvironment(scope). + 3. Let envRec be funcEnv's EnvironmentRecord. + 4. Let name be StringValue of BindingIdentifier. + 5. Perform envRec.CreateImmutableBinding(name, false). + 6. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + funcEnv, name). + ... + 10. Return closure. +includes: [propertyHelper.js] +---*/ + +verifyProperty(function() {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(function func() {}, "name", { + value: "func", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-arrow.js b/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-arrow.js new file mode 100644 index 0000000000..e252daeb6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-arrow.js @@ -0,0 +1,26 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named function expression in non-strict mode code) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +assert.sameValue(ref(), ref); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-eval.js b/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-eval.js new file mode 100644 index 0000000000..57960fc9df --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body-in-eval.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named function expression in non-strict mode code) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +assert.sameValue(ref(), ref); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body.js b/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body.js new file mode 100644 index 0000000000..60d9da1cde --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/named-no-strict-reassign-fn-name-in-body.js @@ -0,0 +1,24 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named function expression in non-strict mode code) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, noStrict] +info: | + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +assert.sameValue(ref(), ref); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js b/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js new file mode 100644 index 0000000000..ab9fed2175 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js @@ -0,0 +1,29 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named function expression in strict mode code) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, onlyStrict] +info: | + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +assert.throws(TypeError, () => { + ref(); +}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js b/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js new file mode 100644 index 0000000000..278798315f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js @@ -0,0 +1,27 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named function expression in strict mode code) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, onlyStrict] +info: | + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +assert.throws(TypeError, () => { + ref(); +}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-strict.js b/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-strict.js new file mode 100644 index 0000000000..df7b85b637 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/named-strict-error-reassign-fn-name-in-body-strict.js @@ -0,0 +1,27 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named function expression in strict mode code) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated, onlyStrict] +info: | + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +assert.throws(TypeError, () => { + ref(); +}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/function/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..1e401e31ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/object-destructuring-param-strict-body.js @@ -0,0 +1,133 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/func-expr.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, function({property}) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/function/param-arguments-non-strict.js b/js/src/tests/test262/language/expressions/function/param-arguments-non-strict.js new file mode 100644 index 0000000000..010e3c4394 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-arguments-non-strict.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-2-6 +description: > + arguments allowed as formal parameter name of a non-strict + function expression +flags: [noStrict] +---*/ + +(function foo(arguments){}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/param-dflt-yield-non-strict.js b/js/src/tests/test262/language/expressions/function/param-dflt-yield-non-strict.js new file mode 100644 index 0000000000..2b47209a5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-dflt-yield-non-strict.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions +es6id: 14.1 +description: > + The `yield` token is interpreted as an IdentifierReference within a generator + and outside of strict mode +info: | + FunctionExpression : + function BindingIdentifieropt ( FormalParameters ) { FunctionBody } +features: [generators, default-parameters] +flags: [noStrict] +---*/ + +var yield = 23; +var paramValue; + +function *g() { + (function(x = yield) { + paramValue = x; + }()); +} + +g().next(); + +assert.sameValue(paramValue, 23); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/param-dflt-yield-strict-strict.js b/js/src/tests/test262/language/expressions/function/param-dflt-yield-strict-strict.js new file mode 100644 index 0000000000..3173fee194 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-dflt-yield-strict-strict.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions +es6id: 14.1 +description: > + The `yield` token is interpreted as an IdentifierReference within a generator + and outside of strict mode +info: | + FunctionExpression : + function BindingIdentifieropt ( FormalParameters ) { FunctionBody } +features: [generators, default-parameters] +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function *g() { + 0, function(x = yield) { + paramValue = x; + }; +} diff --git a/js/src/tests/test262/language/expressions/function/param-duplicated-non-strict.js b/js/src/tests/test262/language/expressions/function/param-duplicated-non-strict.js new file mode 100644 index 0000000000..b4c26e1bec --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-duplicated-non-strict.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-1-2 +description: > + Duplicate identifier allowed in non-strict function expression + parameter list +flags: [noStrict] +---*/ + +(function foo(a,a){}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/param-duplicated-strict-1-strict.js b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-1-strict.js new file mode 100644 index 0000000000..65fe3dce50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-1-strict.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode + FunctionDeclaration or FunctionExpression. +es5id: 13.1-8-s +description: > + Strict Mode - SyntaxError is thrown if a function is created in + 'strict mode' using a FunctionExpression and the function has two + identical parameters +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(function (param, param) { }); diff --git a/js/src/tests/test262/language/expressions/function/param-duplicated-strict-2-strict.js b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-2-strict.js new file mode 100644 index 0000000000..e94bd31573 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-2-strict.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode + FunctionDeclaration or FunctionExpression. +es5id: 13.1-9-s +description: > + Strict Mode - SyntaxError is thrown if a function is created in + 'strict mode' using a FunctionExpression and the function has two + identical parameters, which are separated by a unique parameter + name +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(function (param1, param2, param1) { }); diff --git a/js/src/tests/test262/language/expressions/function/param-duplicated-strict-3-strict.js b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-3-strict.js new file mode 100644 index 0000000000..d88fddab0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-3-strict.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode + FunctionDeclaration or FunctionExpression. +es5id: 13.1-10-s +description: > + Strict Mode - SyntaxError is thrown if a function is created in + 'strict mode' using a FunctionExpression and the function has + three identical parameters +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +(function (param, param, param) { }); diff --git a/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-1.js b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-1.js new file mode 100644 index 0000000000..ac130ef625 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-1.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode + FunctionDeclaration or FunctionExpression. +es5id: 13.1-30-s +description: > + Strict Mode - SyntaxError is thrown if a function is created using + a FunctionExpression whose FunctionBody is contained in strict + code and the function has two identical parameters +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function (param, param) { 'use strict'; }); diff --git a/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-2.js b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-2.js new file mode 100644 index 0000000000..aac1570ad8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-2.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode + FunctionDeclaration or FunctionExpression. +es5id: 13.1-32-s +description: > + Strict Mode - SyntaxError is thrown if a function is created using + a FunctionExpression whose FunctionBody is strict and the function + has two identical parameters, which are separated by a unique + parameter name +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function (param1, param2, param1) { 'use strict'; }); diff --git a/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-3.js b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-3.js new file mode 100644 index 0000000000..4a791e5446 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-duplicated-strict-body-3.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if any Identifier value occurs more than once within a FormalParameterList of a strict mode + FunctionDeclaration or FunctionExpression. +es5id: 13.1-34-s +description: > + Strict Mode - SyntaxError is thrown if a function declaration has + three identical parameters with a strict mode body +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function (param, param, param) { 'use strict'; }); diff --git a/js/src/tests/test262/language/expressions/function/param-eval-non-strict-is-correct-value.js b/js/src/tests/test262/language/expressions/function/param-eval-non-strict-is-correct-value.js new file mode 100644 index 0000000000..dadd048b68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-eval-non-strict-is-correct-value.js @@ -0,0 +1,23 @@ +// Copyright (c) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-strict-mode-of-ecmascript +description: > + eval allowed as formal parameter name of a non-strict function expression +flags: [noStrict] +---*/ + +let exprCallCount = 0; +let evalValue = {}; + +let foo = function(eval) { + assert.sameValue(eval, evalValue); + exprCallCount += 1; +}; + +foo(evalValue); + +assert.sameValue(exprCallCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/param-eval-non-strict.js b/js/src/tests/test262/language/expressions/function/param-eval-non-strict.js new file mode 100644 index 0000000000..042cc1c50b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-eval-non-strict.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 13.1-2-2 +description: > + eval allowed as formal parameter name of a non-strict function + expression +flags: [noStrict] +---*/ + +(function foo(eval){}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/param-eval-strict-body.js b/js/src/tests/test262/language/expressions/function/param-eval-strict-body.js new file mode 100644 index 0000000000..676ddeb3ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-eval-strict-body.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList + of a strict mode FunctionDeclaration or FunctionExpression. +es5id: 13.1-18-s +description: > + StrictMode - SyntaxError is thrown if the identifier 'eval' + appears within a FormalParameterList of a strict mode + FunctionExpression when FuctionBody is strict code +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +(function (eval) { 'use strict'; }); diff --git a/js/src/tests/test262/language/expressions/function/param-eval-stricteval.js b/js/src/tests/test262/language/expressions/function/param-eval-stricteval.js new file mode 100644 index 0000000000..2bdfac4ae1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/param-eval-stricteval.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 13.1; + It is a SyntaxError if the Identifier "eval" or the Identifier "arguments" occurs within a FormalParameterList + of a strict mode FunctionDeclaration or FunctionExpression. +es5id: 13.1-17-s +description: > + StrictMode - SyntaxError is thrown if the identifier 'eval' + appears within a FormalParameterList of a strict mode + FunctionExpression in strict eval code +flags: [noStrict] +---*/ + + +assert.throws(SyntaxError, function() { + eval("'use strict'; var _13_1_17_fun = function (eval) { }"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/params-dflt-args-unmapped.js b/js/src/tests/test262/language/expressions/function/params-dflt-args-unmapped.js new file mode 100644 index 0000000000..daf25a8e78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/params-dflt-args-unmapped.js @@ -0,0 +1,84 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [default-parameters] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; +}; + +f(); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/params-dflt-ref-arguments.js b/js/src/tests/test262/language/expressions/function/params-dflt-ref-arguments.js new file mode 100644 index 0000000000..3bee227fa6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/params-dflt-ref-arguments.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [default-parameters] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; +}; + +f(undefined, undefined, 'third', 'fourth'); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/function/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..8f8a1a2b73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/params-trailing-comma-multiple.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/function/params-trailing-comma-single.js new file mode 100644 index 0000000000..a91ca4ce6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/params-trailing-comma-single.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/function/rest-param-strict-body.js new file mode 100644 index 0000000000..2aa8e37cbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/rest-param-strict-body.js @@ -0,0 +1,133 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/func-expr.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, function(a,...rest) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/function/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/function/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..ad4dd97438 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/rest-params-trailing-comma-early-error.js @@ -0,0 +1,58 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/func-expr.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, function(...a,) { + +}; diff --git a/js/src/tests/test262/language/expressions/function/scope-body-lex-distinct.js b/js/src/tests/test262/language/expressions/function/scope-body-lex-distinct.js new file mode 100644 index 0000000000..7cba86042e --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-body-lex-distinct.js @@ -0,0 +1,51 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new lexical environment (distinct from the variable + environment) for the function body outside of strict mode +info: | + [...] + 29. If strict is false, then + a. Let lexEnv be NewDeclarativeEnvironment(varEnv). + b. NOTE: Non-strict functions use a separate lexical Environment Record + for top-level lexical declarations so that a direct eval can + determine whether any var scoped declarations introduced by the eval + code conflict with pre-existing top-level lexically scoped + declarations. This is not needed for strict functions because a + strict direct eval always places all declarations into a new + Environment Record. + [...] + + 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation + + [...] + 5. If strict is false, then + [...] + b. Let thisLex be lexEnv. + c. Assert: The following loop will terminate. + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + ii. NOTE: Annex B.3.5 defines alternate semantics for the + above step. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. +flags: [noStrict] +features: [let] +---*/ + +assert.throws(SyntaxError, function() { + let x; + eval('var x;'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-name-var-close.js b/js/src/tests/test262/language/expressions/function/scope-name-var-close.js new file mode 100644 index 0000000000..2114f5ad5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-name-var-close.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions-runtime-semantics-evaluation +description: Removal of variable environment for the BindingIdentifier +info: | + [...] + 2. Let scope be the running execution context's LexicalEnvironment. + 3. Let funcEnv be NewDeclarativeEnvironment(scope). + 4. Let envRec be funcEnv's EnvironmentRecord. + 5. Let name be StringValue of BindingIdentifier. + 6. Perform envRec.CreateImmutableBinding(name, false). + 7. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + funcEnv, strict). + [...] +---*/ + +var probe; + +var func = function f() { + probe = function() { return f; }; +}; +var f = 'outside'; + +func(); + +assert.sameValue(f, 'outside'); +assert.sameValue(probe(), func); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-name-var-open-non-strict.js b/js/src/tests/test262/language/expressions/function/scope-name-var-open-non-strict.js new file mode 100644 index 0000000000..4d52ee06c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-name-var-open-non-strict.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions-runtime-semantics-evaluation +description: > + Creation of new variable environment for the BindingIdentifier + parameter +info: | + [...] + 2. Let scope be the running execution context's LexicalEnvironment. + 3. Let funcEnv be NewDeclarativeEnvironment(scope). + 4. Let envRec be funcEnv's EnvironmentRecord. + 5. Let name be StringValue of BindingIdentifier. + 6. Perform envRec.CreateImmutableBinding(name, false). + 7. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + funcEnv, strict). + [...] +flags: [noStrict] +---*/ + +var f = 'outside'; +var probeBefore = function() { return f; }; +var setBefore = function() { f = null; }; +var probeParams, setParams, probeBody, setBody; + +var func = function f( + _ = ( + probeParams = function() { return f; }, + setParams = function() { f = null; } + ) + ) { + probeBody = function() { return f; }; + setBody = function() { f = null; }; +}; + +func(); + +assert.sameValue(probeBefore(), 'outside'); +setBefore(); +assert.sameValue(probeBefore(), null); + +assert.sameValue(probeParams(), func, 'inner binding value (from parameters)'); +setParams(); +assert.sameValue( + probeParams(), func, 'inner binding is immutable (from parameters)' +); + +assert.sameValue(probeBody(), func, 'inner binding value (from body)'); +setBody(); +assert.sameValue(probeBody(), func, 'inner binding is immutable (from body)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-name-var-open-strict-strict.js b/js/src/tests/test262/language/expressions/function/scope-name-var-open-strict-strict.js new file mode 100644 index 0000000000..e1afa2fab6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-name-var-open-strict-strict.js @@ -0,0 +1,57 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-definitions-runtime-semantics-evaluation +description: > + Creation of new variable environment for the BindingIdentifier + parameter +info: | + [...] + 2. Let scope be the running execution context's LexicalEnvironment. + 3. Let funcEnv be NewDeclarativeEnvironment(scope). + 4. Let envRec be funcEnv's EnvironmentRecord. + 5. Let name be StringValue of BindingIdentifier. + 6. Perform envRec.CreateImmutableBinding(name, false). + 7. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + funcEnv, strict). + [...] +flags: [onlyStrict] +---*/ + +var f = 'outside'; +var probeBefore = function() { return f; }; +var setBefore = function() { f = null; }; +var probeParams, setParams, probeBody, setBody; + +var func = function f( + _ = ( + probeParams = function() { return f; }, + setParams = function() { f = null; } + ) + ) { + probeBody = function() { return f; }; + setBody = function() { f = null; }; +}; + +func(); + +assert.sameValue(probeBefore(), 'outside'); +setBefore(); +assert.sameValue(probeBefore(), null); + +assert.sameValue(probeParams(), func, 'inner binding value (from parameters)'); +assert.throws( + TypeError, setParams, 'inner binding rejects modification (from parameters)' +); +assert.sameValue( + probeParams(), func, 'inner binding is immutable (from parameters)' +); + +assert.sameValue(probeBody(), func, 'inner binding value (from body)'); +assert.throws( + TypeError, setBody, 'inner binding rejects modification (from body)' +); +assert.sameValue(probeBody(), func, 'inner binding is immutable (from body)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-param-elem-var-close.js b/js/src/tests/test262/language/expressions/function/scope-param-elem-var-close.js new file mode 100644 index 0000000000..4ed7ddbdba --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-param-elem-var-close.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2, probeBody; + +(function( + _ = (eval('var x = "inside";'), probe1 = function() { return x; }), + __ = probe2 = function() { return x; } + ) { + probeBody = function() { return x; }; +}()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-param-elem-var-open.js b/js/src/tests/test262/language/expressions/function/scope-param-elem-var-open.js new file mode 100644 index 0000000000..76953069fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-param-elem-var-open.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2; + +(function( + _ = probe1 = function() { return x; }, + __ = (eval('var x = "inside";'), probe2 = function() { return x; }) + ) { +}()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-close.js b/js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-close.js new file mode 100644 index 0000000000..a1f583d256 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-close.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probeParam, probeBody; + +(function( + ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })] + ) { + probeBody = function() { return x; } +}()); + +assert.sameValue(probeParam(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-open.js b/js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-open.js new file mode 100644 index 0000000000..fd636f75e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-param-rest-elem-var-open.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2; + +(function( + _ = probe1 = function() { return x; }, + ...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })] + ) { +}()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/function/scope-paramsbody-var-close.js new file mode 100644 index 0000000000..25679c5104 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-paramsbody-var-close.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Removal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +// A parameter expression is necessary to trigger the creation of the scope +// under test. +(function(_ = null) { + var x = 'inside'; + probe = function() { return x; }; +}()); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/scope-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/function/scope-paramsbody-var-open.js new file mode 100644 index 0000000000..1066cb066b --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/scope-paramsbody-var-open.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +(function(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; +}()); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/shell.js b/js/src/tests/test262/language/expressions/function/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/function/static-init-await-binding.js b/js/src/tests/test262/language/expressions/function/static-init-await-binding.js new file mode 100644 index 0000000000..1b0f36d2f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/static-init-await-binding.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an IdentifierReference within function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (function await(await) {}); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/static-init-await-reference.js b/js/src/tests/test262/language/expressions/function/static-init-await-reference.js new file mode 100644 index 0000000000..d6c2180a06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/static-init-await-reference.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an IdentifierReference within function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + (function (x = fromParam = await) { + fromBody = await; + })(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/function/unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..f98c73226c --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/unscopables-with-in-nested-fn.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [globalThis, Symbol.unscopables] +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(x) { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/unscopables-with.js b/js/src/tests/test262/language/expressions/function/unscopables-with.js new file mode 100644 index 0000000000..9164981c00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/unscopables-with.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +features: [globalThis, Symbol.unscopables] +flags: [generated, noStrict] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(x) { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/function/use-strict-with-non-simple-param.js b/js/src/tests/test262/language/expressions/function/use-strict-with-non-simple-param.js new file mode 100644 index 0000000000..5b22d8500f --- /dev/null +++ b/js/src/tests/test262/language/expressions/function/use-strict-with-non-simple-param.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-function-definitions-static-semantics-early-errors +description: > + A SyntaxError is thrown if a function contains a non-simple parameter list and a UseStrict directive. +info: | + Static Semantics: Early Errors + + It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of FormalParameters is false. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var f = function(a = 0) { + "use strict"; +} diff --git a/js/src/tests/test262/language/expressions/generators/arguments-with-arguments-fn.js b/js/src/tests/test262/language/expressions/generators/arguments-with-arguments-fn.js new file mode 100644 index 0000000000..c6c0f9dd19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/arguments-with-arguments-fn.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +es6id: 9.2.12 +description: > + Arguments object is created even when the body contains a lexically-scoped + binding named "arguments" +info: | + [...] + 19. Else if "arguments" is an element of parameterNames, then + a. Let argumentsObjectNeeded be false. + 20. Else if hasParameterExpressions is false, then + a. If "arguments" is an element of functionNames or if "arguments" is an + element of lexicalNames, then + i. Let argumentsObjectNeeded be false. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var args; + +var g = function* (x = args = arguments) { + function arguments() {} +}; + +g().next(); + +assert.sameValue(typeof args, 'object'); +assert.sameValue(args.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/arguments-with-arguments-lex.js b/js/src/tests/test262/language/expressions/generators/arguments-with-arguments-lex.js new file mode 100644 index 0000000000..79117a7bae --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/arguments-with-arguments-lex.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +es6id: 9.2.12 +description: > + Arguments object is created even when the body contains a function named + "arguments" +info: | + [...] + 19. Else if "arguments" is an element of parameterNames, then + a. Let argumentsObjectNeeded be false. + 20. Else if hasParameterExpressions is false, then + a. If "arguments" is an element of functionNames or if "arguments" is an + element of lexicalNames, then + i. Let argumentsObjectNeeded be false. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var args; + +var g = function* (x = args = arguments) { + let arguments; +}; + +g().next(); + +assert.sameValue(typeof args, 'object'); +assert.sameValue(args.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/generators/array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..799d648141 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/array-destructuring-param-strict-body.js @@ -0,0 +1,134 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/gen-func-expr.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, function*([element]) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/generators/browser.js b/js/src/tests/test262/language/expressions/generators/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/default-proto.js b/js/src/tests/test262/language/expressions/generators/default-proto.js new file mode 100644 index 0000000000..328ac12d44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/default-proto.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluatebody +es6id: 14.4.11 +description: Intrinsic default prototype of GeneratorFunctions +info: | + 1. Let G be ? OrdinaryCreateFromConstructor(functionObject, + "%GeneratorPrototype%", « [[GeneratorState]], [[GeneratorContext]] »). + [...] + + 9.1.13 OrdinaryCreateFromConstructor + + [...] + 2. Let proto be ? GetPrototypeFromConstructor(constructor, + intrinsicDefaultProto). + 3. Return ObjectCreate(proto, internalSlotsList). + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + [...] +features: [generators] +---*/ + +var g = function*() {}; +var GeneratorPrototype = Object.getPrototypeOf(g).prototype; +g.prototype = null; + +assert.sameValue(Object.getPrototypeOf(g()), GeneratorPrototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/generators/dflt-params-abrupt.js new file mode 100644 index 0000000000..0325685823 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-abrupt.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/gen-func-expr.template +/*--- +description: Abrupt completion returned by evaluation of initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var f; +f = function*(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; +}; + +assert.throws(Test262Error, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..034a1e1aed --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-not-undefined.js @@ -0,0 +1,88 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: Use of initializer when argument value is not `undefined` (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; +}; + +ref(false, '', NaN, 0, null, obj).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..0176a8f6dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-arg-val-undefined.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: Use of initializer when argument value is `undefined` (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; +}; + +ref(undefined, void 0).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/generators/dflt-params-duplicates.js new file mode 100644 index 0000000000..9077978234 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-duplicates.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/gen-func-expr.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, function*(x = 0, x) { + +}; diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/generators/dflt-params-ref-later.js new file mode 100644 index 0000000000..eec15fb5fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-ref-later.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/gen-func-expr.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var f; +f = function*(x = y, y) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/generators/dflt-params-ref-prior.js new file mode 100644 index 0000000000..95d580d6ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-ref-prior.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; +}; + +ref(3).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/generators/dflt-params-ref-self.js new file mode 100644 index 0000000000..c424952c24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-ref-self.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/gen-func-expr.template +/*--- +description: Referencing a parameter from within its own initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var f; +f = function*(x = x) { + + callCount = callCount + 1; +}; + +assert.throws(ReferenceError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-rest.js b/js/src/tests/test262/language/expressions/generators/dflt-params-rest.js new file mode 100644 index 0000000000..5e27383608 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-rest.js @@ -0,0 +1,67 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/gen-func-expr.template +/*--- +description: RestParameter does not support an initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, function*(...x = []) { + +}; diff --git a/js/src/tests/test262/language/expressions/generators/dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/generators/dflt-params-trailing-comma.js new file mode 100644 index 0000000000..82d4011377 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dflt-params-trailing-comma.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-close.js new file mode 100644 index 0000000000..84935e454a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function*([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f(iter).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..9fe0a54eea --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Abrupt completion returned by GetIterator (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var f = function*([x, y, z]) {}; + +assert.throws(TypeError, function() { + f([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err.js new file mode 100644 index 0000000000..7824df798e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-get-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Abrupt completion returned by GetIterator (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var f = function*([x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-no-close.js new file mode 100644 index 0000000000..17c0a276db --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-init-iter-no-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function*([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f(iter).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-name-iter-val.js new file mode 100644 index 0000000000..1b20ed6efa --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-name-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding with normal value iteration (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..b9740b89e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..889d7b46e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f([[7, 8, 9]]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..55b0585736 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function*([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..19ace65312 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var f; +f = function*([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f([[]]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..5df1a5271e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var f; +f = function*([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..16e5262256 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var f; +f = function*([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([[23]]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..345b88f168 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var f; +f = function*([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..66d6596ac0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var f; +f = function*([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([values]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..766da8ebd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Nested array destructuring with a null value (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var f = function*([[x]]) {}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..dfb7c3fd28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Destructuring initializer with an exhausted iterator (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..44ee74995c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding does assign name to arrow functions (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..faa542cff8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..627430ebba --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..875dd85cdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..268b3c6a68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var f; +f = function*([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..323cff1c8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Destructuring initializer with a "hole" (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f([,]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..464148a6e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function*([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f([null, 0, false, '']).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..3d87005376 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Destructuring initializer returns an abrupt completion (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var f = function*([x = (function() { throw new Test262Error(); })()]) {}; + +assert.throws(Test262Error, function() { + f([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..a9fa217ef7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Destructuring initializer with an undefined value (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f([undefined]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..14e8881b67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function*([ x = unresolvableReference ]) {}; + +assert.throws(ReferenceError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..0f780ae96f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding when value iteration completes (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..e73c151da6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..d39e870af6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var f = function*([x]) {}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..9e6cfc4f60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var f; +f = function*([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..5d7925bb9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function*([x]) {}; + +assert.throws(Test262Error, function() { + f(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..ab8de5eba5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..f021625b24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..805f7b8089 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-id.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f([{ x: 11, y: 22, z: 33 }]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..b4cb42679c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..821fb6781b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f([{ u: 777, w: 888, y: 999 }]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..d05feeefbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Nested object destructuring with a null value (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function*([{ x }]) {}; + +assert.throws(TypeError, function() { + f([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..c10cbdfc7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Nested object destructuring with a value of `undefined` (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function*([{ x }]) {}; + +assert.throws(TypeError, function() { + f([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..d9649650d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-exhausted.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Elision accepts exhausted iterator (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var f; +f = function*([,]) { + + callCount = callCount + 1; +}; + +f(iter).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..f4a4b1682b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision-step-err.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Elision advances iterator and forwards abrupt completions (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var f = function*([,]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision.js new file mode 100644 index 0000000000..78dc86d0d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-elision.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Elision advances iterator (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function*([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f(g()).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-empty.js new file mode 100644 index 0000000000..e2aef6fdd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-empty.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function*([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f(iter).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..7515d5fbf2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elem.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element containing an array BindingElementList pattern (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f([3, 4, 5]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..b358ee1683 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element containing an elision (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function*([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f(g()).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..a661695c71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-empty.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element containing an "empty" array pattern (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function*([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f(iter).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..8b9733f5ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-ary-rest.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element containing a rest element (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function*([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f(values).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..6b6f41f1da --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-direct.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Lone rest element (direct binding) (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var f; +f = function*([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f([1]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..8be1666b72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Rest element following elision elements (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var f = function*([, ...x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..4d96462e9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-elision.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element following elision elements (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var f; +f = function*([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..892df853e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: RestElement applied to an exhausted iterator (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var f; +f = function*([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f([1, 2]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..7c8a355cb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var f = function*([...x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..1142c23c30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function*([...x]) {}; + +assert.throws(Test262Error, function() { + f(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id.js new file mode 100644 index 0000000000..6034f2a4b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Lone rest element (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function*([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f(values).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..393bd2d279 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element (nested array pattern) does not support initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...[ x ] = []]) { + + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..601ba93dcf --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element (identifier) does not support initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...x = []]) { + + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..356f750d5c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-init-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element (nested object pattern) does not support initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...{ x } = []]) { + + callCount = callCount + 1; +}; + +f([]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..b53f0d33d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...[x], y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..e3d4dd7fdb --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element (identifier) may not be followed by any element (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...x, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..6786a31042 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...{ x }, y]) { + + callCount = callCount + 1; +}; + +f([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..8e37860adf --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element containing an object binding pattern (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function*([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..b02ec61a0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest element containing an object binding pattern (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var f; +f = function*([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f([7, 8, 9]).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/browser.js b/js/src/tests/test262/language/expressions/generators/dstr/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..2ccce3e053 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function*([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..b8d8769a2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var f = function*([x, y, z] = [1, 2, 3]) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..c527319ec5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-get-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var f = function*([x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..7a3ada5d8f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-init-iter-no-close.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var f; +f = function*([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..1e74aed08c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-name-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..cea02dc600 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..7a39ed0ed9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..4297851c91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function*([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..a2311af339 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var f; +f = function*([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..1e5e4c803f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var f; +f = function*([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..425307056e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var f; +f = function*([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..1d7491924f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var f; +f = function*([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..a6a561fe24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var f; +f = function*([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..8a556b8cea --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Nested array destructuring with a null value (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var f = function*([[x]] = [null]) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..a29b30e2d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..bcef720169 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..85f8a07e66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..6dc1130fff --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..6104e9a415 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..b1bd69fde8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var f; +f = function*([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..e9c254fb02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer with a "hole" (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..3c0ad59d48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function*([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..cf4a74d084 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var f = function*([x = (function() { throw new Test262Error(); })()] = [undefined]) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..1be4893f5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer with an undefined value (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..3d58aecc22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function*([ x = unresolvableReference ] = []) {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..0f3565e347 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..b49d433935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..93c21035f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var f = function*([x] = g) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..8bb35763b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var f; +f = function*([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..692cc5c125 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function*([x] = g) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..1eaf8632d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..8dc6ff5bc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..28abb97ce4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..ff88ea5eb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..37ac85f989 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..ff766738d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Nested object destructuring with a null value (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function*([{ x }] = [null]) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..08feed0d0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var f = function*([{ x }] = []) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..7c645da262 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Elision accepts exhausted iterator (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var f; +f = function*([,] = iter) { + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..fa6ca1957a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var f = function*([,] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..b31ed21753 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-elision.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Elision advances iterator (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function*([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..408096060f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-empty.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function*([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..6b0095c7f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..e9660265cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element containing an elision (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var f; +f = function*([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..36fe8ae212 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var f; +f = function*([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..0e0dac6449 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element containing a rest element (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function*([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..7d79be7121 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Lone rest element (direct binding) (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var f; +f = function*([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..764bff470b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Rest element following elision elements (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var f = function*([, ...x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..a5b2d80bb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element following elision elements (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var f; +f = function*([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..034b002d5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var f; +f = function*([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..75de7fd5f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var f = function*([...x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..c5ba5d9ab9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var f = function*([...x] = iter) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..0442095310 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Lone rest element (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var f; +f = function*([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..7a882a4720 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...[ x ] = []] = []) { + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..62ca6e97d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...x = []] = []) { + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..20d7982d79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...{ x } = []] = []) { + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..ffd62054e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..3d1c7aa00e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..b658b9a00e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var f; +f = function*([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..43457a06e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function*([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..accb2c9cff --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest element containing an object binding pattern (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var f; +f = function*([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-null.js new file mode 100644 index 0000000000..570fcd431f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-null.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function*({} = null) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-undefined.js new file mode 100644 index 0000000000..494e1878f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-init-undefined.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function*({} = undefined) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..97107e817c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-empty.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var f; +f = function*({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..709dd397d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function*({ poisoned } = poisonedProperty) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..6b94ba3533 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..9d4ce74644 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..c1ae517224 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..b3a7997d94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..e8de63f3b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var f; +f = function*({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..a87bc1a951 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function*({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..3dcc295d5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function*({ x = thrower() } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..420e08e639 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function*({ x = unresolvableReference } = {}) {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..43dba09066 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function*({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..f3df1261e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-list-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var f = function*({ a, b = thrower(), c = ++initCount } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..a02b554adb --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..c69f41186f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function*({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..6678efefa4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function*({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..ee7adce8c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..ee6c3cdecb --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function*({ [thrower()]: x } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..213b984e3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function*({ poisoned: x = ++initEvalCount } = poisonedProperty) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..a33ba9b8fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function*({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..18c5056fd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Error thrown when evaluating the initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function*({ x: y = thrower() } = {}) {}; + +assert.throws(Test262Error, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..fd95739abc --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function*({ x: y = unresolvableReference } = {}) {}; + +assert.throws(ReferenceError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..178aa432df --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..79b9c9d3ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function*({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..99bb26e199 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-id.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Binding as specified via property name and identifier (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..a9e5b695d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..0d1889c49c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..baa20d2dea --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function*({ w: { x, y, z } = undefined } = { }) {}; + +assert.throws(TypeError, function() { + f(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..1143ce5e3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..fe63881835 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var f; +f = function*({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..816af84005 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var f; +f = function*({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..5b24c2735a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/gen-func-expr-dflt.template +/*--- +description: Rest object contains just unextracted data (generator function expression (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function*({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-init-null.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-init-null.js new file mode 100644 index 0000000000..883f6927c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-init-null.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function*({}) {}; + +assert.throws(TypeError, function() { + f(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-init-undefined.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-init-undefined.js new file mode 100644 index 0000000000..072239e98c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-init-undefined.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var f = function*({}) {}; + +assert.throws(TypeError, function() { + f(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-empty.js new file mode 100644 index 0000000000..df0223322e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-empty.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: No property access occurs for an "empty" object binding pattern (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var f; +f = function*({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; +}; + +f(obj).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..858e0ab3e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-get-value-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function*({ poisoned }) {}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..cfe3625846 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; +}; + +f({}).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..d80d863a1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; +}; + +f({}).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a2cdba1fb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; +}; + +f({}).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..1293ed3a05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var f; +f = function*({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; +}; + +f({}).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..b6977e4c47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var f; +f = function*({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; +}; + +f({}).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..0223524e4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-skipped.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function*({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; +}; + +f({ w: null, x: 0, y: false, z: '' }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..c12a1d6156 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error thrown when evaluating the initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function*({ x = thrower() }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..7a852e6d96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function*({ x = unresolvableReference }) {}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..b575ec7bf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-id-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function*({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; +}; + +f({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-list-err.js new file mode 100644 index 0000000000..fe21f2843f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-list-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var f = function*({ a, b = thrower(), c = ++initCount }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..075b5266f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({}).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..a6cf18c731 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function*({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; +}; + +f({ x: [45] }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..d9a65aa1af --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function*({ w: [x, y, z] = [4, 5, 6] }) {}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..f2102e670a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-ary.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: [7, undefined, ] }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..4d8fd6516e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-eval-err.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Evaluation of property name returns an abrupt completion (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function*({ [thrower()]: x }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..9d07da7e87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var f = function*({ poisoned: x = ++initEvalCount }) {}; + +assert.throws(Test262Error, function() { + f(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..f93fd8041a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var f; +f = function*({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; +}; + +f({ s: null, u: 0, w: false, y: '' }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..4f3d0b71be --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Error thrown when evaluating the initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var f = function*({ x: y = thrower() }) {}; + +assert.throws(Test262Error, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..4be3836c1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var f = function*({ x: y = unresolvableReference }) {}; + +assert.throws(ReferenceError, function() { + f({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..c4afd6d6bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-init.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Binding as specified via property name, identifier, and initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..eb9d159993 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var f; +f = function*({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id.js new file mode 100644 index 0000000000..7d73216285 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-id.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Binding as specified via property name and identifier (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var f; +f = function*({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; +}; + +f({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..7bf9c55b39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: undefined }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..92a0021c6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {}; + +assert.throws(TypeError, function() { + f({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..9016d033ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var f = function*({ w: { x, y, z } = undefined }) {}; + +assert.throws(TypeError, function() { + f({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..51ebd5d87e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-prop-obj.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var f; +f = function*({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; +}; + +f({ w: { x: undefined, z: 7 } }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..d89d1fb25c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-getter.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var f; +f = function*({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({ get v() { count++; return 2; } }).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..c35499afe6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest object doesn't contain non-enumerable properties (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var f; +f = function*({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; +}; + +f(o).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..1c76f7c863 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/dstr/obj-ptrn-rest-val-obj.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/gen-func-expr.template +/*--- +description: Rest object contains just unextracted data (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function*({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; +}; + +f({x: 1, y: 2, a: 5, b: 3}).next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/dstr/shell.js b/js/src/tests/test262/language/expressions/generators/dstr/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/eval-body-proto-realm.js b/js/src/tests/test262/language/expressions/generators/eval-body-proto-realm.js new file mode 100644 index 0000000000..7162532e50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/eval-body-proto-realm.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluatebody +es6id: 14.4.11 +description: > + Default [[Prototype]] value derived from realm of the generator function +info: | + 1. Let G be ? OrdinaryCreateFromConstructor(functionObject, + "%GeneratorPrototype%", « [[GeneratorState]], [[GeneratorContext]] »). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + [...] +features: [generators, cross-realm] +---*/ + +var other = $262.createRealm().global; +var g = other.eval('(0, function*() {})'); +var GeneratorPrototype = Object.getPrototypeOf(g.prototype); +g.prototype = null; +var instance; + +instance = g(); + +assert.sameValue(Object.getPrototypeOf(instance), GeneratorPrototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/generators/eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..5b8969e979 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/eval-var-scope-syntax-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/gen-func-expr.template +/*--- +description: sloppy direct eval in params introduces var (generator function expression in sloppy code) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [default-parameters, generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + +var callCount = 0; +var f; +f = function*(a = eval("var a = 42")) { + + callCount = callCount + 1; +}; + +assert.throws(SyntaxError, function() { + f(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..e0198fb5c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template +/*--- +description: Forbidden extension, f.arguments (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var f; +f = function*() { + assert.sameValue(f.hasOwnProperty("arguments"), false); + callCount++; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..feb896f644 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/gen-func-expr-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var f; +f = function*() { + assert.sameValue(f.hasOwnProperty("caller"), false); + callCount++; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..e141522a1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (generator function expression) +esid: sec-generator-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = function*() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + + callCount++; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..2c7935b7a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (generator function expression) +esid: sec-generator-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = function*() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + + callCount++; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..de24aa5f8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/gen-func-expr-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template +/*--- +description: Forbidden extension, o.caller (generator function expression) +esid: sec-generator-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var f; +f = function*() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, f); + } + + callCount++; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/generators/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/generator-created-after-decl-inst.js b/js/src/tests/test262/language/expressions/generators/generator-created-after-decl-inst.js new file mode 100644 index 0000000000..740eb2d243 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/generator-created-after-decl-inst.js @@ -0,0 +1,26 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluatebody +description: > + The generator object is created after FunctionDeclarationInstantiation. +info: | + 14.4.10 Runtime Semantics: EvaluateBody + + 1. Perform ? FunctionDeclarationInstantiation(functionObject, argumentsList). + 2. Let G be ? OrdinaryCreateFromConstructor(functionObject, "%GeneratorPrototype%", + « [[GeneratorState]], [[GeneratorContext]] »). + 3. Perform GeneratorStart(G, FunctionBody). + ... + +features: [generators] +---*/ + +var g = function*(a = (g.prototype = null)) {} +var oldPrototype = g.prototype; +var it = g(); + +assert.notSameValue(Object.getPrototypeOf(it), oldPrototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/has-instance.js b/js/src/tests/test262/language/expressions/generators/has-instance.js new file mode 100644 index 0000000000..3167c59026 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/has-instance.js @@ -0,0 +1,15 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + A Generator object is an instance of a generator function. +es6id: 25.3 +features: [generators] +---*/ + +var g = function*() {}; + +assert(g() instanceof g, 'Instance created via function invocation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/implicit-name.js b/js/src/tests/test262/language/expressions/generators/implicit-name.js new file mode 100644 index 0000000000..d7c3752b1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/implicit-name.js @@ -0,0 +1,22 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + Generator can be declared with GeneratorExpression syntax +es6id: 14.4 +author: Sam Mikes +description: can create generator function expressions (no name) +features: [generators] +---*/ + +var f = function *(a) { yield a+1; return; }; + +assert.sameValue(f.name, 'f'); + +var g = f(3); + +assert.sameValue(g.next().value, 4); +assert.sameValue(g.next().done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/invoke-as-constructor.js b/js/src/tests/test262/language/expressions/generators/invoke-as-constructor.js new file mode 100644 index 0000000000..d1f7f24879 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/invoke-as-constructor.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator expressions cannot be used as constructors. +es6id: 14.4 +features: [generators] +---*/ + +var g = function*(){}; + +assert.throws(TypeError, function() { + var instance = new g(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/length-dflt.js b/js/src/tests/test262/language/expressions/generators/length-dflt.js new file mode 100644 index 0000000000..cfa4064dc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/length-dflt.js @@ -0,0 +1,70 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [generators, default-parameters] +includes: [propertyHelper.js] +---*/ + + +var f1 = function* (x = 42) {}; + +verifyProperty(f1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f2 = function* (x = 42, y) {}; + +verifyProperty(f2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f3 = function* (x, y = 42) {}; + +verifyProperty(f3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var f4 = function* (x, y = 42, z) {}; + +verifyProperty(f4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/length-property-descriptor.js b/js/src/tests/test262/language/expressions/generators/length-property-descriptor.js new file mode 100644 index 0000000000..4310824377 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/length-property-descriptor.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator objects should define a `length` property. +includes: [propertyHelper.js] +es6id: 25.2.4 +features: [generators] +---*/ + +var g = function*() {}; + +verifyProperty(g, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/name.js b/js/src/tests/test262/language/expressions/generators/name.js new file mode 100644 index 0000000000..72e5c44be3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/name.js @@ -0,0 +1,39 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: Assignment of function `name` attribute +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + 1. Let scope be the LexicalEnvironment of the running execution context. + 2. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, ""). + ... + 6. Return closure. + + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + 1. Let scope be the running execution context's LexicalEnvironment. + 2. Let funcEnv be NewDeclarativeEnvironment(scope). + 3. Let envRec be funcEnv's EnvironmentRecord. + 4. Let name be StringValue of BindingIdentifier. + 5. Perform envRec.CreateImmutableBinding(name, false). + 6. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, funcEnv, name). + ... + 11. Return closure. +includes: [propertyHelper.js] +features: [generators] +---*/ + +verifyProperty(function*() {}, "name", { + value: "", writable: false, enumerable: false, configurable: true +}); + +verifyProperty(function* func() {}, "name", { + value: "func", writable: false, enumerable: false, configurable: true +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-arrow.js b/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-arrow.js new file mode 100644 index 0000000000..912d2ed2c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-arrow.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/gen-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in non-strict mode code) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function * BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +assert.sameValue(ref().next().value, ref); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-eval.js b/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-eval.js new file mode 100644 index 0000000000..8d60446726 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body-in-eval.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/gen-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in non-strict mode code) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function * BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +assert.sameValue(ref().next().value, ref); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body.js b/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body.js new file mode 100644 index 0000000000..98abcb882f --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-no-strict-reassign-fn-name-in-body.js @@ -0,0 +1,25 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/gen-func-expr-named-no-strict.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in non-strict mode code) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function * BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +assert.sameValue(ref().next().value, ref); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js b/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js new file mode 100644 index 0000000000..93b8ae9297 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-arrow-strict.js @@ -0,0 +1,30 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-arrow.case +// - src/function-forms/expr-named/gen-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in strict mode code) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, onlyStrict] +info: | + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function * BindingIdentifier() { + callCount++; + (() => { + BindingIdentifier = 1; + })(); + return BindingIdentifier; +}; + +assert.throws(TypeError, () => { + ref().next(); +}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js b/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js new file mode 100644 index 0000000000..9d20bb6237 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-in-eval-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body-in-eval.case +// - src/function-forms/expr-named/gen-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in strict mode code) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, onlyStrict] +info: | + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function * BindingIdentifier() { + callCount++; + eval("BindingIdentifier = 1"); + return BindingIdentifier; +}; + +assert.throws(TypeError, () => { + ref().next(); +}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-strict.js b/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-strict.js new file mode 100644 index 0000000000..bf12ac88ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-strict-error-reassign-fn-name-in-body-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// This file was procedurally generated from the following sources: +// - src/function-forms/reassign-fn-name-in-body.case +// - src/function-forms/expr-named/gen-func-expr-named-strict-error.template +/*--- +description: Reassignment of function name is silently ignored in non-strict mode code. (named generator function expression in strict mode code) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated, onlyStrict] +info: | + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + +---*/ + +// increment callCount in case "body" +let callCount = 0; +let ref = function * BindingIdentifier() { + callCount++; + BindingIdentifier = 1; + return BindingIdentifier; +}; + +assert.throws(TypeError, () => { + ref().next(); +}); +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..87c9871b1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier-escaped.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier-escaped.case +// - src/generators/syntax/expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *g() { + var yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier.js new file mode 100644 index 0000000000..86de56e8b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-as-binding-identifier.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier.case +// - src/generators/syntax/expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *g() { + var yield; +}; diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..010032dad4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference-escaped.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference-escaped.case +// - src/generators/syntax/expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *g() { + void yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference.js new file mode 100644 index 0000000000..186df1cc8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-as-identifier-reference.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference.case +// - src/generators/syntax/expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *g() { + void yield; +}; diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..eab9d8a034 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier-escaped.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier-escaped.case +// - src/generators/syntax/expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *g() { + yi\u0065ld: ; +}; diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier.js new file mode 100644 index 0000000000..f0d1001d49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-as-label-identifier.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier.case +// - src/generators/syntax/expression-named.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *g() { + yield: ; +}; diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-identifier-non-strict.js b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-non-strict.js new file mode 100644 index 0000000000..a19f04a13a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-non-strict.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-non-strict.case +// - src/generators/non-strict/expression-named.template +/*--- +description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator named expression - valid for non-strict only cases) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated, noStrict] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + +---*/ + +var callCount = 0; + +var gen = function *g() { + callCount += 1; + return (function(arg) { + var yield = arg + 1; + return yield; + }(yield)) +}; + +var iter = gen(); + +var item = iter.next(); + +assert.sameValue(item.done, false); +assert.sameValue(item.value, undefined); + +item = iter.next(42); + +assert.sameValue(item.done, true); +assert.sameValue(item.value, 43); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-non-strict.js new file mode 100644 index 0000000000..596b2bde71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-non-strict.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-non-strict.case +// - src/generators/non-strict/expression-named.template +/*--- +description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator named expression - valid for non-strict only cases) +esid: prod-GeneratorExpression +features: [Symbol, object-spread, generators] +flags: [generated, noStrict] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +var s = Symbol('s'); + +var callCount = 0; + +var gen = function *g() { + callCount += 1; + yield { + ...yield yield, + ...(function(arg) { + var yield = arg; + return {...yield}; + }(yield)), + ...yield, + } +}; + +var iter = gen(); + +var iter = gen(); + +iter.next(); +iter.next(); +iter.next({ x: 10, a: 0, b: 0, [s]: 1 }); +iter.next({ y: 20, a: 1, b: 1, [s]: 42 }); +var item = iter.next({ z: 30, b: 2 }); + +var value = item.value; + +assert.sameValue(item.done, false); +assert.sameValue(value.x, 10); +assert.sameValue(value.y, 20); +assert.sameValue(value.z, 30); +assert.sameValue(value.a, 1); +assert.sameValue(value.b, 2); +assert.sameValue(value[s], 42); +assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property"); +assert.sameValue(Object.keys(value).length, 5); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..c3177446bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-spread-strict-strict.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/expression-named.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Named generator expression) +esid: prod-GeneratorExpression +features: [object-spread, generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = function *g() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-strict-strict.js new file mode 100644 index 0000000000..3317d213da --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-identifier-strict-strict.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/expression-named.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = function *g() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-multiple.js new file mode 100644 index 0000000000..2b3bdbaa4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-multiple.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/expression-named.template +/*--- +description: Use yield value in a array spread position (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +includes: [compareArray.js] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + +var callCount = 0; + +var gen = function *g() { + callCount += 1; + yield [...yield yield]; +}; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-single.js new file mode 100644 index 0000000000..6009116c72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-spread-arr-single.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/expression-named.template +/*--- +description: Use yield value in a array spread position (Named generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] +---*/ +var arr = ['a', 'b', 'c']; + +var callCount = 0; + +var gen = function *g() { + callCount += 1; + yield [...yield]; +}; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/named-yield-spread-obj.js b/js/src/tests/test262/language/expressions/generators/named-yield-spread-obj.js new file mode 100644 index 0000000000..aa58d44a2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/named-yield-spread-obj.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/expression-named.template +/*--- +description: Use yield value in a object spread position (Named generator expression) +esid: prod-GeneratorExpression +features: [object-spread, generators] +flags: [generated] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + +var callCount = 0; + +var gen = function *g() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; +}; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/no-name.js b/js/src/tests/test262/language/expressions/generators/no-name.js new file mode 100644 index 0000000000..34d7e0b10e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/no-name.js @@ -0,0 +1,23 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + Generator can be declared with GeneratorExpression syntax +es6id: 14.4 +author: Sam Mikes +description: can create generator function expressions (no name) +features: [generators] +---*/ + +var a = [function *(a) { yield a+1; return; }]; +var f = a[0]; + +assert.sameValue(f.name, ''); + +var g = f(3); + +assert.sameValue(g.next().value, 4); +assert.sameValue(g.next().done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/no-yield.js b/js/src/tests/test262/language/expressions/generators/no-yield.js new file mode 100644 index 0000000000..ec30a1501e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/no-yield.js @@ -0,0 +1,20 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generators declared with GeneratorExpression syntax do not require a + `yield` expression. +es6id: 14.4 +features: [generators] +---*/ + +var result; +var foo = function*(a) {}; + +result = foo(3).next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/generators/object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..5c24fda861 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/object-destructuring-param-strict-body.js @@ -0,0 +1,134 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/gen-func-expr.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, function*({property}) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/generators/param-dflt-yield.js b/js/src/tests/test262/language/expressions/generators/param-dflt-yield.js new file mode 100644 index 0000000000..5e3dc67642 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/param-dflt-yield.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression cannot be used within the FormalParameters of a generator + function +info: | + GeneratorExpression : + + function * BindingIdentifier[Yield]opt ( FormalParameters[Yield] ) { GeneratorBody } + + YieldExpression cannot be used within the FormalParameters of a generator + function because any expressions that are part of FormalParameters are + evaluated before the resulting generator object is in a resumable state. +features: [generators, default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, function*(x = yield) {}; diff --git a/js/src/tests/test262/language/expressions/generators/params-dflt-args-unmapped.js b/js/src/tests/test262/language/expressions/generators/params-dflt-args-unmapped.js new file mode 100644 index 0000000000..9a76cfbe30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/params-dflt-args-unmapped.js @@ -0,0 +1,84 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [generators, default-parameters] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; +}; + +f().next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/params-dflt-ref-arguments.js b/js/src/tests/test262/language/expressions/generators/params-dflt-ref-arguments.js new file mode 100644 index 0000000000..cb0ddf5507 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/params-dflt-ref-arguments.js @@ -0,0 +1,63 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [generators, default-parameters] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var f; +f = function*(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; +}; + +f(undefined, undefined, 'third', 'fourth').next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/generators/params-trailing-comma-multiple.js new file mode 100644 index 0000000000..85216d808a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/params-trailing-comma-multiple.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/generators/params-trailing-comma-single.js new file mode 100644 index 0000000000..e8cd6ca25a --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/params-trailing-comma-single.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/prototype-own-properties.js b/js/src/tests/test262/language/expressions/generators/prototype-own-properties.js new file mode 100644 index 0000000000..f3a3c0f4c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/prototype-own-properties.js @@ -0,0 +1,14 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2.4.2 +description: > + The `prototype` property of GeneratorFunction instances are created as + plain objects with no "own" properties. +features: [generators] +---*/ + +var ownProperties = Object.getOwnPropertyNames(function*() {}.prototype); +assert.sameValue(ownProperties.length, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/prototype-property-descriptor.js b/js/src/tests/test262/language/expressions/generators/prototype-property-descriptor.js new file mode 100644 index 0000000000..0073e026de --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/prototype-property-descriptor.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator objects should define a `prototype` property. +includes: [propertyHelper.js] +es6id: 25.2.4 +features: [generators] +---*/ + +var g = function*() {}; + +verifyProperty(g, "prototype", { + writable: true, + enumerable: false, + configurable: false, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/prototype-relation-to-function.js b/js/src/tests/test262/language/expressions/generators/prototype-relation-to-function.js new file mode 100644 index 0000000000..3ff93f60ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/prototype-relation-to-function.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The value of the [[Prototype]] internal slot of the GeneratorFunction + prototype object is the FunctionPrototype intrinsic object. +es6id: 25.2.2.2 +features: [generators] +---*/ + +function f() {} +var g = function*() {}; + +assert.sameValue( + Object.getPrototypeOf(Object.getPrototypeOf(g)), + Object.getPrototypeOf(f) +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/prototype-typeof.js b/js/src/tests/test262/language/expressions/generators/prototype-typeof.js new file mode 100644 index 0000000000..6cb56f61d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/prototype-typeof.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2.4.2 +description: > + Whenever a GeneratorFunction instance is created another ordinary object is + also created and is the initial value of the generator function’s prototype + property. +features: [generators] +---*/ + +assert.sameValue(typeof function*() {}.prototype, 'object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/prototype-uniqueness.js b/js/src/tests/test262/language/expressions/generators/prototype-uniqueness.js new file mode 100644 index 0000000000..4a1b8c3c4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/prototype-uniqueness.js @@ -0,0 +1,16 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + GeneratorFunction instances are created with a unique prototype object. +es6id: 25.2.1 +features: [generators] +---*/ + +var g1 = function*() {}; +var g2 = function*() {}; + +assert(g1.prototype !== g2.prototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/prototype-value.js b/js/src/tests/test262/language/expressions/generators/prototype-value.js new file mode 100644 index 0000000000..2add152eb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/prototype-value.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator instances directly inherit properties from the object that is the + value of the prototype property of the Generator function that created the + instance. +es6id: 25.3 +features: [generators] +---*/ + +var g = function*() {}; + +assert.sameValue( + Object.getPrototypeOf(g()), + g.prototype, + 'Instance created via function invocation' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/rest-param-strict-body.js b/js/src/tests/test262/language/expressions/generators/rest-param-strict-body.js new file mode 100644 index 0000000000..55f0858baa --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/rest-param-strict-body.js @@ -0,0 +1,134 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/gen-func-expr.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, function*(a,...rest) { + "use strict"; +}; diff --git a/js/src/tests/test262/language/expressions/generators/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/generators/rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..c63f696307 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/rest-params-trailing-comma-early-error.js @@ -0,0 +1,60 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/gen-func-expr.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, function*(...a,) { + +}; diff --git a/js/src/tests/test262/language/expressions/generators/return.js b/js/src/tests/test262/language/expressions/generators/return.js new file mode 100644 index 0000000000..f16a9cf1cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/return.js @@ -0,0 +1,23 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `return` is a valid statement within generator function bodies. +es6id: 14.4 +features: [generators] +---*/ + +var result; +var g1 = function*() { return; }; +var g2 = function*() { return 1; }; + +result = g1().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +result = g2().next(); +assert.sameValue(result.value, 1); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-body-lex-distinct.js b/js/src/tests/test262/language/expressions/generators/scope-body-lex-distinct.js new file mode 100644 index 0000000000..92242f65d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-body-lex-distinct.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new lexical environment (distinct from the variable + environment) for the function body outside of strict mode +info: | + [...] + 29. If strict is false, then + a. Let lexEnv be NewDeclarativeEnvironment(varEnv). + b. NOTE: Non-strict functions use a separate lexical Environment Record + for top-level lexical declarations so that a direct eval can + determine whether any var scoped declarations introduced by the eval + code conflict with pre-existing top-level lexically scoped + declarations. This is not needed for strict functions because a + strict direct eval always places all declarations into a new + Environment Record. + [...] + + 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation + + [...] + 5. If strict is false, then + [...] + b. Let thisLex be lexEnv. + c. Assert: The following loop will terminate. + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + ii. NOTE: Annex B.3.5 defines alternate semantics for the + above step. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. +flags: [noStrict] +features: [generators, let] +---*/ + +var g = function*() { + let x; + eval('var x;'); +}; +var iter = g(); + +assert.throws(SyntaxError, function() { + iter.next(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-name-var-close.js b/js/src/tests/test262/language/expressions/generators/scope-name-var-close.js new file mode 100644 index 0000000000..de11e23dbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-name-var-close.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: Removal of variable environment for the BindingIdentifier +info: | + [...] + 2. Let scope be the running execution context's LexicalEnvironment. + 3. Let funcEnv be NewDeclarativeEnvironment(scope). + 4. Let envRec be funcEnv's EnvironmentRecord. + 5. Let name be StringValue of BindingIdentifier. + 6. Perform envRec.CreateImmutableBinding(name, false). + 7. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, funcEnv, strict). + [...] +features: [generators] +---*/ + +var probe; + +var func = function* g() { + probe = function() { return g; }; +}; +var g = 'outside'; + +func().next(); + +assert.sameValue(g, 'outside'); +assert.sameValue(probe(), func); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-name-var-open-non-strict.js b/js/src/tests/test262/language/expressions/generators/scope-name-var-open-non-strict.js new file mode 100644 index 0000000000..2f3e320953 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-name-var-open-non-strict.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + Creation of new variable environment for the BindingIdentifier + parameter +info: | + [...] + 2. Let scope be the running execution context's LexicalEnvironment. + 3. Let funcEnv be NewDeclarativeEnvironment(scope). + 4. Let envRec be funcEnv's EnvironmentRecord. + 5. Let name be StringValue of BindingIdentifier. + 6. Perform envRec.CreateImmutableBinding(name, false). + 7. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, funcEnv, strict). + [...] +flags: [noStrict] +features: [generators] +---*/ + +var g = 'outside'; +var probeBefore = function() { return g; }; +var setBefore = function() { g = null; }; +var probeParams, setParams, probeBody, setBody; + +var func = function* g( + _ = ( + probeParams = function() { return g; }, + setParams = function() { g = null; } + ) + ) { + probeBody = function() { return g; }; + setBody = function() { g = null; }; +}; + +func().next(); + +assert.sameValue(probeBefore(), 'outside'); +setBefore(); +assert.sameValue(probeBefore(), null); + +assert.sameValue(probeParams(), func, 'inner binding value (from parameters)'); +setParams(); +assert.sameValue( + probeParams(), func, 'inner binding is immutable (from parameters)' +); + +assert.sameValue(probeBody(), func, 'inner binding value (from body)'); +setBody(); +assert.sameValue(probeBody(), func, 'inner binding is immutable (from body)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-name-var-open-strict-strict.js b/js/src/tests/test262/language/expressions/generators/scope-name-var-open-strict-strict.js new file mode 100644 index 0000000000..53bdbd04d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-name-var-open-strict-strict.js @@ -0,0 +1,58 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + Creation of new variable environment for the BindingIdentifier + parameter +info: | + [...] + 2. Let scope be the running execution context's LexicalEnvironment. + 3. Let funcEnv be NewDeclarativeEnvironment(scope). + 4. Let envRec be funcEnv's EnvironmentRecord. + 5. Let name be StringValue of BindingIdentifier. + 6. Perform envRec.CreateImmutableBinding(name, false). + 7. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, funcEnv, strict). + [...] +flags: [onlyStrict] +features: [generators] +---*/ + +var g = 'outside'; +var probeBefore = function() { return g; }; +var setBefore = function() { g = null; }; +var probeParams, setParams, probeBody, setBody; + +var func = function* g( + _ = ( + probeParams = function() { return g; }, + setParams = function() { g = null; } + ) + ) { + probeBody = function() { return g; }; + setBody = function() { g = null; }; +}; + +func().next(); + +assert.sameValue(probeBefore(), 'outside'); +setBefore(); +assert.sameValue(probeBefore(), null); + +assert.sameValue(probeParams(), func, 'inner binding value (from parameters)'); +assert.throws( + TypeError, setParams, 'inner binding rejects modification (from parameters)' +); +assert.sameValue( + probeParams(), func, 'inner binding is immutable (from parameters)' +); + +assert.sameValue(probeBody(), func, 'inner binding value (from body)'); +assert.throws( + TypeError, setBody, 'inner binding rejects modification (from body)' +); +assert.sameValue(probeBody(), func, 'inner binding is immutable (from body)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-param-elem-var-close.js b/js/src/tests/test262/language/expressions/generators/scope-param-elem-var-close.js new file mode 100644 index 0000000000..a1efd3aeec --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-param-elem-var-close.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probe1, probe2, probeBody; + +(function*( + _ = (eval('var x = "inside";'), probe1 = function() { return x; }), + __ = probe2 = function() { return x; } + ) { + probeBody = function() { return x; }; +}()).next(); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-param-elem-var-open.js b/js/src/tests/test262/language/expressions/generators/scope-param-elem-var-open.js new file mode 100644 index 0000000000..c37ce004f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-param-elem-var-open.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probe1, probe2; + +(function*( + _ = probe1 = function() { return x; }, + __ = (eval('var x = "inside";'), probe2 = function() { return x; }) + ) { +}().next()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-close.js b/js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-close.js new file mode 100644 index 0000000000..0575cb1130 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-close.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probeParam, probeBody; + +(function*( + ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })] + ) { + probeBody = function() { return x; } +}().next()); + +assert.sameValue(probeParam(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-open.js b/js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-open.js new file mode 100644 index 0000000000..b7bf3a932b --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-param-rest-elem-var-open.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probe1, probe2; + +(function*( + _ = probe1 = function() { return x; }, + ...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })] + ) { +}().next()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-close.js new file mode 100644 index 0000000000..483dbff6aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-close.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var probe; + +// A parameter expression is necessary to trigger the creation of the scope +// under test. +(function*(_ = null) { + var x = 'inside'; + probe = function() { return x; }; +}().next()); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-open.js new file mode 100644 index 0000000000..ed694dbcc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/scope-paramsbody-var-open.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +(function*(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; +}().next()); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/shell.js b/js/src/tests/test262/language/expressions/generators/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/generators/static-init-await-binding.js b/js/src/tests/test262/language/expressions/generators/static-init-await-binding.js new file mode 100644 index 0000000000..f8777fd0e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/static-init-await-binding.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an Identifier within generator function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (function * await (await) {}); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/static-init-await-reference.js b/js/src/tests/test262/language/expressions/generators/static-init-await-reference.js new file mode 100644 index 0000000000..d31ca00b20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/static-init-await-reference.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an Identifier within generator function expressions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + (function * (x = fromParam = await) { + fromBody = await; + })().next(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/unscopables-with-in-nested-fn.js b/js/src/tests/test262/language/expressions/generators/unscopables-with-in-nested-fn.js new file mode 100644 index 0000000000..32bb4ec495 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/unscopables-with-in-nested-fn.js @@ -0,0 +1,105 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with-in-nested-fn.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [globalThis, Symbol.unscopables, generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(x) { + (function() { + count++; + with (globalThis) { + count++; + assert.sameValue(v, 1, 'The value of `v` is 1'); + } + })(); + (function() { + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + })(); + assert.sameValue(v, 1, 'The value of `v` is 1'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/unscopables-with.js b/js/src/tests/test262/language/expressions/generators/unscopables-with.js new file mode 100644 index 0000000000..8a2fc94bba --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/unscopables-with.js @@ -0,0 +1,99 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/unscopables-with.case +// - src/function-forms/default/gen-func-expr.template +/*--- +description: Symbol.unscopables behavior across scope boundaries (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +features: [globalThis, Symbol.unscopables, generators] +flags: [generated, noStrict] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + ... + Let envRec be lex's EnvironmentRecord. + Let exists be ? envRec.HasBinding(name). + + HasBinding + + ... + If the withEnvironment flag of envRec is false, return true. + Let unscopables be ? Get(bindings, @@unscopables). + If Type(unscopables) is Object, then + Let blocked be ToBoolean(? Get(unscopables, N)). + If blocked is true, return false. + + (The `with` Statement) Runtime Semantics: Evaluation + + ... + Set the withEnvironment flag of newEnv’s EnvironmentRecord to true. + ... + +---*/ +let count = 0; +var v = 1; +globalThis[Symbol.unscopables] = { + v: true, +}; + +{ + count++; + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(x) { + count++; + with (globalThis) { + count++; + assert.sameValue(v, undefined, 'The value of `v` is expected to equal `undefined`'); + } + count++; + var v = x; + with (globalThis) { + count++; + assert.sameValue(v, 10, 'The value of `v` is 10'); + v = 20; + } + assert.sameValue(v, 20, 'The value of `v` is 20'); + assert.sameValue(globalThis.v, 1, 'The value of globalThis.v is 1'); + callCount = callCount + 1; +}; + +ref(10).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + + count++; +} +assert.sameValue(count, 6, 'The value of `count` is 6'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/use-strict-with-non-simple-param.js b/js/src/tests/test262/language/expressions/generators/use-strict-with-non-simple-param.js new file mode 100644 index 0000000000..cc050aa63e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/use-strict-with-non-simple-param.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-generator-function-definitions-static-semantics-early-errors +description: > + A SyntaxError is thrown if a generator contains a non-simple parameter list and a UseStrict directive. +info: | + Static Semantics: Early Errors + + It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and IsSimpleParameterList of FormalParameters is false. +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +var f = function*(a = 0) { + "use strict"; +} diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..549138e659 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier-escaped.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier-escaped.case +// - src/generators/syntax/expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *() { + var yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier.js new file mode 100644 index 0000000000..a8bc34bbf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-binding-identifier.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier.case +// - src/generators/syntax/expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *() { + var yield; +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-function-expression-binding-identifier.js b/js/src/tests/test262/language/expressions/generators/yield-as-function-expression-binding-identifier.js new file mode 100644 index 0000000000..298f5807e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-function-expression-binding-identifier.js @@ -0,0 +1,23 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` may be used as the binding identifier of a function expression + within generator bodies. +es6id: 14.1 +flags: [noStrict] +features: [generators] +---*/ + +var result; +var g = function*() { + (function yield() {}); +}; + +result = g().next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-generator-expression-binding-identifier.js b/js/src/tests/test262/language/expressions/generators/yield-as-generator-expression-binding-identifier.js new file mode 100644 index 0000000000..4145deb828 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-generator-expression-binding-identifier.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` is not a valid BindingIdentifier for GeneratorExpressions. +es6id: 12.1.1 +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +var g = function* yield() {}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-identifier-in-nested-function.js b/js/src/tests/test262/language/expressions/generators/yield-as-identifier-in-nested-function.js new file mode 100644 index 0000000000..e7c621de11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-identifier-in-nested-function.js @@ -0,0 +1,24 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` is not a reserved keyword within normal function bodies declared + within generator function bodies. +es6id: 12.1.1 +flags: [noStrict] +features: [generators] +---*/ + +var result; +var g = function*() { + function h() { + yield = 1; + } +}; + +result = g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..9ad170619d --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference-escaped.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference-escaped.case +// - src/generators/syntax/expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *() { + void yi\u0065ld; +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference.js new file mode 100644 index 0000000000..37e9a13963 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-identifier-reference.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference.case +// - src/generators/syntax/expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *() { + void yield; +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/generators/yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..5c25acd7fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-label-identifier-escaped.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier-escaped.case +// - src/generators/syntax/expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *() { + yi\u0065ld: ; +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/generators/yield-as-label-identifier.js new file mode 100644 index 0000000000..430da1cdd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-label-identifier.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier.case +// - src/generators/syntax/expression.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var gen = function *() { + yield: ; +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-literal-property-name.js b/js/src/tests/test262/language/expressions/generators/yield-as-literal-property-name.js new file mode 100644 index 0000000000..7f196e9413 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-literal-property-name.js @@ -0,0 +1,21 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` may be used as a literal property name in an object literal + within generator function bodies. +es6id: 12.1.1 +features: [generators] +---*/ + +var result; +var g = function*() { + ({ get yield() { return 1 } }); +}; + +result = g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-logical-or-expression.js b/js/src/tests/test262/language/expressions/generators/yield-as-logical-or-expression.js new file mode 100644 index 0000000000..4612254f39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-logical-or-expression.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` expressions are not LogicalOrExpressions. +es6id: 12.1.1 +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + + +var g = function*() { + yield ? yield : yield; +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-parameter.js b/js/src/tests/test262/language/expressions/generators/yield-as-parameter.js new file mode 100644 index 0000000000..354507852c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-parameter.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` is a reserved keyword within generator function bodies and may + not be used as the binding identifier of a parameter. +es6id: 12.1.1 +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +var g = function*(yield) {}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-property-name.js b/js/src/tests/test262/language/expressions/generators/yield-as-property-name.js new file mode 100644 index 0000000000..b5a33bd0d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-property-name.js @@ -0,0 +1,21 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` may be used as a literal property name in an object literal + within generator function bodies. +es6id: 12.1.1 +features: [generators] +---*/ + +var result; +var g = function*() { + ({ yield: 1 }); +}; + +result = g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-statement.js b/js/src/tests/test262/language/expressions/generators/yield-as-statement.js new file mode 100644 index 0000000000..84c918dd39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-statement.js @@ -0,0 +1,47 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` is a valid statement within generator function bodies. +es6id: 14.4 +features: [generators] +---*/ + +var iter, result; +var g1 = function*() { yield; }; +var g2 = function*() { yield 1; }; + +iter = g1(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Without right-hand-side: first result `value`' +); +assert.sameValue( + result.done, false, 'Without right-hand-side: first result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Without right-hand-side: second result `value`' +); +assert.sameValue( + result.done, true, 'Without right-hand-eside: second result `done` flag' +); + +iter = g2(); +result = iter.next(); +assert.sameValue( + result.value, 1, 'With right-hand-side: first result `value`' +); +assert.sameValue( + result.done, false, 'With right-hand-side: first result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'With right-hand-side: second result `value`' +); +assert.sameValue( + result.done, true, 'With right-hand-eside: second result `done` flag' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-as-yield-operand.js b/js/src/tests/test262/language/expressions/generators/yield-as-yield-operand.js new file mode 100644 index 0000000000..373ea81f6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-as-yield-operand.js @@ -0,0 +1,31 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` expressions may be used as the right-hand-side of other `yield` + expressions. +es6id: 14.4 +features: [generators] +---*/ + +var iter, result; +var g = function*() { + yield yield 1; +}; + +iter = g(); + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Third result `value`'); +assert.sameValue(result.done, true, 'Thid result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-identifier-non-strict.js b/js/src/tests/test262/language/expressions/generators/yield-identifier-non-strict.js new file mode 100644 index 0000000000..cb9b776051 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-identifier-non-strict.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-non-strict.case +// - src/generators/non-strict/expression.template +/*--- +description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator expression - valid for non-strict only cases) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated, noStrict] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + +---*/ + +var callCount = 0; + +var gen = function *() { + callCount += 1; + return (function(arg) { + var yield = arg + 1; + return yield; + }(yield)) +}; + +var iter = gen(); + +var item = iter.next(); + +assert.sameValue(item.done, false); +assert.sameValue(item.value, undefined); + +item = iter.next(42); + +assert.sameValue(item.done, true); +assert.sameValue(item.value, 43); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/expressions/generators/yield-identifier-spread-non-strict.js new file mode 100644 index 0000000000..421e84b08d --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-identifier-spread-non-strict.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-non-strict.case +// - src/generators/non-strict/expression.template +/*--- +description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator expression - valid for non-strict only cases) +esid: prod-GeneratorExpression +features: [Symbol, object-spread, generators] +flags: [generated, noStrict] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +var s = Symbol('s'); + +var callCount = 0; + +var gen = function *() { + callCount += 1; + yield { + ...yield yield, + ...(function(arg) { + var yield = arg; + return {...yield}; + }(yield)), + ...yield, + } +}; + +var iter = gen(); + +var iter = gen(); + +iter.next(); +iter.next(); +iter.next({ x: 10, a: 0, b: 0, [s]: 1 }); +iter.next({ y: 20, a: 1, b: 1, [s]: 42 }); +var item = iter.next({ z: 30, b: 2 }); + +var value = item.value; + +assert.sameValue(item.done, false); +assert.sameValue(value.x, 10); +assert.sameValue(value.y, 20); +assert.sameValue(value.z, 30); +assert.sameValue(value.a, 1); +assert.sameValue(value.b, 2); +assert.sameValue(value[s], 42); +assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property"); +assert.sameValue(Object.keys(value).length, 5); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/generators/yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..5b37b6248e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-identifier-spread-strict-strict.js @@ -0,0 +1,46 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/expression.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [object-spread, generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = function *() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/generators/yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/generators/yield-identifier-strict-strict.js new file mode 100644 index 0000000000..6193f0d815 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-identifier-strict-strict.js @@ -0,0 +1,37 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/expression.template +/*--- +description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = function *() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) +}; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/generators/yield-newline.js b/js/src/tests/test262/language/expressions/generators/yield-newline.js new file mode 100644 index 0000000000..c257a1c54e --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-newline.js @@ -0,0 +1,27 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Newlines terminate `yield` expressions. +es6id: 14.4 +features: [generators] +---*/ + +var iter, result; +var g = function*() { + yield + 1 +}; + +iter = g(); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Second result `value`'); +assert.sameValue(result.done, true, 'Second result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/generators/yield-spread-arr-multiple.js new file mode 100644 index 0000000000..6e0f57d47c --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-spread-arr-multiple.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/expression.template +/*--- +description: Use yield value in a array spread position (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +includes: [compareArray.js] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + +var callCount = 0; + +var gen = function *() { + callCount += 1; + yield [...yield yield]; +}; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/generators/yield-spread-arr-single.js new file mode 100644 index 0000000000..41bcc723ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-spread-arr-single.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/expression.template +/*--- +description: Use yield value in a array spread position (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [generators] +flags: [generated] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] +---*/ +var arr = ['a', 'b', 'c']; + +var callCount = 0; + +var gen = function *() { + callCount += 1; + yield [...yield]; +}; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-spread-obj.js b/js/src/tests/test262/language/expressions/generators/yield-spread-obj.js new file mode 100644 index 0000000000..dec87332ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-spread-obj.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/expression.template +/*--- +description: Use yield value in a object spread position (Unnamed generator expression) +esid: prod-GeneratorExpression +features: [object-spread, generators] +flags: [generated] +info: | + 14.4 Generator Function Definitions + + GeneratorExpression: + function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + +var callCount = 0; + +var gen = function *() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; +}; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-star-after-newline.js b/js/src/tests/test262/language/expressions/generators/yield-star-after-newline.js new file mode 100644 index 0000000000..a6556ee700 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-star-after-newline.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + A newline may not precede the `*` token in a `yield` expression. +es6id: 14.4 +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +var g = function*() { + yield + * 1 +}; diff --git a/js/src/tests/test262/language/expressions/generators/yield-star-before-newline.js b/js/src/tests/test262/language/expressions/generators/yield-star-before-newline.js new file mode 100644 index 0000000000..abed9e0c90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-star-before-newline.js @@ -0,0 +1,22 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The right-hand side of a `yield *` expression may appear on a new line. +es6id: 14.4 +features: [generators] +---*/ + +var result; +var g = function*() { + yield * + g2(); +}; +var g2 = function*() {}; + +result = g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/generators/yield-weak-binding.js b/js/src/tests/test262/language/expressions/generators/yield-weak-binding.js new file mode 100644 index 0000000000..9a32e8d234 --- /dev/null +++ b/js/src/tests/test262/language/expressions/generators/yield-weak-binding.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` expressions bind weakly +es6id: 14.4 +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +var g = function*() { yield 3 + yield 4; }; diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A1.js new file mode 100644 index 0000000000..2e94294a61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between RelationalExpression and "=>" or + "=>" and ShiftExpression are allowed +es5id: 11.8.4_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009>=\u00091") !== true) { + throw new Test262Error('#1: (1\\u0009>=\\u00091) === true'); +} + +//CHECK#2 +if (eval("1\u000B>=\u000B1") !== true) { + throw new Test262Error('#2: (1\\u000B>=\\u000B1) === true'); +} + +//CHECK#3 +if (eval("1\u000C>=\u000C1") !== true) { + throw new Test262Error('#3: (1\\u000C>=\\u000C1) === true'); +} + +//CHECK#4 +if (eval("1\u0020>=\u00201") !== true) { + throw new Test262Error('#4: (1\\u0020>=\\u00201) === true'); +} + +//CHECK#5 +if (eval("1\u00A0>=\u00A01") !== true) { + throw new Test262Error('#5: (1\\u00A0>=\\u00A01) === true'); +} + +//CHECK#6 +if (eval("1\u000A>=\u000A1") !== true) { + throw new Test262Error('#6: (1\\u000A>=\\u000A1) === true'); +} + +//CHECK#7 +if (eval("1\u000D>=\u000D1") !== true) { + throw new Test262Error('#7: (1\\u000D>=\\u000D1) === true'); +} + +//CHECK#8 +if (eval("1\u2028>=\u20281") !== true) { + throw new Test262Error('#8: (1\\u2028>=\\u20281) === true'); +} + +//CHECK#9 +if (eval("1\u2029>=\u20291") !== true) { + throw new Test262Error('#9: (1\\u2029>=\\u20291) === true'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== true) { + throw new Test262Error('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T1.js new file mode 100644 index 0000000000..ae56ab8929 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >= y uses GetValue +es5id: 11.8.4_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 >= 1 !== true) { + throw new Test262Error('#1: 1 >= 1 === true'); +} + +//CHECK#2 +var x = 1; +if (x >= 1 !== true) { + throw new Test262Error('#2: var x = 1; x >= 1 === true'); +} + +//CHECK#3 +var y = 1; +if (1 >= y !== true) { + throw new Test262Error('#3: var y = 1; 1 >= y === true'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x >= y !== true) { + throw new Test262Error('#4: var x = 1; var y = 1; x >= y === true'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop >= objecty.prop !== true) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop >= objecty.prop === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T2.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T2.js new file mode 100644 index 0000000000..3709bbcf0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >= y uses GetValue +es5id: 11.8.4_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x >= 1; + throw new Test262Error('#1.1: x >= 1 throw ReferenceError. Actual: ' + (x >= 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T3.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T3.js new file mode 100644 index 0000000000..a15f94e755 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >= y uses GetValue +es5id: 11.8.4_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 >= y; + throw new Test262Error('#1.1: 1 >= y throw ReferenceError. Actual: ' + (1 >= y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 >= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.2_T1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.2_T1.js new file mode 100644 index 0000000000..46bc387917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >= y uses [[Default Value]] +es5id: 11.8.4_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 2}} >= 1 !== true) { + throw new Test262Error('#1: {valueOf: function() {return 1}} >= 1 === true. Actual: ' + ({valueOf: function() {return 1}} >= 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 2}, toString: function() {return 0}} >= 1 !== true) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 2}} >= 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 2}} >= 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 2}, toString: function() {return {}}} >= 1 !== true) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} >= 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} >= 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 2}, toString: function() {throw "error"}} >= 1 !== true) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} >= 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} >= 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 2}, toString: function() {throw "error"}} >= 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 2}, toString: function() {throw "error"}} >= 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 >= {toString: function() {return 0}} !== true) { + throw new Test262Error('#5: 1 >= {toString: function() {return 0}} === true. Actual: ' + (1 >= {toString: function() {return 0}})); +} + +//CHECK#6 +if (1 >= {valueOf: function() {return {}}, toString: function() {return 0}} !== true) { + throw new Test262Error('#6: 1 >= {valueOf: function() {return {}}, toString: function() {return 0}} === true. Actual: ' + (1 >= {valueOf: function() {return {}}, toString: function() {return 0}})); +} + +//CHECK#7 +try { + 1 >= {valueOf: function() {throw "error"}, toString: function() {return 0}}; + throw new Test262Error('#7.1: 1 >= {valueOf: function() {throw "error"}, toString: function() {return 0}} throw "error". Actual: ' + (1 >= {valueOf: function() {throw "error"}, toString: function() {return 0}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 >= {valueOf: function() {throw "error"}, toString: function() {return 0}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 >= {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 >= {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 >= {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 >= {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.3_T1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.3_T1.js new file mode 100644 index 0000000000..bbc6874fba --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.8.4_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x >= y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x >= y throw "x". Actual: ' + (x >= y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x >= y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T1.js new file mode 100644 index 0000000000..7eb0324b6f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.4_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 1; +if ((x = 0) >= x !== true) { + throw new Test262Error('#1: var x = 1; (x = 0) >= x === true'); +} + +//CHECK#2 +var x = 0; +if (x >= (x = 1) !== false) { + throw new Test262Error('#2: var x = 0; x >= (x = 1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T2.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T2.js new file mode 100644 index 0000000000..92c3a5b5a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.4_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() >= y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() >= y() throw "x". Actual: ' + (x() >= y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() >= y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T3.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T3.js new file mode 100644 index 0000000000..c2efff4c92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.4_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x >= (x = 1); + throw new Test262Error('#1.1: x >= (x = 1) throw ReferenceError. Actual: ' + (x >= (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >= (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T4.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T4.js new file mode 100644 index 0000000000..75dffdc7fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.4_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) >= y !== true) { + throw new Test262Error('#1: (y = 1) >= y === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.1.js new file mode 100644 index 0000000000..185cac51fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + boolean and Boolean object +---*/ + +//CHECK#1 +if (true >= true !== true) { + throw new Test262Error('#1: true >= true === true'); +} + +//CHECK#2 +if (new Boolean(true) >= true !== true) { + throw new Test262Error('#2: new Boolean(true) >= true === true'); +} + +//CHECK#3 +if (true >= new Boolean(true) !== true) { + throw new Test262Error('#3: true >= new Boolean(true) === true'); +} + +//CHECK#4 +if (new Boolean(true) >= new Boolean(true) !== true) { + throw new Test262Error('#4: new Boolean(true) >= new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.2.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.2.js new file mode 100644 index 0000000000..67628abf1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + number and Number object +---*/ + +//CHECK#1 +if (1 >= 1 !== true) { + throw new Test262Error('#1: 1 >= 1 === true'); +} + +//CHECK#2 +if (new Number(1) >= 1 !== true) { + throw new Test262Error('#2: new Number(1) >= 1 === true'); +} + +//CHECK#3 +if (1 >= new Number(1) !== true) { + throw new Test262Error('#3: 1 >= new Number(1) === true'); +} + +//CHECK#4 +if (new Number(1) >= new Number(1) !== true) { + throw new Test262Error('#4: new Number(1) >= new Number(1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.3.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.3.js new file mode 100644 index 0000000000..5bff1ff2d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T1.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T1.3 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Null and + Undefined +---*/ + +//CHECK#1 +if (null >= undefined !== false) { + throw new Test262Error('#1: null >= undefined === false'); +} + +//CHECK#2 +if (undefined >= null !== false) { + throw new Test262Error('#2: undefined >= null === false'); +} + +//CHECK#3 +if (undefined >= undefined !== false) { + throw new Test262Error('#3: undefined >= undefined === false'); +} + +//CHECK#4 +if (null >= null !== true) { + throw new Test262Error('#4: null >= null === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.1.js new file mode 100644 index 0000000000..ec275291f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.1 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true >= 1 !== true) { + throw new Test262Error('#1: true >= 1 === true'); +} + +//CHECK#2 +if (1 >= true !== true) { + throw new Test262Error('#2: 1 >= true === true'); +} + +//CHECK#3 +if (new Boolean(true) >= 1 !== true) { + throw new Test262Error('#3: new Boolean(true) >= 1 === true'); +} + +//CHECK#4 +if (1 >= new Boolean(true) !== true) { + throw new Test262Error('#4: 1 >= new Boolean(true) === true'); +} + +//CHECK#5 +if (true >= new Number(1) !== true) { + throw new Test262Error('#5: true >= new Number(1) === true'); +} + +//CHECK#6 +if (new Number(1) >= true !== true) { + throw new Test262Error('#6: new Number(1) >= true === true'); +} + +//CHECK#7 +if (new Boolean(true) >= new Number(1) !== true) { + throw new Test262Error('#7: new Boolean(true) >= new Number(1) === true'); +} + +//CHECK#8 +if (new Number(1) >= new Boolean(true) !== true) { + throw new Test262Error('#8: new Number(1) >= new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.2.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.2.js new file mode 100644 index 0000000000..36bc9016ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.2 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and String + (primitive and object) +---*/ + +//CHECK#1 +if ("1" >= 1 !== true) { + throw new Test262Error('#1: "1" >= 1 === true'); +} + +//CHECK#2 +if (1 >= "1" !== true) { + throw new Test262Error('#2: 1 >= "1" === true'); +} + +//CHECK#3 +if (new String("1") >= 1 !== true) { + throw new Test262Error('#3: new String("1") >= 1 === true'); +} + +//CHECK#4 +if (1 >= new String("1") !== true) { + throw new Test262Error('#4: 1 >= new String("1") === true'); +} + +//CHECK#5 +if ("1" >= new Number(1) !== true) { + throw new Test262Error('#5: "1" >= new Number(1) === true'); +} + +//CHECK#6 +if (new Number(1) >= "1" !== true) { + throw new Test262Error('#6: new Number(1) >= "1" === true'); +} + +//CHECK#7 +if (new String("1") >= new Number(1) !== true) { + throw new Test262Error('#7: new String("1") >= new Number(1) === true'); +} + +//CHECK#8 +if (new Number(1) >= new String("1") !== true) { + throw new Test262Error('#8: new Number(1) >= new String("1") === true'); +} + +//CHECK#9 +if ("x" >= 1 !== false) { + throw new Test262Error('#9: "x" >= 1 === false'); +} + +//CHECK#10 +if (1 >= "x" !== false) { + throw new Test262Error('#10: 1 >= "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.3.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.3.js new file mode 100644 index 0000000000..a8481c4c17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.3 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 >= null !== true) { + throw new Test262Error('#1: 1 >= null === true'); +} + +//CHECK#2 +if (null >= 1 !== false) { + throw new Test262Error('#2: null >= 1 === false'); +} + +//CHECK#3 +if (new Number(1) >= null !== true) { + throw new Test262Error('#3: new Number(1) >= null === true'); +} + +//CHECK#4 +if (null >= new Number(1) !== false) { + throw new Test262Error('#4: null >= new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.4.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.4.js new file mode 100644 index 0000000000..b4a791a87c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.4 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 >= undefined !== false) { + throw new Test262Error('#1: 1 >= undefined === false'); +} + +//CHECK#2 +if (undefined >= 1 !== false) { + throw new Test262Error('#2: undefined >= 1 === false'); +} + +//CHECK#3 +if (new Number(1) >= undefined !== false) { + throw new Test262Error('#3: new Number(1) >= undefined === false'); +} + +//CHECK#4 +if (undefined >= new Number(1) !== false) { + throw new Test262Error('#4: undefined >= new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.5.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.5.js new file mode 100644 index 0000000000..e83fd317c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.5.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.5 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true >= "1" !== true) { + throw new Test262Error('#1: true >= "1" === true'); +} + +//CHECK#2 +if ("1" >= true !== true) { + throw new Test262Error('#2: "1" >= true === true'); +} + +//CHECK#3 +if (new Boolean(true) >= "1" !== true) { + throw new Test262Error('#3: new Boolean(true) >= "1" === true'); +} + +//CHECK#4 +if ("1" >= new Boolean(true) !== true) { + throw new Test262Error('#4: "1" >= new Boolean(true) === true'); +} + +//CHECK#5 +if (true >= new String("1") !== true) { + throw new Test262Error('#5: true >= new String("1") === true'); +} + +//CHECK#6 +if (new String("1") >= true !== true) { + throw new Test262Error('#6: new String("1") >= true === true'); +} + +//CHECK#7 +if (new Boolean(true) >= new String("1") !== true) { + throw new Test262Error('#7: new Boolean(true) >= new String("1") === true'); +} + +//CHECK#8 +if (new String("1") >= new Boolean(true) !== true) { + throw new Test262Error('#8: new String("1") >= new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.6.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.6.js new file mode 100644 index 0000000000..0510751eea --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.6 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" >= undefined !== false) { + throw new Test262Error('#1: "1" >= undefined === false'); +} + +//CHECK#2 +if (undefined >= "1" !== false) { + throw new Test262Error('#2: undefined >= "1" === false'); +} + +//CHECK#3 +if (new String("1") >= undefined !== false) { + throw new Test262Error('#3: new String("1") >= undefined === false'); +} + +//CHECK#4 +if (undefined >= new String("1") !== false) { + throw new Test262Error('#4: undefined >= new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.7.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.7.js new file mode 100644 index 0000000000..756eb6dfb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.7.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.7 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" >= null !== true) { + throw new Test262Error('#1: "1" >= null === true'); +} + +//CHECK#2 +if (null >= "1" !== false) { + throw new Test262Error('#2: null >= "1" === false'); +} + +//CHECK#3 +if (new String("1") >= null !== true) { + throw new Test262Error('#3: new String("1") >= null === true'); +} + +//CHECK#4 +if (null >= new String("1") !== false) { + throw new Test262Error('#4: null >= new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.8.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.8.js new file mode 100644 index 0000000000..0b03ab1598 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.8 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true >= undefined !== false) { + throw new Test262Error('#1: true >= undefined === false'); +} + +//CHECK#2 +if (undefined >= true !== false) { + throw new Test262Error('#2: undefined >= true === false'); +} + +//CHECK#3 +if (new Boolean(true) >= undefined !== false) { + throw new Test262Error('#3: new Boolean(true) >= undefined === false'); +} + +//CHECK#4 +if (undefined >= new Boolean(true) !== false) { + throw new Test262Error('#4: undefined >= new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.9.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.9.js new file mode 100644 index 0000000000..54c69a751a --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.1_T2.9.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x >= y returns ToNumber(x) >= ToNumber(y) +es5id: 11.8.4_A3.1_T2.9 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true >= null !== true) { + throw new Test262Error('#1: true >= null === true'); +} + +//CHECK#2 +if (null >= true !== false) { + throw new Test262Error('#2: null >= true === false'); +} + +//CHECK#3 +if (new Boolean(true) >= null !== true) { + throw new Test262Error('#3: new Boolean(true) >= null === true'); +} + +//CHECK#4 +if (null >= new Boolean(true) !== false) { + throw new Test262Error('#4: null >= new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.1.js new file mode 100644 index 0000000000..d59ef44d17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x >= y returns ToString(x) >= ToString(y), if Type(Primitive(x)) + is String and Type(Primitive(y)) is String +es5id: 11.8.4_A3.2_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + string and String object +---*/ + +//CHECK#1 +if ("1" >= "1" !== true) { + throw new Test262Error('#1: "1" >= "1" === true'); +} + +//CHECK#2 +if (new String("1") >= "1" !== true) { + throw new Test262Error('#2: new String("1") >= "1" === true'); +} + +//CHECK#3 +if ("1" >= new String("1") !== true) { + throw new Test262Error('#3: "1" >= new String("1") === true'); +} + +//CHECK#4 +if (new String("1") >= new String("1") !== true) { + throw new Test262Error('#4: new String("1") >= new String("1") === true'); +} + +//CHECK#5 +if ("x" >= "1" !== true) { + throw new Test262Error('#5: "x" >= "1" === true'); +} + +//CHECK#6 +if ("1" >= "x" !== false) { + throw new Test262Error('#6: "1" >= "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.2.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.2.js new file mode 100644 index 0000000000..d5752b49d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A3.2_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x >= y returns ToString(x) >= ToString(y), if Type(Primitive(x)) + is String and Type(Primitive(y)) is String +es5id: 11.8.4_A3.2_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Object + object and Function object +---*/ + +//CHECK#1 +if (({} >= function(){return 1}) !== ({}.toString() >= function(){return 1}.toString())) { + throw new Test262Error('#1: ({} >= function(){return 1}) === ({}.toString() >= function(){return 1}.toString())'); +} + +//CHECK#2 +if ((function(){return 1} >= {}) !== (function(){return 1}.toString() >= {}.toString())) { + throw new Test262Error('#2: (function(){return 1} >= {}) === (function(){return 1}.toString() >= {}.toString())'); +} + +//CHECK#3 +if ((function(){return 1} >= function(){return 1}) !== (function(){return 1}.toString() >= function(){return 1}.toString())) { + throw new Test262Error('#3: (function(){return 1} >= function(){return 1}) === (function(){return 1}.toString() >= function(){return 1}.toString())'); +} + +//CHECK#4 +if (({} >= {}) !== ({}.toString() >= {}.toString())) { + throw new Test262Error('#4: ({} >= {}) === ({}.toString() >= {}.toString())'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.1.js new file mode 100644 index 0000000000..4c3006197f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.4_A4.1 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NaN >= 0) !== false) { + throw new Test262Error('#1: (NaN >= 0) === false'); +} + +//CHECK#2 +if ((Number.NaN >= 1.1) !== false) { + throw new Test262Error('#2: (NaN >= 1.1) === false'); +} + +//CHECK#3 +if ((Number.NaN >= -1.1) !== false) { + throw new Test262Error('#3: (NaN >= -1.1) === false'); +} + +//CHECK#4 +if ((Number.NaN >= Number.NaN) !== false) { + throw new Test262Error('#4: (NaN >= NaN) === false'); +} + +//CHECK#5 +if ((Number.NaN >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (NaN >= +Infinity) === false'); +} + +//CHECK#6 +if ((Number.NaN >= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#6: (NaN >= -Infinity) === false'); +} + +//CHECK#7 +if ((Number.NaN >= Number.MAX_VALUE) !== false) { + throw new Test262Error('#7: (NaN >= Number.MAX_VALUE) === false'); +} + +//CHECK#8 +if ((Number.NaN >= Number.MIN_VALUE) !== false) { + throw new Test262Error('#8: (NaN >= Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.10.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.10.js new file mode 100644 index 0000000000..a99d5c3f57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.10.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is a prefix of y and x !== y, return false +es5id: 11.8.4_A4.10 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" >= "x ") !== false) { + throw new Test262Error('#1: ("x" >= "x ") === false'); +} + +//CHECK#2 +if (("" >= "x") !== false) { + throw new Test262Error('#2: ("" >= "x") === false'); +} + +//CHECK#3 +if (("ab" >= "abcd") !== false) { + throw new Test262Error('#3: ("ab" >= abcd") === false'); +} + +//CHECK#4 +if (("abcd" >= "abc\u0064") !== true) { + throw new Test262Error('#4: ("abcd" >= abc\\u0064") === true'); +} + +//CHECK#5 +if (("x" >= "x" + "y") !== false) { + throw new Test262Error('#5: ("x" >= "x" + "y") === false'); +} + +//CHECK#6 +var x = "x"; +if ((x >= x + "y") !== false) { + throw new Test262Error('#6: var x = "x"; (x >= x + "y") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.11.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.11.js new file mode 100644 index 0000000000..5856986f7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.11.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is a prefix of x, return true +es5id: 11.8.4_A4.11 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" >= "x") !== true) { + throw new Test262Error('#1: ("x" >= "x") === true'); +} + +//CHECK#2 +if (("x" >= "") !== true) { + throw new Test262Error('#2: ("x" >= "") === true'); +} + +//CHECK#3 +if (("abcd" >= "ab") !== true) { + throw new Test262Error('#3: ("abcd" >= ab") === true'); +} + +//CHECK#4 +if (("abc\u0064" >= "abcd") !== true) { + throw new Test262Error('#4: ("abc\\u0064" >= abc") === true'); +} + +//CHECK#5 +if (("x" + "y" >= "x") !== true) { + throw new Test262Error('#5: ("x" + "y" >= "x") === true'); +} + +//CHECK#6 +var x = "x"; +if ((x + 'y' >= x) !== true) { + throw new Test262Error('#6: var x = "x"; (x + "y" >= x) === true'); +} + +//CHECK#7 +if (("a\u0000a" >= "a\u0000") !== true) { + throw new Test262Error('#7: ("a\\u0000a" >= "a\\u0000") === true'); +} + +//CHECK#8 +if ((" x" >= "x") !== false) { + throw new Test262Error('#8: (" x" >= "x") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T1.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T1.js new file mode 100644 index 0000000000..ba1a6ea0b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T1.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.4_A4.12_T1 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("xy" >= "xx") !== true) { + throw new Test262Error('#1: ("xy" >= "xx") === true'); +} + +//CHECK#2 +if (("xx" >= "xy") !== false) { + throw new Test262Error('#2: ("xx" >= "xy") === false'); +} + +//CHECK#3 +if (("y" >= "x") !== true) { + throw new Test262Error('#3: ("y" >= "x") === true'); +} + +//CHECK#4 +if (("aba" >= "aab") !== true) { + throw new Test262Error('#4: ("aba" >= aab") === true'); +} + +//CHECK#5 +if (("\u0061\u0061\u0061\u0061" >= "\u0061\u0061\u0061\u0062") !== false) { + throw new Test262Error('#5: ("\\u0061\\u0061\\u0061\\u0061" >= \\u0061\\u0061\\u0061\\u0062") === false'); +} + +//CHECK#6 +if (("a\u0000b" >= "a\u0000a") !== true) { + throw new Test262Error('#6: ("a\\u0000b" >= "a\\u0000a") === true'); +} + +//CHECK#7 +if (("aa" >= "aB") !== true) { + throw new Test262Error('#7: ("aa" >= aB") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T2.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T2.js new file mode 100644 index 0000000000..42811e9812 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.12_T2.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.4_A4.12_T2 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" >= "0") !== true) { + throw new Test262Error('#1: ("x" >= "0") !== true'); +} + +//CHECK#2 +if (("0" >= "-") !== true) { + throw new Test262Error('#2: ("0" >= "-") !== true'); +} + +//CHECK#3 +if (("0" >= ".") !== true) { + throw new Test262Error('#3: ("0" >= ".") !== true'); +} + +//CHECK#4 +if (("-" >= "+") !== true) { + throw new Test262Error('#4: ("-" >= "+") !== true'); +} + +//CHECK#5 +if (("-1" >= "-0") !== true) { + throw new Test262Error('#5: ("-1" >= "-0") !== true'); +} + +//CHECK#6 +if (("-1" >= "+1") !== true) { + throw new Test262Error('#6: ("-1" >= "+1") !== true'); +} + +//CHECK#7 +if (("1e-10" >= "1") !== true) { +throw new Test262Error('#7: ("1e-10" >= "1") !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.2.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.2.js new file mode 100644 index 0000000000..2d5595b7af --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.4_A4.2 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 >= Number.NaN) !== false) { + throw new Test262Error('#1: (0 >= NaN) === false'); +} + +//CHECK#2 +if ((1.1 >= Number.NaN) !== false) { + throw new Test262Error('#2: (1.1 >= NaN) === false'); +} + +//CHECK#3 +if ((-1.1 >= Number.NaN) !== false) { + throw new Test262Error('#3: (-1.1 >= NaN) === false'); +} + +//CHECK#4 +if ((Number.NaN >= Number.NaN) !== false) { + throw new Test262Error('#4: (NaN >= NaN) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY >= Number.NaN) !== false) { + throw new Test262Error('#5: (+Infinity >= NaN) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY >= Number.NaN) !== false) { + throw new Test262Error('#6: (-Infinity >= NaN) === false'); +} + +//CHECK#7 +if ((Number.MAX_VALUE >= Number.NaN) !== false) { + throw new Test262Error('#7: (Number.MAX_VALUE >= NaN) === false'); +} + +//CHECK#8 +if ((Number.MIN_VALUE >= Number.NaN) !== false) { + throw new Test262Error('#8: (Number.MIN_VALUE >= NaN) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.3.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.3.js new file mode 100644 index 0000000000..de2f9e0ad6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x and y are the same number value, return true +es5id: 11.8.4_A4.3 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 >= 1) !== true) { + throw new Test262Error('#1: (1 >= 1) === true'); +} + +//CHECK#2 +if ((1.1 >= 1.1) !== true) { + throw new Test262Error('#2: (1.1 >= 1.1) === true'); +} + +//CHECK#3 +if ((-1.1 >= -1.1) !== true) { + throw new Test262Error('#3: (-1.1 >= -1.1) === true'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (-Infinity >= -Infinity) === true'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#5: (+Infinity >= +Infinity) === true'); +} + +//CHECK#6 +if ((Number.MAX_VALUE >= Number.MAX_VALUE) !== true) { + throw new Test262Error('#6: (Number.MAX_VALUE >= Number.MAX_VALUE) === true'); +} + +//CHECK#7 +if ((Number.MIN_VALUE >= Number.MIN_VALUE) !== true) { + throw new Test262Error('#7: (Number.MIN_VALUE >= Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.4.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.4.js new file mode 100644 index 0000000000..6548dbaa4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If either x or y is +0 and the other is -0, return true +es5id: 11.8.4_A4.4 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((0 >= 0) !== true) { + throw new Test262Error('#1: (0 >= 0) === true'); +} + +//CHECK#2 +if ((-0 >= -0) !== true) { + throw new Test262Error('#2: (-0 >= -0) === true'); +} + +//CHECK#3 +if ((+0 >= -0) !== true) { + throw new Test262Error('#3: (+0 >= -0) === true'); +} + +//CHECK#4 +if ((-0 >= +0) !== true) { + throw new Test262Error('#4: (-0 >= +0) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.5.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.5.js new file mode 100644 index 0000000000..942f811e9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.5.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +Infinity, return true +es5id: 11.8.4_A4.5 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY >= 0) !== true) { + throw new Test262Error('#1: (+Infinity >= 0) === true'); +} + +//CHECK#2 +if ((Number.POSITIVE_INFINITY >= 1.1) !== true) { + throw new Test262Error('#2: (+Infinity >= 1.1) === true'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY >= -1.1) !== true) { + throw new Test262Error('#3: (+Infinity >= -1.1) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (+Infinity >= -Infinity) === true'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY >= Number.MAX_VALUE) !== true) { + throw new Test262Error('#5: (+Infinity >= Number.MAX_VALUE) === true'); +} + +//CHECK#6 +if ((Number.POSITIVE_INFINITY >= Number.MIN_VALUE) !== true) { + throw new Test262Error('#6: (+Infinity >= Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.6.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.6.js new file mode 100644 index 0000000000..66a6ccbe3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.6.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is +Infinity and x !== y, return false +es5id: 11.8.4_A4.6 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#1: (0 >= +Infinity) === false'); +} + +//CHECK#2 +if ((1.1 >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#2: (1.1 >= +Infinity) === false'); +} + +//CHECK#3 +if ((-1.1 >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#3: (-1.1 >= +Infinity) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity >= +Infinity) === false'); +} + +//CHECK#5 +if ((Number.MAX_VALUE >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (Number.MAX_VALUE >= +Infinity) === false'); +} + +//CHECK#6 +if ((Number.MIN_VALUE >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#6: (Number.MIN_VALUE >= +Infinity) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.7.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.7.js new file mode 100644 index 0000000000..e76fd5be80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.7.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity and x !== y, return false +es5id: 11.8.4_A4.7 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NEGATIVE_INFINITY >= 0) !== false) { + throw new Test262Error('#1: (-Infinity >= 0) === false'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY >= 1.1) !== false) { + throw new Test262Error('#2: (-Infinity >= 1.1) === false'); +} + +//CHECK#3 +if ((Number.NEGATIVE_INFINITY >= -1.1) !== false) { + throw new Test262Error('#3: (-Infinity >= -1.1) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY >= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity >= +Infinity) === false'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY >= Number.MAX_VALUE) !== false) { + throw new Test262Error('#5: (-Infinity >= Number.MAX_VALUE) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY >= Number.MIN_VALUE) !== false) { + throw new Test262Error('#6: (-Infinity >= Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.8.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.8.js new file mode 100644 index 0000000000..64ee2a09ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.8.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is -Infinity, return true +es5id: 11.8.4_A4.8 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#1: (0 >= -Infinity) === true'); +} + +//CHECK#2 +if ((1.1 >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#2: (1.1 >= -Infinity) === true'); +} + +//CHECK#3 +if ((-1.1 >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#3: (-1.1 >= -Infinity) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (+Infinity >= -Infinity) === true'); +} + +//CHECK#5 +if ((Number.MAX_VALUE >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: (Number.MAX_VALUE >= -Infinity) === true'); +} + +//CHECK#6 +if ((Number.MIN_VALUE >= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#6: (Number.MIN_VALUE >= -Infinity) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.9.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.9.js new file mode 100644 index 0000000000..3d7bfb50a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/S11.8.4_A4.9.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If x is greater or equal than y and these values are both finite + non-zero, return true; otherwise, return false +es5id: 11.8.4_A4.9 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 >= 1.1) !== false) { + throw new Test262Error('#1: (1 >= 1.1) === false'); +} + +//CHECK#2 +if ((1.1 >= 1) !== true) { + throw new Test262Error('#2: (1.1 >= 1) === true'); +} + +//CHECK#3 +if ((-1 >= -1.1) !== true) { + throw new Test262Error('#3: (-1 >= -1.1) === true'); +} + +//CHECK#4 +if ((-1.1 >= -1) !== false) { + throw new Test262Error('#4: (-1.1 >= -1) === false'); +} + +//CHECK#5 +if ((0.1 >= 0) !== true) { + throw new Test262Error('#5: (0.1 >= 0) === true'); +} + +//CHECK#6 +if ((0 >= -0.1) !== true) { + throw new Test262Error('#6: (0 >= -0.1) === true'); +} + +//CHECK#7 +if ((Number.MAX_VALUE >= Number.MAX_VALUE/2) !== true) { + throw new Test262Error('#7: (Number.MAX_VALUE >= Number.MAX_VALUE/2) === true'); +} + +//CHECK#8 +if ((Number.MIN_VALUE*2 >= Number.MIN_VALUE) !== true) { + throw new Test262Error('#8: (Number.MIN_VALUE*2 >= Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-bigint.js new file mode 100644 index 0000000000..bdd785f160 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-bigint.js @@ -0,0 +1,166 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and BigInt values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + + sec-numeric-types-bigint-lessThan + BigInt::lessThan (x, y) + + The abstract operation BigInt::lessThan with two arguments x and y of BigInt type returns true if x is less than y and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n >= 0n, true, 'The result of (0n >= 0n) is true'); +assert.sameValue(1n >= 1n, true, 'The result of (1n >= 1n) is true'); +assert.sameValue(-1n >= -1n, true, 'The result of (-1n >= -1n) is true'); +assert.sameValue(0n >= -0n, true, 'The result of (0n >= -0n) is true'); +assert.sameValue(-0n >= 0n, true, 'The result of (-0n >= 0n) is true'); +assert.sameValue(0n >= 1n, false, 'The result of (0n >= 1n) is false'); +assert.sameValue(1n >= 0n, true, 'The result of (1n >= 0n) is true'); +assert.sameValue(0n >= -1n, true, 'The result of (0n >= -1n) is true'); +assert.sameValue(-1n >= 0n, false, 'The result of (-1n >= 0n) is false'); +assert.sameValue(1n >= -1n, true, 'The result of (1n >= -1n) is true'); +assert.sameValue(-1n >= 1n, false, 'The result of (-1n >= 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n >= 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n >= 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n >= 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n >= 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n >= -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n >= -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n >= -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n >= -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n >= 0n, + true, + 'The result of (0x10000000000000000n >= 0n) is true' +); + +assert.sameValue( + 0n >= 0x10000000000000000n, + false, + 'The result of (0n >= 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n >= 1n, + true, + 'The result of (0x10000000000000000n >= 1n) is true' +); + +assert.sameValue( + 1n >= 0x10000000000000000n, + false, + 'The result of (1n >= 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n >= -1n, + true, + 'The result of (0x10000000000000000n >= -1n) is true' +); + +assert.sameValue( + -1n >= 0x10000000000000000n, + false, + 'The result of (-1n >= 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n >= 0n, + true, + 'The result of (0x10000000000000001n >= 0n) is true' +); + +assert.sameValue( + 0n >= 0x10000000000000001n, + false, + 'The result of (0n >= 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n >= 0n, + false, + 'The result of (-0x10000000000000000n >= 0n) is false' +); + +assert.sameValue( + 0n >= -0x10000000000000000n, + true, + 'The result of (0n >= -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n >= 1n, + false, + 'The result of (-0x10000000000000000n >= 1n) is false' +); + +assert.sameValue( + 1n >= -0x10000000000000000n, + true, + 'The result of (1n >= -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n >= -1n, + false, + 'The result of (-0x10000000000000000n >= -1n) is false' +); + +assert.sameValue( + -1n >= -0x10000000000000000n, + true, + 'The result of (-1n >= -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n >= 0n, + false, + 'The result of (-0x10000000000000001n >= 0n) is false' +); + +assert.sameValue( + 0n >= -0x10000000000000001n, + true, + 'The result of (0n >= -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n >= 0x100000000n, + true, + 'The result of (0x10000000000000000n >= 0x100000000n) is true' +); + +assert.sameValue( + 0x100000000n >= 0x10000000000000000n, + false, + 'The result of (0x100000000n >= 0x10000000000000000n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js new file mode 100644 index 0000000000..9b6cea7fe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-incomparable-string.js @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(1n >= '0n', false, 'The result of (1n >= "0n") is false'); +assert.sameValue(1n >= '0.', false, 'The result of (1n >= "0.") is false'); +assert.sameValue(1n >= '.0', false, 'The result of (1n >= ".0") is false'); +assert.sameValue(1n >= '0/1', false, 'The result of (1n >= "0/1") is false'); +assert.sameValue(1n >= 'z0', false, 'The result of (1n >= "z0") is false'); +assert.sameValue(1n >= '0z', false, 'The result of (1n >= "0z") is false'); +assert.sameValue(1n >= '++0', false, 'The result of (1n >= "++0") is false'); +assert.sameValue(1n >= '--0', false, 'The result of (1n >= "--0") is false'); +assert.sameValue(1n >= '0e0', false, 'The result of (1n >= "0e0") is false'); +assert.sameValue(1n >= 'Infinity', false, 'The result of (1n >= "Infinity") is false'); +assert.sameValue('1n' >= 0n, false, 'The result of ("1n" >= 0n) is false'); +assert.sameValue('1.' >= 0n, false, 'The result of ("1." >= 0n) is false'); +assert.sameValue('.1' >= 0n, false, 'The result of (".1" >= 0n) is false'); +assert.sameValue('1/1' >= 0n, false, 'The result of ("1/1" >= 0n) is false'); +assert.sameValue('z1' >= 0n, false, 'The result of ("z1" >= 0n) is false'); +assert.sameValue('1z' >= 0n, false, 'The result of ("1z" >= 0n) is false'); +assert.sameValue('++1' >= 0n, false, 'The result of ("++1" >= 0n) is false'); +assert.sameValue('--1' >= 0n, false, 'The result of ("--1" >= 0n) is false'); +assert.sameValue('1e0' >= 0n, false, 'The result of ("1e0" >= 0n) is false'); +assert.sameValue('Infinity' >= 0n, false, 'The result of ("Infinity" >= 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-non-finite.js new file mode 100644 index 0000000000..2469d0fd09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and non-finite Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. +features: [BigInt] +---*/ +assert.sameValue(1n >= Infinity, false, 'The result of (1n >= Infinity) is false'); +assert.sameValue(Infinity >= 1n, true, 'The result of (Infinity >= 1n) is true'); +assert.sameValue(-1n >= Infinity, false, 'The result of (-1n >= Infinity) is false'); +assert.sameValue(Infinity >= -1n, true, 'The result of (Infinity >= -1n) is true'); +assert.sameValue(1n >= -Infinity, true, 'The result of (1n >= -Infinity) is true'); +assert.sameValue(-Infinity >= 1n, false, 'The result of (-Infinity >= 1n) is false'); +assert.sameValue(-1n >= -Infinity, true, 'The result of (-1n >= -Infinity) is true'); +assert.sameValue(-Infinity >= -1n, false, 'The result of (-Infinity >= -1n) is false'); +assert.sameValue(0n >= NaN, false, 'The result of (0n >= NaN) is false'); +assert.sameValue(NaN >= 0n, false, 'The result of (NaN >= 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js new file mode 100644 index 0000000000..fc6ae0f92c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number-extremes.js @@ -0,0 +1,55 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of large BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(1n >= Number.MAX_VALUE, false, 'The result of (1n >= Number.MAX_VALUE) is false'); +assert.sameValue(Number.MAX_VALUE >= 1n, true, 'The result of (Number.MAX_VALUE >= 1n) is true'); +assert.sameValue(1n >= -Number.MAX_VALUE, true, 'The result of (1n >= -Number.MAX_VALUE) is true'); + +assert.sameValue( + -Number.MAX_VALUE >= 1n, + false, + 'The result of (-Number.MAX_VALUE >= 1n) is false' +); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn >= Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn >= Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE >= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + true, + 'The result of (Number.MAX_VALUE >= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n >= Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n >= Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE >= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + false, + 'The result of (Number.MAX_VALUE >= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number.js new file mode 100644 index 0000000000..c03309ba6e --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-number.js @@ -0,0 +1,57 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(0n >= 0, true, 'The result of (0n >= 0) is true'); +assert.sameValue(0 >= 0n, true, 'The result of (0 >= 0n) is true'); +assert.sameValue(0n >= -0, true, 'The result of (0n >= -0) is true'); +assert.sameValue(-0 >= 0n, true, 'The result of (-0 >= 0n) is true'); +assert.sameValue(0n >= 0.000000000001, false, 'The result of (0n >= 0.000000000001) is false'); +assert.sameValue(0.000000000001 >= 0n, true, 'The result of (0.000000000001 >= 0n) is true'); +assert.sameValue(0n >= 1, false, 'The result of (0n >= 1) is false'); +assert.sameValue(1 >= 0n, true, 'The result of (1 >= 0n) is true'); +assert.sameValue(1n >= 0, true, 'The result of (1n >= 0) is true'); +assert.sameValue(0 >= 1n, false, 'The result of (0 >= 1n) is false'); +assert.sameValue(1n >= 0.999999999999, true, 'The result of (1n >= 0.999999999999) is true'); +assert.sameValue(0.999999999999 >= 1n, false, 'The result of (0.999999999999 >= 1n) is false'); +assert.sameValue(1n >= 1, true, 'The result of (1n >= 1) is true'); +assert.sameValue(1 >= 1n, true, 'The result of (1 >= 1n) is true'); +assert.sameValue(0n >= Number.MIN_VALUE, false, 'The result of (0n >= Number.MIN_VALUE) is false'); +assert.sameValue(Number.MIN_VALUE >= 0n, true, 'The result of (Number.MIN_VALUE >= 0n) is true'); +assert.sameValue(0n >= -Number.MIN_VALUE, true, 'The result of (0n >= -Number.MIN_VALUE) is true'); + +assert.sameValue( + -Number.MIN_VALUE >= 0n, + false, + 'The result of (-Number.MIN_VALUE >= 0n) is false' +); + +assert.sameValue( + -10n >= Number.MIN_VALUE, + false, + 'The result of (-10n >= Number.MIN_VALUE) is false' +); + +assert.sameValue( + Number.MIN_VALUE >= -10n, + true, + 'The result of (Number.MIN_VALUE >= -10n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-string.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-string.js new file mode 100644 index 0000000000..2d9f4142b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than-or-equal/bigint-and-string.js @@ -0,0 +1,53 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n >= '0', true, 'The result of (0n >= "0") is true'); +assert.sameValue('0' >= 0n, true, 'The result of ("0" >= 0n) is true'); +assert.sameValue(0n >= '1', false, 'The result of (0n >= "1") is false'); +assert.sameValue('0' >= 1n, false, 'The result of ("0" >= 1n) is false'); +assert.sameValue(1n >= '0', true, 'The result of (1n >= "0") is true'); +assert.sameValue('1' >= 0n, true, 'The result of ("1" >= 0n) is true'); +assert.sameValue(0n >= '', true, 'The result of (0n >= "") is true'); +assert.sameValue('' >= 0n, true, 'The result of ("" >= 0n) is true'); +assert.sameValue(0n >= '1', false, 'The result of (0n >= "1") is false'); +assert.sameValue('' >= 1n, false, 'The result of ("" >= 1n) is false'); +assert.sameValue(1n >= '', true, 'The result of (1n >= "") is true'); +assert.sameValue('1' >= 0n, true, 'The result of ("1" >= 0n) is true'); +assert.sameValue(1n >= '1', true, 'The result of (1n >= "1") is true'); +assert.sameValue('1' >= 1n, true, 'The result of ("1" >= 1n) is true'); +assert.sameValue(1n >= '-1', true, 'The result of (1n >= "-1") is true'); +assert.sameValue('1' >= -1n, true, 'The result of ("1" >= -1n) is true'); +assert.sameValue(-1n >= '1', false, 'The result of (-1n >= "1") is false'); +assert.sameValue('-1' >= 1n, false, 'The result of ("-1" >= 1n) is false'); +assert.sameValue(-1n >= '-1', true, 'The result of (-1n >= "-1") is true'); +assert.sameValue('-1' >= -1n, true, 'The result of ("-1" >= -1n) is true'); + +assert.sameValue( + 9007199254740993n >= '9007199254740992', + true, + 'The result of (9007199254740993n >= "9007199254740992") is true' +); + +assert.sameValue( + '9007199254740993' >= 9007199254740992n, + true, + 'The result of ("9007199254740993" >= 9007199254740992n) is true' +); + +assert.sameValue( + -9007199254740992n >= '-9007199254740993', + true, + 'The result of (-9007199254740992n >= "-9007199254740993") is true' +); + +assert.sameValue( + '-9007199254740992' >= -9007199254740993n, + true, + 'The result of ("-9007199254740992" >= -9007199254740993n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/browser.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/greater-than-or-equal/shell.js b/js/src/tests/test262/language/expressions/greater-than-or-equal/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-1.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-1.js new file mode 100644 index 0000000000..51d0794027 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-1.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-1 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: valueOf > valueOf +---*/ + +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + valueOf: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-2.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-2.js new file mode 100644 index 0000000000..3ce46ca740 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-2.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-2 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: valueOf > toString +---*/ + +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + toString: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-3.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-3.js new file mode 100644 index 0000000000..4960c37278 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-3.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-3 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: toString > valueOf +---*/ + +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + valueOf: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/11.8.2-4.js b/js/src/tests/test262/language/expressions/greater-than/11.8.2-4.js new file mode 100644 index 0000000000..fda8104eff --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/11.8.2-4.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.2-4 +description: > + 11.8.2 Greater-than Operator - Partial left to right order + enforced when using Greater-than operator: toString > toString +---*/ + +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 3; + } +}; +var obj2 = { + toString: function () { + return 4; + } +}; + +assert.sameValue(obj1 > obj2, false, 'The result of (obj1 > obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A1.js new file mode 100644 index 0000000000..ac04fe911d --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between RelationalExpression and ">" or + ">" and ShiftExpression are allowed +es5id: 11.8.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("0\u0009>\u00091") !== false) { + throw new Test262Error('#1: 0\\u0009>\\u00091) === false'); +} + +//CHECK#2 +if (eval("0\u000B>\u000B1") !== false) { + throw new Test262Error('#2: 0\\u000B>\\u000B1) === false'); +} + +//CHECK#3 +if (eval("0\u000C>\u000C1") !== false) { + throw new Test262Error('#3: (0\\u000C>\\u000C1) === false'); +} + +//CHECK#4 +if (eval("0\u0020>\u00201") !== false) { + throw new Test262Error('#4: (0\\u0020>\\u00201) === false'); +} + +//CHECK#5 +if (eval("0\u00A0>\u00A01") !== false) { + throw new Test262Error('#5: (0\\u00A0>\\u00A01) === false'); +} + +//CHECK#6 +if (eval("0\u000A>\u000A1") !== false) { + throw new Test262Error('#6: (0\\u000A>\\u000A1) === false'); +} + +//CHECK#7 +if (eval("0\u000D>\u000D1") !== false) { + throw new Test262Error('#7: (0\\u000D>\\u000D1) === false'); +} + +//CHECK#8 +if (eval("0\u2028>\u20281") !== false) { + throw new Test262Error('#8: (0\\u2028>\\u20281) === false'); +} + +//CHECK#9 +if (eval("0\u2029>\u20291") !== false) { + throw new Test262Error('#9: (0\\u2029>\\u20291) === false'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>=\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== true) { + throw new Test262Error('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>=\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T1.js new file mode 100644 index 0000000000..7ad2573860 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x > y uses GetValue +es5id: 11.8.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (2 > 1 !== true) { + throw new Test262Error('#1: 2 > 1 === true'); +} + +//CHECK#2 +var x = 2; +if (x > 1 !== true) { + throw new Test262Error('#2: var x = 2; x > 1 === true'); +} + +//CHECK#3 +var y = 1; +if (2 > y !== true) { + throw new Test262Error('#3: var y = 1; 2 > y === true'); +} + +//CHECK#4 +var x = 2; +var y = 1; +if (x > y !== true) { + throw new Test262Error('#4: var x = 2; var y = 1; x > y === true'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 2; +objecty.prop = 1; +if (objectx.prop > objecty.prop !== true) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 2; objecty.prop = 1; objectx.prop > objecty.prop === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T2.js new file mode 100644 index 0000000000..2ca35d3864 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x > y uses GetValue +es5id: 11.8.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x > 1; + throw new Test262Error('#1.1: x > 1 throw ReferenceError. Actual: ' + (x > 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x > 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T3.js new file mode 100644 index 0000000000..ff3d7291b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x > y uses GetValue +es5id: 11.8.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 > y; + throw new Test262Error('#1.1: 1 > y throw ReferenceError. Actual: ' + (1 > y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 > y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.2_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.2_T1.js new file mode 100644 index 0000000000..8aa14008a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x > y uses [[Default Value]] +es5id: 11.8.2_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 2}} > 1 !== true) { + throw new Test262Error('#1: {valueOf: function() {return 1}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}} > 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 2}, toString: function() {return 0}} > 1 !== true) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 2}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 2}} > 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 2}, toString: function() {return {}}} > 1 !== true) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} > 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 2}, toString: function() {throw "error"}} > 1 !== true) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} > 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} > 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 2}, toString: function() {throw "error"}} > 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 2}, toString: function() {throw "error"}} > 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 > {toString: function() {return 0}} !== true) { + throw new Test262Error('#5: 1 > {toString: function() {return 0}} === true. Actual: ' + (1 > {toString: function() {return 0}})); +} + +//CHECK#6 +if (1 > {valueOf: function() {return {}}, toString: function() {return 0}} !== true) { + throw new Test262Error('#6: 1 > {valueOf: function() {return {}}, toString: function() {return 0}} === true. Actual: ' + (1 > {valueOf: function() {return {}}, toString: function() {return 0}})); +} + +//CHECK#7 +try { + 1 > {valueOf: function() {throw "error"}, toString: function() {return 0}}; + throw new Test262Error('#7.1: 1 > {valueOf: function() {throw "error"}, toString: function() {return 0}} throw "error". Actual: ' + (1 > {valueOf: function() {throw "error"}, toString: function() {return 0}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 > {valueOf: function() {throw "error"}, toString: function() {return 0}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 > {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 > {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 > {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 > {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.3_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.3_T1.js new file mode 100644 index 0000000000..4c8b975924 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.3_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: In ES5, First expression should be evaluated first. +es5id: 11.8.2_A2.3_T1 +description: Checking that operands of a "<" evaluate left-to-right +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x > y; + throw new Test262Error('#1.1: Should have thrown'); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression should be evaluated first'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: Failed with: ' + e); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T1.js new file mode 100644 index 0000000000..7fc28d9a56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) > x !== false) { + throw new Test262Error('#1: var x = 0; (x = 1) > x === false'); +} + +//CHECK#2 +var x = 1; +if (x > (x = 0) !== true) { + throw new Test262Error('#2: var x = 1; x > (x = 0) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T2.js new file mode 100644 index 0000000000..606bfe02ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() > y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() > y() throw "x". Actual: ' + (x() > y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() > y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T3.js new file mode 100644 index 0000000000..03e6cc878c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x > (x = 1); + throw new Test262Error('#1.1: x > (x = 1) throw ReferenceError. Actual: ' + (x > (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x > (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T4.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T4.js new file mode 100644 index 0000000000..950aaa524f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.2_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) > y !== false) { + throw new Test262Error('#1: (y = 1) > y === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.1.js new file mode 100644 index 0000000000..cdbd11d1e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + boolean and Boolean object +---*/ + +//CHECK#1 +if (true > true !== false) { + throw new Test262Error('#1: true > true === false'); +} + +//CHECK#2 +if (new Boolean(true) > true !== false) { + throw new Test262Error('#2: new Boolean(true) > true === false'); +} + +//CHECK#3 +if (true > new Boolean(true) !== false) { + throw new Test262Error('#3: true > new Boolean(true) === false'); +} + +//CHECK#4 +if (new Boolean(true) > new Boolean(true) !== false) { + throw new Test262Error('#4: new Boolean(true) > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.2.js new file mode 100644 index 0000000000..55d5965558 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + number and Number object +---*/ + +//CHECK#1 +if (1 > 1 !== false) { + throw new Test262Error('#1: 1 > 1 === false'); +} + +//CHECK#2 +if (new Number(1) > 1 !== false) { + throw new Test262Error('#2: new Number(1) > 1 === false'); +} + +//CHECK#3 +if (1 > new Number(1) !== false) { + throw new Test262Error('#3: 1 > new Number(1) === false'); +} + +//CHECK#4 +if (new Number(1) > new Number(1) !== false) { + throw new Test262Error('#4: new Number(1) > new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.3.js new file mode 100644 index 0000000000..c3548eda0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T1.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T1.3 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Null and + Undefined +---*/ + +//CHECK#1 +if (null > undefined !== false) { + throw new Test262Error('#1: null > undefined === false'); +} + +//CHECK#2 +if (undefined > null !== false) { + throw new Test262Error('#2: undefined > null === false'); +} + +//CHECK#3 +if (undefined > undefined !== false) { + throw new Test262Error('#3: undefined > undefined === false'); +} + +//CHECK#4 +if (null > null !== false) { + throw new Test262Error('#4: null > null === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.1.js new file mode 100644 index 0000000000..e6853a9847 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.1 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true > 1 !== false) { + throw new Test262Error('#1: true > 1 === false'); +} + +//CHECK#2 +if (1 > true !== false) { + throw new Test262Error('#2: 1 > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > 1 !== false) { + throw new Test262Error('#3: new Boolean(true) > 1 === false'); +} + +//CHECK#4 +if (1 > new Boolean(true) !== false) { + throw new Test262Error('#4: 1 > new Boolean(true) === false'); +} + +//CHECK#5 +if (true > new Number(1) !== false) { + throw new Test262Error('#5: true > new Number(1) === false'); +} + +//CHECK#6 +if (new Number(1) > true !== false) { + throw new Test262Error('#6: new Number(1) > true === false'); +} + +//CHECK#7 +if (new Boolean(true) > new Number(1) !== false) { + throw new Test262Error('#7: new Boolean(true) > new Number(1) === false'); +} + +//CHECK#8 +if (new Number(1) > new Boolean(true) !== false) { + throw new Test262Error('#8: new Number(1) > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.2.js new file mode 100644 index 0000000000..748b983b9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.2 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and String + (primitive and object) +---*/ + +//CHECK#1 +if ("1" > 1 !== false) { + throw new Test262Error('#1: "1" > 1 === false'); +} + +//CHECK#2 +if (1 > "1" !== false) { + throw new Test262Error('#2: 1 > "1" === false'); +} + +//CHECK#3 +if (new String("1") > 1 !== false) { + throw new Test262Error('#3: new String("1") > 1 === false'); +} + +//CHECK#4 +if (1 > new String("1") !== false) { + throw new Test262Error('#4: 1 > new String("1") === false'); +} + +//CHECK#5 +if ("1" > new Number(1) !== false) { + throw new Test262Error('#5: "1" > new Number(1) === false'); +} + +//CHECK#6 +if (new Number(1) > "1" !== false) { + throw new Test262Error('#6: new Number(1) > "1" === false'); +} + +//CHECK#7 +if (new String("1") > new Number(1) !== false) { + throw new Test262Error('#7: new String("1") > new Number(1) === false'); +} + +//CHECK#8 +if (new Number(1) > new String("1") !== false) { + throw new Test262Error('#8: new Number(1) > new String("1") === false'); +} + +//CHECK#9 +if ("x" > 1 !== false) { + throw new Test262Error('#9: "x" > 1 === false'); +} + +//CHECK#10 +if (1 > "x" !== false) { + throw new Test262Error('#10: 1 > "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.3.js new file mode 100644 index 0000000000..a21db3ca84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.3 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 > null !== true) { + throw new Test262Error('#1: 1 > null === true'); +} + +//CHECK#2 +if (null > 1 !== false) { + throw new Test262Error('#2: null > 1 === false'); +} + +//CHECK#3 +if (new Number(1) > null !== true) { + throw new Test262Error('#3: new Number(1) > null === true'); +} + +//CHECK#4 +if (null > new Number(1) !== false) { + throw new Test262Error('#4: null > new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.4.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.4.js new file mode 100644 index 0000000000..e1befa60ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.4 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 > undefined !== false) { + throw new Test262Error('#1: 1 > undefined === false'); +} + +//CHECK#2 +if (undefined > 1 !== false) { + throw new Test262Error('#2: undefined > 1 === false'); +} + +//CHECK#3 +if (new Number(1) > undefined !== false) { + throw new Test262Error('#3: new Number(1) > undefined === false'); +} + +//CHECK#4 +if (undefined > new Number(1) !== false) { + throw new Test262Error('#4: undefined > new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.5.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.5.js new file mode 100644 index 0000000000..18e3d476dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.5.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.5 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true > "1" !== false) { + throw new Test262Error('#1: true > "1" === false'); +} + +//CHECK#2 +if ("1" > true !== false) { + throw new Test262Error('#2: "1" > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > "1" !== false) { + throw new Test262Error('#3: new Boolean(true) > "1" === false'); +} + +//CHECK#4 +if ("1" > new Boolean(true) !== false) { + throw new Test262Error('#4: "1" > new Boolean(true) === false'); +} + +//CHECK#5 +if (true > new String("1") !== false) { + throw new Test262Error('#5: true > new String("1") === false'); +} + +//CHECK#6 +if (new String("1") > true !== false) { + throw new Test262Error('#6: new String("1") > true === false'); +} + +//CHECK#7 +if (new Boolean(true) > new String("1") !== false) { + throw new Test262Error('#7: new Boolean(true) > new String("1") === false'); +} + +//CHECK#8 +if (new String("1") > new Boolean(true) !== false) { + throw new Test262Error('#8: new String("1") > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.6.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.6.js new file mode 100644 index 0000000000..bca527e047 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.6 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" > undefined !== false) { + throw new Test262Error('#1: "1" > undefined === false'); +} + +//CHECK#2 +if (undefined > "1" !== false) { + throw new Test262Error('#2: undefined > "1" === false'); +} + +//CHECK#3 +if (new String("1") > undefined !== false) { + throw new Test262Error('#3: new String("1") > undefined === false'); +} + +//CHECK#4 +if (undefined > new String("1") !== false) { + throw new Test262Error('#4: undefined > new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.7.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.7.js new file mode 100644 index 0000000000..fb766892d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.7.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.7 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" > null !== true) { + throw new Test262Error('#1: "1" > null === true'); +} + +//CHECK#2 +if (null > "1" !== false) { + throw new Test262Error('#2: null > "1" === false'); +} + +//CHECK#3 +if (new String("1") > null !== true) { + throw new Test262Error('#3: new String("1") > null === true'); +} + +//CHECK#4 +if (null > new String("1") !== false) { + throw new Test262Error('#4: null > new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.8.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.8.js new file mode 100644 index 0000000000..2f4a759c83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.8 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true > undefined !== false) { + throw new Test262Error('#1: true > undefined === false'); +} + +//CHECK#2 +if (undefined > true !== false) { + throw new Test262Error('#2: undefined > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > undefined !== false) { + throw new Test262Error('#3: new Boolean(true) > undefined === false'); +} + +//CHECK#4 +if (undefined > new Boolean(true) !== false) { + throw new Test262Error('#4: undefined > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.9.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.9.js new file mode 100644 index 0000000000..0c84edc721 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.1_T2.9.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x > y returns ToNumber(x) > ToNumber(y) +es5id: 11.8.2_A3.1_T2.9 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true > null !== true) { + throw new Test262Error('#1: true > null === true'); +} + +//CHECK#2 +if (null > true !== false) { + throw new Test262Error('#2: null > true === false'); +} + +//CHECK#3 +if (new Boolean(true) > null !== true) { + throw new Test262Error('#3: new Boolean(true) > null === true'); +} + +//CHECK#4 +if (null > new Boolean(true) !== false) { + throw new Test262Error('#4: null > new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.1.js new file mode 100644 index 0000000000..95a8c47ff7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String and Type(Primitive(y)) is String, then + operator x > y returns ToString(x) > ToString(y) +es5id: 11.8.2_A3.2_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + string and String object +---*/ + +//CHECK#1 +if ("1" > "1" !== false) { + throw new Test262Error('#1: "1" > "1" === false'); +} + +//CHECK#2 +if (new String("1") > "1" !== false) { + throw new Test262Error('#2: new String("1") > "1" === false'); +} + +//CHECK#3 +if ("1" > new String("1") !== false) { + throw new Test262Error('#3: "1" > new String("1") === false'); +} + +//CHECK#4 +if (new String("1") > new String("1") !== false) { + throw new Test262Error('#4: new String("1") > new String("1") === false'); +} + +//CHECK#5 +if ("x" > "1" !== true) { + throw new Test262Error('#5: "x" > "1" === true'); +} + +//CHECK#6 +if ("1" > "x" !== false) { + throw new Test262Error('#6: "1" > "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.2.js new file mode 100644 index 0000000000..26ce9b7ffd --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A3.2_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is String and Type(Primitive(y)) is String, then + operator x > y returns ToString(x) > ToString(y) +es5id: 11.8.2_A3.2_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Object + object and Function object +---*/ + +//CHECK#1 +if (({} > function(){return 1}) !== ({}.toString() > function(){return 1}.toString())) { + throw new Test262Error('#1: ({} > function(){return 1}) === ({}.toString() > function(){return 1}.toString())'); +} + +//CHECK#2 +if ((function(){return 1} > {}) !== (function(){return 1}.toString() > {}.toString())) { + throw new Test262Error('#2: (function(){return 1} > {}) === (function(){return 1}.toString() > {}.toString())'); +} + +//CHECK#3 +if ((function(){return 1} > function(){return 1}) !== (function(){return 1}.toString() > function(){return 1}.toString())) { + throw new Test262Error('#3: (function(){return 1} > function(){return 1}) === (function(){return 1}.toString() > function(){return 1}.toString())'); +} + +//CHECK#4 +if (({} > {}) !== ({}.toString() > {}.toString())) { + throw new Test262Error('#4: ({} > {}) === ({}.toString() > {}.toString())'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.1.js new file mode 100644 index 0000000000..f829fc2897 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.2_A4.1 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NaN > 0) !== false) { + throw new Test262Error('#1: (NaN > 0) === false'); +} + +//CHECK#2 +if ((Number.NaN > 1.1) !== false) { + throw new Test262Error('#2: (NaN > 1.1) === false'); +} + +//CHECK#3 +if ((Number.NaN > -1.1) !== false) { + throw new Test262Error('#3: (NaN > -1.1) === false'); +} + +//CHECK#4 +if ((Number.NaN > Number.NaN) !== false) { + throw new Test262Error('#4: (NaN > NaN) === false'); +} + +//CHECK#5 +if ((Number.NaN > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (NaN > +Infinity) === false'); +} + +//CHECK#6 +if ((Number.NaN > Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#6: (NaN > -Infinity) === false'); +} + +//CHECK#7 +if ((Number.NaN > Number.MAX_VALUE) !== false) { + throw new Test262Error('#7: (NaN > Number.MAX_VALUE) === false'); +} + +//CHECK#8 +if ((Number.NaN > Number.MIN_VALUE) !== false) { + throw new Test262Error('#8: (NaN > Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.10.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.10.js new file mode 100644 index 0000000000..9773655acd --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.10.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is a prefix of y, return false +es5id: 11.8.2_A4.10 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" > "x") !== false) { + throw new Test262Error('#1: ("x" > "x") === false'); +} + +//CHECK#2 +if (("" > "x") !== false) { + throw new Test262Error('#2: ("" > "x") === false'); +} + +//CHECK#3 +if (("ab" > "abcd") !== false) { + throw new Test262Error('#3: ("ab" > abcd") === false'); +} + +//CHECK#4 +if (("abcd" > "abc\u0064") !== false) { + throw new Test262Error('#4: ("abcd" > abc\\u0064") === false'); +} + +//CHECK#5 +if (("x" > "x" + "y") !== false) { + throw new Test262Error('#5: ("x" > "x" + "y") === false'); +} + +//CHECK#6 +var x = "x"; +if ((x > x + "y") !== false) { + throw new Test262Error('#6: var x = "x"; (x > x + "y") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.11.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.11.js new file mode 100644 index 0000000000..27688e3192 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.11.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is a prefix of x and x !== y, return true +es5id: 11.8.2_A4.11 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x " > "x") !== true) { + throw new Test262Error('#1: ("x " > "x") === true'); +} + +//CHECK#2 +if (("x" > "") !== true) { + throw new Test262Error('#2: ("x" > "") === true'); +} + +//CHECK#3 +if (("abcd" > "ab") !== true) { + throw new Test262Error('#3: ("abcd" > ab") === true'); +} + +//CHECK#4 +if (("abc\u0064" > "abcd") !== false) { + throw new Test262Error('#4: ("abc\\u0064" > abc") === false'); +} + +//CHECK#5 +if (("x" + "y" > "x") !== true) { + throw new Test262Error('#5: ("x" + "y" > "x") === true'); +} + +//CHECK#6 +var x = "x"; +if ((x + 'y' > x) !== true) { + throw new Test262Error('#6: var x = "x"; (x + "y" > x) === true'); +} + +//CHECK#7 +if (("a\u0000a" > "a\u0000") !== true) { + throw new Test262Error('#7: ("a\\u0000a" > "a\\u0000") === true'); +} + +//CHECK#8 +if ((" x" > "x") !== false) { + throw new Test262Error('#8: (" x" > "x") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.js new file mode 100644 index 0000000000..9f3588c206 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T1.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.2_A4.12_T1 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("xy" > "xx") !== true) { + throw new Test262Error('#1: ("xy" > "xx") === true'); +} + +//CHECK#2 +if (("xx" > "xy") !== false) { + throw new Test262Error('#2: ("xx" > "xy") === false'); +} + +//CHECK#3 +if (("y" > "x") !== true) { + throw new Test262Error('#3: ("y" > "x") === true'); +} + +//CHECK#4 +if (("aba" > "aab") !== true) { + throw new Test262Error('#4: ("aba" > aab") === true'); +} + +//CHECK#5 +if (("\u0061\u0061\u0061\u0061" > "\u0061\u0061\u0061\u0062") !== false) { + throw new Test262Error('#5: ("\\u0061\\u0061\\u0061\\u0061" > \\u0061\\u0061\\u0061\\u0062") === false'); +} + +//CHECK#6 +if (("a\u0000b" > "a\u0000a") !== true) { + throw new Test262Error('#6: ("a\\u0000b" > "a\\u0000a") === true'); +} + +//CHECK#7 +if (("aa" > "aB") !== true) { + throw new Test262Error('#7: ("aa" > aB") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T2.js new file mode 100644 index 0000000000..f58dfa7d92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.12_T2.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.2_A4.12_T2 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" > "0") !== true) { + throw new Test262Error('#1: ("x" > "0") !== true'); +} + +//CHECK#2 +if (("0" > "-") !== true) { + throw new Test262Error('#2: ("0" > "-") !== true'); +} + +//CHECK#3 +if (("0" > ".") !== true) { + throw new Test262Error('#3: ("0" > ".") !== true'); +} + +//CHECK#4 +if (("-" > "+") !== true) { + throw new Test262Error('#4: ("-" > "+") !== true'); +} + +//CHECK#5 +if (("-1" > "-0") !== true) { + throw new Test262Error('#5: ("-1" > "-0") !== true'); +} + +//CHECK#6 +if (("-1" > "+1") !== true) { + throw new Test262Error('#6: ("-1" > "+1") !== true'); +} + +//CHECK#7 +if (("1e-10" > "1") !== true) { +throw new Test262Error('#7: ("1e-10" > "1") !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.2.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.2.js new file mode 100644 index 0000000000..5b17f46b59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.2_A4.2 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 > Number.NaN) !== false) { + throw new Test262Error('#1: (0 > NaN) === false'); +} + +//CHECK#2 +if ((1.1 > Number.NaN) !== false) { + throw new Test262Error('#2: (1.1 > NaN) === false'); +} + +//CHECK#3 +if ((-1.1 > Number.NaN) !== false) { + throw new Test262Error('#3: (-1.1 > NaN) === false'); +} + +//CHECK#4 +if ((Number.NaN > Number.NaN) !== false) { + throw new Test262Error('#4: (NaN > NaN) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY > Number.NaN) !== false) { + throw new Test262Error('#5: (+Infinity > NaN) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY > Number.NaN) !== false) { + throw new Test262Error('#6: (-Infinity > NaN) === false'); +} + +//CHECK#7 +if ((Number.MAX_VALUE > Number.NaN) !== false) { + throw new Test262Error('#7: (Number.MAX_VALUE > NaN) === false'); +} + +//CHECK#8 +if ((Number.MIN_VALUE > Number.NaN) !== false) { + throw new Test262Error('#8: (Number.MIN_VALUE > NaN) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.3.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.3.js new file mode 100644 index 0000000000..9274a583d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x and y are the same number value, return false +es5id: 11.8.2_A4.3 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 > 1) !== false) { + throw new Test262Error('#1: (1 > 1) === false'); +} + +//CHECK#2 +if ((1.1 > 1.1) !== false) { + throw new Test262Error('#2: (1.1 > 1.1) === false'); +} + +//CHECK#3 +if ((-1.1 > -1.1) !== false) { + throw new Test262Error('#3: (-1.1 > -1.1) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity > -Infinity) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (+Infinity > +Infinity) === false'); +} + +//CHECK#6 +if ((Number.MAX_VALUE > Number.MAX_VALUE) !== false) { + throw new Test262Error('#6: (Number.MAX_VALUE > Number.MAX_VALUE) === false'); +} + +//CHECK#7 +if ((Number.MIN_VALUE > Number.MIN_VALUE) !== false) { + throw new Test262Error('#7: (Number.MIN_VALUE > Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.4.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.4.js new file mode 100644 index 0000000000..f554feb4c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If either variable x or y is +0 and the other is -0, return false +es5id: 11.8.2_A4.4 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((0 > 0) !== false) { + throw new Test262Error('#1: (0 > 0) === false'); +} + +//CHECK#2 +if ((-0 > -0) !== false) { + throw new Test262Error('#2: (-0 > -0) === false'); +} + +//CHECK#3 +if ((+0 > -0) !== false) { + throw new Test262Error('#3: (+0 > -0) === false'); +} + +//CHECK#4 +if ((-0 > +0) !== false) { + throw new Test262Error('#4: (-0 > +0) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.5.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.5.js new file mode 100644 index 0000000000..f147d0987f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.5.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +Infinity and x !== y, return true +es5id: 11.8.2_A4.5 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY > 0) !== true) { + throw new Test262Error('#1: (+Infinity > 0) === true'); +} + +//CHECK#2 +if ((Number.POSITIVE_INFINITY > 1.1) !== true) { + throw new Test262Error('#2: (+Infinity > 1.1) === true'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY > -1.1) !== true) { + throw new Test262Error('#3: (+Infinity > -1.1) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (+Infinity > -Infinity) === true'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY > Number.MAX_VALUE) !== true) { + throw new Test262Error('#5: (+Infinity > Number.MAX_VALUE) === true'); +} + +//CHECK#6 +if ((Number.POSITIVE_INFINITY > Number.MIN_VALUE) !== true) { + throw new Test262Error('#6: (+Infinity > Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.6.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.6.js new file mode 100644 index 0000000000..3b05e89fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.6.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is +Infinity, return false +es5id: 11.8.2_A4.6 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#1: (0 > +Infinity) === false'); +} + +//CHECK#2 +if ((1.1 > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#2: (1.1 > +Infinity) === false'); +} + +//CHECK#3 +if ((-1.1 > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#3: (-1.1 > +Infinity) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity > +Infinity) === false'); +} + +//CHECK#5 +if ((Number.MAX_VALUE > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (Number.MAX_VALUE > +Infinity) === false'); +} + +//CHECK#6 +if ((Number.MIN_VALUE > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#6: (Number.MIN_VALUE > +Infinity) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.7.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.7.js new file mode 100644 index 0000000000..f09a555633 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.7.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity, return false +es5id: 11.8.2_A4.7 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NEGATIVE_INFINITY > 0) !== false) { + throw new Test262Error('#1: (-Infinity > 0) === false'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY > 1.1) !== false) { + throw new Test262Error('#2: (-Infinity > 1.1) === false'); +} + +//CHECK#3 +if ((Number.NEGATIVE_INFINITY > -1.1) !== false) { + throw new Test262Error('#3: (-Infinity > -1.1) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY > Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity > +Infinity) === false'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY > Number.MAX_VALUE) !== false) { + throw new Test262Error('#5: (-Infinity > Number.MAX_VALUE) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY > Number.MIN_VALUE) !== false) { + throw new Test262Error('#6: (-Infinity > Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.8.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.8.js new file mode 100644 index 0000000000..12ae0c7714 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.8.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is -Infinity and x !== y, return true +es5id: 11.8.2_A4.8 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#1: (0 > -Infinity) === true'); +} + +//CHECK#2 +if ((1.1 > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#2: (1.1 > -Infinity) === true'); +} + +//CHECK#3 +if ((-1.1 > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#3: (-1.1 > -Infinity) === true'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (+Infinity > -Infinity) === true'); +} + +//CHECK#5 +if ((Number.MAX_VALUE > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: (Number.MAX_VALUE > -Infinity) === true'); +} + +//CHECK#6 +if ((Number.MIN_VALUE > Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#6: (Number.MIN_VALUE > -Infinity) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.9.js b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.9.js new file mode 100644 index 0000000000..5375d96c4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/S11.8.2_A4.9.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If is x greater than y and these values are both finite non-zero, return + true; otherwise, return false +es5id: 11.8.2_A4.9 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 > 1.1) !== false) { + throw new Test262Error('#1: (1 > 1.1) === false'); +} + +//CHECK#2 +if ((1.1 > 1) !== true) { + throw new Test262Error('#2: (1.1 > 1) === true'); +} + +//CHECK#3 +if ((-1 > -1.1) !== true) { + throw new Test262Error('#3: (-1 > -1.1) === true'); +} + +//CHECK#4 +if ((-1.1 > -1) !== false) { + throw new Test262Error('#4: (-1.1 > -1) === false'); +} + +//CHECK#5 +if ((0.1 > 0) !== true) { + throw new Test262Error('#5: (0.1 > 0) === true'); +} + +//CHECK#6 +if ((0 > -0.1) !== true) { + throw new Test262Error('#6: (0 > -0.1) === true'); +} + +//CHECK#7 +if ((Number.MAX_VALUE > Number.MAX_VALUE/2) !== true) { + throw new Test262Error('#7: (Number.MAX_VALUE > Number.MAX_VALUE/2) === true'); +} + +//CHECK#8 +if ((Number.MIN_VALUE*2 > Number.MIN_VALUE) !== true) { + throw new Test262Error('#8: (Number.MIN_VALUE*2 > Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-bigint.js new file mode 100644 index 0000000000..17c16fd1b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-bigint.js @@ -0,0 +1,166 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and BigInt values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + + sec-numeric-types-bigint-lessThan + BigInt::lessThan (x, y) + + The abstract operation BigInt::lessThan with two arguments x and y of BigInt type returns true if x is less than y and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n > 0n, false, 'The result of (0n > 0n) is false'); +assert.sameValue(1n > 1n, false, 'The result of (1n > 1n) is false'); +assert.sameValue(-1n > -1n, false, 'The result of (-1n > -1n) is false'); +assert.sameValue(0n > -0n, false, 'The result of (0n > -0n) is false'); +assert.sameValue(-0n > 0n, false, 'The result of (-0n > 0n) is false'); +assert.sameValue(0n > 1n, false, 'The result of (0n > 1n) is false'); +assert.sameValue(1n > 0n, true, 'The result of (1n > 0n) is true'); +assert.sameValue(0n > -1n, true, 'The result of (0n > -1n) is true'); +assert.sameValue(-1n > 0n, false, 'The result of (-1n > 0n) is false'); +assert.sameValue(1n > -1n, true, 'The result of (1n > -1n) is true'); +assert.sameValue(-1n > 1n, false, 'The result of (-1n > 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n > 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n > 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n > 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n > 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n > -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n > -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n > -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n > -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n > 0n, + true, + 'The result of (0x10000000000000000n > 0n) is true' +); + +assert.sameValue( + 0n > 0x10000000000000000n, + false, + 'The result of (0n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n > 1n, + true, + 'The result of (0x10000000000000000n > 1n) is true' +); + +assert.sameValue( + 1n > 0x10000000000000000n, + false, + 'The result of (1n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n > -1n, + true, + 'The result of (0x10000000000000000n > -1n) is true' +); + +assert.sameValue( + -1n > 0x10000000000000000n, + false, + 'The result of (-1n > 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n > 0n, + true, + 'The result of (0x10000000000000001n > 0n) is true' +); + +assert.sameValue( + 0n > 0x10000000000000001n, + false, + 'The result of (0n > 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n > 0n, + false, + 'The result of (-0x10000000000000000n > 0n) is false' +); + +assert.sameValue( + 0n > -0x10000000000000000n, + true, + 'The result of (0n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n > 1n, + false, + 'The result of (-0x10000000000000000n > 1n) is false' +); + +assert.sameValue( + 1n > -0x10000000000000000n, + true, + 'The result of (1n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n > -1n, + false, + 'The result of (-0x10000000000000000n > -1n) is false' +); + +assert.sameValue( + -1n > -0x10000000000000000n, + true, + 'The result of (-1n > -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n > 0n, + false, + 'The result of (-0x10000000000000001n > 0n) is false' +); + +assert.sameValue( + 0n > -0x10000000000000001n, + true, + 'The result of (0n > -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n > 0x100000000n, + true, + 'The result of (0x10000000000000000n > 0x100000000n) is true' +); + +assert.sameValue( + 0x100000000n > 0x10000000000000000n, + false, + 'The result of (0x100000000n > 0x10000000000000000n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-boolean.js new file mode 100644 index 0000000000..263b7c2e6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-boolean.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and boolean values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n > false, false, 'The result of (0n > false) is false'); +assert.sameValue(false > 0n, false, 'The result of (false > 0n) is false'); +assert.sameValue(0n > true, false, 'The result of (0n > true) is false'); +assert.sameValue(true > 0n, true, 'The result of (true > 0n) is true'); +assert.sameValue(1n > false, true, 'The result of (1n > false) is true'); +assert.sameValue(false > 1n, false, 'The result of (false > 1n) is false'); +assert.sameValue(1n > true, false, 'The result of (1n > true) is false'); +assert.sameValue(true > 1n, false, 'The result of (true > 1n) is false'); +assert.sameValue(31n > true, true, 'The result of (31n > true) is true'); +assert.sameValue(true > 31n, false, 'The result of (true > 31n) is false'); +assert.sameValue(-3n > true, false, 'The result of (-3n > true) is false'); +assert.sameValue(true > -3n, true, 'The result of (true > -3n) is true'); +assert.sameValue(-3n > false, false, 'The result of (-3n > false) is false'); +assert.sameValue(false > -3n, true, 'The result of (false > -3n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-incomparable-string.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-incomparable-string.js new file mode 100644 index 0000000000..f0902a1fe1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-incomparable-string.js @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(1n > '0n', false, 'The result of (1n > "0n") is false'); +assert.sameValue(1n > '0.', false, 'The result of (1n > "0.") is false'); +assert.sameValue(1n > '.0', false, 'The result of (1n > ".0") is false'); +assert.sameValue(1n > '0/1', false, 'The result of (1n > "0/1") is false'); +assert.sameValue(1n > 'z0', false, 'The result of (1n > "z0") is false'); +assert.sameValue(1n > '0z', false, 'The result of (1n > "0z") is false'); +assert.sameValue(1n > '++0', false, 'The result of (1n > "++0") is false'); +assert.sameValue(1n > '--0', false, 'The result of (1n > "--0") is false'); +assert.sameValue(1n > '0e0', false, 'The result of (1n > "0e0") is false'); +assert.sameValue(1n > 'Infinity', false, 'The result of (1n > "Infinity") is false'); +assert.sameValue('1n' > 0n, false, 'The result of ("1n" > 0n) is false'); +assert.sameValue('1.' > 0n, false, 'The result of ("1." > 0n) is false'); +assert.sameValue('.1' > 0n, false, 'The result of (".1" > 0n) is false'); +assert.sameValue('1/1' > 0n, false, 'The result of ("1/1" > 0n) is false'); +assert.sameValue('z1' > 0n, false, 'The result of ("z1" > 0n) is false'); +assert.sameValue('1z' > 0n, false, 'The result of ("1z" > 0n) is false'); +assert.sameValue('++1' > 0n, false, 'The result of ("++1" > 0n) is false'); +assert.sameValue('--1' > 0n, false, 'The result of ("--1" > 0n) is false'); +assert.sameValue('1e0' > 0n, false, 'The result of ("1e0" > 0n) is false'); +assert.sameValue('Infinity' > 0n, false, 'The result of ("Infinity" > 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-non-finite.js new file mode 100644 index 0000000000..bb651a58a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and non-finite Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. +features: [BigInt] +---*/ +assert.sameValue(1n > Infinity, false, 'The result of (1n > Infinity) is false'); +assert.sameValue(Infinity > 1n, true, 'The result of (Infinity > 1n) is true'); +assert.sameValue(-1n > Infinity, false, 'The result of (-1n > Infinity) is false'); +assert.sameValue(Infinity > -1n, true, 'The result of (Infinity > -1n) is true'); +assert.sameValue(1n > -Infinity, true, 'The result of (1n > -Infinity) is true'); +assert.sameValue(-Infinity > 1n, false, 'The result of (-Infinity > 1n) is false'); +assert.sameValue(-1n > -Infinity, true, 'The result of (-1n > -Infinity) is true'); +assert.sameValue(-Infinity > -1n, false, 'The result of (-Infinity > -1n) is false'); +assert.sameValue(0n > NaN, false, 'The result of (0n > NaN) is false'); +assert.sameValue(NaN > 0n, false, 'The result of (NaN > 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number-extremes.js new file mode 100644 index 0000000000..c0323cde2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number-extremes.js @@ -0,0 +1,50 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(1n > Number.MAX_VALUE, false, 'The result of (1n > Number.MAX_VALUE) is false'); +assert.sameValue(Number.MAX_VALUE > 1n, true, 'The result of (Number.MAX_VALUE > 1n) is true'); +assert.sameValue(1n > -Number.MAX_VALUE, true, 'The result of (1n > -Number.MAX_VALUE) is true'); +assert.sameValue(-Number.MAX_VALUE > 1n, false, 'The result of (-Number.MAX_VALUE > 1n) is false'); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn > Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn > Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE > 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + true, + 'The result of (Number.MAX_VALUE > 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n > Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n > Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE > 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + false, + 'The result of (Number.MAX_VALUE > 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-number.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number.js new file mode 100644 index 0000000000..852f4e4322 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-number.js @@ -0,0 +1,48 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(0n > 0, false, 'The result of (0n > 0) is false'); +assert.sameValue(0 > 0n, false, 'The result of (0 > 0n) is false'); +assert.sameValue(0n > -0, false, 'The result of (0n > -0) is false'); +assert.sameValue(-0 > 0n, false, 'The result of (-0 > 0n) is false'); +assert.sameValue(0n > 0.000000000001, false, 'The result of (0n > 0.000000000001) is false'); +assert.sameValue(0.000000000001 > 0n, true, 'The result of (0.000000000001 > 0n) is true'); +assert.sameValue(0n > 1, false, 'The result of (0n > 1) is false'); +assert.sameValue(1 > 0n, true, 'The result of (1 > 0n) is true'); +assert.sameValue(1n > 0, true, 'The result of (1n > 0) is true'); +assert.sameValue(0 > 1n, false, 'The result of (0 > 1n) is false'); +assert.sameValue(1n > 0.999999999999, true, 'The result of (1n > 0.999999999999) is true'); +assert.sameValue(0.999999999999 > 1n, false, 'The result of (0.999999999999 > 1n) is false'); +assert.sameValue(1n > 1, false, 'The result of (1n > 1) is false'); +assert.sameValue(1 > 1n, false, 'The result of (1 > 1n) is false'); +assert.sameValue(0n > Number.MIN_VALUE, false, 'The result of (0n > Number.MIN_VALUE) is false'); +assert.sameValue(Number.MIN_VALUE > 0n, true, 'The result of (Number.MIN_VALUE > 0n) is true'); +assert.sameValue(0n > -Number.MIN_VALUE, true, 'The result of (0n > -Number.MIN_VALUE) is true'); +assert.sameValue(-Number.MIN_VALUE > 0n, false, 'The result of (-Number.MIN_VALUE > 0n) is false'); + +assert.sameValue( + -10n > Number.MIN_VALUE, + false, + 'The result of (-10n > Number.MIN_VALUE) is false' +); + +assert.sameValue(Number.MIN_VALUE > -10n, true, 'The result of (Number.MIN_VALUE > -10n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-string.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-string.js new file mode 100644 index 0000000000..0355e77be4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-string.js @@ -0,0 +1,62 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n > '0', false, 'The result of (0n > "0") is false'); +assert.sameValue('0' > 0n, false, 'The result of ("0" > 0n) is false'); +assert.sameValue(0n > '1', false, 'The result of (0n > "1") is false'); +assert.sameValue('0' > 1n, false, 'The result of ("0" > 1n) is false'); +assert.sameValue(1n > '0', true, 'The result of (1n > "0") is true'); +assert.sameValue('1' > 0n, true, 'The result of ("1" > 0n) is true'); +assert.sameValue(0n > '', false, 'The result of (0n > "") is false'); +assert.sameValue('' > 0n, false, 'The result of ("" > 0n) is false'); +assert.sameValue(0n > '1', false, 'The result of (0n > "1") is false'); +assert.sameValue('' > 1n, false, 'The result of ("" > 1n) is false'); +assert.sameValue(1n > '', true, 'The result of (1n > "") is true'); +assert.sameValue('1' > 0n, true, 'The result of ("1" > 0n) is true'); +assert.sameValue(1n > '1', false, 'The result of (1n > "1") is false'); +assert.sameValue('1' > 1n, false, 'The result of ("1" > 1n) is false'); +assert.sameValue(1n > '-1', true, 'The result of (1n > "-1") is true'); +assert.sameValue('1' > -1n, true, 'The result of ("1" > -1n) is true'); +assert.sameValue(-1n > '1', false, 'The result of (-1n > "1") is false'); +assert.sameValue('-1' > 1n, false, 'The result of ("-1" > 1n) is false'); +assert.sameValue(-1n > '-1', false, 'The result of (-1n > "-1") is false'); +assert.sameValue('-1' > -1n, false, 'The result of ("-1" > -1n) is false'); +assert.sameValue('0x10' > 15n, true, 'The result of ("0x10" > 15n) is true'); +assert.sameValue('0x10' > 16n, false, 'The result of ("0x10" > 16n) is false'); +assert.sameValue('0x10' > 17n, false, 'The result of ("0x10" > 17n) is false'); +assert.sameValue('0o10' > 7n, true, 'The result of ("0o10" > 7n) is true'); +assert.sameValue('0o10' > 8n, false, 'The result of ("0o10" > 8n) is false'); +assert.sameValue('0o10' > 9n, false, 'The result of ("0o10" > 9n) is false'); +assert.sameValue('0b10' > 1n, true, 'The result of ("0b10" > 1n) is true'); +assert.sameValue('0b10' > 2n, false, 'The result of ("0b10" > 2n) is false'); +assert.sameValue('0b10' > 3n, false, 'The result of ("0b10" > 3n) is false'); + +assert.sameValue( + 9007199254740993n > '9007199254740992', + true, + 'The result of (9007199254740993n > "9007199254740992") is true' +); + +assert.sameValue( + '9007199254740993' > 9007199254740992n, + true, + 'The result of ("9007199254740993" > 9007199254740992n) is true' +); + +assert.sameValue( + -9007199254740992n > '-9007199254740993', + true, + 'The result of (-9007199254740992n > "-9007199254740993") is true' +); + +assert.sameValue( + '-9007199254740992' > -9007199254740993n, + true, + 'The result of ("-9007199254740992" > -9007199254740993n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/bigint-and-symbol.js b/js/src/tests/test262/language/expressions/greater-than/bigint-and-symbol.js new file mode 100644 index 0000000000..5de77bc5d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/greater-than/bigint-and-symbol.js @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and Symbol values +esid: sec-abstract-relational-comparison +features: [BigInt, Symbol] +---*/ +assert.throws(TypeError, function() { + 3n > Symbol('2'); +}, '3n > Symbol("2") throws TypeError'); + +assert.throws(TypeError, function() { + Symbol('2') > 3n; +}, 'Symbol("2") > 3n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/greater-than/browser.js b/js/src/tests/test262/language/expressions/greater-than/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/greater-than/shell.js b/js/src/tests/test262/language/expressions/greater-than/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A1.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A1.js new file mode 100644 index 0000000000..e46ec0fa98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: White Space and Line Terminator inside "grouping" operator are allowed +es5id: 11.1.6_A1 +description: > + Inserting WhiteSpaces and LineTerminators into grouping operator. + Eval is used +---*/ + +//CHECK#1 +if (eval("(\u00091\u0009)") !== 1) { + throw new Test262Error('#1: (\\u00091\\u0009) === 1'); +} + +//CHECK#2 +if (eval("(\u000B1\u000B)") !== 1) { + throw new Test262Error('#2: (\\u000B1\\u000B) === 1'); +} + +//CHECK#3 +if (eval("(\u000C1\u000C)") !== 1) { + throw new Test262Error('#3: (\\u000C1\\u000C) === 1'); +} + +//CHECK#4 +if (eval("(\u00201\u0020)") !== 1) { + throw new Test262Error('#4: (\\u00201\\u0020 === 1'); +} + +//CHECK#5 +if (eval("(\u00A01\u00A0)") !== 1) { + throw new Test262Error('#5: (\\u00A01\\u00A0) === 1'); +} + +//CHECK#6 +if (eval("(\u000A1\u000A)") !== 1) { + throw new Test262Error('#6: (\\u000A1\\u000A) === 1'); +} + +//CHECK#7 +if (eval("(\u000D1\u000D)") !== 1) { + throw new Test262Error('#7: (\\u000D1\\u000D) === 1'); +} + +//CHECK#8 +if (eval("(\u20281\u2028)") !== 1) { + throw new Test262Error('#8: (\\u20281\\u2028) === 1'); +} + +//CHECK#9 +if (eval("(\u20291\u2029)") !== 1) { + throw new Test262Error('#9: (\\u20291\\u2029) === 1'); +} + +//CHECK#10 +if (eval("(\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029)") !== 1) { + throw new Test262Error('#10: (\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029) === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T1.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T1.js new file mode 100644 index 0000000000..422794e8c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + "This" operator doesn't use GetValue. The operators "delete" and "typeof" + can be applied to parenthesised expressions +es5id: 11.1.6_A2_T1 +description: > + Applying "delete" and "typeof" operators to an undefined variable + and a property of an object +---*/ + +//CHECK#1 +if (typeof (x) !== "undefined") { + throw new Test262Error('#1: typeof (x) === "undefined". Actual: ' + (typeof (x))); +} + +var object = {}; +//CHECK#2 +if (delete (object.prop) !== true) { + throw new Test262Error('#2: var object = {}; delete (object.prop) === true'); +} + +//CHECK#3 +if (typeof (object.prop) !== "undefined") { + throw new Test262Error('#3: var object = {}; typeof (object.prop) === "undefined". Actual: ' + (typeof (object.prop))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T2.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T2.js new file mode 100644 index 0000000000..974abf0459 --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A2_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + "This" operator doesn't use GetValue. The operators "delete" and "typeof" + can be applied to parenthesised expressions +es5id: 11.1.6_A2_T2 +description: > + Applying "delete" operator to an undefined variable +flags: [noStrict] +---*/ + +//CHECK#1 +if (delete (x) !== true) { + throw new Test262Error('#1: delete (x) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T1.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T1.js new file mode 100644 index 0000000000..eba51a8bf6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "\"This\" operator only evaluates Expression" +es5id: 11.1.6_A3_T1 +description: Applying grouping operator to Boolean +---*/ + +// Check for Boolean + +//CHECK#1 +if ((true) !== true) { + throw new Test262Error('#1: (true) === true'); +} + +//CHECK#2 +var x = new Boolean(true); +if ((x) !== x) { + throw new Test262Error('#2: var x = new Boolean(true); (x) === x. Actual: ' + ((x))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T2.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T2.js new file mode 100644 index 0000000000..56333e682a --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "\"This\" operator only evaluates Expression" +es5id: 11.1.6_A3_T2 +description: Applying grouping operator to Number +---*/ + +//Check for Number + +//CHECK#1 +if ((1) !== 1) { + throw new Test262Error('#1: (1) === 1. Actual: ' + ((1))); +} + +//CHECK#2 +var x = new Number(1); +if ((x) !== x) { + throw new Test262Error('#2: var x = new Number(1); (x) === x. Actual: ' + ((x))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T3.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T3.js new file mode 100644 index 0000000000..ab17b6c73b --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "\"This\" operator only evaluates Expression" +es5id: 11.1.6_A3_T3 +description: Applying grouping operator to String +---*/ + +//Check for String + +//CHECK#1 +if (("1") !== "1") { + throw new Test262Error('#1: ("1") === "1". Actual: ' + (("1"))); +} + +//CHECK#2 +if (("x") !== "x") { + throw new Test262Error('#2: ("x") === "x". Actual: ' + (("x"))); +} + +//CHECK#3 +var x = new Number("1"); +if ((x) !== x) { + throw new Test262Error('#3: var x = new Number("1"); (x) === x. Actual: ' + ((x))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T4.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T4.js new file mode 100644 index 0000000000..b5ae7c383c --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T4.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "\"This\" operator only evaluates Expression" +es5id: 11.1.6_A3_T4 +description: Applying grouping operator to undefined +---*/ + +//Check for undefined and null + +//CHECK#1 +if ((undefined) !== undefined) { + throw new Test262Error('#1: (undefined) === undefined. Actual: ' + ((undefined))); +} + +//CHECK#2 +if ((void 0) !== void 0) { + throw new Test262Error('#2: (void 0) === void 0. Actual: ' + ((void 0))); +} + +//CHECK#2 +if ((null) !== null) { + throw new Test262Error('#2: (null) === null. Actual: ' + ((null))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T6.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T6.js new file mode 100644 index 0000000000..866c12c238 --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "\"This\" operator only evaluates Expression" +es5id: 11.1.6_A3_T6 +description: Applying grouping operator to delete operator +flags: [noStrict] +---*/ + +//CHECK#1 +if (delete (x) !== true) { + throw new Test262Error('#1: delete (x) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T7.js b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T7.js new file mode 100644 index 0000000000..b4394b5f6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/grouping/S11.1.6_A3_T7.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "\"This\" operator only evaluates Expression" +es5id: 11.1.6_A3_T7 +description: Applying grouping operator to typeof operator +---*/ + +//CHECK#1 +if (typeof (x) !== "undefined") { + throw new Test262Error('#1: typeof (x) === "undefined". Actual: ' + (typeof (x))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/grouping/browser.js b/js/src/tests/test262/language/expressions/grouping/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/grouping/shell.js b/js/src/tests/test262/language/expressions/grouping/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/import.meta/browser.js b/js/src/tests/test262/language/expressions/import.meta/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js new file mode 100644 index 0000000000..6f8745bd07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module.js @@ -0,0 +1,39 @@ +// |reftest| module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-meta-properties-runtime-semantics-evaluation +description: > + The import.meta object is not shared across modules. +info: | + Runtime Semantics: Evaluation + + ImportMeta : import.meta + + 1. Let module be GetActiveScriptOrModule(). + ... + 3. Let importMeta be module.[[ImportMeta]]. + 4. If importMeta is undefined. + ... + f. Set module.[[ImportMeta]] to importMeta. + g. Return importMeta. + ... +flags: [module] +features: [import.meta] +---*/ + +import {meta as fixture_meta, getMeta} from "./distinct-for-each-module_FIXTURE.js"; + +// The imported module has a distinct import.meta object. +assert.notSameValue(import.meta, fixture_meta, + "foreign import.meta accessed via import binding"); +assert.notSameValue(import.meta, getMeta(), + "foreign import.meta accessed via function call"); + +// Calling a function which returns import.meta returns the import.meta object +// from the module in which the function is declared. +assert.sameValue(fixture_meta, getMeta(), + "import.meta accessed via import binding is identical to the one accessed via call"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js new file mode 100644 index 0000000000..53b9ea2172 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/distinct-for-each-module_FIXTURE.js @@ -0,0 +1,9 @@ +// |reftest| skip -- not a test file +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +export var meta = import.meta; + +export function getMeta() { + return import.meta; +} diff --git a/js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js b/js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js new file mode 100644 index 0000000000..846cb1c016 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/import-meta-is-an-ordinary-object.js @@ -0,0 +1,80 @@ +// |reftest| module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-meta-properties-runtime-semantics-evaluation +description: > + import.meta is an ordinary object. +info: | + Runtime Semantics: Evaluation + + ImportMeta : import.meta + + ... + 4. If importMeta is undefined. + a. Set importMeta to ObjectCreate(null). + b. Let importMetaValues be ! HostGetImportMetaProperties(module). + ... + e. Perform ! HostFinalizeImportMeta(importMeta, module). + ... + g. Return importMeta. + ... +flags: [module] +features: [import.meta] +---*/ + +// import.meta is an object. +assert.sameValue(typeof import.meta, "object", + "typeof import.meta is 'object'"); +assert.notSameValue(import.meta, null, + "typeof import.meta is 'object' and import.meta isn't |null|."); + +assert.throws(TypeError, function() { + import.meta(); +}, "import.meta is not callable"); + +assert.throws(TypeError, function() { + new import.meta(); +}, "import.meta is not a constructor"); + +// Note: The properties, the shape of the properties, the extensibility state, and the prototype +// of import.meta are implementation-defined via HostGetImportMetaProperties and +// HostFinalizeImportMeta. + +// Properties and the prototype can only be modified when import.meta is extensible. +if (Object.isExtensible(import.meta)) { + assert.sameValue(Object.getOwnPropertyDescriptor(import.meta, "test262prop"), undefined, + "test262 test property is not present initially"); + + import.meta.test262prop = "blubb"; + + assert.sameValue(import.meta.test262prop, "blubb", + "Properties can be added and retrieved from import.meta"); + + assert.sameValue(delete import.meta.test262prop, true, + "Properties can be removed from import.meta"); + + assert.sameValue(Object.getOwnPropertyDescriptor(import.meta, "test262prop"), undefined, + "test262 test property is no longer present"); + + var proto = {}; + Object.setPrototypeOf(import.meta, proto); + + assert.sameValue(Object.getPrototypeOf(import.meta), proto, + "[[Prototype]] of import.meta can be changed"); +} + +Object.preventExtensions(import.meta); +assert.sameValue(Object.isExtensible(import.meta), false, + "import.meta is non-extensible after calling |Object.preventExtensions|"); + +Object.seal(import.meta); +assert.sameValue(Object.isSealed(import.meta), true, + "import.meta is sealed after calling |Object.seal|"); + +Object.freeze(import.meta); +assert.sameValue(Object.isFrozen(import.meta), true, + "import.meta is frozen after calling |Object.freeze|"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js b/js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js new file mode 100644 index 0000000000..f97ce5ab96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/not-accessible-from-direct-eval.js @@ -0,0 +1,19 @@ +// |reftest| module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + import.meta is not allowed in direct eval in module code. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +flags: [module] +features: [import.meta] +---*/ + +assert.throws(SyntaxError, function() { + eval("import.meta"); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/same-object-returned.js b/js/src/tests/test262/language/expressions/import.meta/same-object-returned.js new file mode 100644 index 0000000000..07cf9fc674 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/same-object-returned.js @@ -0,0 +1,37 @@ +// |reftest| module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-meta-properties-runtime-semantics-evaluation +description: > + The same import.meta object is returned for a module. +info: | + Runtime Semantics: Evaluation + + ImportMeta : import.meta + + 1. Let module be GetActiveScriptOrModule(). + ... + 3. Let importMeta be module.[[ImportMeta]]. + 4. If importMeta is undefined. + ... + f. Set module.[[ImportMeta]] to importMeta. + g. Return importMeta. + 5. Else, + a. Assert: Type(importMeta) is Object. + b. Return importMeta. +flags: [module] +features: [import.meta] +---*/ + +var a = import.meta; +var b = function() { return import.meta; }(); + +assert.sameValue(import.meta, a, + "import.meta accessed directly and accessed via variable declaration"); + +assert.sameValue(import.meta, b, + "import.meta accessed directly and accessed via function return value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/shell.js b/js/src/tests/test262/language/expressions/import.meta/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/browser.js b/js/src/tests/test262/language/expressions/import.meta/syntax/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js new file mode 100644 index 0000000000..cb09314662 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-import.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions +description: > + "import" in import.meta must not contain escape sequences. +info: | + 5.1.5 Grammar Notation + + Terminal symbols are shown in fixed width + font, both in the productions of the grammars and throughout this specification whenever the + text directly refers to such a terminal symbol. These are to appear in a script exactly as + written. All terminal symbol code points specified in this way are to be understood as the + appropriate Unicode code points from the Basic Latin range, as opposed to any similar-looking + code points from other Unicode ranges. + + 12.3 Left-Hand-Side Expressions + MetaProperty: + NewTarget + ImportMeta + + ImportMeta: + import.meta +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta] +---*/ + +$DONOTEVALUATE(); + +im\u0070ort.meta; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js new file mode 100644 index 0000000000..a8d1113425 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/escape-sequence-meta.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions +description: > + "meta" in import.meta must not contain escape sequences. +info: | + 5.1.5 Grammar Notation + + Terminal symbols are shown in fixed width + font, both in the productions of the grammars and throughout this specification whenever the + text directly refers to such a terminal symbol. These are to appear in a script exactly as + written. All terminal symbol code points specified in this way are to be understood as the + appropriate Unicode code points from the Basic Latin range, as opposed to any similar-looking + code points from other Unicode ranges. + + 12.3 Left-Hand-Side Expressions + MetaProperty: + NewTarget + ImportMeta + + ImportMeta: + import.meta +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta] +---*/ + +$DONOTEVALUATE(); + +import.m\u0065ta; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js new file mode 100644 index 0000000000..1826231385 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-function-params-or-body.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + An Syntax Error is thrown when the syntactic goal symbol is AsyncFunctionBody or FormalParameters. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +features: [import.meta, async-functions] +---*/ + +var AsyncFunction = async function(){}.constructor; + +assert.throws(SyntaxError, function() { + AsyncFunction("import.meta"); +}, "import.meta in AsyncFunctionBody"); + +assert.throws(SyntaxError, function() { + AsyncFunction("a = import.meta", ""); +}, "import.meta in FormalParameters"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js new file mode 100644 index 0000000000..72d0f3c906 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-async-generator-params-or-body.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + An Syntax Error is thrown when the syntactic goal symbol is AsyncGeneratorBody or FormalParameters. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +features: [import.meta, async-iteration] +---*/ + +var AsyncGenerator = async function*(){}.constructor; + +assert.throws(SyntaxError, function() { + AsyncGenerator("import.meta"); +}, "import.meta in AsyncGeneratorBody"); + +assert.throws(SyntaxError, function() { + AsyncGenerator("a = import.meta", ""); +}, "import.meta in FormalParameters"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js new file mode 100644 index 0000000000..b4076d355d --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-function-params-or-body.js @@ -0,0 +1,21 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + An Syntax Error is thrown when the syntactic goal symbol is FunctionBody or FormalParameters. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +features: [import.meta] +---*/ + +assert.throws(SyntaxError, function() { + Function("import.meta"); +}, "import.meta in FunctionBody"); + +assert.throws(SyntaxError, function() { + Function("a = import.meta", ""); +}, "import.meta in FormalParameters"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js new file mode 100644 index 0000000000..4ab91e4595 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-generator-params-or-body.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + An Syntax Error is thrown when the syntactic goal symbol is GeneratorBody or FormalParameters. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +features: [import.meta, generators] +---*/ + +var Generator = function*(){}.constructor; + +assert.throws(SyntaxError, function() { + Generator("import.meta"); +}, "import.meta in GeneratorBody"); + +assert.throws(SyntaxError, function() { + Generator("a = import.meta", ""); +}, "import.meta in FormalParameters"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js new file mode 100644 index 0000000000..5a0ff05649 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module-nested-function.js @@ -0,0 +1,19 @@ +// |reftest| module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + No SyntaxError is thrown when import.meta appears in nested functions in module scripts. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +flags: [module] +features: [import.meta] +---*/ + +function f() { + import.meta; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js new file mode 100644 index 0000000000..729b44cebe --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-module.js @@ -0,0 +1,17 @@ +// |reftest| module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + No early Syntax Error is thrown when the syntactic goal symbol is Module. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +flags: [module] +features: [import.meta] +---*/ + +import.meta; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js new file mode 100644 index 0000000000..e9527eb9c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/goal-script.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions-static-semantics-early-errors +description: > + An early Syntax Error is thrown when the syntactic goal symbol is Script. +info: | + It is an early Syntax Error if Module is not the syntactic goal symbol. +negative: + phase: parse + type: SyntaxError +features: [import.meta] +---*/ + +$DONOTEVALUATE(); + +import.meta; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js new file mode 100644 index 0000000000..d9bfcd5d6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-destructuring-expr.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 12.15.5.1 Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral + and AssignmentTargetType(LeftHandSideExpression) is not simple. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta, destructuring-assignment] +---*/ + +$DONOTEVALUATE(); + +[import.meta] = []; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js new file mode 100644 index 0000000000..6a271927e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-array-rest-destructuring-expr.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 12.15.5.1 Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral + and AssignmentTargetType(LeftHandSideExpression) is not simple. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta, destructuring-assignment] +---*/ + +$DONOTEVALUATE(); + +[...import.meta] = []; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js new file mode 100644 index 0000000000..859420a596 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-assignment-expr.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 12.15.1 Static Semantics: Early Errors + + AssignmentExpression : LeftHandSideExpression = AssignmentExpression + + It is an early Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an + ArrayLiteral and AssignmentTargetType of LeftHandSideExpression is invalid or strict. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta] +---*/ + +$DONOTEVALUATE(); + +import.meta = 0; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js new file mode 100644 index 0000000000..de0d8b0d25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-await-of-loop.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 13.7.5.1 Static Semantics: Early Errors + IterationStatement: + for await ( LeftHandSideExpression of AssignmentExpression ) Statement + + It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta, async-iteration] +---*/ + +$DONOTEVALUATE(); + +async function* f() { + for await (import.meta of null) ; +} diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js new file mode 100644 index 0000000000..3d1eb1d808 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-in-loop.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 13.7.5.1 Static Semantics: Early Errors + IterationStatement: + for ( LeftHandSideExpression in Expression ) Statement + + It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta] +---*/ + +$DONOTEVALUATE(); + +for (import.meta in null) ; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js new file mode 100644 index 0000000000..0ab4e78641 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-for-of-loop.js @@ -0,0 +1,31 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 13.7.5.1 Static Semantics: Early Errors + IterationStatement: + for ( LeftHandSideExpression of AssignmentExpression ) Statement + + It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta] +---*/ + +$DONOTEVALUATE(); + +for (import.meta of null) ; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js new file mode 100644 index 0000000000..1144cc9b2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-destructuring-expr.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 12.15.5.1 Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral + and AssignmentTargetType(LeftHandSideExpression) is not simple. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta, destructuring-assignment] +---*/ + +$DONOTEVALUATE(); + +({a: import.meta} = {}); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js new file mode 100644 index 0000000000..d07fa21af6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-object-rest-destructuring-expr.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 12.15.5.1 Static Semantics: Early Errors + + DestructuringAssignmentTarget : LeftHandSideExpression + + It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral + and AssignmentTargetType(LeftHandSideExpression) is not simple. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta, destructuring-assignment, object-rest] +---*/ + +$DONOTEVALUATE(); + +({...import.meta} = {}); diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js new file mode 100644 index 0000000000..226bcf80a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/import.meta/syntax/invalid-assignment-target-update-expr.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError module +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-static-semantics-static-semantics-assignmenttargettype +description: > + import.meta is not a valid assignment target. +info: | + Static Semantics: AssignmentTargetType + + ImportMeta: + import.meta + + Return invalid. + + 12.4.1 Static Semantics: Early Errors + + UpdateExpression: + LeftHandSideExpression++ + LeftHandSideExpression-- + + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is invalid or strict. +flags: [module] +negative: + phase: parse + type: SyntaxError +features: [import.meta] +---*/ + +$DONOTEVALUATE(); + +import.meta++; diff --git a/js/src/tests/test262/language/expressions/import.meta/syntax/shell.js b/js/src/tests/test262/language/expressions/import.meta/syntax/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A1.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A1.js new file mode 100644 index 0000000000..b304c8f2ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between RelationalExpression and "in" and + between "in" and ShiftExpression are allowed +es5id: 11.8.7_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("'MAX_VALUE'\u0009in\u0009Number") !== true) { + throw new Test262Error('#1: "MAX_VALUE"\\u0009in\\u0009Number === true'); +} + +//CHECK#2 +if (eval("'MAX_VALUE'\u000Bin\u000BNumber") !== true) { + throw new Test262Error('#2: "MAX_VALUE"\\u000Bin\\u000BNumber === true'); +} + +//CHECK#3 +if (eval("'MAX_VALUE'\u000Cin\u000CNumber") !== true) { + throw new Test262Error('#3: "MAX_VALUE"\\u000Cin\\u000CNumber === true'); +} + +//CHECK#4 +if (eval("'MAX_VALUE'\u0020in\u0020Number") !== true) { + throw new Test262Error('#4: "MAX_VALUE"\\u0020in\\u0020Number === true'); +} + +//CHECK#5 +if (eval("'MAX_VALUE'\u00A0in\u00A0Number") !== true) { + throw new Test262Error('#5: "MAX_VALUE"\\u00A0in\\u00A0Number === true'); +} + +//CHECK#6 +if (eval("'MAX_VALUE'\u000Ain\u000ANumber") !== true) { + throw new Test262Error('#6: "MAX_VALUE"\\u000Ain\\u000ANumber === true'); +} + +//CHECK#7 +if (eval("'MAX_VALUE'\u000Din\u000DNumber") !== true) { + throw new Test262Error('#7: "MAX_VALUE"\\u000Din\\u000DNumber === true'); +} + +//CHECK#8 +if (eval("'MAX_VALUE'\u2028in\u2028Number") !== true) { + throw new Test262Error('#8: "MAX_VALUE"\\u2028in\\u2028Number === true'); +} + +//CHECK#9 +if (eval("'MAX_VALUE'\u2029in\u2029Number") !== true) { + throw new Test262Error('#9: "MAX_VALUE"\\u2029in\\u2029Number === true'); +} + +//CHECK#10 +if (eval("'MAX_VALUE'\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029in\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Number") !== true) { + throw new Test262Error('#10: "MAX_VALUE"\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029in\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T1.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T1.js new file mode 100644 index 0000000000..97cff94304 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "in" uses GetValue +es5id: 11.8.7_A2.1_T1 +description: Either Expression is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ("MAX_VALUE" in Number !== true) { + throw new Test262Error('#1: "MAX_VALUE" in Number === true'); +} + +//CHECK#2 +var x = "MAX_VALUE"; +if (x in Number !== true) { + throw new Test262Error('#2: var x = "MAX_VALUE"; x in Number === true'); +} + +//CHECK#3 +var y = Number; +if ("MAX_VALUE" in y !== true) { + throw new Test262Error('#3: var y = Number; "MAX_VALUE" in y === true'); +} + +//CHECK#4 +var x = "MAX_VALUE"; +var y = Number; +if (x in y !== true) { + throw new Test262Error('#4: var x = "MAX_VALUE"; var y = Number; x in y === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T2.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T2.js new file mode 100644 index 0000000000..76bca7149e --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "in" uses GetValue +es5id: 11.8.7_A2.1_T2 +description: If GetBase(RelationalExpression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + MAX_VALUE in Number; + throw new Test262Error('#1.1: MAX_VALUE in Number throw ReferenceError. Actual: ' + (MAX_VALUE in Number)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: MAX_VALUE in Number throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T3.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T3.js new file mode 100644 index 0000000000..9b8129a6e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "in" uses GetValue +es5id: 11.8.7_A2.1_T3 +description: If GetBase(ShiftExpression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + "MAX_VALUE" in NUMBER; + throw new Test262Error('#1.1: "MAX_VALUE" in NUMBER throw ReferenceError. Actual: ' + ("MAX_VALUE" in NUMBER)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: "MAX_VALUE" in NUMBER throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T1.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T1.js new file mode 100644 index 0000000000..60c526eba5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.7_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var NUMBER = 0; +if ((NUMBER = Number, "MAX_VALUE") in NUMBER !== true) { + throw new Test262Error('#1: var NUMBER = 0; (NUMBER = Number, "MAX_VALUE") in NUMBER === true'); +} + +//CHECK#2 +var max_value = "MAX_VALUE"; +if (max_value in (max_value = "none", Number) !== true) { + throw new Test262Error('#2: var max_value = "MAX_VALUE"; max_value in (max_value = "none", Number) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T2.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T2.js new file mode 100644 index 0000000000..5abcc342bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.7_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() in y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() in y() throw "x". Actual: ' + (x() in y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() in y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T3.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T3.js new file mode 100644 index 0000000000..01aa3bff03 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.7_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + max_value in (max_value = "MAX_VALUE", Number); + throw new Test262Error('#1.1: max_value in (max_value = "MAX_VALUE", Number) throw ReferenceError. Actual: ' + (max_value in (max_value = "MAX_VALUE", Number))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: max_value in (max_value = "MAX_VALUE", Number) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T4.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T4.js new file mode 100644 index 0000000000..bdcd86784a --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.7_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((NUMBER = Number, "MAX_VALUE") in NUMBER !== true) { + throw new Test262Error('#1: (NUMBER = Number, "MAX_VALUE") in NUMBER !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A3.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A3.js new file mode 100644 index 0000000000..ea2be192d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A3.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ShiftExpression is not an object, throw TypeError +es5id: 11.8.7_A3 +description: Checking all the types of primitives +---*/ + +//CHECK#1 +try { + "toString" in true; + throw new Test262Error('#1: "toString" in true throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: "toString" in true throw TypeError'); + } +} + +//CHECK#2 +try { + "MAX_VALUE" in 1; + throw new Test262Error('#2: "MAX_VALUE" in 1 throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: "MAX_VALUE" in 1 throw TypeError'); + } +} + +//CHECK#3 +try { + "length" in "string"; + throw new Test262Error('#3: "length" in "string" throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: "length" in "string" throw TypeError'); + } +} + +//CHECK#4 +try { + "toString" in undefined; + throw new Test262Error('#4: "toString" in undefined throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#4: "toString" in undefined throw TypeError'); + } +} + +//CHECK#5 +try { + "toString" in null; + throw new Test262Error('#5: "toString" in null throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#5: "toString" in null throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S11.8.7_A4.js b/js/src/tests/test262/language/expressions/in/S11.8.7_A4.js new file mode 100644 index 0000000000..43c7f37227 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S11.8.7_A4.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "in" calls ToString(ShiftExpression) +es5id: 11.8.7_A4 +description: Checking ToString coversion; +---*/ + +//CHECK#1 +var object = {}; +object["true"] = 1; +if (true in object !== "true" in object) { + throw new Test262Error('#1: "var object = {}; object["true"] = 1; true in object === "true" in object'); +} + +//CHECK#2 +var object = {}; +object.Infinity = 1; +if (Infinity in object !== "Infinity" in object) { + throw new Test262Error('#2: "var object = {}; object.Infinity = 1; Infinity in object === "Infinity" in object'); +} + +//CHECK#4 +var object = {}; +object.undefined = 1; +if (undefined in object !== "undefined" in object) { + throw new Test262Error('#4: "var object = {}; object.undefined = 1; undefined in object === "undefined" in object'); +} + +//CHECK#5 +var object = {}; +object["null"] = 1; +if (null in object !== "null" in object) { + throw new Test262Error('#5: "var object = {}; object["null"] = 1; null in object === "null" in object'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S8.12.6_A1.js b/js/src/tests/test262/language/expressions/in/S8.12.6_A1.js new file mode 100644 index 0000000000..13ffeb62a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S8.12.6_A1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[HasProperty]] method of O is called with property name P and + if O has a property with name P, return true +es5id: 8.12.6_A1 +description: Try find existent property of any Object +---*/ + +var __obj={fooProp:"fooooooo"}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!("fooProp" in __obj)) { + throw new Test262Error('#1: var __obj={fooProp:"fooooooo"}; "fooProp" in __obj'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S8.12.6_A2_T1.js b/js/src/tests/test262/language/expressions/in/S8.12.6_A2_T1.js new file mode 100644 index 0000000000..64e1b60517 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S8.12.6_A2_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[HasProperty]] method of O is called with property name P and if O has not a property with name P + then If the [[Prototype]] of O is null, return false or call the [[HasProperty]] method of [[Prototype]] with property name P +es5id: 8.12.6_A2_T1 +description: Try find not existent property of any Object +---*/ + +var __obj={}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!("valueOf" in __obj)) { + throw new Test262Error('#1: var __obj={}; "valueOf" in __obj'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S8.12.6_A2_T2.js b/js/src/tests/test262/language/expressions/in/S8.12.6_A2_T2.js new file mode 100644 index 0000000000..b662ecedd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S8.12.6_A2_T2.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[HasProperty]] method of O is called with property name P and if O has not a property with name P + then If the [[Prototype]] of O is null, return false or call the [[HasProperty]] method of [[Prototype]] with property name P +es5id: 8.12.6_A2_T2 +description: > + Try find not existent property of any Object, but existent + property of this Object prototype +---*/ + +var __proto={phylum:"avis"}; + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!("valueOf" in __proto)) { + throw new Test262Error('#1: var __proto={phylum:"avis"}; "valueOf" in __proto'); +} +// +////////////////////////////////////////////////////////////////////////////// + +function Robin(){this.name="robin"}; +Robin.prototype=__proto; + +var __my__robin = new Robin; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (!("phylum" in __my__robin)) { + throw new Test262Error('#2: var __proto={phylum:"avis"}; function Robin(){this.name="robin"}; Robin.prototype=__proto; var __my__robin = new Robin; "phylum" in __my__robin'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__my__robin.hasOwnProperty("phylum")) { + throw new Test262Error('#3: var __proto={phylum:"avis"}; function Robin(){this.name="robin"}; Robin.prototype=__proto; var __my__robin = new Robin; __my__robin.hasOwnProperty("phylum") === false. Actual: ' + (__my__robin.hasOwnProperty("phylum"))); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/S8.12.6_A3.js b/js/src/tests/test262/language/expressions/in/S8.12.6_A3.js new file mode 100644 index 0000000000..c9aca7c8d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/S8.12.6_A3.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "[[hasProperty]] is sensitive to property existence but [[Get]] is not" +es5id: 8.12.6_A3 +description: > + Use [[hasProperty]] and [[Get]] for existent and not existent + properties +---*/ + +var __obj={}; __obj.hole=undefined; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.hole !== undefined) { + throw new Test262Error('#1: var __obj={}; __obj.hole=undefined; __obj.hole === undefined. Actual: ' + (__obj.hole)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__obj.notexist !== undefined) { + throw new Test262Error('#2: var __obj={}; __obj.hole=undefined; __obj.notexist === undefined. Actual: ' + (__obj.notexist)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (!("hole" in __obj)) { + throw new Test262Error('#3: var __obj={}; __obj.hole=undefined; "hole" in __obj'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (("notexist" in __obj)) { + throw new Test262Error('#4: var __obj={}; __obj.hole=undefined; "notexist" in __obj'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/browser.js b/js/src/tests/test262/language/expressions/in/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/in/private-field-in-nested.js b/js/src/tests/test262/language/expressions/in/private-field-in-nested.js new file mode 100644 index 0000000000..d49304e62e --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-in-nested.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Can't nest `in` expressions when the left-hand side is PrivateIdentifier. +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] +esid: sec-relational-operators +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +class C { + #field; + + constructor() { + #field in #field in this; + } +} diff --git a/js/src/tests/test262/language/expressions/in/private-field-in.js b/js/src/tests/test262/language/expressions/in/private-field-in.js new file mode 100644 index 0000000000..31a47f55ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-in.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Requires the `In` parsing parameter +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] +esid: sec-relational-operators-runtime-semantics-evaluation +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +class C { + #field; + + constructor() { + for (#field in value;;) break; + } +} diff --git a/js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-reference.js b/js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-reference.js new file mode 100644 index 0000000000..687165cc8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-reference.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Private identifiers aren't valid simple assignment references. +info: | + Syntax + for ( LeftHandSideExpression in Expression ) Statement +esid: sec-for-in-and-for-of-statements-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +class C { + #field; + + m() { + for (#field in []) ; + } +} diff --git a/js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-target.js b/js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-target.js new file mode 100644 index 0000000000..d788f5d9e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-invalid-assignment-target.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Rejected as assignment target +info: | + 12.10.5 Static Semantics: AllPrivateIdentifiersValid + + AllPrivateIdentifiersValid is an abstract operation which takes names as an argument. + + RelationalExpression:PrivateIdentifierinShiftExpression + + 1. If StringValue of PrivateIdentifier is in names, return true. + 2. Return false. + +esid: sec-relational-operators-runtime-semantics-evaluation +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +class C { + #field; + + constructor() { + #field in {} = 0; + } +} diff --git a/js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-complex.js b/js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-complex.js new file mode 100644 index 0000000000..802f539efe --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-complex.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Invalid private identifier - complex case +info: | + 12.10.5 Static Semantics: AllPrivateIdentifiersValid + + AllPrivateIdentifiersValid is an abstract operation which takes names as an argument. + + RelationalExpression:PrivateIdentifierinShiftExpression + + 1. If StringValue of PrivateIdentifier is in names, return true. + 2. Return false. + +esid: sec-relational-operators-runtime-semantics-evaluation +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +class C { + #a; + + constructor() { + #b in {}; + } +} diff --git a/js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-simple.js b/js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-simple.js new file mode 100644 index 0000000000..db3365eea9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-invalid-identifier-simple.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Invalid private identifier - simple case +info: | + 12.10.5 Static Semantics: AllPrivateIdentifiersValid + + AllPrivateIdentifiersValid is an abstract operation which takes names as an argument. + + RelationalExpression:PrivateIdentifierinShiftExpression + + 1. If StringValue of PrivateIdentifier is in names, return true. + 2. Return false. + +esid: sec-relational-operators-runtime-semantics-evaluation +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +#name in {}; diff --git a/js/src/tests/test262/language/expressions/in/private-field-invalid-rhs.js b/js/src/tests/test262/language/expressions/in/private-field-invalid-rhs.js new file mode 100644 index 0000000000..fb8783d019 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-invalid-rhs.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Syntactic grammar restricts right-hand side +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] +esid: sec-relational-operators-runtime-semantics-evaluation +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +class C { + #field; + + constructor() { + #field in () => {}; + } +} diff --git a/js/src/tests/test262/language/expressions/in/private-field-presence-accessor-shadowed.js b/js/src/tests/test262/language/expressions/in/private-field-presence-accessor-shadowed.js new file mode 100644 index 0000000000..29a33b9b2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-presence-accessor-shadowed.js @@ -0,0 +1,49 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Value when private name describes an accessor method +info: | + 7. Let privateName be ? GetValue(privateNameBinding). + 8. Assert: privateName is a Private Name. + [...] + 10. Else, + a. Assert: privateName.[[Kind]] is "method" or "accessor". + b. If PrivateBrandCheck(rval, privateName) is not an abrupt completion, + then return true. + 11. Return false. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-static-methods-private, class-fields-private-in] +---*/ + +let Child; +let parentCount = 0; +let childCount = 0; + +class Parent { + get #accessor() { + parentCount += 1; + } + + static init() { + Child = class { + get #accessor() { + childCount += 1; + } + + static isNameIn(value) { + return #accessor in value; + } + }; + } +} + +Parent.init(); + +assert.sameValue(Child.isNameIn(new Parent()), false); +assert.sameValue(parentCount, 0, 'parent accessor not invoked'); +assert.sameValue(Child.isNameIn(new Child()), true); +assert.sameValue(childCount, 0, 'child accessor not invoked'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-presence-accessor.js b/js/src/tests/test262/language/expressions/in/private-field-presence-accessor.js new file mode 100644 index 0000000000..f684525631 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-presence-accessor.js @@ -0,0 +1,35 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Value when private name describes an accessor method +info: | + 7. Let privateName be ? GetValue(privateNameBinding). + 8. Assert: privateName is a Private Name. + [...] + 10. Else, + a. Assert: privateName.[[Kind]] is "method" or "accessor". + b. If PrivateBrandCheck(rval, privateName) is not an abrupt completion, + then return true. + 11. Return false. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-static-methods-private, class-fields-private-in] +---*/ + +let count = 0; + +class Class { + get #accessor() { + count += 1; + } + + static isNameIn(value) { + return #accessor in value; + } +} + +assert.sameValue(Class.isNameIn({}), false); +assert.sameValue(Class.isNameIn(new Class()), true); +assert.sameValue(count, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-presence-field-shadowed.js b/js/src/tests/test262/language/expressions/in/private-field-presence-field-shadowed.js new file mode 100644 index 0000000000..805ce61193 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-presence-field-shadowed.js @@ -0,0 +1,38 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Value when private name describes a field +info: | + 7. Let privateName be ? GetValue(privateNameBinding). + 8. Assert: privateName is a Private Name. + 9. If privateName.[[Kind]] is "field", + a. If ! PrivateFieldFind(privateName, rval) is not empty, then return true. + [...] + 11. Return false. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-fields-private, class-fields-private-in] +---*/ + +let Child; + +class Parent { + #field; + + static init() { + Child = class { + #field; + + static isNameIn(value) { + return #field in value; + } + }; + } +} + +Parent.init(); + +assert.sameValue(Child.isNameIn(new Parent()), false); +assert.sameValue(Child.isNameIn(new Child()), true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-presence-field.js b/js/src/tests/test262/language/expressions/in/private-field-presence-field.js new file mode 100644 index 0000000000..50a24a6aa5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-presence-field.js @@ -0,0 +1,28 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Value when private name describes a field +info: | + 7. Let privateName be ? GetValue(privateNameBinding). + 8. Assert: privateName is a Private Name. + 9. If privateName.[[Kind]] is "field", + a. If ! PrivateFieldFind(privateName, rval) is not empty, then return true. + [...] + 11. Return false. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-fields-private, class-fields-private-in] +---*/ + +class Class { + #field; + + static isNameIn(value) { + return #field in value; + } +} + +assert.sameValue(Class.isNameIn({}), false); +assert.sameValue(Class.isNameIn(new Class()), true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-presence-method-shadowed.js b/js/src/tests/test262/language/expressions/in/private-field-presence-method-shadowed.js new file mode 100644 index 0000000000..7d12504b05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-presence-method-shadowed.js @@ -0,0 +1,48 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Value when private name describes a method +info: | + 7. Let privateName be ? GetValue(privateNameBinding). + 8. Assert: privateName is a Private Name. + [...] + 10. Else, + a. Assert: privateName.[[Kind]] is "method" or "accessor". + b. If PrivateBrandCheck(rval, privateName) is not an abrupt completion, + then return true. + 11. Return false. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-methods-private, class-fields-private-in] +---*/ + +let Child; +let parentCount = 0; +let childCount = 0; + +class Parent { + #method() { + parentCount += 1; + } + + static init() { + Child = class { + #method() { + childCount += 1; + } + + static isNameIn(value) { + return #method in value; + } + }; + } +} + +Parent.init(); + +assert.sameValue(Child.isNameIn(new Parent()), false); +assert.sameValue(parentCount, 0, 'parent method not invoked'); +assert.sameValue(Child.isNameIn(new Child()), true); +assert.sameValue(childCount, 0, 'child method not invoked'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-presence-method.js b/js/src/tests/test262/language/expressions/in/private-field-presence-method.js new file mode 100644 index 0000000000..c736fa5a95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-presence-method.js @@ -0,0 +1,35 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Value when private name describes a method +info: | + 7. Let privateName be ? GetValue(privateNameBinding). + 8. Assert: privateName is a Private Name. + [...] + 10. Else, + a. Assert: privateName.[[Kind]] is "method" or "accessor". + b. If PrivateBrandCheck(rval, privateName) is not an abrupt completion, + then return true. + 11. Return false. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-methods-private, class-fields-private-in] +---*/ + +let count = 0; + +class Class { + #method() { + count += 1; + } + + static isNameIn(value) { + return #method in value; + } +} + +assert.sameValue(Class.isNameIn({}), false); +assert.sameValue(Class.isNameIn(new Class()), true); +assert.sameValue(count, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-rhs-await-absent.js b/js/src/tests/test262/language/expressions/in/private-field-rhs-await-absent.js new file mode 100644 index 0000000000..c2b12ad402 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-rhs-await-absent.js @@ -0,0 +1,41 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Parsing observes the `Await` production parameter when absent +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] + + [...] + + 1. Let privateIdentifier be the StringValue of PrivateIdentifier. + 2. Let rref be the result of evaluating ShiftExpression. + 3. Let rval be ? GetValue(rref). + 4. If Type(rval) is not Object, throw a TypeError exception. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-fields-private, class-fields-private-in] +---*/ + +let value; +function await() { + return value; +} + +class C { + #field; + + static isNameIn() { + return #field in await(null); + } +} + +value = new C(); +assert.sameValue(C.isNameIn(), true); + +value = {}; +assert.sameValue(C.isNameIn(), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-rhs-await-present.js b/js/src/tests/test262/language/expressions/in/private-field-rhs-await-present.js new file mode 100644 index 0000000000..a67c90218d --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-rhs-await-present.js @@ -0,0 +1,40 @@ +// |reftest| async +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Parsing observes the `Await` production parameter when present +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] + + [...] + + 1. Let privateIdentifier be the StringValue of PrivateIdentifier. + 2. Let rref be the result of evaluating ShiftExpression. + 3. Let rval be ? GetValue(rref). + 4. If Type(rval) is not Object, throw a TypeError exception. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-fields-private, class-fields-private-in] +flags: [async] +---*/ + +class C { + #field; + + static async isNameIn(value) { + return #field in await(value); + } +} + +C.isNameIn(new C()) + .then(function(result) { + assert.sameValue(result, true); + + return C.isNameIn({}); + }) + .then(function(result) { + assert.sameValue(result, false); + }).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/in/private-field-rhs-non-object.js b/js/src/tests/test262/language/expressions/in/private-field-rhs-non-object.js new file mode 100644 index 0000000000..db510e2106 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-rhs-non-object.js @@ -0,0 +1,53 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Algorithm interrupted by non-object right-hand side +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] + + [...] + + 1. Let privateIdentifier be the StringValue of PrivateIdentifier. + 2. Let rref be the result of evaluating ShiftExpression. + 3. Let rval be ? GetValue(rref). + 4. If Type(rval) is not Object, throw a TypeError exception. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-fields-private, class-fields-private-in] +---*/ + +let caught = null; + +class C { + #field; + + constructor() { + try { + /** + * Using a ShiftExpression to produce the non-object value verifies that + * the implementation uses the operator precedence implied by the + * syntactic grammar. In other words, the following statement should be + * interpreted as: + * + * #field in ({} << 0); + * + * ...rather than: + * + * (#field in {}) << 0; + */ + #field in {} << 0; + } catch (error) { + caught = error; + } + } +} + +new C(); + +assert.notSameValue(caught, null); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-rhs-unresolvable.js b/js/src/tests/test262/language/expressions/in/private-field-rhs-unresolvable.js new file mode 100644 index 0000000000..f76cd96882 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-rhs-unresolvable.js @@ -0,0 +1,32 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Algorithm interrupted by unresolvable reference +info: | + 1. Let privateIdentifier be the StringValue of PrivateIdentifier. + 2. Let rref be the result of evaluating ShiftExpression. + 3. Let rval be ? GetValue(rref). +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-fields-private, class-fields-private-in] +---*/ + +let caught = null; + +class C { + #field; + constructor() { + try { + #field in test262unresolvable; + } catch (error) { + caught = error; + } + } +} + +new C(); + +assert.notSameValue(caught, null); +assert.sameValue(caught.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/private-field-rhs-yield-absent.js b/js/src/tests/test262/language/expressions/in/private-field-rhs-yield-absent.js new file mode 100644 index 0000000000..77ee26a61f --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-rhs-yield-absent.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Parsing observes the `Yield` production parameter when present +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] + + [...] + + 1. Let privateIdentifier be the StringValue of PrivateIdentifier. + 2. Let rref be the result of evaluating ShiftExpression. + 3. Let rval be ? GetValue(rref). + 4. If Type(rval) is not Object, throw a TypeError exception. +esid: sec-relational-operators-runtime-semantics-evaluation +negative: + phase: parse + type: SyntaxError +features: [class-fields-private, class-fields-private-in] +---*/ + +$DONOTEVALUATE(); + +class C { + #field; + + static method() { + #field in yield; + } +} diff --git a/js/src/tests/test262/language/expressions/in/private-field-rhs-yield-present.js b/js/src/tests/test262/language/expressions/in/private-field-rhs-yield-present.js new file mode 100644 index 0000000000..7ab2272328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/private-field-rhs-yield-present.js @@ -0,0 +1,38 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Parsing observes the `Yield` production parameter when present +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In]PrivateIdentifier in ShiftExpression[?Yield, ?Await] + + [...] + + 1. Let privateIdentifier be the StringValue of PrivateIdentifier. + 2. Let rref be the result of evaluating ShiftExpression. + 3. Let rval be ? GetValue(rref). + 4. If Type(rval) is not Object, throw a TypeError exception. +esid: sec-relational-operators-runtime-semantics-evaluation +features: [class-fields-private, class-fields-private-in] +---*/ + +class C { + #field; + + static *isNameIn() { + return #field in (yield); + } +} + +let iter1 = C.isNameIn(); +iter1.next(); +assert.sameValue(iter1.next(new C()).value, true); + +let iter2 = C.isNameIn(); +iter2.next(); +assert.sameValue(iter2.next({}).value, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/rhs-yield-absent-non-strict.js b/js/src/tests/test262/language/expressions/in/rhs-yield-absent-non-strict.js new file mode 100644 index 0000000000..7e5cbae2b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/rhs-yield-absent-non-strict.js @@ -0,0 +1,32 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Parsing observes the `Yield` production parameter when absent (without strict mode) +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await] + + [...] + + 1. Let lref be the result of evaluating RelationalExpression. + 2. Let lval be ? GetValue(lref). + 3. Let rref be the result of evaluating ShiftExpression. + 4. Let rval be ? GetValue(rref). + 5. If Type(rval) is not Object, throw a TypeError exception. + 6. Return ? HasProperty(rval, ? ToPropertyKey(lval)). +esid: sec-relational-operators +flags: [noStrict] +---*/ + +var yield; + +yield = {'': 0}; +assert.sameValue('' in (yield), true); + +yield = {}; +assert.sameValue('' in (yield), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/rhs-yield-absent-strict-strict.js b/js/src/tests/test262/language/expressions/in/rhs-yield-absent-strict-strict.js new file mode 100644 index 0000000000..cac0db7e1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/rhs-yield-absent-strict-strict.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Parsing observes the `Yield` production parameter when absent (within strict mode) +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await] +esid: sec-relational-operators +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +'' in (yield); diff --git a/js/src/tests/test262/language/expressions/in/rhs-yield-present.js b/js/src/tests/test262/language/expressions/in/rhs-yield-present.js new file mode 100644 index 0000000000..e3fec252bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/in/rhs-yield-present.js @@ -0,0 +1,35 @@ +// Copyright 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Parsing observes the `Yield` production parameter when present +info: | + Syntax + RelationalExpression[In, Yield, Await]: + [...] + [+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await] + + [...] + + 1. Let lref be the result of evaluating RelationalExpression. + 2. Let lval be ? GetValue(lref). + 3. Let rref be the result of evaluating ShiftExpression. + 4. Let rval be ? GetValue(rref). + 5. If Type(rval) is not Object, throw a TypeError exception. + 6. Return ? HasProperty(rval, ? ToPropertyKey(lval)). +esid: sec-relational-operators-runtime-semantics-evaluation +---*/ + +function * isNameIn() { + return '' in (yield); +} + +let iter1 = isNameIn(); +iter1.next(); +assert.sameValue(iter1.next({'': 0}).value, true); + +let iter2 = isNameIn(); +iter2.next(); +assert.sameValue(iter2.next({}).value, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/in/shell.js b/js/src/tests/test262/language/expressions/in/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js new file mode 100644 index 0000000000..5b300bd5f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between RelationalExpression and + "instanceof" and between "instanceof" and ShiftExpression are allowed +es5id: 11.8.6_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("({})\u0009instanceof\u0009Object") !== true) { + throw new Test262Error('#1: ({})\\u0009instanceof\\u0009Object === true'); +} + +//CHECK#2 +if (eval("({})\u000Binstanceof\u000BObject") !== true) { + throw new Test262Error('#2: ({})\\u000Binstanceof\\u000BObject === true'); +} + +//CHECK#3 +if (eval("({})\u000Cinstanceof\u000CObject") !== true) { + throw new Test262Error('#3: ({})\\u000Cinstanceof\\u000CObject === true'); +} + +//CHECK#4 +if (eval("({})\u0020instanceof\u0020Object") !== true) { + throw new Test262Error('#4: ({})\\u0020instanceof\\u0020Object === true'); +} + +//CHECK#5 +if (eval("({})\u00A0instanceof\u00A0Object") !== true) { + throw new Test262Error('#5: ({})\\u00A0instanceof\\u00A0Object === true'); +} + +//CHECK#6 +if (eval("({})\u000Ainstanceof\u000AObject") !== true) { + throw new Test262Error('#6: ({})\\u000Ainstanceof\\u000AObject === true'); +} + +//CHECK#7 +if (eval("({})\u000Dinstanceof\u000DObject") !== true) { + throw new Test262Error('#7: ({})\\u000Dinstanceof\\u000DObject === true'); +} + +//CHECK#8 +if (eval("({})\u2028instanceof\u2028Object") !== true) { + throw new Test262Error('#8: ({})\\u2028instanceof\\u2028Object === true'); +} + +//CHECK#9 +if (eval("({})\u2029instanceof\u2029Object") !== true) { + throw new Test262Error('#9: ({})\\u2029instanceof\\u2029Object === true'); +} + +//CHECK#10 +if (eval("({})\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029instanceof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Object") !== true) { + throw new Test262Error('#10: ({})\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029instanceof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Object === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js new file mode 100644 index 0000000000..5d4dd549f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "instanceof" uses GetValue +es5id: 11.8.6_A2.1_T1 +description: Either Expression is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (({}) instanceof Object !== true) { + throw new Test262Error('#1: ({}) instanceof Object === true'); +} + +//CHECK#2 +var object = {}; +if (object instanceof Object !== true) { + throw new Test262Error('#2: var object = {}; object instanceof Object === true'); +} + +//CHECK#3 +var OBJECT = Object; +if (({}) instanceof OBJECT !== true) { + throw new Test262Error('#3: var OBJECT = Object; ({}) instanceof OBJECT === true'); +} + +//CHECK#4 +var object = {}; +var OBJECT = Object; +if (object instanceof OBJECT !== true) { + throw new Test262Error('#4: var object = {}; var OBJECT = Object; object instanceof OBJECT === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js new file mode 100644 index 0000000000..b5beec2aa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "instanceof" uses GetValue +es5id: 11.8.6_A2.1_T2 +description: If GetBase(RelationalExpression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + object instanceof Object; + throw new Test262Error('#1.1: object instanceof Object throw ReferenceError. Actual: ' + (object instanceof Object)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: object instanceof Object throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js new file mode 100644 index 0000000000..7e6c7c9abb --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "instanceof" uses GetValue +es5id: 11.8.6_A2.1_T3 +description: If GetBase(ShiftExpression) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + ({}) instanceof OBJECT; + throw new Test262Error('#1.1: ({}) instanceof OBJECT throw ReferenceError. Actual: ' + (({}) instanceof OBJECT)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: ({}) instanceof OBJECT throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js new file mode 100644 index 0000000000..484c95d115 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.6_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var OBJECT = 0; +if ((OBJECT = Object, {}) instanceof OBJECT !== true) { + throw new Test262Error('#1: var OBJECT = 0; (OBJECT = Object, {}) instanceof OBJECT === true'); +} + +//CHECK#2 +var object = {}; +if (object instanceof (object = 0, Object) !== true) { + throw new Test262Error('#2: var object = {}; object instanceof (object = 0, Object) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js new file mode 100644 index 0000000000..5321562c89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.6_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() instanceof y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() instanceof y() throw "x". Actual: ' + (x() instanceof y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() instanceof y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js new file mode 100644 index 0000000000..b9a29bbc04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.6_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + object instanceof (object = {}, Object); + throw new Test262Error('#1.1: object instanceof (object = {}, Object) throw ReferenceError. Actual: ' + (object instanceof (object = {}, Object))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: object instanceof (object = {}, Object) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js new file mode 100644 index 0000000000..3f68f87c3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.6_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((OBJECT = Object, {}) instanceof OBJECT !== true) { + throw new Test262Error('#1: (OBJECT = Object, {}) instanceof OBJECT !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js new file mode 100644 index 0000000000..5857fdd84f --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A3.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ShiftExpression is not an object, throw TypeError +es5id: 11.8.6_A3 +description: Checking all the types of primitives +---*/ + +//CHECK#1 +try { + true instanceof true; + throw new Test262Error('#1: true instanceof true throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + throw new Test262Error('#1: true instanceof true throw TypeError'); + } +} + +//CHECK#2 +try { + 1 instanceof 1; + throw new Test262Error('#2: 1 instanceof 1 throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + throw new Test262Error('#2: 1 instanceof 1 throw TypeError'); + } +} + +//CHECK#3 +try { + "string" instanceof "string"; + throw new Test262Error('#3: "string" instanceof "string" throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + throw new Test262Error('#3: "string" instanceof "string" throw TypeError'); + } +} + +//CHECK#4 +try { + undefined instanceof undefined; + throw new Test262Error('#4: undefined instanceof undefined throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + throw new Test262Error('#4: undefined instanceof undefined throw TypeError'); + } +} + +//CHECK#5 +try { + null instanceof null; + throw new Test262Error('#5: null instanceof null throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + throw new Test262Error('#5: null instanceof null throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js new file mode 100644 index 0000000000..f0e7e51296 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Only constructor call (with "new" keyword) makes instance +es5id: 11.8.6_A4_T1 +description: Checking Boolean case +---*/ + +//CHECK#1 +if (false instanceof Boolean) { + throw new Test262Error('#1: false is not instanceof Boolean'); +} + +//CHECK#2 +if (Boolean(false) instanceof Boolean) { + throw new Test262Error('#2: Boolean(false) is not instanceof Boolean'); +} + +//CHECK#3 +if (new Boolean instanceof Boolean !== true) { + throw new Test262Error('#3: new Boolean instanceof Boolean'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js new file mode 100644 index 0000000000..a37e0c0011 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Only constructor call (with "new" keyword) makes instance +es5id: 11.8.6_A4_T2 +description: Checking Number case +---*/ + +//CHECK#1 +if (0 instanceof Number) { + throw new Test262Error('#1: 0 is not instanceof Number'); +} + +//CHECK#2 +if (Number(0) instanceof Number) { + throw new Test262Error('#2: Number(0) is not instanceof Number'); +} + +//CHECK#3 +if (new Number instanceof Number !== true) { + throw new Test262Error('#3: new Number instanceof Number'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js new file mode 100644 index 0000000000..cd8fd0e05a --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A4_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Only constructor call (with "new" keyword) makes instance +es5id: 11.8.6_A4_T3 +description: Checking String case +---*/ + +//CHECK#1 +if ("" instanceof String) { + throw new Test262Error('#1: "" is not instanceof String'); +} + +//CHECK#2 +if (String("") instanceof String) { + throw new Test262Error('#2: String("") is not instanceof String'); +} + +//CHECK#3 +if (new String instanceof String !== true) { + throw new Test262Error('#3: new String instanceof String'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js new file mode 100644 index 0000000000..b8055648b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: TypeError is subclass of Error from instanceof operator point of view +es5id: 11.8.6_A5_T1 +description: Checking Error case +---*/ + +var __err = new Error; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__err instanceof Error)) { + throw new Test262Error('#1: TypeError is subclass of Error from instanceof operator point of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__err instanceof TypeError) { + throw new Test262Error('#2: TypeError is subclass of Error from instanceof operator point of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + +var err__ = Error('failed'); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (!(err__ instanceof Error)) { + throw new Test262Error('#3: TypeError is subclass of Error from instanceof operator point of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (err__ instanceof TypeError) { + throw new Test262Error('#4: TypeError is subclass of Error from instanceof operator point of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js new file mode 100644 index 0000000000..8ecfa573cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A5_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: TypeError is subclass of Error from instanceof operator point of view +es5id: 11.8.6_A5_T2 +description: Checking TypeError case +---*/ + +var __t__err = new TypeError; + +//CHECK#1 +if (!(__t__err instanceof Error)) { + throw new Test262Error('#1: TypeError is subclass of Error from instanceof operator point of view'); +} + +//CHECK#2 +if (!(__t__err instanceof TypeError)) { + throw new Test262Error('#2: TypeError is subclass of Error from instanceof operator point of view'); +} + +////////////////////////////////////////////////////////////////////////////// +var err__t__ = TypeError('failed'); + +//CHECK#3 +if (!(err__t__ instanceof Error)) { + throw new Test262Error('#3: TypeError is subclass of Error from instanceof operator point of view'); +} + +//CHECK#4 +if (!(err__t__ instanceof TypeError)) { + throw new Test262Error('#4: TypeError is subclass of Error from instanceof operator point of view'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js new file mode 100644 index 0000000000..1897ee35c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T1.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Only Function objects implement [[HasInstance]] and can be proper + ShiftExpression for the "instanceof" operator consequently +es5id: 11.8.6_A6_T1 +description: Checking "this" case +---*/ + +//CHECK#1 +try{ + ({}) instanceof this; + throw new Test262Error('#1: Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} +catch(e){ + if (e instanceof TypeError !== true) { + throw new Test262Error('#1: Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js new file mode 100644 index 0000000000..6752c71839 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Only Function objects implement [[HasInstance]] and can be proper + ShiftExpression for the "instanceof" operator consequently +es5id: 11.8.6_A6_T2 +description: Checking Math case +---*/ + +//CHECK#1 +try{ + 1 instanceof Math; + throw new Test262Error('#1: 1 instanceof Math throw TypeError'); +} +catch(e){ + if (e instanceof TypeError !== true) { + throw new Test262Error('#1: 1 instanceof Math throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js new file mode 100644 index 0000000000..96cc036457 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Only Function objects implement [[HasInstance]] and can be proper + ShiftExpression for the "instanceof" operator consequently +es5id: 11.8.6_A6_T3 +description: Checking if RelationalExpression is function +---*/ + +function MyFunct(){return 0}; + +//CHECK#1 +if (MyFunct instanceof MyFunct){ + throw new Test262Error('#1 function MyFunct(){return 0}; MyFunct instanceof MyFunct === false'); +} + +//CHECK#2 +if (MyFunct instanceof Function !== true){ + throw new Test262Error('#2 function MyFunct(){return 0}; MyFunct instanceof Function === true'); +} + +//CHECK#3 +if (MyFunct instanceof Object !== true){ + throw new Test262Error('#3 function MyFunct(){return 0}; MyFunct instanceof Object === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js new file mode 100644 index 0000000000..f72e4a43f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A6_T4.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Only Function objects implement [[HasInstance]] and can be proper + ShiftExpression for the "instanceof" operator consequently +es5id: 11.8.6_A6_T4 +description: Checking if RelationalExpression is object +---*/ + +var MyFunct = function(){}; +var __my__funct = new MyFunct; + + +//CHECK#1 +if (!(__my__funct instanceof MyFunct)){ + throw new Test262Error('#1 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} + +//CHECK#2 +if (__my__funct instanceof Function){ + throw new Test262Error('#2 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} + +//CHECK#3 +if (!(__my__funct instanceof Object)){ + throw new Test262Error('#3 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} + +//CHECK#4 +try{ + __my__funct instanceof __my__funct; + throw new Test262Error('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} +catch(e){ + if (e instanceof TypeError !== true) { + throw new Test262Error('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js new file mode 100644 index 0000000000..842d23762c --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When "instanceof" returns true it means that + GetValue(RelationalExpression) is constructed with ShiftExpression +es5id: 11.8.6_A7_T1 +description: Checking Object object +---*/ + +var __obj={}; + +//CHECK#1 +if (!(__obj instanceof Object)) { + throw new Test262Error('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +//CHECK#2 +if (__obj.constructor !== Object) { + throw new Test262Error('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js new file mode 100644 index 0000000000..e27c76e779 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When "instanceof" returns true it means that + GetValue(RelationalExpression) is constructed with ShiftExpression +es5id: 11.8.6_A7_T2 +description: Checking Array object +---*/ + +var __arr=[]; + +//CHECK#1 +if (!(__arr instanceof Array)) { + throw new Test262Error('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +//CHECK#2 +if (__arr.constructor !== Array) { + throw new Test262Error('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js new file mode 100644 index 0000000000..17b80eae7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S11.8.6_A7_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When "instanceof" returns true it means that + GetValue(RelationalExpression) is constructed with ShiftExpression +es5id: 11.8.6_A7_T3 +description: Checking Function object +---*/ + +var __func = new Function; + +//CHECK#1 +if (!(__func instanceof Function)) { + throw new Test262Error('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +//CHECK#2 +if (__func.constructor !== Function) { + throw new Test262Error('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js new file mode 100644 index 0000000000..254bb0fec9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T1 +description: V is number +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((1 instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js new file mode 100644 index 0000000000..f533326181 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T2 +description: V is string +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if (("1" instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js new file mode 100644 index 0000000000..6ff9336099 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T3 +description: V is boolean true +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((true instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js new file mode 100644 index 0000000000..f326d90b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T4.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T4 +description: V is boolean false +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((false instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js new file mode 100644 index 0000000000..5ea46544db --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T5.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T5 +description: V is void 0 +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((void 0 instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js new file mode 100644 index 0000000000..5cf1da10d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T6.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T6 +description: V is null +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((null instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js new file mode 100644 index 0000000000..940d51c3ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T7.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T7 +description: V is undefined +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((undefined instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js new file mode 100644 index 0000000000..38f4897df5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A1_T8.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is + called with value V, the following steps are taken: i) If V is not an + object, return false +es5id: 15.3.5.3_A1_T8 +description: V is undefined variable +---*/ + +var FACTORY; +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((x instanceof FACTORY)!==false) { + throw new Test262Error('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +var x; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js new file mode 100644 index 0000000000..e1deedadec --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken: + i) Call the [[Get]] method of F with property name "prototype". + ii) Let O be Result(i). + iii) O is not an object, throw a TypeError exception +es5id: 15.3.5.3_A2_T2 +description: F.prototype is undefined, and V is empty object +---*/ + +var FACTORY; +FACTORY = new Function; + +FACTORY.prototype = undefined; + +var obj; +obj={}; + +//CHECK#1 +try { + obj instanceof FACTORY; + throw new Test262Error('#1: O is not an object, throw a TypeError exception'); +} catch (e) { + if (!(e instanceof TypeError)) { + throw new Test262Error('#1.1: O is not an object, throw a TypeError exception'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js new file mode 100644 index 0000000000..0304818c15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T5.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of + F is called with value V and V is an object, the following steps + are taken: i) Call the [[Get]] method of F with property name + "prototype". ii) Let O be Result(i). iii) O is not an object, + throw a TypeError exception +es5id: 15.3.5.3_A2_T5 +description: F.prototype is void 0, and V is new F +---*/ + +var FACTORY; +FACTORY = Function("this.prop=1;"); + +FACTORY.prototype.name = "fairy"; + +var instance; +instance = new FACTORY; + +FACTORY.prototype = void 0; + +// CHECK#1 +try { + instance instanceof FACTORY; + throw new Test262Error('#1: O is not an object, throw a TypeError exception'); +} catch (e) { + if (!(e instanceof TypeError)) { + throw new Test262Error('#1.1: O is not an object, throw a TypeError exception'); + } +} + +// CHECK#2 +if ((instance.constructor !== FACTORY) || (instance.name !== "fairy")) { + throw new Test262Error('#2: instance.constructor === FACTORY'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js new file mode 100644 index 0000000000..602bf2a033 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A2_T6.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of + F is called with value V and V is an object, the following steps + are taken: i) Call the [[Get]] method of F with property name + "prototype". ii) Let O be Result(i). iii) O is not an object, + throw a TypeError exception +es5id: 15.3.5.3_A2_T6 +description: F.prototype is string, and V is function +---*/ + +var FACTORY; +FACTORY = new Function; + +FACTORY.prototype = "error"; + +// CHECK#1 +try { + ( function() { + }) instanceof FACTORY; + throw new Test262Error('#1: O is not an object, throw a TypeError exception'); +} catch (e) { + if (!(e instanceof TypeError)) { + throw new Test262Error('#1.1: O is not an object, throw a TypeError exception'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js new file mode 100644 index 0000000000..a560afc77a --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T1.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken: + i) Call the [[Get]] method of F with property name "prototype". + ii) Let O be Result(i) and O is an object. + iii) Let V be the value of the [[Prototype]] property of V. + iv) If V is null, return false. + v) If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true. + vi) Go to step iii) +es5id: 15.3.5.3_A3_T1 +description: F.prototype.type is 1, and V is new F +---*/ + +var FACTORY; +FACTORY = Function("this.name=\"root\""); + +FACTORY.prototype.type=1; + +var instance; +instance = new FACTORY; + +//CHECK#1 +if (!(instance instanceof FACTORY)) { + throw new Test262Error('#1: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js new file mode 100644 index 0000000000..f4eea724ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/S15.3.5.3_A3_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken: + i) Call the [[Get]] method of F with property name "prototype". + ii) Let O be Result(i) and O is an object. + iii) Let V be the value of the [[Prototype]] property of V. + iv) If V is null, return false. + v) If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true. + vi) Go to step iii) +es5id: 15.3.5.3_A3_T2 +description: F.prototype is Object.prototype, and V is empty object +---*/ + +var FAKEFACTORY; +FAKEFACTORY = Function(); + +var fakeinstance; +fakeinstance = {}; + +//CHECK#1 +if (fakeinstance instanceof FAKEFACTORY) { + throw new Test262Error('#1: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true'); +} + +FAKEFACTORY.prototype=Object.prototype; + +//CHECK#2 +if (!(fakeinstance instanceof FAKEFACTORY)) { + throw new Test262Error('#2: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/browser.js b/js/src/tests/test262/language/expressions/instanceof/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js new file mode 100644 index 0000000000..38ee7a8be7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-object.js @@ -0,0 +1,34 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.3 +description: > + Throws a TypeError if `prototype` property is not an Object. +info: | + 12.9.3 Runtime Semantics: Evaluation + RelationalExpression : RelationalExpression instanceof ShiftExpression + ... + 7. Return InstanceofOperator(lval, rval). + + 12.9.4 Runtime Semantics: InstanceofOperator(O, C) + ... + 6. Return OrdinaryHasInstance(C, O). + + 7.3.19 OrdinaryHasInstance + ... + 3. If Type(O) is not Object, return false. + 4. Let P be Get(C, "prototype"). + 5. ReturnIfAbrupt(P). + 6. If Type(P) is not Object, throw a TypeError exception. + ... +---*/ + +// Check with primitive "prototype" property on non-constructor function. +Function.prototype.prototype = ""; + +assert.throws(TypeError, function() { + [] instanceof Function.prototype; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js new file mode 100644 index 0000000000..53ca25f50a --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/primitive-prototype-with-primitive.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.3 +description: > + Does not throw a TypeError if left-hand side expression and `prototype` property are both primitive values. +info: | + 12.9.3 Runtime Semantics: Evaluation + RelationalExpression : RelationalExpression instanceof ShiftExpression + ... + 7. Return InstanceofOperator(lval, rval). + + 12.9.4 Runtime Semantics: InstanceofOperator(O, C) + ... + 6. Return OrdinaryHasInstance(C, O). + + 7.3.19 OrdinaryHasInstance + ... + 3. If Type(O) is not Object, return false. + ... +---*/ + +// Check with primitive "prototype" property on non-constructor function. +Function.prototype.prototype = true; + +var result = 0 instanceof Function.prototype; + +assert.sameValue(result, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js new file mode 100644 index 0000000000..a7100ae431 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object-throws.js @@ -0,0 +1,44 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.3 +description: > + "prototype" property is retrieved when left-hand side expression in `instanceof` is object. +info: | + 12.9.3 Runtime Semantics: Evaluation + RelationalExpression : RelationalExpression instanceof ShiftExpression + ... + 7. Return InstanceofOperator(lval, rval). + + 12.9.4 Runtime Semantics: InstanceofOperator(O, C) + ... + 6. Return OrdinaryHasInstance(C, O). + + 7.3.19 OrdinaryHasInstance + ... + 3. If Type(O) is not Object, return false. + 4. Let P be Get(C, "prototype"). + 5. ReturnIfAbrupt(P). + ... +---*/ + +var getterCalled = false; + +function DummyError() { } + +// The "prototype" property for constructor functions is a non-configurable data-property, +// therefore we need to use a non-constructor function to install the getter. +Object.defineProperty(Function.prototype, "prototype", { + get: function() { + assert.sameValue(getterCalled, false, "'prototype' getter called once"); + getterCalled = true; + throw new DummyError(); + } +}); + +assert.throws(DummyError, function() { + [] instanceof Function.prototype; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js new file mode 100644 index 0000000000..a26c3e67f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-object.js @@ -0,0 +1,49 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.3 +description: > + "prototype" property is retrieved when left-hand side expression in `instanceof` is object. +info: | + 12.9.3 Runtime Semantics: Evaluation + RelationalExpression : RelationalExpression instanceof ShiftExpression + ... + 7. Return InstanceofOperator(lval, rval). + + 12.9.4 Runtime Semantics: InstanceofOperator(O, C) + ... + 6. Return OrdinaryHasInstance(C, O). + + 7.3.19 OrdinaryHasInstance + ... + 3. If Type(O) is not Object, return false. + 4. Let P be Get(C, "prototype"). + 5. ReturnIfAbrupt(P). + 6. If Type(P) is not Object, throw a TypeError exception. + 7. Repeat + a. Let O be O.[[GetPrototypeOf]](). + b. ReturnIfAbrupt(O). + c. If O is null, return false. + d. If SameValue(P, O) is true, return true. + ... +---*/ + +var getterCalled = false; + +// The "prototype" property for constructor functions is a non-configurable data-property, +// therefore we need to use a non-constructor function to install the getter. +Object.defineProperty(Function.prototype, "prototype", { + get: function() { + assert.sameValue(getterCalled, false, "'prototype' getter called once"); + getterCalled = true; + return Array.prototype; + } +}); + +var result = [] instanceof Function.prototype; + +assert(result, "[] should be instance of Function.prototype"); +assert(getterCalled, "'prototype' getter called"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js new file mode 100644 index 0000000000..e37cfec7c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/prototype-getter-with-primitive.js @@ -0,0 +1,36 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.3 +description: > + "prototype" property is not retrieved when left-hand side expression in `instanceof` is primitive. +info: | + 12.9.3 Runtime Semantics: Evaluation + RelationalExpression : RelationalExpression instanceof ShiftExpression + ... + 7. Return InstanceofOperator(lval, rval). + + 12.9.4 Runtime Semantics: InstanceofOperator(O, C) + ... + 6. Return OrdinaryHasInstance(C, O). + + 7.3.19 OrdinaryHasInstance + ... + 3. If Type(O) is not Object, return false. + ... +---*/ + +// The "prototype" property for constructor functions is a non-configurable data-property, +// therefore we need to use a non-constructor function to install the getter. +Object.defineProperty(Function.prototype, "prototype", { + get: function() { + throw new Test262Error("getter for 'prototype' called"); + } +}); + +var result = 0 instanceof Function.prototype; + +assert.sameValue(result, false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/shell.js b/js/src/tests/test262/language/expressions/instanceof/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js new file mode 100644 index 0000000000..e562e9c4ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-get-err.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.4 +description: Error thrown when accessing constructor's @@hasInstance property +info: | + 1. If Type(C) is not Object, throw a TypeError exception. + 2. Let instOfHandler be GetMethod(C,@@hasInstance). + 3. ReturnIfAbrupt(instOfHandler). +features: [Symbol.hasInstance] +---*/ + +var F = {}; + +Object.defineProperty(F, Symbol.hasInstance, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + 0 instanceof F; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js new file mode 100644 index 0000000000..bc0a56e9c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-invocation.js @@ -0,0 +1,34 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.4 +description: > + Arguments and 'this' value when invoking constructor's @@hasInstance property +info: | + 1. If Type(C) is not Object, throw a TypeError exception. + 2. Let instOfHandler be GetMethod(C,@@hasInstance). + 3. ReturnIfAbrupt(instOfHandler). + 4. If instOfHandler is not undefined, then + a. Return ToBoolean(Call(instOfHandler, C, «O»)). +features: [Symbol.hasInstance] +---*/ + +var F = {}; +var callCount = 0; +var thisValue, args; + +F[Symbol.hasInstance] = function() { + thisValue = this; + args = arguments; + callCount += 1; +}; + +0 instanceof F; + +assert.sameValue(callCount, 1); +assert.sameValue(thisValue, F); +assert.sameValue(args.length, 1); +assert.sameValue(args[0], 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js new file mode 100644 index 0000000000..4059b662c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-not-callable.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.4 +description: > + Error thrown when constructor's @@hasInstance property is defined but not callable +info: | + 1. If Type(C) is not Object, throw a TypeError exception. + 2. Let instOfHandler be GetMethod(C,@@hasInstance). + 3. ReturnIfAbrupt(instOfHandler). + 4. If instOfHandler is not undefined, then + a. Return ToBoolean(Call(instOfHandler, C, «O»)). + 5. If IsCallable(C) is false, throw a TypeError exception. +features: [Symbol.hasInstance] +---*/ + +var F = {}; + +F[Symbol.hasInstance] = null; + +assert.throws(TypeError, function() { + 0 instanceof F; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js new file mode 100644 index 0000000000..195ac80ad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/instanceof/symbol-hasinstance-to-boolean.js @@ -0,0 +1,46 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.9.4 +description: > + Type coercion of value returned by constructor's @@hasInstance property +info: | + 1. If Type(C) is not Object, throw a TypeError exception. + 2. Let instOfHandler be GetMethod(C,@@hasInstance). + 3. ReturnIfAbrupt(instOfHandler). + 4. If instOfHandler is not undefined, then + a. Return ToBoolean(Call(instOfHandler, C, «O»)). +features: [Symbol, Symbol.hasInstance] +---*/ + +var F = {}; + +F[Symbol.hasInstance] = function() { return undefined; }; +assert.sameValue(0 instanceof F, false); + +F[Symbol.hasInstance] = function() { return null; }; +assert.sameValue(0 instanceof F, false); + +F[Symbol.hasInstance] = function() { return true; }; +assert.sameValue(0 instanceof F, true); + +F[Symbol.hasInstance] = function() { return NaN; }; +assert.sameValue(0 instanceof F, false); + +F[Symbol.hasInstance] = function() { return 1; }; +assert.sameValue(0 instanceof F, true); + +F[Symbol.hasInstance] = function() { return ''; }; +assert.sameValue(0 instanceof F, false); + +F[Symbol.hasInstance] = function() { return 'string'; }; +assert.sameValue(0 instanceof F, true); + +F[Symbol.hasInstance] = function() { return Symbol(); }; +assert.sameValue(0 instanceof F, true); + +F[Symbol.hasInstance] = function() { return {}; }; +assert.sameValue(0 instanceof F, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A1.js new file mode 100644 index 0000000000..7408a6aba2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between ShiftExpression and "<<" or + between "<<" and AdditiveExpression are allowed +es5id: 11.7.1_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009<<\u00091") !== 2) { + throw new Test262Error('#1: 1\\u0009<<\\u00091 === 2'); +} + +//CHECK#2 +if (eval("1\u000B<<\u000B1") !== 2) { + throw new Test262Error('#2: 1\\u000B<<\\u000B1 === 2'); +} + +//CHECK#3 +if (eval("1\u000C<<\u000C1") !== 2) { + throw new Test262Error('#3: 1\\u000C<<\\u000C1 === 2'); +} + +//CHECK#4 +if (eval("1\u0020<<\u00201") !== 2) { + throw new Test262Error('#4: 1\\u0020<<\\u00201 === 2'); +} + +//CHECK#5 +if (eval("1\u00A0<<\u00A01") !== 2) { + throw new Test262Error('#5: 1\\u00A0<<\\u00A01 === 2'); +} + +//CHECK#6 +if (eval("1\u000A<<\u000A1") !== 2) { + throw new Test262Error('#6: 1\\u000A<<\\u000A1 === 2'); +} + +//CHECK#7 +if (eval("1\u000D<<\u000D1") !== 2) { + throw new Test262Error('#7: 1\\u000D<<\\u000D1 === 2'); +} + +//CHECK#8 +if (eval("1\u2028<<\u20281") !== 2) { + throw new Test262Error('#8: 1\\u2028<<\\u20281 === 2'); +} + +//CHECK#9 +if (eval("1\u2029<<\u20291") !== 2) { + throw new Test262Error('#9: 1\\u2029<<\\u20291 === 2'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029<<\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 2) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029<<\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 2'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T1.js new file mode 100644 index 0000000000..add4214586 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y uses GetValue +es5id: 11.7.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (2 << 1 !== 4) { + throw new Test262Error('#1: 2 << 1 === 4. Actual: ' + (2 << 1)); +} + +//CHECK#2 +var x = 2; +if (x << 1 !== 4) { + throw new Test262Error('#2: var x = 2; x << 1 === 4. Actual: ' + (x << 1)); +} + +//CHECK#3 +var y = 1; +if (2 << y !== 4) { + throw new Test262Error('#3: var y = 2; 2 << y === 4. Actual: ' + (2 << y)); +} + +//CHECK#4 +var x = 2; +var y = 1; +if (x << y !== 4) { + throw new Test262Error('#4: var x = 2; var y = 1; x << y === 4. Actual: ' + (x << y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 2; +objecty.prop = 1; +if (objectx.prop << objecty.prop !== 4) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 2; objecty.prop = 1; objectx.prop << objecty.prop === 4. Actual: ' + (objectx.prop << objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T2.js new file mode 100644 index 0000000000..d9bdaf32b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y uses GetValue +es5id: 11.7.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x << 1; + throw new Test262Error('#1.1: x << 1 throw ReferenceError. Actual: ' + (x << 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x << 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T3.js new file mode 100644 index 0000000000..a95c7f450b --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y uses GetValue +es5id: 11.7.1_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 << y; + throw new Test262Error('#1.1: 1 << y throw ReferenceError. Actual: ' + (1 << y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 << y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.2_T1.js new file mode 100644 index 0000000000..6d683274f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y uses [[Default Value]] +es5id: 11.7.1_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 1}} << 1 !== 2) { + throw new Test262Error('#1: {valueOf: function() {return 1}} << 1 === 2. Actual: ' + ({valueOf: function() {return 1}} << 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} << 1 !== 2) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} << 1 === 2. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} << 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} << 1 !== 2) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} << 1 === 2. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} << 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} << 1 !== 2) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} << 1 === 2. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} << 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} << 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} << 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 << {toString: function() {return 1}} !== 2) { + throw new Test262Error('#5: 1 << {toString: function() {return 1}} === 2. Actual: ' + (1 << {toString: function() {return 1}})); +} + +//CHECK#6 +if (1 << {valueOf: function() {return {}}, toString: function() {return 1}} !== 2) { + throw new Test262Error('#6: 1 << {valueOf: function() {return {}}, toString: function() {return 1}} === 2. Actual: ' + (1 << {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + 1 << {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 1 << {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 << {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 << {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 << {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 << {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 << {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 << {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.3_T1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.3_T1.js new file mode 100644 index 0000000000..44456ebcad --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.7.1_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x << y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x << y throw "x". Actual: ' + (x << y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x << y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T1.js new file mode 100644 index 0000000000..f571d275a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) << x !== 2) { + throw new Test262Error('#1: var x = 0; (x = 1) << x === 2. Actual: ' + ((x = 1) << x)); +} + +//CHECK#2 +var x = 0; +if (x << (x = 1) !== 0) { + throw new Test262Error('#2: var x = 0; x << (x = 1) === 0. Actual: ' + (x << (x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T2.js new file mode 100644 index 0000000000..e47d0b8e86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() << y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() << y() throw "x". Actual: ' + (x() << y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() << y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T3.js new file mode 100644 index 0000000000..e1fa3f6514 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.1_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x << (x = 1); + throw new Test262Error('#1.1: x << (x = 1) throw ReferenceError. Actual: ' + (x << (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x << (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T4.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T4.js new file mode 100644 index 0000000000..66b554e3c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.1_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) << y !== 2) { + throw new Test262Error('#1: (y = 1) << y === 2. Actual: ' + ((y = 1) << y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.1.js new file mode 100644 index 0000000000..3eb08688b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (true << true !== 2) { + throw new Test262Error('#1: true << true === 2. Actual: ' + (true << true)); +} + +//CHECK#2 +if (new Boolean(true) << true !== 2) { + throw new Test262Error('#2: new Boolean(true) << true === 2. Actual: ' + (new Boolean(true) << true)); +} + +//CHECK#3 +if (true << new Boolean(true) !== 2) { + throw new Test262Error('#3: true << new Boolean(true) === 2. Actual: ' + (true << new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) << new Boolean(true) !== 2) { + throw new Test262Error('#4: new Boolean(true) << new Boolean(true) === 2. Actual: ' + (new Boolean(true) << new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.2.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.2.js new file mode 100644 index 0000000000..7c34cd6249 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if (1 << 1 !== 2) { + throw new Test262Error('#1: 1 << 1 === 2. Actual: ' + (1 << 1)); +} + +//CHECK#2 +if (new Number(1) << 1 !== 2) { + throw new Test262Error('#2: new Number(1) << 1 === 2. Actual: ' + (new Number(1) << 1)); +} + +//CHECK#3 +if (1 << new Number(1) !== 2) { + throw new Test262Error('#3: 1 << new Number(1) === 2. Actual: ' + (1 << new Number(1))); +} + +//CHECK#4 +if (new Number(1) << new Number(1) !== 2) { + throw new Test262Error('#4: new Number(1) << new Number(1) === 2. Actual: ' + (new Number(1) << new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.3.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.3.js new file mode 100644 index 0000000000..c7663ea6cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if ("1" << "1" !== 2) { + throw new Test262Error('#1: "1" << "1" === 2. Actual: ' + ("1" << "1")); +} + +//CHECK#2 +if (new String("1") << "1" !== 2) { + throw new Test262Error('#2: new String("1") << "1" === 2. Actual: ' + (new String("1") << "1")); +} + +//CHECK#3 +if ("1" << new String("1") !== 2) { + throw new Test262Error('#3: "1" << new String("1") === 2. Actual: ' + ("1" << new String("1"))); +} + +//CHECK#4 +if (new String("1") << new String("1") !== 2) { + throw new Test262Error('#4: new String("1") << new String("1") === 2. Actual: ' + (new String("1") << new String("1"))); +} + +//CHECK#5 +if ("x" << "1" !== 0) { + throw new Test262Error('#5: "x" << "1" === 0. Actual: ' + ("x" << "1")); +} + +//CHECK#6 +if ("1" << "x" !== 1) { + throw new Test262Error('#6: "1" << "x" === 1. Actual: ' + ("1" << "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.4.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.4.js new file mode 100644 index 0000000000..ff6f20f358 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if (null << undefined !== 0) { + throw new Test262Error('#1: null << undefined === 0. Actual: ' + (null << undefined)); +} + +//CHECK#2 +if (undefined << null !== 0) { + throw new Test262Error('#2: undefined << null === 0. Actual: ' + (undefined << null)); +} + +//CHECK#3 +if (undefined << undefined !== 0) { + throw new Test262Error('#3: undefined << undefined === 0. Actual: ' + (undefined << undefined)); +} + +//CHECK#4 +if (null << null !== 0) { + throw new Test262Error('#4: null << null === 0. Actual: ' + (null << null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.5.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.5.js new file mode 100644 index 0000000000..3aeac1904d --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (({} << function(){return 1}) !== 0) { + throw new Test262Error('#1: ({} << function(){return 1}) === 0. Actual: ' + (({} << function(){return 1}))); +} + +//CHECK#2 +if ((function(){return 1} << {}) !== 0) { + throw new Test262Error('#2: (function(){return 1} << {}) === 0. Actual: ' + ((function(){return 1} << {}))); +} + +//CHECK#3 +if ((function(){return 1} << function(){return 1}) !== 0) { + throw new Test262Error('#3: (function(){return 1} << function(){return 1}) === 0. Actual: ' + ((function(){return 1} << function(){return 1}))); +} + +//CHECK#4 +if (({} << {}) !== 0) { + throw new Test262Error('#4: ({} << {}) === 0. Actual: ' + (({} << {}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.1.js new file mode 100644 index 0000000000..f2f0abb25c --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true << 1 !== 2) { + throw new Test262Error('#1: true << 1 === 2. Actual: ' + (true << 1)); +} + +//CHECK#2 +if (1 << true !== 2) { + throw new Test262Error('#2: 1 << true === 2. Actual: ' + (1 << true)); +} + +//CHECK#3 +if (new Boolean(true) << 1 !== 2) { + throw new Test262Error('#3: new Boolean(true) << 1 === 2. Actual: ' + (new Boolean(true) << 1)); +} + +//CHECK#4 +if (1 << new Boolean(true) !== 2) { + throw new Test262Error('#4: 1 << new Boolean(true) === 2. Actual: ' + (1 << new Boolean(true))); +} + +//CHECK#5 +if (true << new Number(1) !== 2) { + throw new Test262Error('#5: true << new Number(1) === 2. Actual: ' + (true << new Number(1))); +} + +//CHECK#6 +if (new Number(1) << true !== 2) { + throw new Test262Error('#6: new Number(1) << true === 2. Actual: ' + (new Number(1) << true)); +} + +//CHECK#7 +if (new Boolean(true) << new Number(1) !== 2) { + throw new Test262Error('#7: new Boolean(true) << new Number(1) === 2. Actual: ' + (new Boolean(true) << new Number(1))); +} + +//CHECK#8 +if (new Number(1) << new Boolean(true) !== 2) { + throw new Test262Error('#8: new Number(1) << new Boolean(true) === 2. Actual: ' + (new Number(1) << new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.2.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.2.js new file mode 100644 index 0000000000..6ff2cfeaa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if ("1" << 1 !== 2) { + throw new Test262Error('#1: "1" << 1 === 2. Actual: ' + ("1" << 1)); +} + +//CHECK#2 +if (1 << "1" !== 2) { + throw new Test262Error('#2: 1 << "1" === 2. Actual: ' + (1 << "1")); +} + +//CHECK#3 +if (new String("1") << 1 !== 2) { + throw new Test262Error('#3: new String("1") << 1 === 2. Actual: ' + (new String("1") << 1)); +} + +//CHECK#4 +if (1 << new String("1") !== 2) { + throw new Test262Error('#4: 1 << new String("1") === 2. Actual: ' + (1 << new String("1"))); +} + +//CHECK#5 +if ("1" << new Number(1) !== 2) { + throw new Test262Error('#5: "1" << new Number(1) === 2. Actual: ' + ("1" << new Number(1))); +} + +//CHECK#6 +if (new Number(1) << "1" !== 2) { + throw new Test262Error('#6: new Number(1) << "1" === 2. Actual: ' + (new Number(1) << "1")); +} + +//CHECK#7 +if (new String("1") << new Number(1) !== 2) { + throw new Test262Error('#7: new String("1") << new Number(1) === 2. Actual: ' + (new String("1") << new Number(1))); +} + +//CHECK#8 +if (new Number(1) << new String("1") !== 2) { + throw new Test262Error('#8: new Number(1) << new String("1") === 2. Actual: ' + (new Number(1) << new String("1"))); +} + +//CHECK#9 +if ("x" << 1 !== 0) { + throw new Test262Error('#9: "x" << 1 === 0. Actual: ' + ("x" << 1)); +} + +//CHECK#10 +if (1 << "x" !== 1) { + throw new Test262Error('#10: 1 << "x" === 1. Actual: ' + (1 << "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.3.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.3.js new file mode 100644 index 0000000000..4f3151aa5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 << null !== 1) { + throw new Test262Error('#1: 1 << null === 1. Actual: ' + (1 << null)); +} + +//CHECK#2 +if (null << 1 !== 0) { + throw new Test262Error('#2: null << 1 === 0. Actual: ' + (null << 1)); +} + +//CHECK#3 +if (new Number(1) << null !== 1) { + throw new Test262Error('#3: new Number(1) << null === 1. Actual: ' + (new Number(1) << null)); +} + +//CHECK#4 +if (null << new Number(1) !== 0) { + throw new Test262Error('#4: null << new Number(1) === 0. Actual: ' + (null << new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.4.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.4.js new file mode 100644 index 0000000000..2dbc02a0c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 << undefined !== 1) { + throw new Test262Error('#1: 1 << undefined === 1. Actual: ' + (1 << undefined)); +} + +//CHECK#2 +if (undefined << 1 !== 0) { + throw new Test262Error('#2: undefined << 1 === 0. Actual: ' + (undefined << 1)); +} + +//CHECK#3 +if (new Number(1) << undefined !== 1) { + throw new Test262Error('#3: new Number(1) << undefined === 1. Actual: ' + (new Number(1) << undefined)); +} + +//CHECK#4 +if (undefined << new Number(1) !== 0) { + throw new Test262Error('#4: undefined << new Number(1) === 0. Actual: ' + (undefined << new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.5.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.5.js new file mode 100644 index 0000000000..e686df998a --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) or Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true << "1" !== 2) { + throw new Test262Error('#1: true << "1" === 2. Actual: ' + (true << "1")); +} + +//CHECK#2 +if ("1" << true !== 2) { + throw new Test262Error('#2: "1" << true === 2. Actual: ' + ("1" << true)); +} + +//CHECK#3 +if (new Boolean(true) << "1" !== 2) { + throw new Test262Error('#3: new Boolean(true) << "1" === 2. Actual: ' + (new Boolean(true) << "1")); +} + +//CHECK#4 +if ("1" << new Boolean(true) !== 2) { + throw new Test262Error('#4: "1" << new Boolean(true) === 2. Actual: ' + ("1" << new Boolean(true))); +} + +//CHECK#5 +if (true << new String("1") !== 2) { + throw new Test262Error('#5: true << new String("1") === 2. Actual: ' + (true << new String("1"))); +} + +//CHECK#6 +if (new String("1") << true !== 2) { + throw new Test262Error('#6: new String("1") << true === 2. Actual: ' + (new String("1") << true)); +} + +//CHECK#7 +if (new Boolean(true) << new String("1") !== 2) { + throw new Test262Error('#7: new Boolean(true) << new String("1") === 2. Actual: ' + (new Boolean(true) << new String("1"))); +} + +//CHECK#8 +if (new String("1") << new Boolean(true) !== 2) { + throw new Test262Error('#8: new String("1") << new Boolean(true) === 2. Actual: ' + (new String("1") << new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.6.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.6.js new file mode 100644 index 0000000000..1e41f5a234 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" << undefined !== 1) { + throw new Test262Error('#1: "1" << undefined === 1. Actual: ' + ("1" << undefined)); +} + +//CHECK#2 +if (undefined << "1" !== 0) { + throw new Test262Error('#2: undefined << "1" === 0. Actual: ' + (undefined << "1")); +} + +//CHECK#3 +if (new String("1") << undefined !== 1) { + throw new Test262Error('#3: new String("1") << undefined === 1. Actual: ' + (new String("1") << undefined)); +} + +//CHECK#4 +if (undefined << new String("1") !== 0) { + throw new Test262Error('#4: undefined << new String("1") === 0. Actual: ' + (undefined << new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.7.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.7.js new file mode 100644 index 0000000000..3ce8af19b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" << null !== 1) { + throw new Test262Error('#1: "1" << null === 1. Actual: ' + ("1" << null)); +} + +//CHECK#2 +if (null << "1" !== 0) { + throw new Test262Error('#2: null << "1" === 0. Actual: ' + (null << "1")); +} + +//CHECK#3 +if (new String("1") << null !== 1) { + throw new Test262Error('#3: new String("1") << null === 1. Actual: ' + (new String("1") << null)); +} + +//CHECK#4 +if (null << new String("1") !== 0) { + throw new Test262Error('#4: null << new String("1") === 0. Actual: ' + (null << new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.8.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.8.js new file mode 100644 index 0000000000..f8fd9abe67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true << undefined !== 1) { + throw new Test262Error('#1: true << undefined === 1. Actual: ' + (true << undefined)); +} + +//CHECK#2 +if (undefined << true !== 0) { + throw new Test262Error('#2: undefined << true === 0. Actual: ' + (undefined << true)); +} + +//CHECK#3 +if (new Boolean(true) << undefined !== 1) { + throw new Test262Error('#3: new Boolean(true) << undefined === 1. Actual: ' + (new Boolean(true) << undefined)); +} + +//CHECK#4 +if (undefined << new Boolean(true) !== 0) { + throw new Test262Error('#4: undefined << new Boolean(true) === 0. Actual: ' + (undefined << new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.9.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.9.js new file mode 100644 index 0000000000..bd4cdeaa5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y returns ToNumber(x) << ToNumber(y) +es5id: 11.7.1_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true << null !== 1) { + throw new Test262Error('#1: true << null === 1. Actual: ' + (true << null)); +} + +//CHECK#2 +if (null << true !== 0) { + throw new Test262Error('#2: null << true === 0. Actual: ' + (null << true)); +} + +//CHECK#3 +if (new Boolean(true) << null !== 1) { + throw new Test262Error('#3: new Boolean(true) << null === 1. Actual: ' + (new Boolean(true) << null)); +} + +//CHECK#4 +if (null << new Boolean(true) !== 0) { + throw new Test262Error('#4: null << new Boolean(true) === 0. Actual: ' + (null << new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T1.js new file mode 100644 index 0000000000..e9e940948a --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T1.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x << y in distinct points +es5id: 11.7.1_A4_T1 +description: ShiftExpression = -2^n, n = 0...15 +---*/ + +//CHECK + +if (-1 << 0 !== -1) { + throw new Test262Error('#1: -1 << 0 === -1. Actual: ' + (-1 << 0)); +} + + +if (-2 << 0 !== -2) { + throw new Test262Error('#2: -2 << 0 === -2. Actual: ' + (-2 << 0)); +} + + +if (-4 << 0 !== -4) { + throw new Test262Error('#3: -4 << 0 === -4. Actual: ' + (-4 << 0)); +} + + +if (-8 << 0 !== -8) { + throw new Test262Error('#4: -8 << 0 === -8. Actual: ' + (-8 << 0)); +} + + +if (-16 << 0 !== -16) { + throw new Test262Error('#5: -16 << 0 === -16. Actual: ' + (-16 << 0)); +} + + +if (-32 << 0 !== -32) { + throw new Test262Error('#6: -32 << 0 === -32. Actual: ' + (-32 << 0)); +} + + +if (-64 << 0 !== -64) { + throw new Test262Error('#7: -64 << 0 === -64. Actual: ' + (-64 << 0)); +} + + +if (-128 << 0 !== -128) { + throw new Test262Error('#8: -128 << 0 === -128. Actual: ' + (-128 << 0)); +} + + +if (-256 << 0 !== -256) { + throw new Test262Error('#9: -256 << 0 === -256. Actual: ' + (-256 << 0)); +} + + +if (-512 << 0 !== -512) { + throw new Test262Error('#10: -512 << 0 === -512. Actual: ' + (-512 << 0)); +} + + +if (-1024 << 0 !== -1024) { + throw new Test262Error('#11: -1024 << 0 === -1024. Actual: ' + (-1024 << 0)); +} + + +if (-2048 << 0 !== -2048) { + throw new Test262Error('#12: -2048 << 0 === -2048. Actual: ' + (-2048 << 0)); +} + + +if (-4096 << 0 !== -4096) { + throw new Test262Error('#13: -4096 << 0 === -4096. Actual: ' + (-4096 << 0)); +} + + +if (-8192 << 0 !== -8192) { + throw new Test262Error('#14: -8192 << 0 === -8192. Actual: ' + (-8192 << 0)); +} + + +if (-16384 << 0 !== -16384) { + throw new Test262Error('#15: -16384 << 0 === -16384. Actual: ' + (-16384 << 0)); +} + + +if (-32768 << 0 !== -32768) { + throw new Test262Error('#16: -32768 << 0 === -32768. Actual: ' + (-32768 << 0)); +} + + +if (-65536 << 0 !== -65536) { + throw new Test262Error('#17: -65536 << 0 === -65536. Actual: ' + (-65536 << 0)); +} + + +if (-131072 << 0 !== -131072) { + throw new Test262Error('#18: -131072 << 0 === -131072. Actual: ' + (-131072 << 0)); +} + + +if (-262144 << 0 !== -262144) { + throw new Test262Error('#19: -262144 << 0 === -262144. Actual: ' + (-262144 << 0)); +} + + +if (-524288 << 0 !== -524288) { + throw new Test262Error('#20: -524288 << 0 === -524288. Actual: ' + (-524288 << 0)); +} + + +if (-1048576 << 0 !== -1048576) { + throw new Test262Error('#21: -1048576 << 0 === -1048576. Actual: ' + (-1048576 << 0)); +} + + +if (-2097152 << 0 !== -2097152) { + throw new Test262Error('#22: -2097152 << 0 === -2097152. Actual: ' + (-2097152 << 0)); +} + + +if (-4194304 << 0 !== -4194304) { + throw new Test262Error('#23: -4194304 << 0 === -4194304. Actual: ' + (-4194304 << 0)); +} + + +if (-8388608 << 0 !== -8388608) { + throw new Test262Error('#24: -8388608 << 0 === -8388608. Actual: ' + (-8388608 << 0)); +} + + +if (-16777216 << 0 !== -16777216) { + throw new Test262Error('#25: -16777216 << 0 === -16777216. Actual: ' + (-16777216 << 0)); +} + + +if (-33554432 << 0 !== -33554432) { + throw new Test262Error('#26: -33554432 << 0 === -33554432. Actual: ' + (-33554432 << 0)); +} + + +if (-67108864 << 0 !== -67108864) { + throw new Test262Error('#27: -67108864 << 0 === -67108864. Actual: ' + (-67108864 << 0)); +} + + +if (-134217728 << 0 !== -134217728) { + throw new Test262Error('#28: -134217728 << 0 === -134217728. Actual: ' + (-134217728 << 0)); +} + + +if (-268435456 << 0 !== -268435456) { + throw new Test262Error('#29: -268435456 << 0 === -268435456. Actual: ' + (-268435456 << 0)); +} + + +if (-536870912 << 0 !== -536870912) { + throw new Test262Error('#30: -536870912 << 0 === -536870912. Actual: ' + (-536870912 << 0)); +} + + +if (-1073741824 << 0 !== -1073741824) { + throw new Test262Error('#31: -1073741824 << 0 === -1073741824. Actual: ' + (-1073741824 << 0)); +} + + +if (-2147483648 << 0 !== -2147483648) { + throw new Test262Error('#32: -2147483648 << 0 === -2147483648. Actual: ' + (-2147483648 << 0)); +} + + +if (-1 << 1 !== -2) { + throw new Test262Error('#33: -1 << 1 === -2. Actual: ' + (-1 << 1)); +} + + +if (-2 << 1 !== -4) { + throw new Test262Error('#34: -2 << 1 === -4. Actual: ' + (-2 << 1)); +} + + +if (-4 << 1 !== -8) { + throw new Test262Error('#35: -4 << 1 === -8. Actual: ' + (-4 << 1)); +} + + +if (-8 << 1 !== -16) { + throw new Test262Error('#36: -8 << 1 === -16. Actual: ' + (-8 << 1)); +} + + +if (-16 << 1 !== -32) { + throw new Test262Error('#37: -16 << 1 === -32. Actual: ' + (-16 << 1)); +} + + +if (-32 << 1 !== -64) { + throw new Test262Error('#38: -32 << 1 === -64. Actual: ' + (-32 << 1)); +} + + +if (-64 << 1 !== -128) { + throw new Test262Error('#39: -64 << 1 === -128. Actual: ' + (-64 << 1)); +} + + +if (-128 << 1 !== -256) { + throw new Test262Error('#40: -128 << 1 === -256. Actual: ' + (-128 << 1)); +} + + +if (-256 << 1 !== -512) { + throw new Test262Error('#41: -256 << 1 === -512. Actual: ' + (-256 << 1)); +} + + +if (-512 << 1 !== -1024) { + throw new Test262Error('#42: -512 << 1 === -1024. Actual: ' + (-512 << 1)); +} + + +if (-1024 << 1 !== -2048) { + throw new Test262Error('#43: -1024 << 1 === -2048. Actual: ' + (-1024 << 1)); +} + + +if (-2048 << 1 !== -4096) { + throw new Test262Error('#44: -2048 << 1 === -4096. Actual: ' + (-2048 << 1)); +} + + +if (-4096 << 1 !== -8192) { + throw new Test262Error('#45: -4096 << 1 === -8192. Actual: ' + (-4096 << 1)); +} + + +if (-8192 << 1 !== -16384) { + throw new Test262Error('#46: -8192 << 1 === -16384. Actual: ' + (-8192 << 1)); +} + + +if (-16384 << 1 !== -32768) { + throw new Test262Error('#47: -16384 << 1 === -32768. Actual: ' + (-16384 << 1)); +} + + +if (-32768 << 1 !== -65536) { + throw new Test262Error('#48: -32768 << 1 === -65536. Actual: ' + (-32768 << 1)); +} + + +if (-65536 << 1 !== -131072) { + throw new Test262Error('#49: -65536 << 1 === -131072. Actual: ' + (-65536 << 1)); +} + + +if (-131072 << 1 !== -262144) { + throw new Test262Error('#50: -131072 << 1 === -262144. Actual: ' + (-131072 << 1)); +} + + +if (-262144 << 1 !== -524288) { + throw new Test262Error('#51: -262144 << 1 === -524288. Actual: ' + (-262144 << 1)); +} + + +if (-524288 << 1 !== -1048576) { + throw new Test262Error('#52: -524288 << 1 === -1048576. Actual: ' + (-524288 << 1)); +} + + +if (-1048576 << 1 !== -2097152) { + throw new Test262Error('#53: -1048576 << 1 === -2097152. Actual: ' + (-1048576 << 1)); +} + + +if (-2097152 << 1 !== -4194304) { + throw new Test262Error('#54: -2097152 << 1 === -4194304. Actual: ' + (-2097152 << 1)); +} + + +if (-4194304 << 1 !== -8388608) { + throw new Test262Error('#55: -4194304 << 1 === -8388608. Actual: ' + (-4194304 << 1)); +} + + +if (-8388608 << 1 !== -16777216) { + throw new Test262Error('#56: -8388608 << 1 === -16777216. Actual: ' + (-8388608 << 1)); +} + + +if (-16777216 << 1 !== -33554432) { + throw new Test262Error('#57: -16777216 << 1 === -33554432. Actual: ' + (-16777216 << 1)); +} + + +if (-33554432 << 1 !== -67108864) { + throw new Test262Error('#58: -33554432 << 1 === -67108864. Actual: ' + (-33554432 << 1)); +} + + +if (-67108864 << 1 !== -134217728) { + throw new Test262Error('#59: -67108864 << 1 === -134217728. Actual: ' + (-67108864 << 1)); +} + + +if (-134217728 << 1 !== -268435456) { + throw new Test262Error('#60: -134217728 << 1 === -268435456. Actual: ' + (-134217728 << 1)); +} + + +if (-268435456 << 1 !== -536870912) { + throw new Test262Error('#61: -268435456 << 1 === -536870912. Actual: ' + (-268435456 << 1)); +} + + +if (-536870912 << 1 !== -1073741824) { + throw new Test262Error('#62: -536870912 << 1 === -1073741824. Actual: ' + (-536870912 << 1)); +} + + +if (-1073741824 << 1 !== -2147483648) { + throw new Test262Error('#63: -1073741824 << 1 === -2147483648. Actual: ' + (-1073741824 << 1)); +} + + +if (-2147483648 << 1 !== 0) { + throw new Test262Error('#64: -2147483648 << 1 === 0. Actual: ' + (-2147483648 << 1)); +} + + +if (-1 << 2 !== -4) { + throw new Test262Error('#65: -1 << 2 === -4. Actual: ' + (-1 << 2)); +} + + +if (-2 << 2 !== -8) { + throw new Test262Error('#66: -2 << 2 === -8. Actual: ' + (-2 << 2)); +} + + +if (-4 << 2 !== -16) { + throw new Test262Error('#67: -4 << 2 === -16. Actual: ' + (-4 << 2)); +} + + +if (-8 << 2 !== -32) { + throw new Test262Error('#68: -8 << 2 === -32. Actual: ' + (-8 << 2)); +} + + +if (-16 << 2 !== -64) { + throw new Test262Error('#69: -16 << 2 === -64. Actual: ' + (-16 << 2)); +} + + +if (-32 << 2 !== -128) { + throw new Test262Error('#70: -32 << 2 === -128. Actual: ' + (-32 << 2)); +} + + +if (-64 << 2 !== -256) { + throw new Test262Error('#71: -64 << 2 === -256. Actual: ' + (-64 << 2)); +} + + +if (-128 << 2 !== -512) { + throw new Test262Error('#72: -128 << 2 === -512. Actual: ' + (-128 << 2)); +} + + +if (-256 << 2 !== -1024) { + throw new Test262Error('#73: -256 << 2 === -1024. Actual: ' + (-256 << 2)); +} + + +if (-512 << 2 !== -2048) { + throw new Test262Error('#74: -512 << 2 === -2048. Actual: ' + (-512 << 2)); +} + + +if (-1024 << 2 !== -4096) { + throw new Test262Error('#75: -1024 << 2 === -4096. Actual: ' + (-1024 << 2)); +} + + +if (-2048 << 2 !== -8192) { + throw new Test262Error('#76: -2048 << 2 === -8192. Actual: ' + (-2048 << 2)); +} + + +if (-4096 << 2 !== -16384) { + throw new Test262Error('#77: -4096 << 2 === -16384. Actual: ' + (-4096 << 2)); +} + + +if (-8192 << 2 !== -32768) { + throw new Test262Error('#78: -8192 << 2 === -32768. Actual: ' + (-8192 << 2)); +} + + +if (-16384 << 2 !== -65536) { + throw new Test262Error('#79: -16384 << 2 === -65536. Actual: ' + (-16384 << 2)); +} + + +if (-32768 << 2 !== -131072) { + throw new Test262Error('#80: -32768 << 2 === -131072. Actual: ' + (-32768 << 2)); +} + + +if (-65536 << 2 !== -262144) { + throw new Test262Error('#81: -65536 << 2 === -262144. Actual: ' + (-65536 << 2)); +} + + +if (-131072 << 2 !== -524288) { + throw new Test262Error('#82: -131072 << 2 === -524288. Actual: ' + (-131072 << 2)); +} + + +if (-262144 << 2 !== -1048576) { + throw new Test262Error('#83: -262144 << 2 === -1048576. Actual: ' + (-262144 << 2)); +} + + +if (-524288 << 2 !== -2097152) { + throw new Test262Error('#84: -524288 << 2 === -2097152. Actual: ' + (-524288 << 2)); +} + + +if (-1048576 << 2 !== -4194304) { + throw new Test262Error('#85: -1048576 << 2 === -4194304. Actual: ' + (-1048576 << 2)); +} + + +if (-2097152 << 2 !== -8388608) { + throw new Test262Error('#86: -2097152 << 2 === -8388608. Actual: ' + (-2097152 << 2)); +} + + +if (-4194304 << 2 !== -16777216) { + throw new Test262Error('#87: -4194304 << 2 === -16777216. Actual: ' + (-4194304 << 2)); +} + + +if (-8388608 << 2 !== -33554432) { + throw new Test262Error('#88: -8388608 << 2 === -33554432. Actual: ' + (-8388608 << 2)); +} + + +if (-16777216 << 2 !== -67108864) { + throw new Test262Error('#89: -16777216 << 2 === -67108864. Actual: ' + (-16777216 << 2)); +} + + +if (-33554432 << 2 !== -134217728) { + throw new Test262Error('#90: -33554432 << 2 === -134217728. Actual: ' + (-33554432 << 2)); +} + + +if (-67108864 << 2 !== -268435456) { + throw new Test262Error('#91: -67108864 << 2 === -268435456. Actual: ' + (-67108864 << 2)); +} + + +if (-134217728 << 2 !== -536870912) { + throw new Test262Error('#92: -134217728 << 2 === -536870912. Actual: ' + (-134217728 << 2)); +} + + +if (-268435456 << 2 !== -1073741824) { + throw new Test262Error('#93: -268435456 << 2 === -1073741824. Actual: ' + (-268435456 << 2)); +} + + +if (-536870912 << 2 !== -2147483648) { + throw new Test262Error('#94: -536870912 << 2 === -2147483648. Actual: ' + (-536870912 << 2)); +} + + +if (-1073741824 << 2 !== 0) { + throw new Test262Error('#95: -1073741824 << 2 === 0. Actual: ' + (-1073741824 << 2)); +} + + +if (-2147483648 << 2 !== 0) { + throw new Test262Error('#96: -2147483648 << 2 === 0. Actual: ' + (-2147483648 << 2)); +} + + +if (-1 << 3 !== -8) { + throw new Test262Error('#97: -1 << 3 === -8. Actual: ' + (-1 << 3)); +} + + +if (-2 << 3 !== -16) { + throw new Test262Error('#98: -2 << 3 === -16. Actual: ' + (-2 << 3)); +} + + +if (-4 << 3 !== -32) { + throw new Test262Error('#99: -4 << 3 === -32. Actual: ' + (-4 << 3)); +} + + +if (-8 << 3 !== -64) { + throw new Test262Error('#100: -8 << 3 === -64. Actual: ' + (-8 << 3)); +} + + +if (-16 << 3 !== -128) { + throw new Test262Error('#101: -16 << 3 === -128. Actual: ' + (-16 << 3)); +} + + +if (-32 << 3 !== -256) { + throw new Test262Error('#102: -32 << 3 === -256. Actual: ' + (-32 << 3)); +} + + +if (-64 << 3 !== -512) { + throw new Test262Error('#103: -64 << 3 === -512. Actual: ' + (-64 << 3)); +} + + +if (-128 << 3 !== -1024) { + throw new Test262Error('#104: -128 << 3 === -1024. Actual: ' + (-128 << 3)); +} + + +if (-256 << 3 !== -2048) { + throw new Test262Error('#105: -256 << 3 === -2048. Actual: ' + (-256 << 3)); +} + + +if (-512 << 3 !== -4096) { + throw new Test262Error('#106: -512 << 3 === -4096. Actual: ' + (-512 << 3)); +} + + +if (-1024 << 3 !== -8192) { + throw new Test262Error('#107: -1024 << 3 === -8192. Actual: ' + (-1024 << 3)); +} + + +if (-2048 << 3 !== -16384) { + throw new Test262Error('#108: -2048 << 3 === -16384. Actual: ' + (-2048 << 3)); +} + + +if (-4096 << 3 !== -32768) { + throw new Test262Error('#109: -4096 << 3 === -32768. Actual: ' + (-4096 << 3)); +} + + +if (-8192 << 3 !== -65536) { + throw new Test262Error('#110: -8192 << 3 === -65536. Actual: ' + (-8192 << 3)); +} + + +if (-16384 << 3 !== -131072) { + throw new Test262Error('#111: -16384 << 3 === -131072. Actual: ' + (-16384 << 3)); +} + + +if (-32768 << 3 !== -262144) { + throw new Test262Error('#112: -32768 << 3 === -262144. Actual: ' + (-32768 << 3)); +} + + +if (-65536 << 3 !== -524288) { + throw new Test262Error('#113: -65536 << 3 === -524288. Actual: ' + (-65536 << 3)); +} + + +if (-131072 << 3 !== -1048576) { + throw new Test262Error('#114: -131072 << 3 === -1048576. Actual: ' + (-131072 << 3)); +} + + +if (-262144 << 3 !== -2097152) { + throw new Test262Error('#115: -262144 << 3 === -2097152. Actual: ' + (-262144 << 3)); +} + + +if (-524288 << 3 !== -4194304) { + throw new Test262Error('#116: -524288 << 3 === -4194304. Actual: ' + (-524288 << 3)); +} + + +if (-1048576 << 3 !== -8388608) { + throw new Test262Error('#117: -1048576 << 3 === -8388608. Actual: ' + (-1048576 << 3)); +} + + +if (-2097152 << 3 !== -16777216) { + throw new Test262Error('#118: -2097152 << 3 === -16777216. Actual: ' + (-2097152 << 3)); +} + + +if (-4194304 << 3 !== -33554432) { + throw new Test262Error('#119: -4194304 << 3 === -33554432. Actual: ' + (-4194304 << 3)); +} + + +if (-8388608 << 3 !== -67108864) { + throw new Test262Error('#120: -8388608 << 3 === -67108864. Actual: ' + (-8388608 << 3)); +} + + +if (-16777216 << 3 !== -134217728) { + throw new Test262Error('#121: -16777216 << 3 === -134217728. Actual: ' + (-16777216 << 3)); +} + + +if (-33554432 << 3 !== -268435456) { + throw new Test262Error('#122: -33554432 << 3 === -268435456. Actual: ' + (-33554432 << 3)); +} + + +if (-67108864 << 3 !== -536870912) { + throw new Test262Error('#123: -67108864 << 3 === -536870912. Actual: ' + (-67108864 << 3)); +} + + +if (-134217728 << 3 !== -1073741824) { + throw new Test262Error('#124: -134217728 << 3 === -1073741824. Actual: ' + (-134217728 << 3)); +} + + +if (-268435456 << 3 !== -2147483648) { + throw new Test262Error('#125: -268435456 << 3 === -2147483648. Actual: ' + (-268435456 << 3)); +} + + +if (-536870912 << 3 !== 0) { + throw new Test262Error('#126: -536870912 << 3 === 0. Actual: ' + (-536870912 << 3)); +} + + +if (-1073741824 << 3 !== 0) { + throw new Test262Error('#127: -1073741824 << 3 === 0. Actual: ' + (-1073741824 << 3)); +} + + +if (-2147483648 << 3 !== 0) { + throw new Test262Error('#128: -2147483648 << 3 === 0. Actual: ' + (-2147483648 << 3)); +} + + +if (-1 << 4 !== -16) { + throw new Test262Error('#129: -1 << 4 === -16. Actual: ' + (-1 << 4)); +} + + +if (-2 << 4 !== -32) { + throw new Test262Error('#130: -2 << 4 === -32. Actual: ' + (-2 << 4)); +} + + +if (-4 << 4 !== -64) { + throw new Test262Error('#131: -4 << 4 === -64. Actual: ' + (-4 << 4)); +} + + +if (-8 << 4 !== -128) { + throw new Test262Error('#132: -8 << 4 === -128. Actual: ' + (-8 << 4)); +} + + +if (-16 << 4 !== -256) { + throw new Test262Error('#133: -16 << 4 === -256. Actual: ' + (-16 << 4)); +} + + +if (-32 << 4 !== -512) { + throw new Test262Error('#134: -32 << 4 === -512. Actual: ' + (-32 << 4)); +} + + +if (-64 << 4 !== -1024) { + throw new Test262Error('#135: -64 << 4 === -1024. Actual: ' + (-64 << 4)); +} + + +if (-128 << 4 !== -2048) { + throw new Test262Error('#136: -128 << 4 === -2048. Actual: ' + (-128 << 4)); +} + + +if (-256 << 4 !== -4096) { + throw new Test262Error('#137: -256 << 4 === -4096. Actual: ' + (-256 << 4)); +} + + +if (-512 << 4 !== -8192) { + throw new Test262Error('#138: -512 << 4 === -8192. Actual: ' + (-512 << 4)); +} + + +if (-1024 << 4 !== -16384) { + throw new Test262Error('#139: -1024 << 4 === -16384. Actual: ' + (-1024 << 4)); +} + + +if (-2048 << 4 !== -32768) { + throw new Test262Error('#140: -2048 << 4 === -32768. Actual: ' + (-2048 << 4)); +} + + +if (-4096 << 4 !== -65536) { + throw new Test262Error('#141: -4096 << 4 === -65536. Actual: ' + (-4096 << 4)); +} + + +if (-8192 << 4 !== -131072) { + throw new Test262Error('#142: -8192 << 4 === -131072. Actual: ' + (-8192 << 4)); +} + + +if (-16384 << 4 !== -262144) { + throw new Test262Error('#143: -16384 << 4 === -262144. Actual: ' + (-16384 << 4)); +} + + +if (-32768 << 4 !== -524288) { + throw new Test262Error('#144: -32768 << 4 === -524288. Actual: ' + (-32768 << 4)); +} + + +if (-65536 << 4 !== -1048576) { + throw new Test262Error('#145: -65536 << 4 === -1048576. Actual: ' + (-65536 << 4)); +} + + +if (-131072 << 4 !== -2097152) { + throw new Test262Error('#146: -131072 << 4 === -2097152. Actual: ' + (-131072 << 4)); +} + + +if (-262144 << 4 !== -4194304) { + throw new Test262Error('#147: -262144 << 4 === -4194304. Actual: ' + (-262144 << 4)); +} + + +if (-524288 << 4 !== -8388608) { + throw new Test262Error('#148: -524288 << 4 === -8388608. Actual: ' + (-524288 << 4)); +} + + +if (-1048576 << 4 !== -16777216) { + throw new Test262Error('#149: -1048576 << 4 === -16777216. Actual: ' + (-1048576 << 4)); +} + + +if (-2097152 << 4 !== -33554432) { + throw new Test262Error('#150: -2097152 << 4 === -33554432. Actual: ' + (-2097152 << 4)); +} + + +if (-4194304 << 4 !== -67108864) { + throw new Test262Error('#151: -4194304 << 4 === -67108864. Actual: ' + (-4194304 << 4)); +} + + +if (-8388608 << 4 !== -134217728) { + throw new Test262Error('#152: -8388608 << 4 === -134217728. Actual: ' + (-8388608 << 4)); +} + + +if (-16777216 << 4 !== -268435456) { + throw new Test262Error('#153: -16777216 << 4 === -268435456. Actual: ' + (-16777216 << 4)); +} + + +if (-33554432 << 4 !== -536870912) { + throw new Test262Error('#154: -33554432 << 4 === -536870912. Actual: ' + (-33554432 << 4)); +} + + +if (-67108864 << 4 !== -1073741824) { + throw new Test262Error('#155: -67108864 << 4 === -1073741824. Actual: ' + (-67108864 << 4)); +} + + +if (-134217728 << 4 !== -2147483648) { + throw new Test262Error('#156: -134217728 << 4 === -2147483648. Actual: ' + (-134217728 << 4)); +} + + +if (-268435456 << 4 !== 0) { + throw new Test262Error('#157: -268435456 << 4 === 0. Actual: ' + (-268435456 << 4)); +} + + +if (-536870912 << 4 !== 0) { + throw new Test262Error('#158: -536870912 << 4 === 0. Actual: ' + (-536870912 << 4)); +} + + +if (-1073741824 << 4 !== 0) { + throw new Test262Error('#159: -1073741824 << 4 === 0. Actual: ' + (-1073741824 << 4)); +} + + +if (-2147483648 << 4 !== 0) { + throw new Test262Error('#160: -2147483648 << 4 === 0. Actual: ' + (-2147483648 << 4)); +} + + +if (-1 << 5 !== -32) { + throw new Test262Error('#161: -1 << 5 === -32. Actual: ' + (-1 << 5)); +} + + +if (-2 << 5 !== -64) { + throw new Test262Error('#162: -2 << 5 === -64. Actual: ' + (-2 << 5)); +} + + +if (-4 << 5 !== -128) { + throw new Test262Error('#163: -4 << 5 === -128. Actual: ' + (-4 << 5)); +} + + +if (-8 << 5 !== -256) { + throw new Test262Error('#164: -8 << 5 === -256. Actual: ' + (-8 << 5)); +} + + +if (-16 << 5 !== -512) { + throw new Test262Error('#165: -16 << 5 === -512. Actual: ' + (-16 << 5)); +} + + +if (-32 << 5 !== -1024) { + throw new Test262Error('#166: -32 << 5 === -1024. Actual: ' + (-32 << 5)); +} + + +if (-64 << 5 !== -2048) { + throw new Test262Error('#167: -64 << 5 === -2048. Actual: ' + (-64 << 5)); +} + + +if (-128 << 5 !== -4096) { + throw new Test262Error('#168: -128 << 5 === -4096. Actual: ' + (-128 << 5)); +} + + +if (-256 << 5 !== -8192) { + throw new Test262Error('#169: -256 << 5 === -8192. Actual: ' + (-256 << 5)); +} + + +if (-512 << 5 !== -16384) { + throw new Test262Error('#170: -512 << 5 === -16384. Actual: ' + (-512 << 5)); +} + + +if (-1024 << 5 !== -32768) { + throw new Test262Error('#171: -1024 << 5 === -32768. Actual: ' + (-1024 << 5)); +} + + +if (-2048 << 5 !== -65536) { + throw new Test262Error('#172: -2048 << 5 === -65536. Actual: ' + (-2048 << 5)); +} + + +if (-4096 << 5 !== -131072) { + throw new Test262Error('#173: -4096 << 5 === -131072. Actual: ' + (-4096 << 5)); +} + + +if (-8192 << 5 !== -262144) { + throw new Test262Error('#174: -8192 << 5 === -262144. Actual: ' + (-8192 << 5)); +} + + +if (-16384 << 5 !== -524288) { + throw new Test262Error('#175: -16384 << 5 === -524288. Actual: ' + (-16384 << 5)); +} + + +if (-32768 << 5 !== -1048576) { + throw new Test262Error('#176: -32768 << 5 === -1048576. Actual: ' + (-32768 << 5)); +} + + +if (-65536 << 5 !== -2097152) { + throw new Test262Error('#177: -65536 << 5 === -2097152. Actual: ' + (-65536 << 5)); +} + + +if (-131072 << 5 !== -4194304) { + throw new Test262Error('#178: -131072 << 5 === -4194304. Actual: ' + (-131072 << 5)); +} + + +if (-262144 << 5 !== -8388608) { + throw new Test262Error('#179: -262144 << 5 === -8388608. Actual: ' + (-262144 << 5)); +} + + +if (-524288 << 5 !== -16777216) { + throw new Test262Error('#180: -524288 << 5 === -16777216. Actual: ' + (-524288 << 5)); +} + + +if (-1048576 << 5 !== -33554432) { + throw new Test262Error('#181: -1048576 << 5 === -33554432. Actual: ' + (-1048576 << 5)); +} + + +if (-2097152 << 5 !== -67108864) { + throw new Test262Error('#182: -2097152 << 5 === -67108864. Actual: ' + (-2097152 << 5)); +} + + +if (-4194304 << 5 !== -134217728) { + throw new Test262Error('#183: -4194304 << 5 === -134217728. Actual: ' + (-4194304 << 5)); +} + + +if (-8388608 << 5 !== -268435456) { + throw new Test262Error('#184: -8388608 << 5 === -268435456. Actual: ' + (-8388608 << 5)); +} + + +if (-16777216 << 5 !== -536870912) { + throw new Test262Error('#185: -16777216 << 5 === -536870912. Actual: ' + (-16777216 << 5)); +} + + +if (-33554432 << 5 !== -1073741824) { + throw new Test262Error('#186: -33554432 << 5 === -1073741824. Actual: ' + (-33554432 << 5)); +} + + +if (-67108864 << 5 !== -2147483648) { + throw new Test262Error('#187: -67108864 << 5 === -2147483648. Actual: ' + (-67108864 << 5)); +} + + +if (-134217728 << 5 !== 0) { + throw new Test262Error('#188: -134217728 << 5 === 0. Actual: ' + (-134217728 << 5)); +} + + +if (-268435456 << 5 !== 0) { + throw new Test262Error('#189: -268435456 << 5 === 0. Actual: ' + (-268435456 << 5)); +} + + +if (-536870912 << 5 !== 0) { + throw new Test262Error('#190: -536870912 << 5 === 0. Actual: ' + (-536870912 << 5)); +} + + +if (-1073741824 << 5 !== 0) { + throw new Test262Error('#191: -1073741824 << 5 === 0. Actual: ' + (-1073741824 << 5)); +} + + +if (-2147483648 << 5 !== 0) { + throw new Test262Error('#192: -2147483648 << 5 === 0. Actual: ' + (-2147483648 << 5)); +} + + +if (-1 << 6 !== -64) { + throw new Test262Error('#193: -1 << 6 === -64. Actual: ' + (-1 << 6)); +} + + +if (-2 << 6 !== -128) { + throw new Test262Error('#194: -2 << 6 === -128. Actual: ' + (-2 << 6)); +} + + +if (-4 << 6 !== -256) { + throw new Test262Error('#195: -4 << 6 === -256. Actual: ' + (-4 << 6)); +} + + +if (-8 << 6 !== -512) { + throw new Test262Error('#196: -8 << 6 === -512. Actual: ' + (-8 << 6)); +} + + +if (-16 << 6 !== -1024) { + throw new Test262Error('#197: -16 << 6 === -1024. Actual: ' + (-16 << 6)); +} + + +if (-32 << 6 !== -2048) { + throw new Test262Error('#198: -32 << 6 === -2048. Actual: ' + (-32 << 6)); +} + + +if (-64 << 6 !== -4096) { + throw new Test262Error('#199: -64 << 6 === -4096. Actual: ' + (-64 << 6)); +} + + +if (-128 << 6 !== -8192) { + throw new Test262Error('#200: -128 << 6 === -8192. Actual: ' + (-128 << 6)); +} + + +if (-256 << 6 !== -16384) { + throw new Test262Error('#201: -256 << 6 === -16384. Actual: ' + (-256 << 6)); +} + + +if (-512 << 6 !== -32768) { + throw new Test262Error('#202: -512 << 6 === -32768. Actual: ' + (-512 << 6)); +} + + +if (-1024 << 6 !== -65536) { + throw new Test262Error('#203: -1024 << 6 === -65536. Actual: ' + (-1024 << 6)); +} + + +if (-2048 << 6 !== -131072) { + throw new Test262Error('#204: -2048 << 6 === -131072. Actual: ' + (-2048 << 6)); +} + + +if (-4096 << 6 !== -262144) { + throw new Test262Error('#205: -4096 << 6 === -262144. Actual: ' + (-4096 << 6)); +} + + +if (-8192 << 6 !== -524288) { + throw new Test262Error('#206: -8192 << 6 === -524288. Actual: ' + (-8192 << 6)); +} + + +if (-16384 << 6 !== -1048576) { + throw new Test262Error('#207: -16384 << 6 === -1048576. Actual: ' + (-16384 << 6)); +} + + +if (-32768 << 6 !== -2097152) { + throw new Test262Error('#208: -32768 << 6 === -2097152. Actual: ' + (-32768 << 6)); +} + + +if (-65536 << 6 !== -4194304) { + throw new Test262Error('#209: -65536 << 6 === -4194304. Actual: ' + (-65536 << 6)); +} + + +if (-131072 << 6 !== -8388608) { + throw new Test262Error('#210: -131072 << 6 === -8388608. Actual: ' + (-131072 << 6)); +} + + +if (-262144 << 6 !== -16777216) { + throw new Test262Error('#211: -262144 << 6 === -16777216. Actual: ' + (-262144 << 6)); +} + + +if (-524288 << 6 !== -33554432) { + throw new Test262Error('#212: -524288 << 6 === -33554432. Actual: ' + (-524288 << 6)); +} + + +if (-1048576 << 6 !== -67108864) { + throw new Test262Error('#213: -1048576 << 6 === -67108864. Actual: ' + (-1048576 << 6)); +} + + +if (-2097152 << 6 !== -134217728) { + throw new Test262Error('#214: -2097152 << 6 === -134217728. Actual: ' + (-2097152 << 6)); +} + + +if (-4194304 << 6 !== -268435456) { + throw new Test262Error('#215: -4194304 << 6 === -268435456. Actual: ' + (-4194304 << 6)); +} + + +if (-8388608 << 6 !== -536870912) { + throw new Test262Error('#216: -8388608 << 6 === -536870912. Actual: ' + (-8388608 << 6)); +} + + +if (-16777216 << 6 !== -1073741824) { + throw new Test262Error('#217: -16777216 << 6 === -1073741824. Actual: ' + (-16777216 << 6)); +} + + +if (-33554432 << 6 !== -2147483648) { + throw new Test262Error('#218: -33554432 << 6 === -2147483648. Actual: ' + (-33554432 << 6)); +} + + +if (-67108864 << 6 !== 0) { + throw new Test262Error('#219: -67108864 << 6 === 0. Actual: ' + (-67108864 << 6)); +} + + +if (-134217728 << 6 !== 0) { + throw new Test262Error('#220: -134217728 << 6 === 0. Actual: ' + (-134217728 << 6)); +} + + +if (-268435456 << 6 !== 0) { + throw new Test262Error('#221: -268435456 << 6 === 0. Actual: ' + (-268435456 << 6)); +} + + +if (-536870912 << 6 !== 0) { + throw new Test262Error('#222: -536870912 << 6 === 0. Actual: ' + (-536870912 << 6)); +} + + +if (-1073741824 << 6 !== 0) { + throw new Test262Error('#223: -1073741824 << 6 === 0. Actual: ' + (-1073741824 << 6)); +} + + +if (-2147483648 << 6 !== 0) { + throw new Test262Error('#224: -2147483648 << 6 === 0. Actual: ' + (-2147483648 << 6)); +} + + +if (-1 << 7 !== -128) { + throw new Test262Error('#225: -1 << 7 === -128. Actual: ' + (-1 << 7)); +} + + +if (-2 << 7 !== -256) { + throw new Test262Error('#226: -2 << 7 === -256. Actual: ' + (-2 << 7)); +} + + +if (-4 << 7 !== -512) { + throw new Test262Error('#227: -4 << 7 === -512. Actual: ' + (-4 << 7)); +} + + +if (-8 << 7 !== -1024) { + throw new Test262Error('#228: -8 << 7 === -1024. Actual: ' + (-8 << 7)); +} + + +if (-16 << 7 !== -2048) { + throw new Test262Error('#229: -16 << 7 === -2048. Actual: ' + (-16 << 7)); +} + + +if (-32 << 7 !== -4096) { + throw new Test262Error('#230: -32 << 7 === -4096. Actual: ' + (-32 << 7)); +} + + +if (-64 << 7 !== -8192) { + throw new Test262Error('#231: -64 << 7 === -8192. Actual: ' + (-64 << 7)); +} + + +if (-128 << 7 !== -16384) { + throw new Test262Error('#232: -128 << 7 === -16384. Actual: ' + (-128 << 7)); +} + + +if (-256 << 7 !== -32768) { + throw new Test262Error('#233: -256 << 7 === -32768. Actual: ' + (-256 << 7)); +} + + +if (-512 << 7 !== -65536) { + throw new Test262Error('#234: -512 << 7 === -65536. Actual: ' + (-512 << 7)); +} + + +if (-1024 << 7 !== -131072) { + throw new Test262Error('#235: -1024 << 7 === -131072. Actual: ' + (-1024 << 7)); +} + + +if (-2048 << 7 !== -262144) { + throw new Test262Error('#236: -2048 << 7 === -262144. Actual: ' + (-2048 << 7)); +} + + +if (-4096 << 7 !== -524288) { + throw new Test262Error('#237: -4096 << 7 === -524288. Actual: ' + (-4096 << 7)); +} + + +if (-8192 << 7 !== -1048576) { + throw new Test262Error('#238: -8192 << 7 === -1048576. Actual: ' + (-8192 << 7)); +} + + +if (-16384 << 7 !== -2097152) { + throw new Test262Error('#239: -16384 << 7 === -2097152. Actual: ' + (-16384 << 7)); +} + + +if (-32768 << 7 !== -4194304) { + throw new Test262Error('#240: -32768 << 7 === -4194304. Actual: ' + (-32768 << 7)); +} + + +if (-65536 << 7 !== -8388608) { + throw new Test262Error('#241: -65536 << 7 === -8388608. Actual: ' + (-65536 << 7)); +} + + +if (-131072 << 7 !== -16777216) { + throw new Test262Error('#242: -131072 << 7 === -16777216. Actual: ' + (-131072 << 7)); +} + + +if (-262144 << 7 !== -33554432) { + throw new Test262Error('#243: -262144 << 7 === -33554432. Actual: ' + (-262144 << 7)); +} + + +if (-524288 << 7 !== -67108864) { + throw new Test262Error('#244: -524288 << 7 === -67108864. Actual: ' + (-524288 << 7)); +} + + +if (-1048576 << 7 !== -134217728) { + throw new Test262Error('#245: -1048576 << 7 === -134217728. Actual: ' + (-1048576 << 7)); +} + + +if (-2097152 << 7 !== -268435456) { + throw new Test262Error('#246: -2097152 << 7 === -268435456. Actual: ' + (-2097152 << 7)); +} + + +if (-4194304 << 7 !== -536870912) { + throw new Test262Error('#247: -4194304 << 7 === -536870912. Actual: ' + (-4194304 << 7)); +} + + +if (-8388608 << 7 !== -1073741824) { + throw new Test262Error('#248: -8388608 << 7 === -1073741824. Actual: ' + (-8388608 << 7)); +} + + +if (-16777216 << 7 !== -2147483648) { + throw new Test262Error('#249: -16777216 << 7 === -2147483648. Actual: ' + (-16777216 << 7)); +} + + +if (-33554432 << 7 !== 0) { + throw new Test262Error('#250: -33554432 << 7 === 0. Actual: ' + (-33554432 << 7)); +} + + +if (-67108864 << 7 !== 0) { + throw new Test262Error('#251: -67108864 << 7 === 0. Actual: ' + (-67108864 << 7)); +} + + +if (-134217728 << 7 !== 0) { + throw new Test262Error('#252: -134217728 << 7 === 0. Actual: ' + (-134217728 << 7)); +} + + +if (-268435456 << 7 !== 0) { + throw new Test262Error('#253: -268435456 << 7 === 0. Actual: ' + (-268435456 << 7)); +} + + +if (-536870912 << 7 !== 0) { + throw new Test262Error('#254: -536870912 << 7 === 0. Actual: ' + (-536870912 << 7)); +} + + +if (-1073741824 << 7 !== 0) { + throw new Test262Error('#255: -1073741824 << 7 === 0. Actual: ' + (-1073741824 << 7)); +} + + +if (-2147483648 << 7 !== 0) { + throw new Test262Error('#256: -2147483648 << 7 === 0. Actual: ' + (-2147483648 << 7)); +} + + +if (-1 << 8 !== -256) { + throw new Test262Error('#257: -1 << 8 === -256. Actual: ' + (-1 << 8)); +} + + +if (-2 << 8 !== -512) { + throw new Test262Error('#258: -2 << 8 === -512. Actual: ' + (-2 << 8)); +} + + +if (-4 << 8 !== -1024) { + throw new Test262Error('#259: -4 << 8 === -1024. Actual: ' + (-4 << 8)); +} + + +if (-8 << 8 !== -2048) { + throw new Test262Error('#260: -8 << 8 === -2048. Actual: ' + (-8 << 8)); +} + + +if (-16 << 8 !== -4096) { + throw new Test262Error('#261: -16 << 8 === -4096. Actual: ' + (-16 << 8)); +} + + +if (-32 << 8 !== -8192) { + throw new Test262Error('#262: -32 << 8 === -8192. Actual: ' + (-32 << 8)); +} + + +if (-64 << 8 !== -16384) { + throw new Test262Error('#263: -64 << 8 === -16384. Actual: ' + (-64 << 8)); +} + + +if (-128 << 8 !== -32768) { + throw new Test262Error('#264: -128 << 8 === -32768. Actual: ' + (-128 << 8)); +} + + +if (-256 << 8 !== -65536) { + throw new Test262Error('#265: -256 << 8 === -65536. Actual: ' + (-256 << 8)); +} + + +if (-512 << 8 !== -131072) { + throw new Test262Error('#266: -512 << 8 === -131072. Actual: ' + (-512 << 8)); +} + + +if (-1024 << 8 !== -262144) { + throw new Test262Error('#267: -1024 << 8 === -262144. Actual: ' + (-1024 << 8)); +} + + +if (-2048 << 8 !== -524288) { + throw new Test262Error('#268: -2048 << 8 === -524288. Actual: ' + (-2048 << 8)); +} + + +if (-4096 << 8 !== -1048576) { + throw new Test262Error('#269: -4096 << 8 === -1048576. Actual: ' + (-4096 << 8)); +} + + +if (-8192 << 8 !== -2097152) { + throw new Test262Error('#270: -8192 << 8 === -2097152. Actual: ' + (-8192 << 8)); +} + + +if (-16384 << 8 !== -4194304) { + throw new Test262Error('#271: -16384 << 8 === -4194304. Actual: ' + (-16384 << 8)); +} + + +if (-32768 << 8 !== -8388608) { + throw new Test262Error('#272: -32768 << 8 === -8388608. Actual: ' + (-32768 << 8)); +} + + +if (-65536 << 8 !== -16777216) { + throw new Test262Error('#273: -65536 << 8 === -16777216. Actual: ' + (-65536 << 8)); +} + + +if (-131072 << 8 !== -33554432) { + throw new Test262Error('#274: -131072 << 8 === -33554432. Actual: ' + (-131072 << 8)); +} + + +if (-262144 << 8 !== -67108864) { + throw new Test262Error('#275: -262144 << 8 === -67108864. Actual: ' + (-262144 << 8)); +} + + +if (-524288 << 8 !== -134217728) { + throw new Test262Error('#276: -524288 << 8 === -134217728. Actual: ' + (-524288 << 8)); +} + + +if (-1048576 << 8 !== -268435456) { + throw new Test262Error('#277: -1048576 << 8 === -268435456. Actual: ' + (-1048576 << 8)); +} + + +if (-2097152 << 8 !== -536870912) { + throw new Test262Error('#278: -2097152 << 8 === -536870912. Actual: ' + (-2097152 << 8)); +} + + +if (-4194304 << 8 !== -1073741824) { + throw new Test262Error('#279: -4194304 << 8 === -1073741824. Actual: ' + (-4194304 << 8)); +} + + +if (-8388608 << 8 !== -2147483648) { + throw new Test262Error('#280: -8388608 << 8 === -2147483648. Actual: ' + (-8388608 << 8)); +} + + +if (-16777216 << 8 !== 0) { + throw new Test262Error('#281: -16777216 << 8 === 0. Actual: ' + (-16777216 << 8)); +} + + +if (-33554432 << 8 !== 0) { + throw new Test262Error('#282: -33554432 << 8 === 0. Actual: ' + (-33554432 << 8)); +} + + +if (-67108864 << 8 !== 0) { + throw new Test262Error('#283: -67108864 << 8 === 0. Actual: ' + (-67108864 << 8)); +} + + +if (-134217728 << 8 !== 0) { + throw new Test262Error('#284: -134217728 << 8 === 0. Actual: ' + (-134217728 << 8)); +} + + +if (-268435456 << 8 !== 0) { + throw new Test262Error('#285: -268435456 << 8 === 0. Actual: ' + (-268435456 << 8)); +} + + +if (-536870912 << 8 !== 0) { + throw new Test262Error('#286: -536870912 << 8 === 0. Actual: ' + (-536870912 << 8)); +} + + +if (-1073741824 << 8 !== 0) { + throw new Test262Error('#287: -1073741824 << 8 === 0. Actual: ' + (-1073741824 << 8)); +} + + +if (-2147483648 << 8 !== 0) { + throw new Test262Error('#288: -2147483648 << 8 === 0. Actual: ' + (-2147483648 << 8)); +} + + +if (-1 << 9 !== -512) { + throw new Test262Error('#289: -1 << 9 === -512. Actual: ' + (-1 << 9)); +} + + +if (-2 << 9 !== -1024) { + throw new Test262Error('#290: -2 << 9 === -1024. Actual: ' + (-2 << 9)); +} + + +if (-4 << 9 !== -2048) { + throw new Test262Error('#291: -4 << 9 === -2048. Actual: ' + (-4 << 9)); +} + + +if (-8 << 9 !== -4096) { + throw new Test262Error('#292: -8 << 9 === -4096. Actual: ' + (-8 << 9)); +} + + +if (-16 << 9 !== -8192) { + throw new Test262Error('#293: -16 << 9 === -8192. Actual: ' + (-16 << 9)); +} + + +if (-32 << 9 !== -16384) { + throw new Test262Error('#294: -32 << 9 === -16384. Actual: ' + (-32 << 9)); +} + + +if (-64 << 9 !== -32768) { + throw new Test262Error('#295: -64 << 9 === -32768. Actual: ' + (-64 << 9)); +} + + +if (-128 << 9 !== -65536) { + throw new Test262Error('#296: -128 << 9 === -65536. Actual: ' + (-128 << 9)); +} + + +if (-256 << 9 !== -131072) { + throw new Test262Error('#297: -256 << 9 === -131072. Actual: ' + (-256 << 9)); +} + + +if (-512 << 9 !== -262144) { + throw new Test262Error('#298: -512 << 9 === -262144. Actual: ' + (-512 << 9)); +} + + +if (-1024 << 9 !== -524288) { + throw new Test262Error('#299: -1024 << 9 === -524288. Actual: ' + (-1024 << 9)); +} + + +if (-2048 << 9 !== -1048576) { + throw new Test262Error('#300: -2048 << 9 === -1048576. Actual: ' + (-2048 << 9)); +} + + +if (-4096 << 9 !== -2097152) { + throw new Test262Error('#301: -4096 << 9 === -2097152. Actual: ' + (-4096 << 9)); +} + + +if (-8192 << 9 !== -4194304) { + throw new Test262Error('#302: -8192 << 9 === -4194304. Actual: ' + (-8192 << 9)); +} + + +if (-16384 << 9 !== -8388608) { + throw new Test262Error('#303: -16384 << 9 === -8388608. Actual: ' + (-16384 << 9)); +} + + +if (-32768 << 9 !== -16777216) { + throw new Test262Error('#304: -32768 << 9 === -16777216. Actual: ' + (-32768 << 9)); +} + + +if (-65536 << 9 !== -33554432) { + throw new Test262Error('#305: -65536 << 9 === -33554432. Actual: ' + (-65536 << 9)); +} + + +if (-131072 << 9 !== -67108864) { + throw new Test262Error('#306: -131072 << 9 === -67108864. Actual: ' + (-131072 << 9)); +} + + +if (-262144 << 9 !== -134217728) { + throw new Test262Error('#307: -262144 << 9 === -134217728. Actual: ' + (-262144 << 9)); +} + + +if (-524288 << 9 !== -268435456) { + throw new Test262Error('#308: -524288 << 9 === -268435456. Actual: ' + (-524288 << 9)); +} + + +if (-1048576 << 9 !== -536870912) { + throw new Test262Error('#309: -1048576 << 9 === -536870912. Actual: ' + (-1048576 << 9)); +} + + +if (-2097152 << 9 !== -1073741824) { + throw new Test262Error('#310: -2097152 << 9 === -1073741824. Actual: ' + (-2097152 << 9)); +} + + +if (-4194304 << 9 !== -2147483648) { + throw new Test262Error('#311: -4194304 << 9 === -2147483648. Actual: ' + (-4194304 << 9)); +} + + +if (-8388608 << 9 !== 0) { + throw new Test262Error('#312: -8388608 << 9 === 0. Actual: ' + (-8388608 << 9)); +} + + +if (-16777216 << 9 !== 0) { + throw new Test262Error('#313: -16777216 << 9 === 0. Actual: ' + (-16777216 << 9)); +} + + +if (-33554432 << 9 !== 0) { + throw new Test262Error('#314: -33554432 << 9 === 0. Actual: ' + (-33554432 << 9)); +} + + +if (-67108864 << 9 !== 0) { + throw new Test262Error('#315: -67108864 << 9 === 0. Actual: ' + (-67108864 << 9)); +} + + +if (-134217728 << 9 !== 0) { + throw new Test262Error('#316: -134217728 << 9 === 0. Actual: ' + (-134217728 << 9)); +} + + +if (-268435456 << 9 !== 0) { + throw new Test262Error('#317: -268435456 << 9 === 0. Actual: ' + (-268435456 << 9)); +} + + +if (-536870912 << 9 !== 0) { + throw new Test262Error('#318: -536870912 << 9 === 0. Actual: ' + (-536870912 << 9)); +} + + +if (-1073741824 << 9 !== 0) { + throw new Test262Error('#319: -1073741824 << 9 === 0. Actual: ' + (-1073741824 << 9)); +} + + +if (-2147483648 << 9 !== 0) { + throw new Test262Error('#320: -2147483648 << 9 === 0. Actual: ' + (-2147483648 << 9)); +} + + +if (-1 << 10 !== -1024) { + throw new Test262Error('#321: -1 << 10 === -1024. Actual: ' + (-1 << 10)); +} + + +if (-2 << 10 !== -2048) { + throw new Test262Error('#322: -2 << 10 === -2048. Actual: ' + (-2 << 10)); +} + + +if (-4 << 10 !== -4096) { + throw new Test262Error('#323: -4 << 10 === -4096. Actual: ' + (-4 << 10)); +} + + +if (-8 << 10 !== -8192) { + throw new Test262Error('#324: -8 << 10 === -8192. Actual: ' + (-8 << 10)); +} + + +if (-16 << 10 !== -16384) { + throw new Test262Error('#325: -16 << 10 === -16384. Actual: ' + (-16 << 10)); +} + + +if (-32 << 10 !== -32768) { + throw new Test262Error('#326: -32 << 10 === -32768. Actual: ' + (-32 << 10)); +} + + +if (-64 << 10 !== -65536) { + throw new Test262Error('#327: -64 << 10 === -65536. Actual: ' + (-64 << 10)); +} + + +if (-128 << 10 !== -131072) { + throw new Test262Error('#328: -128 << 10 === -131072. Actual: ' + (-128 << 10)); +} + + +if (-256 << 10 !== -262144) { + throw new Test262Error('#329: -256 << 10 === -262144. Actual: ' + (-256 << 10)); +} + + +if (-512 << 10 !== -524288) { + throw new Test262Error('#330: -512 << 10 === -524288. Actual: ' + (-512 << 10)); +} + + +if (-1024 << 10 !== -1048576) { + throw new Test262Error('#331: -1024 << 10 === -1048576. Actual: ' + (-1024 << 10)); +} + + +if (-2048 << 10 !== -2097152) { + throw new Test262Error('#332: -2048 << 10 === -2097152. Actual: ' + (-2048 << 10)); +} + + +if (-4096 << 10 !== -4194304) { + throw new Test262Error('#333: -4096 << 10 === -4194304. Actual: ' + (-4096 << 10)); +} + + +if (-8192 << 10 !== -8388608) { + throw new Test262Error('#334: -8192 << 10 === -8388608. Actual: ' + (-8192 << 10)); +} + + +if (-16384 << 10 !== -16777216) { + throw new Test262Error('#335: -16384 << 10 === -16777216. Actual: ' + (-16384 << 10)); +} + + +if (-32768 << 10 !== -33554432) { + throw new Test262Error('#336: -32768 << 10 === -33554432. Actual: ' + (-32768 << 10)); +} + + +if (-65536 << 10 !== -67108864) { + throw new Test262Error('#337: -65536 << 10 === -67108864. Actual: ' + (-65536 << 10)); +} + + +if (-131072 << 10 !== -134217728) { + throw new Test262Error('#338: -131072 << 10 === -134217728. Actual: ' + (-131072 << 10)); +} + + +if (-262144 << 10 !== -268435456) { + throw new Test262Error('#339: -262144 << 10 === -268435456. Actual: ' + (-262144 << 10)); +} + + +if (-524288 << 10 !== -536870912) { + throw new Test262Error('#340: -524288 << 10 === -536870912. Actual: ' + (-524288 << 10)); +} + + +if (-1048576 << 10 !== -1073741824) { + throw new Test262Error('#341: -1048576 << 10 === -1073741824. Actual: ' + (-1048576 << 10)); +} + + +if (-2097152 << 10 !== -2147483648) { + throw new Test262Error('#342: -2097152 << 10 === -2147483648. Actual: ' + (-2097152 << 10)); +} + + +if (-4194304 << 10 !== 0) { + throw new Test262Error('#343: -4194304 << 10 === 0. Actual: ' + (-4194304 << 10)); +} + + +if (-8388608 << 10 !== 0) { + throw new Test262Error('#344: -8388608 << 10 === 0. Actual: ' + (-8388608 << 10)); +} + + +if (-16777216 << 10 !== 0) { + throw new Test262Error('#345: -16777216 << 10 === 0. Actual: ' + (-16777216 << 10)); +} + + +if (-33554432 << 10 !== 0) { + throw new Test262Error('#346: -33554432 << 10 === 0. Actual: ' + (-33554432 << 10)); +} + + +if (-67108864 << 10 !== 0) { + throw new Test262Error('#347: -67108864 << 10 === 0. Actual: ' + (-67108864 << 10)); +} + + +if (-134217728 << 10 !== 0) { + throw new Test262Error('#348: -134217728 << 10 === 0. Actual: ' + (-134217728 << 10)); +} + + +if (-268435456 << 10 !== 0) { + throw new Test262Error('#349: -268435456 << 10 === 0. Actual: ' + (-268435456 << 10)); +} + + +if (-536870912 << 10 !== 0) { + throw new Test262Error('#350: -536870912 << 10 === 0. Actual: ' + (-536870912 << 10)); +} + + +if (-1073741824 << 10 !== 0) { + throw new Test262Error('#351: -1073741824 << 10 === 0. Actual: ' + (-1073741824 << 10)); +} + + +if (-2147483648 << 10 !== 0) { + throw new Test262Error('#352: -2147483648 << 10 === 0. Actual: ' + (-2147483648 << 10)); +} + + +if (-1 << 11 !== -2048) { + throw new Test262Error('#353: -1 << 11 === -2048. Actual: ' + (-1 << 11)); +} + + +if (-2 << 11 !== -4096) { + throw new Test262Error('#354: -2 << 11 === -4096. Actual: ' + (-2 << 11)); +} + + +if (-4 << 11 !== -8192) { + throw new Test262Error('#355: -4 << 11 === -8192. Actual: ' + (-4 << 11)); +} + + +if (-8 << 11 !== -16384) { + throw new Test262Error('#356: -8 << 11 === -16384. Actual: ' + (-8 << 11)); +} + + +if (-16 << 11 !== -32768) { + throw new Test262Error('#357: -16 << 11 === -32768. Actual: ' + (-16 << 11)); +} + + +if (-32 << 11 !== -65536) { + throw new Test262Error('#358: -32 << 11 === -65536. Actual: ' + (-32 << 11)); +} + + +if (-64 << 11 !== -131072) { + throw new Test262Error('#359: -64 << 11 === -131072. Actual: ' + (-64 << 11)); +} + + +if (-128 << 11 !== -262144) { + throw new Test262Error('#360: -128 << 11 === -262144. Actual: ' + (-128 << 11)); +} + + +if (-256 << 11 !== -524288) { + throw new Test262Error('#361: -256 << 11 === -524288. Actual: ' + (-256 << 11)); +} + + +if (-512 << 11 !== -1048576) { + throw new Test262Error('#362: -512 << 11 === -1048576. Actual: ' + (-512 << 11)); +} + + +if (-1024 << 11 !== -2097152) { + throw new Test262Error('#363: -1024 << 11 === -2097152. Actual: ' + (-1024 << 11)); +} + + +if (-2048 << 11 !== -4194304) { + throw new Test262Error('#364: -2048 << 11 === -4194304. Actual: ' + (-2048 << 11)); +} + + +if (-4096 << 11 !== -8388608) { + throw new Test262Error('#365: -4096 << 11 === -8388608. Actual: ' + (-4096 << 11)); +} + + +if (-8192 << 11 !== -16777216) { + throw new Test262Error('#366: -8192 << 11 === -16777216. Actual: ' + (-8192 << 11)); +} + + +if (-16384 << 11 !== -33554432) { + throw new Test262Error('#367: -16384 << 11 === -33554432. Actual: ' + (-16384 << 11)); +} + + +if (-32768 << 11 !== -67108864) { + throw new Test262Error('#368: -32768 << 11 === -67108864. Actual: ' + (-32768 << 11)); +} + + +if (-65536 << 11 !== -134217728) { + throw new Test262Error('#369: -65536 << 11 === -134217728. Actual: ' + (-65536 << 11)); +} + + +if (-131072 << 11 !== -268435456) { + throw new Test262Error('#370: -131072 << 11 === -268435456. Actual: ' + (-131072 << 11)); +} + + +if (-262144 << 11 !== -536870912) { + throw new Test262Error('#371: -262144 << 11 === -536870912. Actual: ' + (-262144 << 11)); +} + + +if (-524288 << 11 !== -1073741824) { + throw new Test262Error('#372: -524288 << 11 === -1073741824. Actual: ' + (-524288 << 11)); +} + + +if (-1048576 << 11 !== -2147483648) { + throw new Test262Error('#373: -1048576 << 11 === -2147483648. Actual: ' + (-1048576 << 11)); +} + + +if (-2097152 << 11 !== 0) { + throw new Test262Error('#374: -2097152 << 11 === 0. Actual: ' + (-2097152 << 11)); +} + + +if (-4194304 << 11 !== 0) { + throw new Test262Error('#375: -4194304 << 11 === 0. Actual: ' + (-4194304 << 11)); +} + + +if (-8388608 << 11 !== 0) { + throw new Test262Error('#376: -8388608 << 11 === 0. Actual: ' + (-8388608 << 11)); +} + + +if (-16777216 << 11 !== 0) { + throw new Test262Error('#377: -16777216 << 11 === 0. Actual: ' + (-16777216 << 11)); +} + + +if (-33554432 << 11 !== 0) { + throw new Test262Error('#378: -33554432 << 11 === 0. Actual: ' + (-33554432 << 11)); +} + + +if (-67108864 << 11 !== 0) { + throw new Test262Error('#379: -67108864 << 11 === 0. Actual: ' + (-67108864 << 11)); +} + + +if (-134217728 << 11 !== 0) { + throw new Test262Error('#380: -134217728 << 11 === 0. Actual: ' + (-134217728 << 11)); +} + + +if (-268435456 << 11 !== 0) { + throw new Test262Error('#381: -268435456 << 11 === 0. Actual: ' + (-268435456 << 11)); +} + + +if (-536870912 << 11 !== 0) { + throw new Test262Error('#382: -536870912 << 11 === 0. Actual: ' + (-536870912 << 11)); +} + + +if (-1073741824 << 11 !== 0) { + throw new Test262Error('#383: -1073741824 << 11 === 0. Actual: ' + (-1073741824 << 11)); +} + + +if (-2147483648 << 11 !== 0) { + throw new Test262Error('#384: -2147483648 << 11 === 0. Actual: ' + (-2147483648 << 11)); +} + + +if (-1 << 12 !== -4096) { + throw new Test262Error('#385: -1 << 12 === -4096. Actual: ' + (-1 << 12)); +} + + +if (-2 << 12 !== -8192) { + throw new Test262Error('#386: -2 << 12 === -8192. Actual: ' + (-2 << 12)); +} + + +if (-4 << 12 !== -16384) { + throw new Test262Error('#387: -4 << 12 === -16384. Actual: ' + (-4 << 12)); +} + + +if (-8 << 12 !== -32768) { + throw new Test262Error('#388: -8 << 12 === -32768. Actual: ' + (-8 << 12)); +} + + +if (-16 << 12 !== -65536) { + throw new Test262Error('#389: -16 << 12 === -65536. Actual: ' + (-16 << 12)); +} + + +if (-32 << 12 !== -131072) { + throw new Test262Error('#390: -32 << 12 === -131072. Actual: ' + (-32 << 12)); +} + + +if (-64 << 12 !== -262144) { + throw new Test262Error('#391: -64 << 12 === -262144. Actual: ' + (-64 << 12)); +} + + +if (-128 << 12 !== -524288) { + throw new Test262Error('#392: -128 << 12 === -524288. Actual: ' + (-128 << 12)); +} + + +if (-256 << 12 !== -1048576) { + throw new Test262Error('#393: -256 << 12 === -1048576. Actual: ' + (-256 << 12)); +} + + +if (-512 << 12 !== -2097152) { + throw new Test262Error('#394: -512 << 12 === -2097152. Actual: ' + (-512 << 12)); +} + + +if (-1024 << 12 !== -4194304) { + throw new Test262Error('#395: -1024 << 12 === -4194304. Actual: ' + (-1024 << 12)); +} + + +if (-2048 << 12 !== -8388608) { + throw new Test262Error('#396: -2048 << 12 === -8388608. Actual: ' + (-2048 << 12)); +} + + +if (-4096 << 12 !== -16777216) { + throw new Test262Error('#397: -4096 << 12 === -16777216. Actual: ' + (-4096 << 12)); +} + + +if (-8192 << 12 !== -33554432) { + throw new Test262Error('#398: -8192 << 12 === -33554432. Actual: ' + (-8192 << 12)); +} + + +if (-16384 << 12 !== -67108864) { + throw new Test262Error('#399: -16384 << 12 === -67108864. Actual: ' + (-16384 << 12)); +} + + +if (-32768 << 12 !== -134217728) { + throw new Test262Error('#400: -32768 << 12 === -134217728. Actual: ' + (-32768 << 12)); +} + + +if (-65536 << 12 !== -268435456) { + throw new Test262Error('#401: -65536 << 12 === -268435456. Actual: ' + (-65536 << 12)); +} + + +if (-131072 << 12 !== -536870912) { + throw new Test262Error('#402: -131072 << 12 === -536870912. Actual: ' + (-131072 << 12)); +} + + +if (-262144 << 12 !== -1073741824) { + throw new Test262Error('#403: -262144 << 12 === -1073741824. Actual: ' + (-262144 << 12)); +} + + +if (-524288 << 12 !== -2147483648) { + throw new Test262Error('#404: -524288 << 12 === -2147483648. Actual: ' + (-524288 << 12)); +} + + +if (-1048576 << 12 !== 0) { + throw new Test262Error('#405: -1048576 << 12 === 0. Actual: ' + (-1048576 << 12)); +} + + +if (-2097152 << 12 !== 0) { + throw new Test262Error('#406: -2097152 << 12 === 0. Actual: ' + (-2097152 << 12)); +} + + +if (-4194304 << 12 !== 0) { + throw new Test262Error('#407: -4194304 << 12 === 0. Actual: ' + (-4194304 << 12)); +} + + +if (-8388608 << 12 !== 0) { + throw new Test262Error('#408: -8388608 << 12 === 0. Actual: ' + (-8388608 << 12)); +} + + +if (-16777216 << 12 !== 0) { + throw new Test262Error('#409: -16777216 << 12 === 0. Actual: ' + (-16777216 << 12)); +} + + +if (-33554432 << 12 !== 0) { + throw new Test262Error('#410: -33554432 << 12 === 0. Actual: ' + (-33554432 << 12)); +} + + +if (-67108864 << 12 !== 0) { + throw new Test262Error('#411: -67108864 << 12 === 0. Actual: ' + (-67108864 << 12)); +} + + +if (-134217728 << 12 !== 0) { + throw new Test262Error('#412: -134217728 << 12 === 0. Actual: ' + (-134217728 << 12)); +} + + +if (-268435456 << 12 !== 0) { + throw new Test262Error('#413: -268435456 << 12 === 0. Actual: ' + (-268435456 << 12)); +} + + +if (-536870912 << 12 !== 0) { + throw new Test262Error('#414: -536870912 << 12 === 0. Actual: ' + (-536870912 << 12)); +} + + +if (-1073741824 << 12 !== 0) { + throw new Test262Error('#415: -1073741824 << 12 === 0. Actual: ' + (-1073741824 << 12)); +} + + +if (-2147483648 << 12 !== 0) { + throw new Test262Error('#416: -2147483648 << 12 === 0. Actual: ' + (-2147483648 << 12)); +} + + +if (-1 << 13 !== -8192) { + throw new Test262Error('#417: -1 << 13 === -8192. Actual: ' + (-1 << 13)); +} + + +if (-2 << 13 !== -16384) { + throw new Test262Error('#418: -2 << 13 === -16384. Actual: ' + (-2 << 13)); +} + + +if (-4 << 13 !== -32768) { + throw new Test262Error('#419: -4 << 13 === -32768. Actual: ' + (-4 << 13)); +} + + +if (-8 << 13 !== -65536) { + throw new Test262Error('#420: -8 << 13 === -65536. Actual: ' + (-8 << 13)); +} + + +if (-16 << 13 !== -131072) { + throw new Test262Error('#421: -16 << 13 === -131072. Actual: ' + (-16 << 13)); +} + + +if (-32 << 13 !== -262144) { + throw new Test262Error('#422: -32 << 13 === -262144. Actual: ' + (-32 << 13)); +} + + +if (-64 << 13 !== -524288) { + throw new Test262Error('#423: -64 << 13 === -524288. Actual: ' + (-64 << 13)); +} + + +if (-128 << 13 !== -1048576) { + throw new Test262Error('#424: -128 << 13 === -1048576. Actual: ' + (-128 << 13)); +} + + +if (-256 << 13 !== -2097152) { + throw new Test262Error('#425: -256 << 13 === -2097152. Actual: ' + (-256 << 13)); +} + + +if (-512 << 13 !== -4194304) { + throw new Test262Error('#426: -512 << 13 === -4194304. Actual: ' + (-512 << 13)); +} + + +if (-1024 << 13 !== -8388608) { + throw new Test262Error('#427: -1024 << 13 === -8388608. Actual: ' + (-1024 << 13)); +} + + +if (-2048 << 13 !== -16777216) { + throw new Test262Error('#428: -2048 << 13 === -16777216. Actual: ' + (-2048 << 13)); +} + + +if (-4096 << 13 !== -33554432) { + throw new Test262Error('#429: -4096 << 13 === -33554432. Actual: ' + (-4096 << 13)); +} + + +if (-8192 << 13 !== -67108864) { + throw new Test262Error('#430: -8192 << 13 === -67108864. Actual: ' + (-8192 << 13)); +} + + +if (-16384 << 13 !== -134217728) { + throw new Test262Error('#431: -16384 << 13 === -134217728. Actual: ' + (-16384 << 13)); +} + + +if (-32768 << 13 !== -268435456) { + throw new Test262Error('#432: -32768 << 13 === -268435456. Actual: ' + (-32768 << 13)); +} + + +if (-65536 << 13 !== -536870912) { + throw new Test262Error('#433: -65536 << 13 === -536870912. Actual: ' + (-65536 << 13)); +} + + +if (-131072 << 13 !== -1073741824) { + throw new Test262Error('#434: -131072 << 13 === -1073741824. Actual: ' + (-131072 << 13)); +} + + +if (-262144 << 13 !== -2147483648) { + throw new Test262Error('#435: -262144 << 13 === -2147483648. Actual: ' + (-262144 << 13)); +} + + +if (-524288 << 13 !== 0) { + throw new Test262Error('#436: -524288 << 13 === 0. Actual: ' + (-524288 << 13)); +} + + +if (-1048576 << 13 !== 0) { + throw new Test262Error('#437: -1048576 << 13 === 0. Actual: ' + (-1048576 << 13)); +} + + +if (-2097152 << 13 !== 0) { + throw new Test262Error('#438: -2097152 << 13 === 0. Actual: ' + (-2097152 << 13)); +} + + +if (-4194304 << 13 !== 0) { + throw new Test262Error('#439: -4194304 << 13 === 0. Actual: ' + (-4194304 << 13)); +} + + +if (-8388608 << 13 !== 0) { + throw new Test262Error('#440: -8388608 << 13 === 0. Actual: ' + (-8388608 << 13)); +} + + +if (-16777216 << 13 !== 0) { + throw new Test262Error('#441: -16777216 << 13 === 0. Actual: ' + (-16777216 << 13)); +} + + +if (-33554432 << 13 !== 0) { + throw new Test262Error('#442: -33554432 << 13 === 0. Actual: ' + (-33554432 << 13)); +} + + +if (-67108864 << 13 !== 0) { + throw new Test262Error('#443: -67108864 << 13 === 0. Actual: ' + (-67108864 << 13)); +} + + +if (-134217728 << 13 !== 0) { + throw new Test262Error('#444: -134217728 << 13 === 0. Actual: ' + (-134217728 << 13)); +} + + +if (-268435456 << 13 !== 0) { + throw new Test262Error('#445: -268435456 << 13 === 0. Actual: ' + (-268435456 << 13)); +} + + +if (-536870912 << 13 !== 0) { + throw new Test262Error('#446: -536870912 << 13 === 0. Actual: ' + (-536870912 << 13)); +} + + +if (-1073741824 << 13 !== 0) { + throw new Test262Error('#447: -1073741824 << 13 === 0. Actual: ' + (-1073741824 << 13)); +} + + +if (-2147483648 << 13 !== 0) { + throw new Test262Error('#448: -2147483648 << 13 === 0. Actual: ' + (-2147483648 << 13)); +} + + +if (-1 << 14 !== -16384) { + throw new Test262Error('#449: -1 << 14 === -16384. Actual: ' + (-1 << 14)); +} + + +if (-2 << 14 !== -32768) { + throw new Test262Error('#450: -2 << 14 === -32768. Actual: ' + (-2 << 14)); +} + + +if (-4 << 14 !== -65536) { + throw new Test262Error('#451: -4 << 14 === -65536. Actual: ' + (-4 << 14)); +} + + +if (-8 << 14 !== -131072) { + throw new Test262Error('#452: -8 << 14 === -131072. Actual: ' + (-8 << 14)); +} + + +if (-16 << 14 !== -262144) { + throw new Test262Error('#453: -16 << 14 === -262144. Actual: ' + (-16 << 14)); +} + + +if (-32 << 14 !== -524288) { + throw new Test262Error('#454: -32 << 14 === -524288. Actual: ' + (-32 << 14)); +} + + +if (-64 << 14 !== -1048576) { + throw new Test262Error('#455: -64 << 14 === -1048576. Actual: ' + (-64 << 14)); +} + + +if (-128 << 14 !== -2097152) { + throw new Test262Error('#456: -128 << 14 === -2097152. Actual: ' + (-128 << 14)); +} + + +if (-256 << 14 !== -4194304) { + throw new Test262Error('#457: -256 << 14 === -4194304. Actual: ' + (-256 << 14)); +} + + +if (-512 << 14 !== -8388608) { + throw new Test262Error('#458: -512 << 14 === -8388608. Actual: ' + (-512 << 14)); +} + + +if (-1024 << 14 !== -16777216) { + throw new Test262Error('#459: -1024 << 14 === -16777216. Actual: ' + (-1024 << 14)); +} + + +if (-2048 << 14 !== -33554432) { + throw new Test262Error('#460: -2048 << 14 === -33554432. Actual: ' + (-2048 << 14)); +} + + +if (-4096 << 14 !== -67108864) { + throw new Test262Error('#461: -4096 << 14 === -67108864. Actual: ' + (-4096 << 14)); +} + + +if (-8192 << 14 !== -134217728) { + throw new Test262Error('#462: -8192 << 14 === -134217728. Actual: ' + (-8192 << 14)); +} + + +if (-16384 << 14 !== -268435456) { + throw new Test262Error('#463: -16384 << 14 === -268435456. Actual: ' + (-16384 << 14)); +} + + +if (-32768 << 14 !== -536870912) { + throw new Test262Error('#464: -32768 << 14 === -536870912. Actual: ' + (-32768 << 14)); +} + + +if (-65536 << 14 !== -1073741824) { + throw new Test262Error('#465: -65536 << 14 === -1073741824. Actual: ' + (-65536 << 14)); +} + + +if (-131072 << 14 !== -2147483648) { + throw new Test262Error('#466: -131072 << 14 === -2147483648. Actual: ' + (-131072 << 14)); +} + + +if (-262144 << 14 !== 0) { + throw new Test262Error('#467: -262144 << 14 === 0. Actual: ' + (-262144 << 14)); +} + + +if (-524288 << 14 !== 0) { + throw new Test262Error('#468: -524288 << 14 === 0. Actual: ' + (-524288 << 14)); +} + + +if (-1048576 << 14 !== 0) { + throw new Test262Error('#469: -1048576 << 14 === 0. Actual: ' + (-1048576 << 14)); +} + + +if (-2097152 << 14 !== 0) { + throw new Test262Error('#470: -2097152 << 14 === 0. Actual: ' + (-2097152 << 14)); +} + + +if (-4194304 << 14 !== 0) { + throw new Test262Error('#471: -4194304 << 14 === 0. Actual: ' + (-4194304 << 14)); +} + + +if (-8388608 << 14 !== 0) { + throw new Test262Error('#472: -8388608 << 14 === 0. Actual: ' + (-8388608 << 14)); +} + + +if (-16777216 << 14 !== 0) { + throw new Test262Error('#473: -16777216 << 14 === 0. Actual: ' + (-16777216 << 14)); +} + + +if (-33554432 << 14 !== 0) { + throw new Test262Error('#474: -33554432 << 14 === 0. Actual: ' + (-33554432 << 14)); +} + + +if (-67108864 << 14 !== 0) { + throw new Test262Error('#475: -67108864 << 14 === 0. Actual: ' + (-67108864 << 14)); +} + + +if (-134217728 << 14 !== 0) { + throw new Test262Error('#476: -134217728 << 14 === 0. Actual: ' + (-134217728 << 14)); +} + + +if (-268435456 << 14 !== 0) { + throw new Test262Error('#477: -268435456 << 14 === 0. Actual: ' + (-268435456 << 14)); +} + + +if (-536870912 << 14 !== 0) { + throw new Test262Error('#478: -536870912 << 14 === 0. Actual: ' + (-536870912 << 14)); +} + + +if (-1073741824 << 14 !== 0) { + throw new Test262Error('#479: -1073741824 << 14 === 0. Actual: ' + (-1073741824 << 14)); +} + + +if (-2147483648 << 14 !== 0) { + throw new Test262Error('#480: -2147483648 << 14 === 0. Actual: ' + (-2147483648 << 14)); +} + + +if (-1 << 15 !== -32768) { + throw new Test262Error('#481: -1 << 15 === -32768. Actual: ' + (-1 << 15)); +} + + +if (-2 << 15 !== -65536) { + throw new Test262Error('#482: -2 << 15 === -65536. Actual: ' + (-2 << 15)); +} + + +if (-4 << 15 !== -131072) { + throw new Test262Error('#483: -4 << 15 === -131072. Actual: ' + (-4 << 15)); +} + + +if (-8 << 15 !== -262144) { + throw new Test262Error('#484: -8 << 15 === -262144. Actual: ' + (-8 << 15)); +} + + +if (-16 << 15 !== -524288) { + throw new Test262Error('#485: -16 << 15 === -524288. Actual: ' + (-16 << 15)); +} + + +if (-32 << 15 !== -1048576) { + throw new Test262Error('#486: -32 << 15 === -1048576. Actual: ' + (-32 << 15)); +} + + +if (-64 << 15 !== -2097152) { + throw new Test262Error('#487: -64 << 15 === -2097152. Actual: ' + (-64 << 15)); +} + + +if (-128 << 15 !== -4194304) { + throw new Test262Error('#488: -128 << 15 === -4194304. Actual: ' + (-128 << 15)); +} + + +if (-256 << 15 !== -8388608) { + throw new Test262Error('#489: -256 << 15 === -8388608. Actual: ' + (-256 << 15)); +} + + +if (-512 << 15 !== -16777216) { + throw new Test262Error('#490: -512 << 15 === -16777216. Actual: ' + (-512 << 15)); +} + + +if (-1024 << 15 !== -33554432) { + throw new Test262Error('#491: -1024 << 15 === -33554432. Actual: ' + (-1024 << 15)); +} + + +if (-2048 << 15 !== -67108864) { + throw new Test262Error('#492: -2048 << 15 === -67108864. Actual: ' + (-2048 << 15)); +} + + +if (-4096 << 15 !== -134217728) { + throw new Test262Error('#493: -4096 << 15 === -134217728. Actual: ' + (-4096 << 15)); +} + + +if (-8192 << 15 !== -268435456) { + throw new Test262Error('#494: -8192 << 15 === -268435456. Actual: ' + (-8192 << 15)); +} + + +if (-16384 << 15 !== -536870912) { + throw new Test262Error('#495: -16384 << 15 === -536870912. Actual: ' + (-16384 << 15)); +} + + +if (-32768 << 15 !== -1073741824) { + throw new Test262Error('#496: -32768 << 15 === -1073741824. Actual: ' + (-32768 << 15)); +} + + +if (-65536 << 15 !== -2147483648) { + throw new Test262Error('#497: -65536 << 15 === -2147483648. Actual: ' + (-65536 << 15)); +} + + +if (-131072 << 15 !== 0) { + throw new Test262Error('#498: -131072 << 15 === 0. Actual: ' + (-131072 << 15)); +} + + +if (-262144 << 15 !== 0) { + throw new Test262Error('#499: -262144 << 15 === 0. Actual: ' + (-262144 << 15)); +} + + +if (-524288 << 15 !== 0) { + throw new Test262Error('#500: -524288 << 15 === 0. Actual: ' + (-524288 << 15)); +} + + +if (-1048576 << 15 !== 0) { + throw new Test262Error('#501: -1048576 << 15 === 0. Actual: ' + (-1048576 << 15)); +} + + +if (-2097152 << 15 !== 0) { + throw new Test262Error('#502: -2097152 << 15 === 0. Actual: ' + (-2097152 << 15)); +} + + +if (-4194304 << 15 !== 0) { + throw new Test262Error('#503: -4194304 << 15 === 0. Actual: ' + (-4194304 << 15)); +} + + +if (-8388608 << 15 !== 0) { + throw new Test262Error('#504: -8388608 << 15 === 0. Actual: ' + (-8388608 << 15)); +} + + +if (-16777216 << 15 !== 0) { + throw new Test262Error('#505: -16777216 << 15 === 0. Actual: ' + (-16777216 << 15)); +} + + +if (-33554432 << 15 !== 0) { + throw new Test262Error('#506: -33554432 << 15 === 0. Actual: ' + (-33554432 << 15)); +} + + +if (-67108864 << 15 !== 0) { + throw new Test262Error('#507: -67108864 << 15 === 0. Actual: ' + (-67108864 << 15)); +} + + +if (-134217728 << 15 !== 0) { + throw new Test262Error('#508: -134217728 << 15 === 0. Actual: ' + (-134217728 << 15)); +} + + +if (-268435456 << 15 !== 0) { + throw new Test262Error('#509: -268435456 << 15 === 0. Actual: ' + (-268435456 << 15)); +} + + +if (-536870912 << 15 !== 0) { + throw new Test262Error('#510: -536870912 << 15 === 0. Actual: ' + (-536870912 << 15)); +} + + +if (-1073741824 << 15 !== 0) { + throw new Test262Error('#511: -1073741824 << 15 === 0. Actual: ' + (-1073741824 << 15)); +} + + +if (-2147483648 << 15 !== 0) { + throw new Test262Error('#512: -2147483648 << 15 === 0. Actual: ' + (-2147483648 << 15)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T2.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T2.js new file mode 100644 index 0000000000..4445bbf3b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T2.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x << y in distinct points +es5id: 11.7.1_A4_T2 +description: ShiftExpression = 2^n - 1, n = 16...31 +---*/ + +//CHECK + +if (-1 << 16 !== -65536) { + throw new Test262Error('#513: -1 << 16 === -65536. Actual: ' + (-1 << 16)); +} + + +if (-2 << 16 !== -131072) { + throw new Test262Error('#514: -2 << 16 === -131072. Actual: ' + (-2 << 16)); +} + + +if (-4 << 16 !== -262144) { + throw new Test262Error('#515: -4 << 16 === -262144. Actual: ' + (-4 << 16)); +} + + +if (-8 << 16 !== -524288) { + throw new Test262Error('#516: -8 << 16 === -524288. Actual: ' + (-8 << 16)); +} + + +if (-16 << 16 !== -1048576) { + throw new Test262Error('#517: -16 << 16 === -1048576. Actual: ' + (-16 << 16)); +} + + +if (-32 << 16 !== -2097152) { + throw new Test262Error('#518: -32 << 16 === -2097152. Actual: ' + (-32 << 16)); +} + + +if (-64 << 16 !== -4194304) { + throw new Test262Error('#519: -64 << 16 === -4194304. Actual: ' + (-64 << 16)); +} + + +if (-128 << 16 !== -8388608) { + throw new Test262Error('#520: -128 << 16 === -8388608. Actual: ' + (-128 << 16)); +} + + +if (-256 << 16 !== -16777216) { + throw new Test262Error('#521: -256 << 16 === -16777216. Actual: ' + (-256 << 16)); +} + + +if (-512 << 16 !== -33554432) { + throw new Test262Error('#522: -512 << 16 === -33554432. Actual: ' + (-512 << 16)); +} + + +if (-1024 << 16 !== -67108864) { + throw new Test262Error('#523: -1024 << 16 === -67108864. Actual: ' + (-1024 << 16)); +} + + +if (-2048 << 16 !== -134217728) { + throw new Test262Error('#524: -2048 << 16 === -134217728. Actual: ' + (-2048 << 16)); +} + + +if (-4096 << 16 !== -268435456) { + throw new Test262Error('#525: -4096 << 16 === -268435456. Actual: ' + (-4096 << 16)); +} + + +if (-8192 << 16 !== -536870912) { + throw new Test262Error('#526: -8192 << 16 === -536870912. Actual: ' + (-8192 << 16)); +} + + +if (-16384 << 16 !== -1073741824) { + throw new Test262Error('#527: -16384 << 16 === -1073741824. Actual: ' + (-16384 << 16)); +} + + +if (-32768 << 16 !== -2147483648) { + throw new Test262Error('#528: -32768 << 16 === -2147483648. Actual: ' + (-32768 << 16)); +} + + +if (-65536 << 16 !== 0) { + throw new Test262Error('#529: -65536 << 16 === 0. Actual: ' + (-65536 << 16)); +} + + +if (-131072 << 16 !== 0) { + throw new Test262Error('#530: -131072 << 16 === 0. Actual: ' + (-131072 << 16)); +} + + +if (-262144 << 16 !== 0) { + throw new Test262Error('#531: -262144 << 16 === 0. Actual: ' + (-262144 << 16)); +} + + +if (-524288 << 16 !== 0) { + throw new Test262Error('#532: -524288 << 16 === 0. Actual: ' + (-524288 << 16)); +} + + +if (-1048576 << 16 !== 0) { + throw new Test262Error('#533: -1048576 << 16 === 0. Actual: ' + (-1048576 << 16)); +} + + +if (-2097152 << 16 !== 0) { + throw new Test262Error('#534: -2097152 << 16 === 0. Actual: ' + (-2097152 << 16)); +} + + +if (-4194304 << 16 !== 0) { + throw new Test262Error('#535: -4194304 << 16 === 0. Actual: ' + (-4194304 << 16)); +} + + +if (-8388608 << 16 !== 0) { + throw new Test262Error('#536: -8388608 << 16 === 0. Actual: ' + (-8388608 << 16)); +} + + +if (-16777216 << 16 !== 0) { + throw new Test262Error('#537: -16777216 << 16 === 0. Actual: ' + (-16777216 << 16)); +} + + +if (-33554432 << 16 !== 0) { + throw new Test262Error('#538: -33554432 << 16 === 0. Actual: ' + (-33554432 << 16)); +} + + +if (-67108864 << 16 !== 0) { + throw new Test262Error('#539: -67108864 << 16 === 0. Actual: ' + (-67108864 << 16)); +} + + +if (-134217728 << 16 !== 0) { + throw new Test262Error('#540: -134217728 << 16 === 0. Actual: ' + (-134217728 << 16)); +} + + +if (-268435456 << 16 !== 0) { + throw new Test262Error('#541: -268435456 << 16 === 0. Actual: ' + (-268435456 << 16)); +} + + +if (-536870912 << 16 !== 0) { + throw new Test262Error('#542: -536870912 << 16 === 0. Actual: ' + (-536870912 << 16)); +} + + +if (-1073741824 << 16 !== 0) { + throw new Test262Error('#543: -1073741824 << 16 === 0. Actual: ' + (-1073741824 << 16)); +} + + +if (-2147483648 << 16 !== 0) { + throw new Test262Error('#544: -2147483648 << 16 === 0. Actual: ' + (-2147483648 << 16)); +} + + +if (-1 << 17 !== -131072) { + throw new Test262Error('#545: -1 << 17 === -131072. Actual: ' + (-1 << 17)); +} + + +if (-2 << 17 !== -262144) { + throw new Test262Error('#546: -2 << 17 === -262144. Actual: ' + (-2 << 17)); +} + + +if (-4 << 17 !== -524288) { + throw new Test262Error('#547: -4 << 17 === -524288. Actual: ' + (-4 << 17)); +} + + +if (-8 << 17 !== -1048576) { + throw new Test262Error('#548: -8 << 17 === -1048576. Actual: ' + (-8 << 17)); +} + + +if (-16 << 17 !== -2097152) { + throw new Test262Error('#549: -16 << 17 === -2097152. Actual: ' + (-16 << 17)); +} + + +if (-32 << 17 !== -4194304) { + throw new Test262Error('#550: -32 << 17 === -4194304. Actual: ' + (-32 << 17)); +} + + +if (-64 << 17 !== -8388608) { + throw new Test262Error('#551: -64 << 17 === -8388608. Actual: ' + (-64 << 17)); +} + + +if (-128 << 17 !== -16777216) { + throw new Test262Error('#552: -128 << 17 === -16777216. Actual: ' + (-128 << 17)); +} + + +if (-256 << 17 !== -33554432) { + throw new Test262Error('#553: -256 << 17 === -33554432. Actual: ' + (-256 << 17)); +} + + +if (-512 << 17 !== -67108864) { + throw new Test262Error('#554: -512 << 17 === -67108864. Actual: ' + (-512 << 17)); +} + + +if (-1024 << 17 !== -134217728) { + throw new Test262Error('#555: -1024 << 17 === -134217728. Actual: ' + (-1024 << 17)); +} + + +if (-2048 << 17 !== -268435456) { + throw new Test262Error('#556: -2048 << 17 === -268435456. Actual: ' + (-2048 << 17)); +} + + +if (-4096 << 17 !== -536870912) { + throw new Test262Error('#557: -4096 << 17 === -536870912. Actual: ' + (-4096 << 17)); +} + + +if (-8192 << 17 !== -1073741824) { + throw new Test262Error('#558: -8192 << 17 === -1073741824. Actual: ' + (-8192 << 17)); +} + + +if (-16384 << 17 !== -2147483648) { + throw new Test262Error('#559: -16384 << 17 === -2147483648. Actual: ' + (-16384 << 17)); +} + + +if (-32768 << 17 !== 0) { + throw new Test262Error('#560: -32768 << 17 === 0. Actual: ' + (-32768 << 17)); +} + + +if (-65536 << 17 !== 0) { + throw new Test262Error('#561: -65536 << 17 === 0. Actual: ' + (-65536 << 17)); +} + + +if (-131072 << 17 !== 0) { + throw new Test262Error('#562: -131072 << 17 === 0. Actual: ' + (-131072 << 17)); +} + + +if (-262144 << 17 !== 0) { + throw new Test262Error('#563: -262144 << 17 === 0. Actual: ' + (-262144 << 17)); +} + + +if (-524288 << 17 !== 0) { + throw new Test262Error('#564: -524288 << 17 === 0. Actual: ' + (-524288 << 17)); +} + + +if (-1048576 << 17 !== 0) { + throw new Test262Error('#565: -1048576 << 17 === 0. Actual: ' + (-1048576 << 17)); +} + + +if (-2097152 << 17 !== 0) { + throw new Test262Error('#566: -2097152 << 17 === 0. Actual: ' + (-2097152 << 17)); +} + + +if (-4194304 << 17 !== 0) { + throw new Test262Error('#567: -4194304 << 17 === 0. Actual: ' + (-4194304 << 17)); +} + + +if (-8388608 << 17 !== 0) { + throw new Test262Error('#568: -8388608 << 17 === 0. Actual: ' + (-8388608 << 17)); +} + + +if (-16777216 << 17 !== 0) { + throw new Test262Error('#569: -16777216 << 17 === 0. Actual: ' + (-16777216 << 17)); +} + + +if (-33554432 << 17 !== 0) { + throw new Test262Error('#570: -33554432 << 17 === 0. Actual: ' + (-33554432 << 17)); +} + + +if (-67108864 << 17 !== 0) { + throw new Test262Error('#571: -67108864 << 17 === 0. Actual: ' + (-67108864 << 17)); +} + + +if (-134217728 << 17 !== 0) { + throw new Test262Error('#572: -134217728 << 17 === 0. Actual: ' + (-134217728 << 17)); +} + + +if (-268435456 << 17 !== 0) { + throw new Test262Error('#573: -268435456 << 17 === 0. Actual: ' + (-268435456 << 17)); +} + + +if (-536870912 << 17 !== 0) { + throw new Test262Error('#574: -536870912 << 17 === 0. Actual: ' + (-536870912 << 17)); +} + + +if (-1073741824 << 17 !== 0) { + throw new Test262Error('#575: -1073741824 << 17 === 0. Actual: ' + (-1073741824 << 17)); +} + + +if (-2147483648 << 17 !== 0) { + throw new Test262Error('#576: -2147483648 << 17 === 0. Actual: ' + (-2147483648 << 17)); +} + + +if (-1 << 18 !== -262144) { + throw new Test262Error('#577: -1 << 18 === -262144. Actual: ' + (-1 << 18)); +} + + +if (-2 << 18 !== -524288) { + throw new Test262Error('#578: -2 << 18 === -524288. Actual: ' + (-2 << 18)); +} + + +if (-4 << 18 !== -1048576) { + throw new Test262Error('#579: -4 << 18 === -1048576. Actual: ' + (-4 << 18)); +} + + +if (-8 << 18 !== -2097152) { + throw new Test262Error('#580: -8 << 18 === -2097152. Actual: ' + (-8 << 18)); +} + + +if (-16 << 18 !== -4194304) { + throw new Test262Error('#581: -16 << 18 === -4194304. Actual: ' + (-16 << 18)); +} + + +if (-32 << 18 !== -8388608) { + throw new Test262Error('#582: -32 << 18 === -8388608. Actual: ' + (-32 << 18)); +} + + +if (-64 << 18 !== -16777216) { + throw new Test262Error('#583: -64 << 18 === -16777216. Actual: ' + (-64 << 18)); +} + + +if (-128 << 18 !== -33554432) { + throw new Test262Error('#584: -128 << 18 === -33554432. Actual: ' + (-128 << 18)); +} + + +if (-256 << 18 !== -67108864) { + throw new Test262Error('#585: -256 << 18 === -67108864. Actual: ' + (-256 << 18)); +} + + +if (-512 << 18 !== -134217728) { + throw new Test262Error('#586: -512 << 18 === -134217728. Actual: ' + (-512 << 18)); +} + + +if (-1024 << 18 !== -268435456) { + throw new Test262Error('#587: -1024 << 18 === -268435456. Actual: ' + (-1024 << 18)); +} + + +if (-2048 << 18 !== -536870912) { + throw new Test262Error('#588: -2048 << 18 === -536870912. Actual: ' + (-2048 << 18)); +} + + +if (-4096 << 18 !== -1073741824) { + throw new Test262Error('#589: -4096 << 18 === -1073741824. Actual: ' + (-4096 << 18)); +} + + +if (-8192 << 18 !== -2147483648) { + throw new Test262Error('#590: -8192 << 18 === -2147483648. Actual: ' + (-8192 << 18)); +} + + +if (-16384 << 18 !== 0) { + throw new Test262Error('#591: -16384 << 18 === 0. Actual: ' + (-16384 << 18)); +} + + +if (-32768 << 18 !== 0) { + throw new Test262Error('#592: -32768 << 18 === 0. Actual: ' + (-32768 << 18)); +} + + +if (-65536 << 18 !== 0) { + throw new Test262Error('#593: -65536 << 18 === 0. Actual: ' + (-65536 << 18)); +} + + +if (-131072 << 18 !== 0) { + throw new Test262Error('#594: -131072 << 18 === 0. Actual: ' + (-131072 << 18)); +} + + +if (-262144 << 18 !== 0) { + throw new Test262Error('#595: -262144 << 18 === 0. Actual: ' + (-262144 << 18)); +} + + +if (-524288 << 18 !== 0) { + throw new Test262Error('#596: -524288 << 18 === 0. Actual: ' + (-524288 << 18)); +} + + +if (-1048576 << 18 !== 0) { + throw new Test262Error('#597: -1048576 << 18 === 0. Actual: ' + (-1048576 << 18)); +} + + +if (-2097152 << 18 !== 0) { + throw new Test262Error('#598: -2097152 << 18 === 0. Actual: ' + (-2097152 << 18)); +} + + +if (-4194304 << 18 !== 0) { + throw new Test262Error('#599: -4194304 << 18 === 0. Actual: ' + (-4194304 << 18)); +} + + +if (-8388608 << 18 !== 0) { + throw new Test262Error('#600: -8388608 << 18 === 0. Actual: ' + (-8388608 << 18)); +} + + +if (-16777216 << 18 !== 0) { + throw new Test262Error('#601: -16777216 << 18 === 0. Actual: ' + (-16777216 << 18)); +} + + +if (-33554432 << 18 !== 0) { + throw new Test262Error('#602: -33554432 << 18 === 0. Actual: ' + (-33554432 << 18)); +} + + +if (-67108864 << 18 !== 0) { + throw new Test262Error('#603: -67108864 << 18 === 0. Actual: ' + (-67108864 << 18)); +} + + +if (-134217728 << 18 !== 0) { + throw new Test262Error('#604: -134217728 << 18 === 0. Actual: ' + (-134217728 << 18)); +} + + +if (-268435456 << 18 !== 0) { + throw new Test262Error('#605: -268435456 << 18 === 0. Actual: ' + (-268435456 << 18)); +} + + +if (-536870912 << 18 !== 0) { + throw new Test262Error('#606: -536870912 << 18 === 0. Actual: ' + (-536870912 << 18)); +} + + +if (-1073741824 << 18 !== 0) { + throw new Test262Error('#607: -1073741824 << 18 === 0. Actual: ' + (-1073741824 << 18)); +} + + +if (-2147483648 << 18 !== 0) { + throw new Test262Error('#608: -2147483648 << 18 === 0. Actual: ' + (-2147483648 << 18)); +} + + +if (-1 << 19 !== -524288) { + throw new Test262Error('#609: -1 << 19 === -524288. Actual: ' + (-1 << 19)); +} + + +if (-2 << 19 !== -1048576) { + throw new Test262Error('#610: -2 << 19 === -1048576. Actual: ' + (-2 << 19)); +} + + +if (-4 << 19 !== -2097152) { + throw new Test262Error('#611: -4 << 19 === -2097152. Actual: ' + (-4 << 19)); +} + + +if (-8 << 19 !== -4194304) { + throw new Test262Error('#612: -8 << 19 === -4194304. Actual: ' + (-8 << 19)); +} + + +if (-16 << 19 !== -8388608) { + throw new Test262Error('#613: -16 << 19 === -8388608. Actual: ' + (-16 << 19)); +} + + +if (-32 << 19 !== -16777216) { + throw new Test262Error('#614: -32 << 19 === -16777216. Actual: ' + (-32 << 19)); +} + + +if (-64 << 19 !== -33554432) { + throw new Test262Error('#615: -64 << 19 === -33554432. Actual: ' + (-64 << 19)); +} + + +if (-128 << 19 !== -67108864) { + throw new Test262Error('#616: -128 << 19 === -67108864. Actual: ' + (-128 << 19)); +} + + +if (-256 << 19 !== -134217728) { + throw new Test262Error('#617: -256 << 19 === -134217728. Actual: ' + (-256 << 19)); +} + + +if (-512 << 19 !== -268435456) { + throw new Test262Error('#618: -512 << 19 === -268435456. Actual: ' + (-512 << 19)); +} + + +if (-1024 << 19 !== -536870912) { + throw new Test262Error('#619: -1024 << 19 === -536870912. Actual: ' + (-1024 << 19)); +} + + +if (-2048 << 19 !== -1073741824) { + throw new Test262Error('#620: -2048 << 19 === -1073741824. Actual: ' + (-2048 << 19)); +} + + +if (-4096 << 19 !== -2147483648) { + throw new Test262Error('#621: -4096 << 19 === -2147483648. Actual: ' + (-4096 << 19)); +} + + +if (-8192 << 19 !== 0) { + throw new Test262Error('#622: -8192 << 19 === 0. Actual: ' + (-8192 << 19)); +} + + +if (-16384 << 19 !== 0) { + throw new Test262Error('#623: -16384 << 19 === 0. Actual: ' + (-16384 << 19)); +} + + +if (-32768 << 19 !== 0) { + throw new Test262Error('#624: -32768 << 19 === 0. Actual: ' + (-32768 << 19)); +} + + +if (-65536 << 19 !== 0) { + throw new Test262Error('#625: -65536 << 19 === 0. Actual: ' + (-65536 << 19)); +} + + +if (-131072 << 19 !== 0) { + throw new Test262Error('#626: -131072 << 19 === 0. Actual: ' + (-131072 << 19)); +} + + +if (-262144 << 19 !== 0) { + throw new Test262Error('#627: -262144 << 19 === 0. Actual: ' + (-262144 << 19)); +} + + +if (-524288 << 19 !== 0) { + throw new Test262Error('#628: -524288 << 19 === 0. Actual: ' + (-524288 << 19)); +} + + +if (-1048576 << 19 !== 0) { + throw new Test262Error('#629: -1048576 << 19 === 0. Actual: ' + (-1048576 << 19)); +} + + +if (-2097152 << 19 !== 0) { + throw new Test262Error('#630: -2097152 << 19 === 0. Actual: ' + (-2097152 << 19)); +} + + +if (-4194304 << 19 !== 0) { + throw new Test262Error('#631: -4194304 << 19 === 0. Actual: ' + (-4194304 << 19)); +} + + +if (-8388608 << 19 !== 0) { + throw new Test262Error('#632: -8388608 << 19 === 0. Actual: ' + (-8388608 << 19)); +} + + +if (-16777216 << 19 !== 0) { + throw new Test262Error('#633: -16777216 << 19 === 0. Actual: ' + (-16777216 << 19)); +} + + +if (-33554432 << 19 !== 0) { + throw new Test262Error('#634: -33554432 << 19 === 0. Actual: ' + (-33554432 << 19)); +} + + +if (-67108864 << 19 !== 0) { + throw new Test262Error('#635: -67108864 << 19 === 0. Actual: ' + (-67108864 << 19)); +} + + +if (-134217728 << 19 !== 0) { + throw new Test262Error('#636: -134217728 << 19 === 0. Actual: ' + (-134217728 << 19)); +} + + +if (-268435456 << 19 !== 0) { + throw new Test262Error('#637: -268435456 << 19 === 0. Actual: ' + (-268435456 << 19)); +} + + +if (-536870912 << 19 !== 0) { + throw new Test262Error('#638: -536870912 << 19 === 0. Actual: ' + (-536870912 << 19)); +} + + +if (-1073741824 << 19 !== 0) { + throw new Test262Error('#639: -1073741824 << 19 === 0. Actual: ' + (-1073741824 << 19)); +} + + +if (-2147483648 << 19 !== 0) { + throw new Test262Error('#640: -2147483648 << 19 === 0. Actual: ' + (-2147483648 << 19)); +} + + +if (-1 << 20 !== -1048576) { + throw new Test262Error('#641: -1 << 20 === -1048576. Actual: ' + (-1 << 20)); +} + + +if (-2 << 20 !== -2097152) { + throw new Test262Error('#642: -2 << 20 === -2097152. Actual: ' + (-2 << 20)); +} + + +if (-4 << 20 !== -4194304) { + throw new Test262Error('#643: -4 << 20 === -4194304. Actual: ' + (-4 << 20)); +} + + +if (-8 << 20 !== -8388608) { + throw new Test262Error('#644: -8 << 20 === -8388608. Actual: ' + (-8 << 20)); +} + + +if (-16 << 20 !== -16777216) { + throw new Test262Error('#645: -16 << 20 === -16777216. Actual: ' + (-16 << 20)); +} + + +if (-32 << 20 !== -33554432) { + throw new Test262Error('#646: -32 << 20 === -33554432. Actual: ' + (-32 << 20)); +} + + +if (-64 << 20 !== -67108864) { + throw new Test262Error('#647: -64 << 20 === -67108864. Actual: ' + (-64 << 20)); +} + + +if (-128 << 20 !== -134217728) { + throw new Test262Error('#648: -128 << 20 === -134217728. Actual: ' + (-128 << 20)); +} + + +if (-256 << 20 !== -268435456) { + throw new Test262Error('#649: -256 << 20 === -268435456. Actual: ' + (-256 << 20)); +} + + +if (-512 << 20 !== -536870912) { + throw new Test262Error('#650: -512 << 20 === -536870912. Actual: ' + (-512 << 20)); +} + + +if (-1024 << 20 !== -1073741824) { + throw new Test262Error('#651: -1024 << 20 === -1073741824. Actual: ' + (-1024 << 20)); +} + + +if (-2048 << 20 !== -2147483648) { + throw new Test262Error('#652: -2048 << 20 === -2147483648. Actual: ' + (-2048 << 20)); +} + + +if (-4096 << 20 !== 0) { + throw new Test262Error('#653: -4096 << 20 === 0. Actual: ' + (-4096 << 20)); +} + + +if (-8192 << 20 !== 0) { + throw new Test262Error('#654: -8192 << 20 === 0. Actual: ' + (-8192 << 20)); +} + + +if (-16384 << 20 !== 0) { + throw new Test262Error('#655: -16384 << 20 === 0. Actual: ' + (-16384 << 20)); +} + + +if (-32768 << 20 !== 0) { + throw new Test262Error('#656: -32768 << 20 === 0. Actual: ' + (-32768 << 20)); +} + + +if (-65536 << 20 !== 0) { + throw new Test262Error('#657: -65536 << 20 === 0. Actual: ' + (-65536 << 20)); +} + + +if (-131072 << 20 !== 0) { + throw new Test262Error('#658: -131072 << 20 === 0. Actual: ' + (-131072 << 20)); +} + + +if (-262144 << 20 !== 0) { + throw new Test262Error('#659: -262144 << 20 === 0. Actual: ' + (-262144 << 20)); +} + + +if (-524288 << 20 !== 0) { + throw new Test262Error('#660: -524288 << 20 === 0. Actual: ' + (-524288 << 20)); +} + + +if (-1048576 << 20 !== 0) { + throw new Test262Error('#661: -1048576 << 20 === 0. Actual: ' + (-1048576 << 20)); +} + + +if (-2097152 << 20 !== 0) { + throw new Test262Error('#662: -2097152 << 20 === 0. Actual: ' + (-2097152 << 20)); +} + + +if (-4194304 << 20 !== 0) { + throw new Test262Error('#663: -4194304 << 20 === 0. Actual: ' + (-4194304 << 20)); +} + + +if (-8388608 << 20 !== 0) { + throw new Test262Error('#664: -8388608 << 20 === 0. Actual: ' + (-8388608 << 20)); +} + + +if (-16777216 << 20 !== 0) { + throw new Test262Error('#665: -16777216 << 20 === 0. Actual: ' + (-16777216 << 20)); +} + + +if (-33554432 << 20 !== 0) { + throw new Test262Error('#666: -33554432 << 20 === 0. Actual: ' + (-33554432 << 20)); +} + + +if (-67108864 << 20 !== 0) { + throw new Test262Error('#667: -67108864 << 20 === 0. Actual: ' + (-67108864 << 20)); +} + + +if (-134217728 << 20 !== 0) { + throw new Test262Error('#668: -134217728 << 20 === 0. Actual: ' + (-134217728 << 20)); +} + + +if (-268435456 << 20 !== 0) { + throw new Test262Error('#669: -268435456 << 20 === 0. Actual: ' + (-268435456 << 20)); +} + + +if (-536870912 << 20 !== 0) { + throw new Test262Error('#670: -536870912 << 20 === 0. Actual: ' + (-536870912 << 20)); +} + + +if (-1073741824 << 20 !== 0) { + throw new Test262Error('#671: -1073741824 << 20 === 0. Actual: ' + (-1073741824 << 20)); +} + + +if (-2147483648 << 20 !== 0) { + throw new Test262Error('#672: -2147483648 << 20 === 0. Actual: ' + (-2147483648 << 20)); +} + + +if (-1 << 21 !== -2097152) { + throw new Test262Error('#673: -1 << 21 === -2097152. Actual: ' + (-1 << 21)); +} + + +if (-2 << 21 !== -4194304) { + throw new Test262Error('#674: -2 << 21 === -4194304. Actual: ' + (-2 << 21)); +} + + +if (-4 << 21 !== -8388608) { + throw new Test262Error('#675: -4 << 21 === -8388608. Actual: ' + (-4 << 21)); +} + + +if (-8 << 21 !== -16777216) { + throw new Test262Error('#676: -8 << 21 === -16777216. Actual: ' + (-8 << 21)); +} + + +if (-16 << 21 !== -33554432) { + throw new Test262Error('#677: -16 << 21 === -33554432. Actual: ' + (-16 << 21)); +} + + +if (-32 << 21 !== -67108864) { + throw new Test262Error('#678: -32 << 21 === -67108864. Actual: ' + (-32 << 21)); +} + + +if (-64 << 21 !== -134217728) { + throw new Test262Error('#679: -64 << 21 === -134217728. Actual: ' + (-64 << 21)); +} + + +if (-128 << 21 !== -268435456) { + throw new Test262Error('#680: -128 << 21 === -268435456. Actual: ' + (-128 << 21)); +} + + +if (-256 << 21 !== -536870912) { + throw new Test262Error('#681: -256 << 21 === -536870912. Actual: ' + (-256 << 21)); +} + + +if (-512 << 21 !== -1073741824) { + throw new Test262Error('#682: -512 << 21 === -1073741824. Actual: ' + (-512 << 21)); +} + + +if (-1024 << 21 !== -2147483648) { + throw new Test262Error('#683: -1024 << 21 === -2147483648. Actual: ' + (-1024 << 21)); +} + + +if (-2048 << 21 !== 0) { + throw new Test262Error('#684: -2048 << 21 === 0. Actual: ' + (-2048 << 21)); +} + + +if (-4096 << 21 !== 0) { + throw new Test262Error('#685: -4096 << 21 === 0. Actual: ' + (-4096 << 21)); +} + + +if (-8192 << 21 !== 0) { + throw new Test262Error('#686: -8192 << 21 === 0. Actual: ' + (-8192 << 21)); +} + + +if (-16384 << 21 !== 0) { + throw new Test262Error('#687: -16384 << 21 === 0. Actual: ' + (-16384 << 21)); +} + + +if (-32768 << 21 !== 0) { + throw new Test262Error('#688: -32768 << 21 === 0. Actual: ' + (-32768 << 21)); +} + + +if (-65536 << 21 !== 0) { + throw new Test262Error('#689: -65536 << 21 === 0. Actual: ' + (-65536 << 21)); +} + + +if (-131072 << 21 !== 0) { + throw new Test262Error('#690: -131072 << 21 === 0. Actual: ' + (-131072 << 21)); +} + + +if (-262144 << 21 !== 0) { + throw new Test262Error('#691: -262144 << 21 === 0. Actual: ' + (-262144 << 21)); +} + + +if (-524288 << 21 !== 0) { + throw new Test262Error('#692: -524288 << 21 === 0. Actual: ' + (-524288 << 21)); +} + + +if (-1048576 << 21 !== 0) { + throw new Test262Error('#693: -1048576 << 21 === 0. Actual: ' + (-1048576 << 21)); +} + + +if (-2097152 << 21 !== 0) { + throw new Test262Error('#694: -2097152 << 21 === 0. Actual: ' + (-2097152 << 21)); +} + + +if (-4194304 << 21 !== 0) { + throw new Test262Error('#695: -4194304 << 21 === 0. Actual: ' + (-4194304 << 21)); +} + + +if (-8388608 << 21 !== 0) { + throw new Test262Error('#696: -8388608 << 21 === 0. Actual: ' + (-8388608 << 21)); +} + + +if (-16777216 << 21 !== 0) { + throw new Test262Error('#697: -16777216 << 21 === 0. Actual: ' + (-16777216 << 21)); +} + + +if (-33554432 << 21 !== 0) { + throw new Test262Error('#698: -33554432 << 21 === 0. Actual: ' + (-33554432 << 21)); +} + + +if (-67108864 << 21 !== 0) { + throw new Test262Error('#699: -67108864 << 21 === 0. Actual: ' + (-67108864 << 21)); +} + + +if (-134217728 << 21 !== 0) { + throw new Test262Error('#700: -134217728 << 21 === 0. Actual: ' + (-134217728 << 21)); +} + + +if (-268435456 << 21 !== 0) { + throw new Test262Error('#701: -268435456 << 21 === 0. Actual: ' + (-268435456 << 21)); +} + + +if (-536870912 << 21 !== 0) { + throw new Test262Error('#702: -536870912 << 21 === 0. Actual: ' + (-536870912 << 21)); +} + + +if (-1073741824 << 21 !== 0) { + throw new Test262Error('#703: -1073741824 << 21 === 0. Actual: ' + (-1073741824 << 21)); +} + + +if (-2147483648 << 21 !== 0) { + throw new Test262Error('#704: -2147483648 << 21 === 0. Actual: ' + (-2147483648 << 21)); +} + + +if (-1 << 22 !== -4194304) { + throw new Test262Error('#705: -1 << 22 === -4194304. Actual: ' + (-1 << 22)); +} + + +if (-2 << 22 !== -8388608) { + throw new Test262Error('#706: -2 << 22 === -8388608. Actual: ' + (-2 << 22)); +} + + +if (-4 << 22 !== -16777216) { + throw new Test262Error('#707: -4 << 22 === -16777216. Actual: ' + (-4 << 22)); +} + + +if (-8 << 22 !== -33554432) { + throw new Test262Error('#708: -8 << 22 === -33554432. Actual: ' + (-8 << 22)); +} + + +if (-16 << 22 !== -67108864) { + throw new Test262Error('#709: -16 << 22 === -67108864. Actual: ' + (-16 << 22)); +} + + +if (-32 << 22 !== -134217728) { + throw new Test262Error('#710: -32 << 22 === -134217728. Actual: ' + (-32 << 22)); +} + + +if (-64 << 22 !== -268435456) { + throw new Test262Error('#711: -64 << 22 === -268435456. Actual: ' + (-64 << 22)); +} + + +if (-128 << 22 !== -536870912) { + throw new Test262Error('#712: -128 << 22 === -536870912. Actual: ' + (-128 << 22)); +} + + +if (-256 << 22 !== -1073741824) { + throw new Test262Error('#713: -256 << 22 === -1073741824. Actual: ' + (-256 << 22)); +} + + +if (-512 << 22 !== -2147483648) { + throw new Test262Error('#714: -512 << 22 === -2147483648. Actual: ' + (-512 << 22)); +} + + +if (-1024 << 22 !== 0) { + throw new Test262Error('#715: -1024 << 22 === 0. Actual: ' + (-1024 << 22)); +} + + +if (-2048 << 22 !== 0) { + throw new Test262Error('#716: -2048 << 22 === 0. Actual: ' + (-2048 << 22)); +} + + +if (-4096 << 22 !== 0) { + throw new Test262Error('#717: -4096 << 22 === 0. Actual: ' + (-4096 << 22)); +} + + +if (-8192 << 22 !== 0) { + throw new Test262Error('#718: -8192 << 22 === 0. Actual: ' + (-8192 << 22)); +} + + +if (-16384 << 22 !== 0) { + throw new Test262Error('#719: -16384 << 22 === 0. Actual: ' + (-16384 << 22)); +} + + +if (-32768 << 22 !== 0) { + throw new Test262Error('#720: -32768 << 22 === 0. Actual: ' + (-32768 << 22)); +} + + +if (-65536 << 22 !== 0) { + throw new Test262Error('#721: -65536 << 22 === 0. Actual: ' + (-65536 << 22)); +} + + +if (-131072 << 22 !== 0) { + throw new Test262Error('#722: -131072 << 22 === 0. Actual: ' + (-131072 << 22)); +} + + +if (-262144 << 22 !== 0) { + throw new Test262Error('#723: -262144 << 22 === 0. Actual: ' + (-262144 << 22)); +} + + +if (-524288 << 22 !== 0) { + throw new Test262Error('#724: -524288 << 22 === 0. Actual: ' + (-524288 << 22)); +} + + +if (-1048576 << 22 !== 0) { + throw new Test262Error('#725: -1048576 << 22 === 0. Actual: ' + (-1048576 << 22)); +} + + +if (-2097152 << 22 !== 0) { + throw new Test262Error('#726: -2097152 << 22 === 0. Actual: ' + (-2097152 << 22)); +} + + +if (-4194304 << 22 !== 0) { + throw new Test262Error('#727: -4194304 << 22 === 0. Actual: ' + (-4194304 << 22)); +} + + +if (-8388608 << 22 !== 0) { + throw new Test262Error('#728: -8388608 << 22 === 0. Actual: ' + (-8388608 << 22)); +} + + +if (-16777216 << 22 !== 0) { + throw new Test262Error('#729: -16777216 << 22 === 0. Actual: ' + (-16777216 << 22)); +} + + +if (-33554432 << 22 !== 0) { + throw new Test262Error('#730: -33554432 << 22 === 0. Actual: ' + (-33554432 << 22)); +} + + +if (-67108864 << 22 !== 0) { + throw new Test262Error('#731: -67108864 << 22 === 0. Actual: ' + (-67108864 << 22)); +} + + +if (-134217728 << 22 !== 0) { + throw new Test262Error('#732: -134217728 << 22 === 0. Actual: ' + (-134217728 << 22)); +} + + +if (-268435456 << 22 !== 0) { + throw new Test262Error('#733: -268435456 << 22 === 0. Actual: ' + (-268435456 << 22)); +} + + +if (-536870912 << 22 !== 0) { + throw new Test262Error('#734: -536870912 << 22 === 0. Actual: ' + (-536870912 << 22)); +} + + +if (-1073741824 << 22 !== 0) { + throw new Test262Error('#735: -1073741824 << 22 === 0. Actual: ' + (-1073741824 << 22)); +} + + +if (-2147483648 << 22 !== 0) { + throw new Test262Error('#736: -2147483648 << 22 === 0. Actual: ' + (-2147483648 << 22)); +} + + +if (-1 << 23 !== -8388608) { + throw new Test262Error('#737: -1 << 23 === -8388608. Actual: ' + (-1 << 23)); +} + + +if (-2 << 23 !== -16777216) { + throw new Test262Error('#738: -2 << 23 === -16777216. Actual: ' + (-2 << 23)); +} + + +if (-4 << 23 !== -33554432) { + throw new Test262Error('#739: -4 << 23 === -33554432. Actual: ' + (-4 << 23)); +} + + +if (-8 << 23 !== -67108864) { + throw new Test262Error('#740: -8 << 23 === -67108864. Actual: ' + (-8 << 23)); +} + + +if (-16 << 23 !== -134217728) { + throw new Test262Error('#741: -16 << 23 === -134217728. Actual: ' + (-16 << 23)); +} + + +if (-32 << 23 !== -268435456) { + throw new Test262Error('#742: -32 << 23 === -268435456. Actual: ' + (-32 << 23)); +} + + +if (-64 << 23 !== -536870912) { + throw new Test262Error('#743: -64 << 23 === -536870912. Actual: ' + (-64 << 23)); +} + + +if (-128 << 23 !== -1073741824) { + throw new Test262Error('#744: -128 << 23 === -1073741824. Actual: ' + (-128 << 23)); +} + + +if (-256 << 23 !== -2147483648) { + throw new Test262Error('#745: -256 << 23 === -2147483648. Actual: ' + (-256 << 23)); +} + + +if (-512 << 23 !== 0) { + throw new Test262Error('#746: -512 << 23 === 0. Actual: ' + (-512 << 23)); +} + + +if (-1024 << 23 !== 0) { + throw new Test262Error('#747: -1024 << 23 === 0. Actual: ' + (-1024 << 23)); +} + + +if (-2048 << 23 !== 0) { + throw new Test262Error('#748: -2048 << 23 === 0. Actual: ' + (-2048 << 23)); +} + + +if (-4096 << 23 !== 0) { + throw new Test262Error('#749: -4096 << 23 === 0. Actual: ' + (-4096 << 23)); +} + + +if (-8192 << 23 !== 0) { + throw new Test262Error('#750: -8192 << 23 === 0. Actual: ' + (-8192 << 23)); +} + + +if (-16384 << 23 !== 0) { + throw new Test262Error('#751: -16384 << 23 === 0. Actual: ' + (-16384 << 23)); +} + + +if (-32768 << 23 !== 0) { + throw new Test262Error('#752: -32768 << 23 === 0. Actual: ' + (-32768 << 23)); +} + + +if (-65536 << 23 !== 0) { + throw new Test262Error('#753: -65536 << 23 === 0. Actual: ' + (-65536 << 23)); +} + + +if (-131072 << 23 !== 0) { + throw new Test262Error('#754: -131072 << 23 === 0. Actual: ' + (-131072 << 23)); +} + + +if (-262144 << 23 !== 0) { + throw new Test262Error('#755: -262144 << 23 === 0. Actual: ' + (-262144 << 23)); +} + + +if (-524288 << 23 !== 0) { + throw new Test262Error('#756: -524288 << 23 === 0. Actual: ' + (-524288 << 23)); +} + + +if (-1048576 << 23 !== 0) { + throw new Test262Error('#757: -1048576 << 23 === 0. Actual: ' + (-1048576 << 23)); +} + + +if (-2097152 << 23 !== 0) { + throw new Test262Error('#758: -2097152 << 23 === 0. Actual: ' + (-2097152 << 23)); +} + + +if (-4194304 << 23 !== 0) { + throw new Test262Error('#759: -4194304 << 23 === 0. Actual: ' + (-4194304 << 23)); +} + + +if (-8388608 << 23 !== 0) { + throw new Test262Error('#760: -8388608 << 23 === 0. Actual: ' + (-8388608 << 23)); +} + + +if (-16777216 << 23 !== 0) { + throw new Test262Error('#761: -16777216 << 23 === 0. Actual: ' + (-16777216 << 23)); +} + + +if (-33554432 << 23 !== 0) { + throw new Test262Error('#762: -33554432 << 23 === 0. Actual: ' + (-33554432 << 23)); +} + + +if (-67108864 << 23 !== 0) { + throw new Test262Error('#763: -67108864 << 23 === 0. Actual: ' + (-67108864 << 23)); +} + + +if (-134217728 << 23 !== 0) { + throw new Test262Error('#764: -134217728 << 23 === 0. Actual: ' + (-134217728 << 23)); +} + + +if (-268435456 << 23 !== 0) { + throw new Test262Error('#765: -268435456 << 23 === 0. Actual: ' + (-268435456 << 23)); +} + + +if (-536870912 << 23 !== 0) { + throw new Test262Error('#766: -536870912 << 23 === 0. Actual: ' + (-536870912 << 23)); +} + + +if (-1073741824 << 23 !== 0) { + throw new Test262Error('#767: -1073741824 << 23 === 0. Actual: ' + (-1073741824 << 23)); +} + + +if (-2147483648 << 23 !== 0) { + throw new Test262Error('#768: -2147483648 << 23 === 0. Actual: ' + (-2147483648 << 23)); +} + + +if (-1 << 24 !== -16777216) { + throw new Test262Error('#769: -1 << 24 === -16777216. Actual: ' + (-1 << 24)); +} + + +if (-2 << 24 !== -33554432) { + throw new Test262Error('#770: -2 << 24 === -33554432. Actual: ' + (-2 << 24)); +} + + +if (-4 << 24 !== -67108864) { + throw new Test262Error('#771: -4 << 24 === -67108864. Actual: ' + (-4 << 24)); +} + + +if (-8 << 24 !== -134217728) { + throw new Test262Error('#772: -8 << 24 === -134217728. Actual: ' + (-8 << 24)); +} + + +if (-16 << 24 !== -268435456) { + throw new Test262Error('#773: -16 << 24 === -268435456. Actual: ' + (-16 << 24)); +} + + +if (-32 << 24 !== -536870912) { + throw new Test262Error('#774: -32 << 24 === -536870912. Actual: ' + (-32 << 24)); +} + + +if (-64 << 24 !== -1073741824) { + throw new Test262Error('#775: -64 << 24 === -1073741824. Actual: ' + (-64 << 24)); +} + + +if (-128 << 24 !== -2147483648) { + throw new Test262Error('#776: -128 << 24 === -2147483648. Actual: ' + (-128 << 24)); +} + + +if (-256 << 24 !== 0) { + throw new Test262Error('#777: -256 << 24 === 0. Actual: ' + (-256 << 24)); +} + + +if (-512 << 24 !== 0) { + throw new Test262Error('#778: -512 << 24 === 0. Actual: ' + (-512 << 24)); +} + + +if (-1024 << 24 !== 0) { + throw new Test262Error('#779: -1024 << 24 === 0. Actual: ' + (-1024 << 24)); +} + + +if (-2048 << 24 !== 0) { + throw new Test262Error('#780: -2048 << 24 === 0. Actual: ' + (-2048 << 24)); +} + + +if (-4096 << 24 !== 0) { + throw new Test262Error('#781: -4096 << 24 === 0. Actual: ' + (-4096 << 24)); +} + + +if (-8192 << 24 !== 0) { + throw new Test262Error('#782: -8192 << 24 === 0. Actual: ' + (-8192 << 24)); +} + + +if (-16384 << 24 !== 0) { + throw new Test262Error('#783: -16384 << 24 === 0. Actual: ' + (-16384 << 24)); +} + + +if (-32768 << 24 !== 0) { + throw new Test262Error('#784: -32768 << 24 === 0. Actual: ' + (-32768 << 24)); +} + + +if (-65536 << 24 !== 0) { + throw new Test262Error('#785: -65536 << 24 === 0. Actual: ' + (-65536 << 24)); +} + + +if (-131072 << 24 !== 0) { + throw new Test262Error('#786: -131072 << 24 === 0. Actual: ' + (-131072 << 24)); +} + + +if (-262144 << 24 !== 0) { + throw new Test262Error('#787: -262144 << 24 === 0. Actual: ' + (-262144 << 24)); +} + + +if (-524288 << 24 !== 0) { + throw new Test262Error('#788: -524288 << 24 === 0. Actual: ' + (-524288 << 24)); +} + + +if (-1048576 << 24 !== 0) { + throw new Test262Error('#789: -1048576 << 24 === 0. Actual: ' + (-1048576 << 24)); +} + + +if (-2097152 << 24 !== 0) { + throw new Test262Error('#790: -2097152 << 24 === 0. Actual: ' + (-2097152 << 24)); +} + + +if (-4194304 << 24 !== 0) { + throw new Test262Error('#791: -4194304 << 24 === 0. Actual: ' + (-4194304 << 24)); +} + + +if (-8388608 << 24 !== 0) { + throw new Test262Error('#792: -8388608 << 24 === 0. Actual: ' + (-8388608 << 24)); +} + + +if (-16777216 << 24 !== 0) { + throw new Test262Error('#793: -16777216 << 24 === 0. Actual: ' + (-16777216 << 24)); +} + + +if (-33554432 << 24 !== 0) { + throw new Test262Error('#794: -33554432 << 24 === 0. Actual: ' + (-33554432 << 24)); +} + + +if (-67108864 << 24 !== 0) { + throw new Test262Error('#795: -67108864 << 24 === 0. Actual: ' + (-67108864 << 24)); +} + + +if (-134217728 << 24 !== 0) { + throw new Test262Error('#796: -134217728 << 24 === 0. Actual: ' + (-134217728 << 24)); +} + + +if (-268435456 << 24 !== 0) { + throw new Test262Error('#797: -268435456 << 24 === 0. Actual: ' + (-268435456 << 24)); +} + + +if (-536870912 << 24 !== 0) { + throw new Test262Error('#798: -536870912 << 24 === 0. Actual: ' + (-536870912 << 24)); +} + + +if (-1073741824 << 24 !== 0) { + throw new Test262Error('#799: -1073741824 << 24 === 0. Actual: ' + (-1073741824 << 24)); +} + + +if (-2147483648 << 24 !== 0) { + throw new Test262Error('#800: -2147483648 << 24 === 0. Actual: ' + (-2147483648 << 24)); +} + + +if (-1 << 25 !== -33554432) { + throw new Test262Error('#801: -1 << 25 === -33554432. Actual: ' + (-1 << 25)); +} + + +if (-2 << 25 !== -67108864) { + throw new Test262Error('#802: -2 << 25 === -67108864. Actual: ' + (-2 << 25)); +} + + +if (-4 << 25 !== -134217728) { + throw new Test262Error('#803: -4 << 25 === -134217728. Actual: ' + (-4 << 25)); +} + + +if (-8 << 25 !== -268435456) { + throw new Test262Error('#804: -8 << 25 === -268435456. Actual: ' + (-8 << 25)); +} + + +if (-16 << 25 !== -536870912) { + throw new Test262Error('#805: -16 << 25 === -536870912. Actual: ' + (-16 << 25)); +} + + +if (-32 << 25 !== -1073741824) { + throw new Test262Error('#806: -32 << 25 === -1073741824. Actual: ' + (-32 << 25)); +} + + +if (-64 << 25 !== -2147483648) { + throw new Test262Error('#807: -64 << 25 === -2147483648. Actual: ' + (-64 << 25)); +} + + +if (-128 << 25 !== 0) { + throw new Test262Error('#808: -128 << 25 === 0. Actual: ' + (-128 << 25)); +} + + +if (-256 << 25 !== 0) { + throw new Test262Error('#809: -256 << 25 === 0. Actual: ' + (-256 << 25)); +} + + +if (-512 << 25 !== 0) { + throw new Test262Error('#810: -512 << 25 === 0. Actual: ' + (-512 << 25)); +} + + +if (-1024 << 25 !== 0) { + throw new Test262Error('#811: -1024 << 25 === 0. Actual: ' + (-1024 << 25)); +} + + +if (-2048 << 25 !== 0) { + throw new Test262Error('#812: -2048 << 25 === 0. Actual: ' + (-2048 << 25)); +} + + +if (-4096 << 25 !== 0) { + throw new Test262Error('#813: -4096 << 25 === 0. Actual: ' + (-4096 << 25)); +} + + +if (-8192 << 25 !== 0) { + throw new Test262Error('#814: -8192 << 25 === 0. Actual: ' + (-8192 << 25)); +} + + +if (-16384 << 25 !== 0) { + throw new Test262Error('#815: -16384 << 25 === 0. Actual: ' + (-16384 << 25)); +} + + +if (-32768 << 25 !== 0) { + throw new Test262Error('#816: -32768 << 25 === 0. Actual: ' + (-32768 << 25)); +} + + +if (-65536 << 25 !== 0) { + throw new Test262Error('#817: -65536 << 25 === 0. Actual: ' + (-65536 << 25)); +} + + +if (-131072 << 25 !== 0) { + throw new Test262Error('#818: -131072 << 25 === 0. Actual: ' + (-131072 << 25)); +} + + +if (-262144 << 25 !== 0) { + throw new Test262Error('#819: -262144 << 25 === 0. Actual: ' + (-262144 << 25)); +} + + +if (-524288 << 25 !== 0) { + throw new Test262Error('#820: -524288 << 25 === 0. Actual: ' + (-524288 << 25)); +} + + +if (-1048576 << 25 !== 0) { + throw new Test262Error('#821: -1048576 << 25 === 0. Actual: ' + (-1048576 << 25)); +} + + +if (-2097152 << 25 !== 0) { + throw new Test262Error('#822: -2097152 << 25 === 0. Actual: ' + (-2097152 << 25)); +} + + +if (-4194304 << 25 !== 0) { + throw new Test262Error('#823: -4194304 << 25 === 0. Actual: ' + (-4194304 << 25)); +} + + +if (-8388608 << 25 !== 0) { + throw new Test262Error('#824: -8388608 << 25 === 0. Actual: ' + (-8388608 << 25)); +} + + +if (-16777216 << 25 !== 0) { + throw new Test262Error('#825: -16777216 << 25 === 0. Actual: ' + (-16777216 << 25)); +} + + +if (-33554432 << 25 !== 0) { + throw new Test262Error('#826: -33554432 << 25 === 0. Actual: ' + (-33554432 << 25)); +} + + +if (-67108864 << 25 !== 0) { + throw new Test262Error('#827: -67108864 << 25 === 0. Actual: ' + (-67108864 << 25)); +} + + +if (-134217728 << 25 !== 0) { + throw new Test262Error('#828: -134217728 << 25 === 0. Actual: ' + (-134217728 << 25)); +} + + +if (-268435456 << 25 !== 0) { + throw new Test262Error('#829: -268435456 << 25 === 0. Actual: ' + (-268435456 << 25)); +} + + +if (-536870912 << 25 !== 0) { + throw new Test262Error('#830: -536870912 << 25 === 0. Actual: ' + (-536870912 << 25)); +} + + +if (-1073741824 << 25 !== 0) { + throw new Test262Error('#831: -1073741824 << 25 === 0. Actual: ' + (-1073741824 << 25)); +} + + +if (-2147483648 << 25 !== 0) { + throw new Test262Error('#832: -2147483648 << 25 === 0. Actual: ' + (-2147483648 << 25)); +} + + +if (-1 << 26 !== -67108864) { + throw new Test262Error('#833: -1 << 26 === -67108864. Actual: ' + (-1 << 26)); +} + + +if (-2 << 26 !== -134217728) { + throw new Test262Error('#834: -2 << 26 === -134217728. Actual: ' + (-2 << 26)); +} + + +if (-4 << 26 !== -268435456) { + throw new Test262Error('#835: -4 << 26 === -268435456. Actual: ' + (-4 << 26)); +} + + +if (-8 << 26 !== -536870912) { + throw new Test262Error('#836: -8 << 26 === -536870912. Actual: ' + (-8 << 26)); +} + + +if (-16 << 26 !== -1073741824) { + throw new Test262Error('#837: -16 << 26 === -1073741824. Actual: ' + (-16 << 26)); +} + + +if (-32 << 26 !== -2147483648) { + throw new Test262Error('#838: -32 << 26 === -2147483648. Actual: ' + (-32 << 26)); +} + + +if (-64 << 26 !== 0) { + throw new Test262Error('#839: -64 << 26 === 0. Actual: ' + (-64 << 26)); +} + + +if (-128 << 26 !== 0) { + throw new Test262Error('#840: -128 << 26 === 0. Actual: ' + (-128 << 26)); +} + + +if (-256 << 26 !== 0) { + throw new Test262Error('#841: -256 << 26 === 0. Actual: ' + (-256 << 26)); +} + + +if (-512 << 26 !== 0) { + throw new Test262Error('#842: -512 << 26 === 0. Actual: ' + (-512 << 26)); +} + + +if (-1024 << 26 !== 0) { + throw new Test262Error('#843: -1024 << 26 === 0. Actual: ' + (-1024 << 26)); +} + + +if (-2048 << 26 !== 0) { + throw new Test262Error('#844: -2048 << 26 === 0. Actual: ' + (-2048 << 26)); +} + + +if (-4096 << 26 !== 0) { + throw new Test262Error('#845: -4096 << 26 === 0. Actual: ' + (-4096 << 26)); +} + + +if (-8192 << 26 !== 0) { + throw new Test262Error('#846: -8192 << 26 === 0. Actual: ' + (-8192 << 26)); +} + + +if (-16384 << 26 !== 0) { + throw new Test262Error('#847: -16384 << 26 === 0. Actual: ' + (-16384 << 26)); +} + + +if (-32768 << 26 !== 0) { + throw new Test262Error('#848: -32768 << 26 === 0. Actual: ' + (-32768 << 26)); +} + + +if (-65536 << 26 !== 0) { + throw new Test262Error('#849: -65536 << 26 === 0. Actual: ' + (-65536 << 26)); +} + + +if (-131072 << 26 !== 0) { + throw new Test262Error('#850: -131072 << 26 === 0. Actual: ' + (-131072 << 26)); +} + + +if (-262144 << 26 !== 0) { + throw new Test262Error('#851: -262144 << 26 === 0. Actual: ' + (-262144 << 26)); +} + + +if (-524288 << 26 !== 0) { + throw new Test262Error('#852: -524288 << 26 === 0. Actual: ' + (-524288 << 26)); +} + + +if (-1048576 << 26 !== 0) { + throw new Test262Error('#853: -1048576 << 26 === 0. Actual: ' + (-1048576 << 26)); +} + + +if (-2097152 << 26 !== 0) { + throw new Test262Error('#854: -2097152 << 26 === 0. Actual: ' + (-2097152 << 26)); +} + + +if (-4194304 << 26 !== 0) { + throw new Test262Error('#855: -4194304 << 26 === 0. Actual: ' + (-4194304 << 26)); +} + + +if (-8388608 << 26 !== 0) { + throw new Test262Error('#856: -8388608 << 26 === 0. Actual: ' + (-8388608 << 26)); +} + + +if (-16777216 << 26 !== 0) { + throw new Test262Error('#857: -16777216 << 26 === 0. Actual: ' + (-16777216 << 26)); +} + + +if (-33554432 << 26 !== 0) { + throw new Test262Error('#858: -33554432 << 26 === 0. Actual: ' + (-33554432 << 26)); +} + + +if (-67108864 << 26 !== 0) { + throw new Test262Error('#859: -67108864 << 26 === 0. Actual: ' + (-67108864 << 26)); +} + + +if (-134217728 << 26 !== 0) { + throw new Test262Error('#860: -134217728 << 26 === 0. Actual: ' + (-134217728 << 26)); +} + + +if (-268435456 << 26 !== 0) { + throw new Test262Error('#861: -268435456 << 26 === 0. Actual: ' + (-268435456 << 26)); +} + + +if (-536870912 << 26 !== 0) { + throw new Test262Error('#862: -536870912 << 26 === 0. Actual: ' + (-536870912 << 26)); +} + + +if (-1073741824 << 26 !== 0) { + throw new Test262Error('#863: -1073741824 << 26 === 0. Actual: ' + (-1073741824 << 26)); +} + + +if (-2147483648 << 26 !== 0) { + throw new Test262Error('#864: -2147483648 << 26 === 0. Actual: ' + (-2147483648 << 26)); +} + + +if (-1 << 27 !== -134217728) { + throw new Test262Error('#865: -1 << 27 === -134217728. Actual: ' + (-1 << 27)); +} + + +if (-2 << 27 !== -268435456) { + throw new Test262Error('#866: -2 << 27 === -268435456. Actual: ' + (-2 << 27)); +} + + +if (-4 << 27 !== -536870912) { + throw new Test262Error('#867: -4 << 27 === -536870912. Actual: ' + (-4 << 27)); +} + + +if (-8 << 27 !== -1073741824) { + throw new Test262Error('#868: -8 << 27 === -1073741824. Actual: ' + (-8 << 27)); +} + + +if (-16 << 27 !== -2147483648) { + throw new Test262Error('#869: -16 << 27 === -2147483648. Actual: ' + (-16 << 27)); +} + + +if (-32 << 27 !== 0) { + throw new Test262Error('#870: -32 << 27 === 0. Actual: ' + (-32 << 27)); +} + + +if (-64 << 27 !== 0) { + throw new Test262Error('#871: -64 << 27 === 0. Actual: ' + (-64 << 27)); +} + + +if (-128 << 27 !== 0) { + throw new Test262Error('#872: -128 << 27 === 0. Actual: ' + (-128 << 27)); +} + + +if (-256 << 27 !== 0) { + throw new Test262Error('#873: -256 << 27 === 0. Actual: ' + (-256 << 27)); +} + + +if (-512 << 27 !== 0) { + throw new Test262Error('#874: -512 << 27 === 0. Actual: ' + (-512 << 27)); +} + + +if (-1024 << 27 !== 0) { + throw new Test262Error('#875: -1024 << 27 === 0. Actual: ' + (-1024 << 27)); +} + + +if (-2048 << 27 !== 0) { + throw new Test262Error('#876: -2048 << 27 === 0. Actual: ' + (-2048 << 27)); +} + + +if (-4096 << 27 !== 0) { + throw new Test262Error('#877: -4096 << 27 === 0. Actual: ' + (-4096 << 27)); +} + + +if (-8192 << 27 !== 0) { + throw new Test262Error('#878: -8192 << 27 === 0. Actual: ' + (-8192 << 27)); +} + + +if (-16384 << 27 !== 0) { + throw new Test262Error('#879: -16384 << 27 === 0. Actual: ' + (-16384 << 27)); +} + + +if (-32768 << 27 !== 0) { + throw new Test262Error('#880: -32768 << 27 === 0. Actual: ' + (-32768 << 27)); +} + + +if (-65536 << 27 !== 0) { + throw new Test262Error('#881: -65536 << 27 === 0. Actual: ' + (-65536 << 27)); +} + + +if (-131072 << 27 !== 0) { + throw new Test262Error('#882: -131072 << 27 === 0. Actual: ' + (-131072 << 27)); +} + + +if (-262144 << 27 !== 0) { + throw new Test262Error('#883: -262144 << 27 === 0. Actual: ' + (-262144 << 27)); +} + + +if (-524288 << 27 !== 0) { + throw new Test262Error('#884: -524288 << 27 === 0. Actual: ' + (-524288 << 27)); +} + + +if (-1048576 << 27 !== 0) { + throw new Test262Error('#885: -1048576 << 27 === 0. Actual: ' + (-1048576 << 27)); +} + + +if (-2097152 << 27 !== 0) { + throw new Test262Error('#886: -2097152 << 27 === 0. Actual: ' + (-2097152 << 27)); +} + + +if (-4194304 << 27 !== 0) { + throw new Test262Error('#887: -4194304 << 27 === 0. Actual: ' + (-4194304 << 27)); +} + + +if (-8388608 << 27 !== 0) { + throw new Test262Error('#888: -8388608 << 27 === 0. Actual: ' + (-8388608 << 27)); +} + + +if (-16777216 << 27 !== 0) { + throw new Test262Error('#889: -16777216 << 27 === 0. Actual: ' + (-16777216 << 27)); +} + + +if (-33554432 << 27 !== 0) { + throw new Test262Error('#890: -33554432 << 27 === 0. Actual: ' + (-33554432 << 27)); +} + + +if (-67108864 << 27 !== 0) { + throw new Test262Error('#891: -67108864 << 27 === 0. Actual: ' + (-67108864 << 27)); +} + + +if (-134217728 << 27 !== 0) { + throw new Test262Error('#892: -134217728 << 27 === 0. Actual: ' + (-134217728 << 27)); +} + + +if (-268435456 << 27 !== 0) { + throw new Test262Error('#893: -268435456 << 27 === 0. Actual: ' + (-268435456 << 27)); +} + + +if (-536870912 << 27 !== 0) { + throw new Test262Error('#894: -536870912 << 27 === 0. Actual: ' + (-536870912 << 27)); +} + + +if (-1073741824 << 27 !== 0) { + throw new Test262Error('#895: -1073741824 << 27 === 0. Actual: ' + (-1073741824 << 27)); +} + + +if (-2147483648 << 27 !== 0) { + throw new Test262Error('#896: -2147483648 << 27 === 0. Actual: ' + (-2147483648 << 27)); +} + + +if (-1 << 28 !== -268435456) { + throw new Test262Error('#897: -1 << 28 === -268435456. Actual: ' + (-1 << 28)); +} + + +if (-2 << 28 !== -536870912) { + throw new Test262Error('#898: -2 << 28 === -536870912. Actual: ' + (-2 << 28)); +} + + +if (-4 << 28 !== -1073741824) { + throw new Test262Error('#899: -4 << 28 === -1073741824. Actual: ' + (-4 << 28)); +} + + +if (-8 << 28 !== -2147483648) { + throw new Test262Error('#900: -8 << 28 === -2147483648. Actual: ' + (-8 << 28)); +} + + +if (-16 << 28 !== 0) { + throw new Test262Error('#901: -16 << 28 === 0. Actual: ' + (-16 << 28)); +} + + +if (-32 << 28 !== 0) { + throw new Test262Error('#902: -32 << 28 === 0. Actual: ' + (-32 << 28)); +} + + +if (-64 << 28 !== 0) { + throw new Test262Error('#903: -64 << 28 === 0. Actual: ' + (-64 << 28)); +} + + +if (-128 << 28 !== 0) { + throw new Test262Error('#904: -128 << 28 === 0. Actual: ' + (-128 << 28)); +} + + +if (-256 << 28 !== 0) { + throw new Test262Error('#905: -256 << 28 === 0. Actual: ' + (-256 << 28)); +} + + +if (-512 << 28 !== 0) { + throw new Test262Error('#906: -512 << 28 === 0. Actual: ' + (-512 << 28)); +} + + +if (-1024 << 28 !== 0) { + throw new Test262Error('#907: -1024 << 28 === 0. Actual: ' + (-1024 << 28)); +} + + +if (-2048 << 28 !== 0) { + throw new Test262Error('#908: -2048 << 28 === 0. Actual: ' + (-2048 << 28)); +} + + +if (-4096 << 28 !== 0) { + throw new Test262Error('#909: -4096 << 28 === 0. Actual: ' + (-4096 << 28)); +} + + +if (-8192 << 28 !== 0) { + throw new Test262Error('#910: -8192 << 28 === 0. Actual: ' + (-8192 << 28)); +} + + +if (-16384 << 28 !== 0) { + throw new Test262Error('#911: -16384 << 28 === 0. Actual: ' + (-16384 << 28)); +} + + +if (-32768 << 28 !== 0) { + throw new Test262Error('#912: -32768 << 28 === 0. Actual: ' + (-32768 << 28)); +} + + +if (-65536 << 28 !== 0) { + throw new Test262Error('#913: -65536 << 28 === 0. Actual: ' + (-65536 << 28)); +} + + +if (-131072 << 28 !== 0) { + throw new Test262Error('#914: -131072 << 28 === 0. Actual: ' + (-131072 << 28)); +} + + +if (-262144 << 28 !== 0) { + throw new Test262Error('#915: -262144 << 28 === 0. Actual: ' + (-262144 << 28)); +} + + +if (-524288 << 28 !== 0) { + throw new Test262Error('#916: -524288 << 28 === 0. Actual: ' + (-524288 << 28)); +} + + +if (-1048576 << 28 !== 0) { + throw new Test262Error('#917: -1048576 << 28 === 0. Actual: ' + (-1048576 << 28)); +} + + +if (-2097152 << 28 !== 0) { + throw new Test262Error('#918: -2097152 << 28 === 0. Actual: ' + (-2097152 << 28)); +} + + +if (-4194304 << 28 !== 0) { + throw new Test262Error('#919: -4194304 << 28 === 0. Actual: ' + (-4194304 << 28)); +} + + +if (-8388608 << 28 !== 0) { + throw new Test262Error('#920: -8388608 << 28 === 0. Actual: ' + (-8388608 << 28)); +} + + +if (-16777216 << 28 !== 0) { + throw new Test262Error('#921: -16777216 << 28 === 0. Actual: ' + (-16777216 << 28)); +} + + +if (-33554432 << 28 !== 0) { + throw new Test262Error('#922: -33554432 << 28 === 0. Actual: ' + (-33554432 << 28)); +} + + +if (-67108864 << 28 !== 0) { + throw new Test262Error('#923: -67108864 << 28 === 0. Actual: ' + (-67108864 << 28)); +} + + +if (-134217728 << 28 !== 0) { + throw new Test262Error('#924: -134217728 << 28 === 0. Actual: ' + (-134217728 << 28)); +} + + +if (-268435456 << 28 !== 0) { + throw new Test262Error('#925: -268435456 << 28 === 0. Actual: ' + (-268435456 << 28)); +} + + +if (-536870912 << 28 !== 0) { + throw new Test262Error('#926: -536870912 << 28 === 0. Actual: ' + (-536870912 << 28)); +} + + +if (-1073741824 << 28 !== 0) { + throw new Test262Error('#927: -1073741824 << 28 === 0. Actual: ' + (-1073741824 << 28)); +} + + +if (-2147483648 << 28 !== 0) { + throw new Test262Error('#928: -2147483648 << 28 === 0. Actual: ' + (-2147483648 << 28)); +} + + +if (-1 << 29 !== -536870912) { + throw new Test262Error('#929: -1 << 29 === -536870912. Actual: ' + (-1 << 29)); +} + + +if (-2 << 29 !== -1073741824) { + throw new Test262Error('#930: -2 << 29 === -1073741824. Actual: ' + (-2 << 29)); +} + + +if (-4 << 29 !== -2147483648) { + throw new Test262Error('#931: -4 << 29 === -2147483648. Actual: ' + (-4 << 29)); +} + + +if (-8 << 29 !== 0) { + throw new Test262Error('#932: -8 << 29 === 0. Actual: ' + (-8 << 29)); +} + + +if (-16 << 29 !== 0) { + throw new Test262Error('#933: -16 << 29 === 0. Actual: ' + (-16 << 29)); +} + + +if (-32 << 29 !== 0) { + throw new Test262Error('#934: -32 << 29 === 0. Actual: ' + (-32 << 29)); +} + + +if (-64 << 29 !== 0) { + throw new Test262Error('#935: -64 << 29 === 0. Actual: ' + (-64 << 29)); +} + + +if (-128 << 29 !== 0) { + throw new Test262Error('#936: -128 << 29 === 0. Actual: ' + (-128 << 29)); +} + + +if (-256 << 29 !== 0) { + throw new Test262Error('#937: -256 << 29 === 0. Actual: ' + (-256 << 29)); +} + + +if (-512 << 29 !== 0) { + throw new Test262Error('#938: -512 << 29 === 0. Actual: ' + (-512 << 29)); +} + + +if (-1024 << 29 !== 0) { + throw new Test262Error('#939: -1024 << 29 === 0. Actual: ' + (-1024 << 29)); +} + + +if (-2048 << 29 !== 0) { + throw new Test262Error('#940: -2048 << 29 === 0. Actual: ' + (-2048 << 29)); +} + + +if (-4096 << 29 !== 0) { + throw new Test262Error('#941: -4096 << 29 === 0. Actual: ' + (-4096 << 29)); +} + + +if (-8192 << 29 !== 0) { + throw new Test262Error('#942: -8192 << 29 === 0. Actual: ' + (-8192 << 29)); +} + + +if (-16384 << 29 !== 0) { + throw new Test262Error('#943: -16384 << 29 === 0. Actual: ' + (-16384 << 29)); +} + + +if (-32768 << 29 !== 0) { + throw new Test262Error('#944: -32768 << 29 === 0. Actual: ' + (-32768 << 29)); +} + + +if (-65536 << 29 !== 0) { + throw new Test262Error('#945: -65536 << 29 === 0. Actual: ' + (-65536 << 29)); +} + + +if (-131072 << 29 !== 0) { + throw new Test262Error('#946: -131072 << 29 === 0. Actual: ' + (-131072 << 29)); +} + + +if (-262144 << 29 !== 0) { + throw new Test262Error('#947: -262144 << 29 === 0. Actual: ' + (-262144 << 29)); +} + + +if (-524288 << 29 !== 0) { + throw new Test262Error('#948: -524288 << 29 === 0. Actual: ' + (-524288 << 29)); +} + + +if (-1048576 << 29 !== 0) { + throw new Test262Error('#949: -1048576 << 29 === 0. Actual: ' + (-1048576 << 29)); +} + + +if (-2097152 << 29 !== 0) { + throw new Test262Error('#950: -2097152 << 29 === 0. Actual: ' + (-2097152 << 29)); +} + + +if (-4194304 << 29 !== 0) { + throw new Test262Error('#951: -4194304 << 29 === 0. Actual: ' + (-4194304 << 29)); +} + + +if (-8388608 << 29 !== 0) { + throw new Test262Error('#952: -8388608 << 29 === 0. Actual: ' + (-8388608 << 29)); +} + + +if (-16777216 << 29 !== 0) { + throw new Test262Error('#953: -16777216 << 29 === 0. Actual: ' + (-16777216 << 29)); +} + + +if (-33554432 << 29 !== 0) { + throw new Test262Error('#954: -33554432 << 29 === 0. Actual: ' + (-33554432 << 29)); +} + + +if (-67108864 << 29 !== 0) { + throw new Test262Error('#955: -67108864 << 29 === 0. Actual: ' + (-67108864 << 29)); +} + + +if (-134217728 << 29 !== 0) { + throw new Test262Error('#956: -134217728 << 29 === 0. Actual: ' + (-134217728 << 29)); +} + + +if (-268435456 << 29 !== 0) { + throw new Test262Error('#957: -268435456 << 29 === 0. Actual: ' + (-268435456 << 29)); +} + + +if (-536870912 << 29 !== 0) { + throw new Test262Error('#958: -536870912 << 29 === 0. Actual: ' + (-536870912 << 29)); +} + + +if (-1073741824 << 29 !== 0) { + throw new Test262Error('#959: -1073741824 << 29 === 0. Actual: ' + (-1073741824 << 29)); +} + + +if (-2147483648 << 29 !== 0) { + throw new Test262Error('#960: -2147483648 << 29 === 0. Actual: ' + (-2147483648 << 29)); +} + + +if (-1 << 30 !== -1073741824) { + throw new Test262Error('#961: -1 << 30 === -1073741824. Actual: ' + (-1 << 30)); +} + + +if (-2 << 30 !== -2147483648) { + throw new Test262Error('#962: -2 << 30 === -2147483648. Actual: ' + (-2 << 30)); +} + + +if (-4 << 30 !== 0) { + throw new Test262Error('#963: -4 << 30 === 0. Actual: ' + (-4 << 30)); +} + + +if (-8 << 30 !== 0) { + throw new Test262Error('#964: -8 << 30 === 0. Actual: ' + (-8 << 30)); +} + + +if (-16 << 30 !== 0) { + throw new Test262Error('#965: -16 << 30 === 0. Actual: ' + (-16 << 30)); +} + + +if (-32 << 30 !== 0) { + throw new Test262Error('#966: -32 << 30 === 0. Actual: ' + (-32 << 30)); +} + + +if (-64 << 30 !== 0) { + throw new Test262Error('#967: -64 << 30 === 0. Actual: ' + (-64 << 30)); +} + + +if (-128 << 30 !== 0) { + throw new Test262Error('#968: -128 << 30 === 0. Actual: ' + (-128 << 30)); +} + + +if (-256 << 30 !== 0) { + throw new Test262Error('#969: -256 << 30 === 0. Actual: ' + (-256 << 30)); +} + + +if (-512 << 30 !== 0) { + throw new Test262Error('#970: -512 << 30 === 0. Actual: ' + (-512 << 30)); +} + + +if (-1024 << 30 !== 0) { + throw new Test262Error('#971: -1024 << 30 === 0. Actual: ' + (-1024 << 30)); +} + + +if (-2048 << 30 !== 0) { + throw new Test262Error('#972: -2048 << 30 === 0. Actual: ' + (-2048 << 30)); +} + + +if (-4096 << 30 !== 0) { + throw new Test262Error('#973: -4096 << 30 === 0. Actual: ' + (-4096 << 30)); +} + + +if (-8192 << 30 !== 0) { + throw new Test262Error('#974: -8192 << 30 === 0. Actual: ' + (-8192 << 30)); +} + + +if (-16384 << 30 !== 0) { + throw new Test262Error('#975: -16384 << 30 === 0. Actual: ' + (-16384 << 30)); +} + + +if (-32768 << 30 !== 0) { + throw new Test262Error('#976: -32768 << 30 === 0. Actual: ' + (-32768 << 30)); +} + + +if (-65536 << 30 !== 0) { + throw new Test262Error('#977: -65536 << 30 === 0. Actual: ' + (-65536 << 30)); +} + + +if (-131072 << 30 !== 0) { + throw new Test262Error('#978: -131072 << 30 === 0. Actual: ' + (-131072 << 30)); +} + + +if (-262144 << 30 !== 0) { + throw new Test262Error('#979: -262144 << 30 === 0. Actual: ' + (-262144 << 30)); +} + + +if (-524288 << 30 !== 0) { + throw new Test262Error('#980: -524288 << 30 === 0. Actual: ' + (-524288 << 30)); +} + + +if (-1048576 << 30 !== 0) { + throw new Test262Error('#981: -1048576 << 30 === 0. Actual: ' + (-1048576 << 30)); +} + + +if (-2097152 << 30 !== 0) { + throw new Test262Error('#982: -2097152 << 30 === 0. Actual: ' + (-2097152 << 30)); +} + + +if (-4194304 << 30 !== 0) { + throw new Test262Error('#983: -4194304 << 30 === 0. Actual: ' + (-4194304 << 30)); +} + + +if (-8388608 << 30 !== 0) { + throw new Test262Error('#984: -8388608 << 30 === 0. Actual: ' + (-8388608 << 30)); +} + + +if (-16777216 << 30 !== 0) { + throw new Test262Error('#985: -16777216 << 30 === 0. Actual: ' + (-16777216 << 30)); +} + + +if (-33554432 << 30 !== 0) { + throw new Test262Error('#986: -33554432 << 30 === 0. Actual: ' + (-33554432 << 30)); +} + + +if (-67108864 << 30 !== 0) { + throw new Test262Error('#987: -67108864 << 30 === 0. Actual: ' + (-67108864 << 30)); +} + + +if (-134217728 << 30 !== 0) { + throw new Test262Error('#988: -134217728 << 30 === 0. Actual: ' + (-134217728 << 30)); +} + + +if (-268435456 << 30 !== 0) { + throw new Test262Error('#989: -268435456 << 30 === 0. Actual: ' + (-268435456 << 30)); +} + + +if (-536870912 << 30 !== 0) { + throw new Test262Error('#990: -536870912 << 30 === 0. Actual: ' + (-536870912 << 30)); +} + + +if (-1073741824 << 30 !== 0) { + throw new Test262Error('#991: -1073741824 << 30 === 0. Actual: ' + (-1073741824 << 30)); +} + + +if (-2147483648 << 30 !== 0) { + throw new Test262Error('#992: -2147483648 << 30 === 0. Actual: ' + (-2147483648 << 30)); +} + + +if (-1 << 31 !== -2147483648) { + throw new Test262Error('#993: -1 << 31 === -2147483648. Actual: ' + (-1 << 31)); +} + + +if (-2 << 31 !== 0) { + throw new Test262Error('#994: -2 << 31 === 0. Actual: ' + (-2 << 31)); +} + + +if (-4 << 31 !== 0) { + throw new Test262Error('#995: -4 << 31 === 0. Actual: ' + (-4 << 31)); +} + + +if (-8 << 31 !== 0) { + throw new Test262Error('#996: -8 << 31 === 0. Actual: ' + (-8 << 31)); +} + + +if (-16 << 31 !== 0) { + throw new Test262Error('#997: -16 << 31 === 0. Actual: ' + (-16 << 31)); +} + + +if (-32 << 31 !== 0) { + throw new Test262Error('#998: -32 << 31 === 0. Actual: ' + (-32 << 31)); +} + + +if (-64 << 31 !== 0) { + throw new Test262Error('#999: -64 << 31 === 0. Actual: ' + (-64 << 31)); +} + + +if (-128 << 31 !== 0) { + throw new Test262Error('#1000: -128 << 31 === 0. Actual: ' + (-128 << 31)); +} + + +if (-256 << 31 !== 0) { + throw new Test262Error('#1001: -256 << 31 === 0. Actual: ' + (-256 << 31)); +} + + +if (-512 << 31 !== 0) { + throw new Test262Error('#1002: -512 << 31 === 0. Actual: ' + (-512 << 31)); +} + + +if (-1024 << 31 !== 0) { + throw new Test262Error('#1003: -1024 << 31 === 0. Actual: ' + (-1024 << 31)); +} + + +if (-2048 << 31 !== 0) { + throw new Test262Error('#1004: -2048 << 31 === 0. Actual: ' + (-2048 << 31)); +} + + +if (-4096 << 31 !== 0) { + throw new Test262Error('#1005: -4096 << 31 === 0. Actual: ' + (-4096 << 31)); +} + + +if (-8192 << 31 !== 0) { + throw new Test262Error('#1006: -8192 << 31 === 0. Actual: ' + (-8192 << 31)); +} + + +if (-16384 << 31 !== 0) { + throw new Test262Error('#1007: -16384 << 31 === 0. Actual: ' + (-16384 << 31)); +} + + +if (-32768 << 31 !== 0) { + throw new Test262Error('#1008: -32768 << 31 === 0. Actual: ' + (-32768 << 31)); +} + + +if (-65536 << 31 !== 0) { + throw new Test262Error('#1009: -65536 << 31 === 0. Actual: ' + (-65536 << 31)); +} + + +if (-131072 << 31 !== 0) { + throw new Test262Error('#1010: -131072 << 31 === 0. Actual: ' + (-131072 << 31)); +} + + +if (-262144 << 31 !== 0) { + throw new Test262Error('#1011: -262144 << 31 === 0. Actual: ' + (-262144 << 31)); +} + + +if (-524288 << 31 !== 0) { + throw new Test262Error('#1012: -524288 << 31 === 0. Actual: ' + (-524288 << 31)); +} + + +if (-1048576 << 31 !== 0) { + throw new Test262Error('#1013: -1048576 << 31 === 0. Actual: ' + (-1048576 << 31)); +} + + +if (-2097152 << 31 !== 0) { + throw new Test262Error('#1014: -2097152 << 31 === 0. Actual: ' + (-2097152 << 31)); +} + + +if (-4194304 << 31 !== 0) { + throw new Test262Error('#1015: -4194304 << 31 === 0. Actual: ' + (-4194304 << 31)); +} + + +if (-8388608 << 31 !== 0) { + throw new Test262Error('#1016: -8388608 << 31 === 0. Actual: ' + (-8388608 << 31)); +} + + +if (-16777216 << 31 !== 0) { + throw new Test262Error('#1017: -16777216 << 31 === 0. Actual: ' + (-16777216 << 31)); +} + + +if (-33554432 << 31 !== 0) { + throw new Test262Error('#1018: -33554432 << 31 === 0. Actual: ' + (-33554432 << 31)); +} + + +if (-67108864 << 31 !== 0) { + throw new Test262Error('#1019: -67108864 << 31 === 0. Actual: ' + (-67108864 << 31)); +} + + +if (-134217728 << 31 !== 0) { + throw new Test262Error('#1020: -134217728 << 31 === 0. Actual: ' + (-134217728 << 31)); +} + + +if (-268435456 << 31 !== 0) { + throw new Test262Error('#1021: -268435456 << 31 === 0. Actual: ' + (-268435456 << 31)); +} + + +if (-536870912 << 31 !== 0) { + throw new Test262Error('#1022: -536870912 << 31 === 0. Actual: ' + (-536870912 << 31)); +} + + +if (-1073741824 << 31 !== 0) { + throw new Test262Error('#1023: -1073741824 << 31 === 0. Actual: ' + (-1073741824 << 31)); +} + + +if (-2147483648 << 31 !== 0) { + throw new Test262Error('#1024: -2147483648 << 31 === 0. Actual: ' + (-2147483648 << 31)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T3.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T3.js new file mode 100644 index 0000000000..97065c7e02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T3.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x << y in distinct points +es5id: 11.7.1_A4_T3 +description: ShiftExpression = 2^n - 1, n = 0...15 +---*/ + +//CHECK + +if (0 << 0 !== 0) { + throw new Test262Error('#1: 0 << 0 === 0. Actual: ' + (0 << 0)); +} + + +if (1 << 0 !== 1) { + throw new Test262Error('#2: 1 << 0 === 1. Actual: ' + (1 << 0)); +} + + +if (3 << 0 !== 3) { + throw new Test262Error('#3: 3 << 0 === 3. Actual: ' + (3 << 0)); +} + + +if (7 << 0 !== 7) { + throw new Test262Error('#4: 7 << 0 === 7. Actual: ' + (7 << 0)); +} + + +if (15 << 0 !== 15) { + throw new Test262Error('#5: 15 << 0 === 15. Actual: ' + (15 << 0)); +} + + +if (31 << 0 !== 31) { + throw new Test262Error('#6: 31 << 0 === 31. Actual: ' + (31 << 0)); +} + + +if (63 << 0 !== 63) { + throw new Test262Error('#7: 63 << 0 === 63. Actual: ' + (63 << 0)); +} + + +if (127 << 0 !== 127) { + throw new Test262Error('#8: 127 << 0 === 127. Actual: ' + (127 << 0)); +} + + +if (255 << 0 !== 255) { + throw new Test262Error('#9: 255 << 0 === 255. Actual: ' + (255 << 0)); +} + + +if (511 << 0 !== 511) { + throw new Test262Error('#10: 511 << 0 === 511. Actual: ' + (511 << 0)); +} + + +if (1023 << 0 !== 1023) { + throw new Test262Error('#11: 1023 << 0 === 1023. Actual: ' + (1023 << 0)); +} + + +if (2047 << 0 !== 2047) { + throw new Test262Error('#12: 2047 << 0 === 2047. Actual: ' + (2047 << 0)); +} + + +if (4095 << 0 !== 4095) { + throw new Test262Error('#13: 4095 << 0 === 4095. Actual: ' + (4095 << 0)); +} + + +if (8191 << 0 !== 8191) { + throw new Test262Error('#14: 8191 << 0 === 8191. Actual: ' + (8191 << 0)); +} + + +if (16383 << 0 !== 16383) { + throw new Test262Error('#15: 16383 << 0 === 16383. Actual: ' + (16383 << 0)); +} + + +if (32767 << 0 !== 32767) { + throw new Test262Error('#16: 32767 << 0 === 32767. Actual: ' + (32767 << 0)); +} + + +if (65535 << 0 !== 65535) { + throw new Test262Error('#17: 65535 << 0 === 65535. Actual: ' + (65535 << 0)); +} + + +if (131071 << 0 !== 131071) { + throw new Test262Error('#18: 131071 << 0 === 131071. Actual: ' + (131071 << 0)); +} + + +if (262143 << 0 !== 262143) { + throw new Test262Error('#19: 262143 << 0 === 262143. Actual: ' + (262143 << 0)); +} + + +if (524287 << 0 !== 524287) { + throw new Test262Error('#20: 524287 << 0 === 524287. Actual: ' + (524287 << 0)); +} + + +if (1048575 << 0 !== 1048575) { + throw new Test262Error('#21: 1048575 << 0 === 1048575. Actual: ' + (1048575 << 0)); +} + + +if (2097151 << 0 !== 2097151) { + throw new Test262Error('#22: 2097151 << 0 === 2097151. Actual: ' + (2097151 << 0)); +} + + +if (4194303 << 0 !== 4194303) { + throw new Test262Error('#23: 4194303 << 0 === 4194303. Actual: ' + (4194303 << 0)); +} + + +if (8388607 << 0 !== 8388607) { + throw new Test262Error('#24: 8388607 << 0 === 8388607. Actual: ' + (8388607 << 0)); +} + + +if (16777215 << 0 !== 16777215) { + throw new Test262Error('#25: 16777215 << 0 === 16777215. Actual: ' + (16777215 << 0)); +} + + +if (33554431 << 0 !== 33554431) { + throw new Test262Error('#26: 33554431 << 0 === 33554431. Actual: ' + (33554431 << 0)); +} + + +if (67108863 << 0 !== 67108863) { + throw new Test262Error('#27: 67108863 << 0 === 67108863. Actual: ' + (67108863 << 0)); +} + + +if (134217727 << 0 !== 134217727) { + throw new Test262Error('#28: 134217727 << 0 === 134217727. Actual: ' + (134217727 << 0)); +} + + +if (268435455 << 0 !== 268435455) { + throw new Test262Error('#29: 268435455 << 0 === 268435455. Actual: ' + (268435455 << 0)); +} + + +if (536870911 << 0 !== 536870911) { + throw new Test262Error('#30: 536870911 << 0 === 536870911. Actual: ' + (536870911 << 0)); +} + + +if (1073741823 << 0 !== 1073741823) { + throw new Test262Error('#31: 1073741823 << 0 === 1073741823. Actual: ' + (1073741823 << 0)); +} + + +if (2147483647 << 0 !== 2147483647) { + throw new Test262Error('#32: 2147483647 << 0 === 2147483647. Actual: ' + (2147483647 << 0)); +} + + +if (0 << 1 !== 0) { + throw new Test262Error('#33: 0 << 1 === 0. Actual: ' + (0 << 1)); +} + + +if (1 << 1 !== 2) { + throw new Test262Error('#34: 1 << 1 === 2. Actual: ' + (1 << 1)); +} + + +if (3 << 1 !== 6) { + throw new Test262Error('#35: 3 << 1 === 6. Actual: ' + (3 << 1)); +} + + +if (7 << 1 !== 14) { + throw new Test262Error('#36: 7 << 1 === 14. Actual: ' + (7 << 1)); +} + + +if (15 << 1 !== 30) { + throw new Test262Error('#37: 15 << 1 === 30. Actual: ' + (15 << 1)); +} + + +if (31 << 1 !== 62) { + throw new Test262Error('#38: 31 << 1 === 62. Actual: ' + (31 << 1)); +} + + +if (63 << 1 !== 126) { + throw new Test262Error('#39: 63 << 1 === 126. Actual: ' + (63 << 1)); +} + + +if (127 << 1 !== 254) { + throw new Test262Error('#40: 127 << 1 === 254. Actual: ' + (127 << 1)); +} + + +if (255 << 1 !== 510) { + throw new Test262Error('#41: 255 << 1 === 510. Actual: ' + (255 << 1)); +} + + +if (511 << 1 !== 1022) { + throw new Test262Error('#42: 511 << 1 === 1022. Actual: ' + (511 << 1)); +} + + +if (1023 << 1 !== 2046) { + throw new Test262Error('#43: 1023 << 1 === 2046. Actual: ' + (1023 << 1)); +} + + +if (2047 << 1 !== 4094) { + throw new Test262Error('#44: 2047 << 1 === 4094. Actual: ' + (2047 << 1)); +} + + +if (4095 << 1 !== 8190) { + throw new Test262Error('#45: 4095 << 1 === 8190. Actual: ' + (4095 << 1)); +} + + +if (8191 << 1 !== 16382) { + throw new Test262Error('#46: 8191 << 1 === 16382. Actual: ' + (8191 << 1)); +} + + +if (16383 << 1 !== 32766) { + throw new Test262Error('#47: 16383 << 1 === 32766. Actual: ' + (16383 << 1)); +} + + +if (32767 << 1 !== 65534) { + throw new Test262Error('#48: 32767 << 1 === 65534. Actual: ' + (32767 << 1)); +} + + +if (65535 << 1 !== 131070) { + throw new Test262Error('#49: 65535 << 1 === 131070. Actual: ' + (65535 << 1)); +} + + +if (131071 << 1 !== 262142) { + throw new Test262Error('#50: 131071 << 1 === 262142. Actual: ' + (131071 << 1)); +} + + +if (262143 << 1 !== 524286) { + throw new Test262Error('#51: 262143 << 1 === 524286. Actual: ' + (262143 << 1)); +} + + +if (524287 << 1 !== 1048574) { + throw new Test262Error('#52: 524287 << 1 === 1048574. Actual: ' + (524287 << 1)); +} + + +if (1048575 << 1 !== 2097150) { + throw new Test262Error('#53: 1048575 << 1 === 2097150. Actual: ' + (1048575 << 1)); +} + + +if (2097151 << 1 !== 4194302) { + throw new Test262Error('#54: 2097151 << 1 === 4194302. Actual: ' + (2097151 << 1)); +} + + +if (4194303 << 1 !== 8388606) { + throw new Test262Error('#55: 4194303 << 1 === 8388606. Actual: ' + (4194303 << 1)); +} + + +if (8388607 << 1 !== 16777214) { + throw new Test262Error('#56: 8388607 << 1 === 16777214. Actual: ' + (8388607 << 1)); +} + + +if (16777215 << 1 !== 33554430) { + throw new Test262Error('#57: 16777215 << 1 === 33554430. Actual: ' + (16777215 << 1)); +} + + +if (33554431 << 1 !== 67108862) { + throw new Test262Error('#58: 33554431 << 1 === 67108862. Actual: ' + (33554431 << 1)); +} + + +if (67108863 << 1 !== 134217726) { + throw new Test262Error('#59: 67108863 << 1 === 134217726. Actual: ' + (67108863 << 1)); +} + + +if (134217727 << 1 !== 268435454) { + throw new Test262Error('#60: 134217727 << 1 === 268435454. Actual: ' + (134217727 << 1)); +} + + +if (268435455 << 1 !== 536870910) { + throw new Test262Error('#61: 268435455 << 1 === 536870910. Actual: ' + (268435455 << 1)); +} + + +if (536870911 << 1 !== 1073741822) { + throw new Test262Error('#62: 536870911 << 1 === 1073741822. Actual: ' + (536870911 << 1)); +} + + +if (1073741823 << 1 !== 2147483646) { + throw new Test262Error('#63: 1073741823 << 1 === 2147483646. Actual: ' + (1073741823 << 1)); +} + + +if (2147483647 << 1 !== -2) { + throw new Test262Error('#64: 2147483647 << 1 === -2. Actual: ' + (2147483647 << 1)); +} + + +if (0 << 2 !== 0) { + throw new Test262Error('#65: 0 << 2 === 0. Actual: ' + (0 << 2)); +} + + +if (1 << 2 !== 4) { + throw new Test262Error('#66: 1 << 2 === 4. Actual: ' + (1 << 2)); +} + + +if (3 << 2 !== 12) { + throw new Test262Error('#67: 3 << 2 === 12. Actual: ' + (3 << 2)); +} + + +if (7 << 2 !== 28) { + throw new Test262Error('#68: 7 << 2 === 28. Actual: ' + (7 << 2)); +} + + +if (15 << 2 !== 60) { + throw new Test262Error('#69: 15 << 2 === 60. Actual: ' + (15 << 2)); +} + + +if (31 << 2 !== 124) { + throw new Test262Error('#70: 31 << 2 === 124. Actual: ' + (31 << 2)); +} + + +if (63 << 2 !== 252) { + throw new Test262Error('#71: 63 << 2 === 252. Actual: ' + (63 << 2)); +} + + +if (127 << 2 !== 508) { + throw new Test262Error('#72: 127 << 2 === 508. Actual: ' + (127 << 2)); +} + + +if (255 << 2 !== 1020) { + throw new Test262Error('#73: 255 << 2 === 1020. Actual: ' + (255 << 2)); +} + + +if (511 << 2 !== 2044) { + throw new Test262Error('#74: 511 << 2 === 2044. Actual: ' + (511 << 2)); +} + + +if (1023 << 2 !== 4092) { + throw new Test262Error('#75: 1023 << 2 === 4092. Actual: ' + (1023 << 2)); +} + + +if (2047 << 2 !== 8188) { + throw new Test262Error('#76: 2047 << 2 === 8188. Actual: ' + (2047 << 2)); +} + + +if (4095 << 2 !== 16380) { + throw new Test262Error('#77: 4095 << 2 === 16380. Actual: ' + (4095 << 2)); +} + + +if (8191 << 2 !== 32764) { + throw new Test262Error('#78: 8191 << 2 === 32764. Actual: ' + (8191 << 2)); +} + + +if (16383 << 2 !== 65532) { + throw new Test262Error('#79: 16383 << 2 === 65532. Actual: ' + (16383 << 2)); +} + + +if (32767 << 2 !== 131068) { + throw new Test262Error('#80: 32767 << 2 === 131068. Actual: ' + (32767 << 2)); +} + + +if (65535 << 2 !== 262140) { + throw new Test262Error('#81: 65535 << 2 === 262140. Actual: ' + (65535 << 2)); +} + + +if (131071 << 2 !== 524284) { + throw new Test262Error('#82: 131071 << 2 === 524284. Actual: ' + (131071 << 2)); +} + + +if (262143 << 2 !== 1048572) { + throw new Test262Error('#83: 262143 << 2 === 1048572. Actual: ' + (262143 << 2)); +} + + +if (524287 << 2 !== 2097148) { + throw new Test262Error('#84: 524287 << 2 === 2097148. Actual: ' + (524287 << 2)); +} + + +if (1048575 << 2 !== 4194300) { + throw new Test262Error('#85: 1048575 << 2 === 4194300. Actual: ' + (1048575 << 2)); +} + + +if (2097151 << 2 !== 8388604) { + throw new Test262Error('#86: 2097151 << 2 === 8388604. Actual: ' + (2097151 << 2)); +} + + +if (4194303 << 2 !== 16777212) { + throw new Test262Error('#87: 4194303 << 2 === 16777212. Actual: ' + (4194303 << 2)); +} + + +if (8388607 << 2 !== 33554428) { + throw new Test262Error('#88: 8388607 << 2 === 33554428. Actual: ' + (8388607 << 2)); +} + + +if (16777215 << 2 !== 67108860) { + throw new Test262Error('#89: 16777215 << 2 === 67108860. Actual: ' + (16777215 << 2)); +} + + +if (33554431 << 2 !== 134217724) { + throw new Test262Error('#90: 33554431 << 2 === 134217724. Actual: ' + (33554431 << 2)); +} + + +if (67108863 << 2 !== 268435452) { + throw new Test262Error('#91: 67108863 << 2 === 268435452. Actual: ' + (67108863 << 2)); +} + + +if (134217727 << 2 !== 536870908) { + throw new Test262Error('#92: 134217727 << 2 === 536870908. Actual: ' + (134217727 << 2)); +} + + +if (268435455 << 2 !== 1073741820) { + throw new Test262Error('#93: 268435455 << 2 === 1073741820. Actual: ' + (268435455 << 2)); +} + + +if (536870911 << 2 !== 2147483644) { + throw new Test262Error('#94: 536870911 << 2 === 2147483644. Actual: ' + (536870911 << 2)); +} + + +if (1073741823 << 2 !== -4) { + throw new Test262Error('#95: 1073741823 << 2 === -4. Actual: ' + (1073741823 << 2)); +} + + +if (2147483647 << 2 !== -4) { + throw new Test262Error('#96: 2147483647 << 2 === -4. Actual: ' + (2147483647 << 2)); +} + + +if (0 << 3 !== 0) { + throw new Test262Error('#97: 0 << 3 === 0. Actual: ' + (0 << 3)); +} + + +if (1 << 3 !== 8) { + throw new Test262Error('#98: 1 << 3 === 8. Actual: ' + (1 << 3)); +} + + +if (3 << 3 !== 24) { + throw new Test262Error('#99: 3 << 3 === 24. Actual: ' + (3 << 3)); +} + + +if (7 << 3 !== 56) { + throw new Test262Error('#100: 7 << 3 === 56. Actual: ' + (7 << 3)); +} + + +if (15 << 3 !== 120) { + throw new Test262Error('#101: 15 << 3 === 120. Actual: ' + (15 << 3)); +} + + +if (31 << 3 !== 248) { + throw new Test262Error('#102: 31 << 3 === 248. Actual: ' + (31 << 3)); +} + + +if (63 << 3 !== 504) { + throw new Test262Error('#103: 63 << 3 === 504. Actual: ' + (63 << 3)); +} + + +if (127 << 3 !== 1016) { + throw new Test262Error('#104: 127 << 3 === 1016. Actual: ' + (127 << 3)); +} + + +if (255 << 3 !== 2040) { + throw new Test262Error('#105: 255 << 3 === 2040. Actual: ' + (255 << 3)); +} + + +if (511 << 3 !== 4088) { + throw new Test262Error('#106: 511 << 3 === 4088. Actual: ' + (511 << 3)); +} + + +if (1023 << 3 !== 8184) { + throw new Test262Error('#107: 1023 << 3 === 8184. Actual: ' + (1023 << 3)); +} + + +if (2047 << 3 !== 16376) { + throw new Test262Error('#108: 2047 << 3 === 16376. Actual: ' + (2047 << 3)); +} + + +if (4095 << 3 !== 32760) { + throw new Test262Error('#109: 4095 << 3 === 32760. Actual: ' + (4095 << 3)); +} + + +if (8191 << 3 !== 65528) { + throw new Test262Error('#110: 8191 << 3 === 65528. Actual: ' + (8191 << 3)); +} + + +if (16383 << 3 !== 131064) { + throw new Test262Error('#111: 16383 << 3 === 131064. Actual: ' + (16383 << 3)); +} + + +if (32767 << 3 !== 262136) { + throw new Test262Error('#112: 32767 << 3 === 262136. Actual: ' + (32767 << 3)); +} + + +if (65535 << 3 !== 524280) { + throw new Test262Error('#113: 65535 << 3 === 524280. Actual: ' + (65535 << 3)); +} + + +if (131071 << 3 !== 1048568) { + throw new Test262Error('#114: 131071 << 3 === 1048568. Actual: ' + (131071 << 3)); +} + + +if (262143 << 3 !== 2097144) { + throw new Test262Error('#115: 262143 << 3 === 2097144. Actual: ' + (262143 << 3)); +} + + +if (524287 << 3 !== 4194296) { + throw new Test262Error('#116: 524287 << 3 === 4194296. Actual: ' + (524287 << 3)); +} + + +if (1048575 << 3 !== 8388600) { + throw new Test262Error('#117: 1048575 << 3 === 8388600. Actual: ' + (1048575 << 3)); +} + + +if (2097151 << 3 !== 16777208) { + throw new Test262Error('#118: 2097151 << 3 === 16777208. Actual: ' + (2097151 << 3)); +} + + +if (4194303 << 3 !== 33554424) { + throw new Test262Error('#119: 4194303 << 3 === 33554424. Actual: ' + (4194303 << 3)); +} + + +if (8388607 << 3 !== 67108856) { + throw new Test262Error('#120: 8388607 << 3 === 67108856. Actual: ' + (8388607 << 3)); +} + + +if (16777215 << 3 !== 134217720) { + throw new Test262Error('#121: 16777215 << 3 === 134217720. Actual: ' + (16777215 << 3)); +} + + +if (33554431 << 3 !== 268435448) { + throw new Test262Error('#122: 33554431 << 3 === 268435448. Actual: ' + (33554431 << 3)); +} + + +if (67108863 << 3 !== 536870904) { + throw new Test262Error('#123: 67108863 << 3 === 536870904. Actual: ' + (67108863 << 3)); +} + + +if (134217727 << 3 !== 1073741816) { + throw new Test262Error('#124: 134217727 << 3 === 1073741816. Actual: ' + (134217727 << 3)); +} + + +if (268435455 << 3 !== 2147483640) { + throw new Test262Error('#125: 268435455 << 3 === 2147483640. Actual: ' + (268435455 << 3)); +} + + +if (536870911 << 3 !== -8) { + throw new Test262Error('#126: 536870911 << 3 === -8. Actual: ' + (536870911 << 3)); +} + + +if (1073741823 << 3 !== -8) { + throw new Test262Error('#127: 1073741823 << 3 === -8. Actual: ' + (1073741823 << 3)); +} + + +if (2147483647 << 3 !== -8) { + throw new Test262Error('#128: 2147483647 << 3 === -8. Actual: ' + (2147483647 << 3)); +} + + +if (0 << 4 !== 0) { + throw new Test262Error('#129: 0 << 4 === 0. Actual: ' + (0 << 4)); +} + + +if (1 << 4 !== 16) { + throw new Test262Error('#130: 1 << 4 === 16. Actual: ' + (1 << 4)); +} + + +if (3 << 4 !== 48) { + throw new Test262Error('#131: 3 << 4 === 48. Actual: ' + (3 << 4)); +} + + +if (7 << 4 !== 112) { + throw new Test262Error('#132: 7 << 4 === 112. Actual: ' + (7 << 4)); +} + + +if (15 << 4 !== 240) { + throw new Test262Error('#133: 15 << 4 === 240. Actual: ' + (15 << 4)); +} + + +if (31 << 4 !== 496) { + throw new Test262Error('#134: 31 << 4 === 496. Actual: ' + (31 << 4)); +} + + +if (63 << 4 !== 1008) { + throw new Test262Error('#135: 63 << 4 === 1008. Actual: ' + (63 << 4)); +} + + +if (127 << 4 !== 2032) { + throw new Test262Error('#136: 127 << 4 === 2032. Actual: ' + (127 << 4)); +} + + +if (255 << 4 !== 4080) { + throw new Test262Error('#137: 255 << 4 === 4080. Actual: ' + (255 << 4)); +} + + +if (511 << 4 !== 8176) { + throw new Test262Error('#138: 511 << 4 === 8176. Actual: ' + (511 << 4)); +} + + +if (1023 << 4 !== 16368) { + throw new Test262Error('#139: 1023 << 4 === 16368. Actual: ' + (1023 << 4)); +} + + +if (2047 << 4 !== 32752) { + throw new Test262Error('#140: 2047 << 4 === 32752. Actual: ' + (2047 << 4)); +} + + +if (4095 << 4 !== 65520) { + throw new Test262Error('#141: 4095 << 4 === 65520. Actual: ' + (4095 << 4)); +} + + +if (8191 << 4 !== 131056) { + throw new Test262Error('#142: 8191 << 4 === 131056. Actual: ' + (8191 << 4)); +} + + +if (16383 << 4 !== 262128) { + throw new Test262Error('#143: 16383 << 4 === 262128. Actual: ' + (16383 << 4)); +} + + +if (32767 << 4 !== 524272) { + throw new Test262Error('#144: 32767 << 4 === 524272. Actual: ' + (32767 << 4)); +} + + +if (65535 << 4 !== 1048560) { + throw new Test262Error('#145: 65535 << 4 === 1048560. Actual: ' + (65535 << 4)); +} + + +if (131071 << 4 !== 2097136) { + throw new Test262Error('#146: 131071 << 4 === 2097136. Actual: ' + (131071 << 4)); +} + + +if (262143 << 4 !== 4194288) { + throw new Test262Error('#147: 262143 << 4 === 4194288. Actual: ' + (262143 << 4)); +} + + +if (524287 << 4 !== 8388592) { + throw new Test262Error('#148: 524287 << 4 === 8388592. Actual: ' + (524287 << 4)); +} + + +if (1048575 << 4 !== 16777200) { + throw new Test262Error('#149: 1048575 << 4 === 16777200. Actual: ' + (1048575 << 4)); +} + + +if (2097151 << 4 !== 33554416) { + throw new Test262Error('#150: 2097151 << 4 === 33554416. Actual: ' + (2097151 << 4)); +} + + +if (4194303 << 4 !== 67108848) { + throw new Test262Error('#151: 4194303 << 4 === 67108848. Actual: ' + (4194303 << 4)); +} + + +if (8388607 << 4 !== 134217712) { + throw new Test262Error('#152: 8388607 << 4 === 134217712. Actual: ' + (8388607 << 4)); +} + + +if (16777215 << 4 !== 268435440) { + throw new Test262Error('#153: 16777215 << 4 === 268435440. Actual: ' + (16777215 << 4)); +} + + +if (33554431 << 4 !== 536870896) { + throw new Test262Error('#154: 33554431 << 4 === 536870896. Actual: ' + (33554431 << 4)); +} + + +if (67108863 << 4 !== 1073741808) { + throw new Test262Error('#155: 67108863 << 4 === 1073741808. Actual: ' + (67108863 << 4)); +} + + +if (134217727 << 4 !== 2147483632) { + throw new Test262Error('#156: 134217727 << 4 === 2147483632. Actual: ' + (134217727 << 4)); +} + + +if (268435455 << 4 !== -16) { + throw new Test262Error('#157: 268435455 << 4 === -16. Actual: ' + (268435455 << 4)); +} + + +if (536870911 << 4 !== -16) { + throw new Test262Error('#158: 536870911 << 4 === -16. Actual: ' + (536870911 << 4)); +} + + +if (1073741823 << 4 !== -16) { + throw new Test262Error('#159: 1073741823 << 4 === -16. Actual: ' + (1073741823 << 4)); +} + + +if (2147483647 << 4 !== -16) { + throw new Test262Error('#160: 2147483647 << 4 === -16. Actual: ' + (2147483647 << 4)); +} + + +if (0 << 5 !== 0) { + throw new Test262Error('#161: 0 << 5 === 0. Actual: ' + (0 << 5)); +} + + +if (1 << 5 !== 32) { + throw new Test262Error('#162: 1 << 5 === 32. Actual: ' + (1 << 5)); +} + + +if (3 << 5 !== 96) { + throw new Test262Error('#163: 3 << 5 === 96. Actual: ' + (3 << 5)); +} + + +if (7 << 5 !== 224) { + throw new Test262Error('#164: 7 << 5 === 224. Actual: ' + (7 << 5)); +} + + +if (15 << 5 !== 480) { + throw new Test262Error('#165: 15 << 5 === 480. Actual: ' + (15 << 5)); +} + + +if (31 << 5 !== 992) { + throw new Test262Error('#166: 31 << 5 === 992. Actual: ' + (31 << 5)); +} + + +if (63 << 5 !== 2016) { + throw new Test262Error('#167: 63 << 5 === 2016. Actual: ' + (63 << 5)); +} + + +if (127 << 5 !== 4064) { + throw new Test262Error('#168: 127 << 5 === 4064. Actual: ' + (127 << 5)); +} + + +if (255 << 5 !== 8160) { + throw new Test262Error('#169: 255 << 5 === 8160. Actual: ' + (255 << 5)); +} + + +if (511 << 5 !== 16352) { + throw new Test262Error('#170: 511 << 5 === 16352. Actual: ' + (511 << 5)); +} + + +if (1023 << 5 !== 32736) { + throw new Test262Error('#171: 1023 << 5 === 32736. Actual: ' + (1023 << 5)); +} + + +if (2047 << 5 !== 65504) { + throw new Test262Error('#172: 2047 << 5 === 65504. Actual: ' + (2047 << 5)); +} + + +if (4095 << 5 !== 131040) { + throw new Test262Error('#173: 4095 << 5 === 131040. Actual: ' + (4095 << 5)); +} + + +if (8191 << 5 !== 262112) { + throw new Test262Error('#174: 8191 << 5 === 262112. Actual: ' + (8191 << 5)); +} + + +if (16383 << 5 !== 524256) { + throw new Test262Error('#175: 16383 << 5 === 524256. Actual: ' + (16383 << 5)); +} + + +if (32767 << 5 !== 1048544) { + throw new Test262Error('#176: 32767 << 5 === 1048544. Actual: ' + (32767 << 5)); +} + + +if (65535 << 5 !== 2097120) { + throw new Test262Error('#177: 65535 << 5 === 2097120. Actual: ' + (65535 << 5)); +} + + +if (131071 << 5 !== 4194272) { + throw new Test262Error('#178: 131071 << 5 === 4194272. Actual: ' + (131071 << 5)); +} + + +if (262143 << 5 !== 8388576) { + throw new Test262Error('#179: 262143 << 5 === 8388576. Actual: ' + (262143 << 5)); +} + + +if (524287 << 5 !== 16777184) { + throw new Test262Error('#180: 524287 << 5 === 16777184. Actual: ' + (524287 << 5)); +} + + +if (1048575 << 5 !== 33554400) { + throw new Test262Error('#181: 1048575 << 5 === 33554400. Actual: ' + (1048575 << 5)); +} + + +if (2097151 << 5 !== 67108832) { + throw new Test262Error('#182: 2097151 << 5 === 67108832. Actual: ' + (2097151 << 5)); +} + + +if (4194303 << 5 !== 134217696) { + throw new Test262Error('#183: 4194303 << 5 === 134217696. Actual: ' + (4194303 << 5)); +} + + +if (8388607 << 5 !== 268435424) { + throw new Test262Error('#184: 8388607 << 5 === 268435424. Actual: ' + (8388607 << 5)); +} + + +if (16777215 << 5 !== 536870880) { + throw new Test262Error('#185: 16777215 << 5 === 536870880. Actual: ' + (16777215 << 5)); +} + + +if (33554431 << 5 !== 1073741792) { + throw new Test262Error('#186: 33554431 << 5 === 1073741792. Actual: ' + (33554431 << 5)); +} + + +if (67108863 << 5 !== 2147483616) { + throw new Test262Error('#187: 67108863 << 5 === 2147483616. Actual: ' + (67108863 << 5)); +} + + +if (134217727 << 5 !== -32) { + throw new Test262Error('#188: 134217727 << 5 === -32. Actual: ' + (134217727 << 5)); +} + + +if (268435455 << 5 !== -32) { + throw new Test262Error('#189: 268435455 << 5 === -32. Actual: ' + (268435455 << 5)); +} + + +if (536870911 << 5 !== -32) { + throw new Test262Error('#190: 536870911 << 5 === -32. Actual: ' + (536870911 << 5)); +} + + +if (1073741823 << 5 !== -32) { + throw new Test262Error('#191: 1073741823 << 5 === -32. Actual: ' + (1073741823 << 5)); +} + + +if (2147483647 << 5 !== -32) { + throw new Test262Error('#192: 2147483647 << 5 === -32. Actual: ' + (2147483647 << 5)); +} + + +if (0 << 6 !== 0) { + throw new Test262Error('#193: 0 << 6 === 0. Actual: ' + (0 << 6)); +} + + +if (1 << 6 !== 64) { + throw new Test262Error('#194: 1 << 6 === 64. Actual: ' + (1 << 6)); +} + + +if (3 << 6 !== 192) { + throw new Test262Error('#195: 3 << 6 === 192. Actual: ' + (3 << 6)); +} + + +if (7 << 6 !== 448) { + throw new Test262Error('#196: 7 << 6 === 448. Actual: ' + (7 << 6)); +} + + +if (15 << 6 !== 960) { + throw new Test262Error('#197: 15 << 6 === 960. Actual: ' + (15 << 6)); +} + + +if (31 << 6 !== 1984) { + throw new Test262Error('#198: 31 << 6 === 1984. Actual: ' + (31 << 6)); +} + + +if (63 << 6 !== 4032) { + throw new Test262Error('#199: 63 << 6 === 4032. Actual: ' + (63 << 6)); +} + + +if (127 << 6 !== 8128) { + throw new Test262Error('#200: 127 << 6 === 8128. Actual: ' + (127 << 6)); +} + + +if (255 << 6 !== 16320) { + throw new Test262Error('#201: 255 << 6 === 16320. Actual: ' + (255 << 6)); +} + + +if (511 << 6 !== 32704) { + throw new Test262Error('#202: 511 << 6 === 32704. Actual: ' + (511 << 6)); +} + + +if (1023 << 6 !== 65472) { + throw new Test262Error('#203: 1023 << 6 === 65472. Actual: ' + (1023 << 6)); +} + + +if (2047 << 6 !== 131008) { + throw new Test262Error('#204: 2047 << 6 === 131008. Actual: ' + (2047 << 6)); +} + + +if (4095 << 6 !== 262080) { + throw new Test262Error('#205: 4095 << 6 === 262080. Actual: ' + (4095 << 6)); +} + + +if (8191 << 6 !== 524224) { + throw new Test262Error('#206: 8191 << 6 === 524224. Actual: ' + (8191 << 6)); +} + + +if (16383 << 6 !== 1048512) { + throw new Test262Error('#207: 16383 << 6 === 1048512. Actual: ' + (16383 << 6)); +} + + +if (32767 << 6 !== 2097088) { + throw new Test262Error('#208: 32767 << 6 === 2097088. Actual: ' + (32767 << 6)); +} + + +if (65535 << 6 !== 4194240) { + throw new Test262Error('#209: 65535 << 6 === 4194240. Actual: ' + (65535 << 6)); +} + + +if (131071 << 6 !== 8388544) { + throw new Test262Error('#210: 131071 << 6 === 8388544. Actual: ' + (131071 << 6)); +} + + +if (262143 << 6 !== 16777152) { + throw new Test262Error('#211: 262143 << 6 === 16777152. Actual: ' + (262143 << 6)); +} + + +if (524287 << 6 !== 33554368) { + throw new Test262Error('#212: 524287 << 6 === 33554368. Actual: ' + (524287 << 6)); +} + + +if (1048575 << 6 !== 67108800) { + throw new Test262Error('#213: 1048575 << 6 === 67108800. Actual: ' + (1048575 << 6)); +} + + +if (2097151 << 6 !== 134217664) { + throw new Test262Error('#214: 2097151 << 6 === 134217664. Actual: ' + (2097151 << 6)); +} + + +if (4194303 << 6 !== 268435392) { + throw new Test262Error('#215: 4194303 << 6 === 268435392. Actual: ' + (4194303 << 6)); +} + + +if (8388607 << 6 !== 536870848) { + throw new Test262Error('#216: 8388607 << 6 === 536870848. Actual: ' + (8388607 << 6)); +} + + +if (16777215 << 6 !== 1073741760) { + throw new Test262Error('#217: 16777215 << 6 === 1073741760. Actual: ' + (16777215 << 6)); +} + + +if (33554431 << 6 !== 2147483584) { + throw new Test262Error('#218: 33554431 << 6 === 2147483584. Actual: ' + (33554431 << 6)); +} + + +if (67108863 << 6 !== -64) { + throw new Test262Error('#219: 67108863 << 6 === -64. Actual: ' + (67108863 << 6)); +} + + +if (134217727 << 6 !== -64) { + throw new Test262Error('#220: 134217727 << 6 === -64. Actual: ' + (134217727 << 6)); +} + + +if (268435455 << 6 !== -64) { + throw new Test262Error('#221: 268435455 << 6 === -64. Actual: ' + (268435455 << 6)); +} + + +if (536870911 << 6 !== -64) { + throw new Test262Error('#222: 536870911 << 6 === -64. Actual: ' + (536870911 << 6)); +} + + +if (1073741823 << 6 !== -64) { + throw new Test262Error('#223: 1073741823 << 6 === -64. Actual: ' + (1073741823 << 6)); +} + + +if (2147483647 << 6 !== -64) { + throw new Test262Error('#224: 2147483647 << 6 === -64. Actual: ' + (2147483647 << 6)); +} + + +if (0 << 7 !== 0) { + throw new Test262Error('#225: 0 << 7 === 0. Actual: ' + (0 << 7)); +} + + +if (1 << 7 !== 128) { + throw new Test262Error('#226: 1 << 7 === 128. Actual: ' + (1 << 7)); +} + + +if (3 << 7 !== 384) { + throw new Test262Error('#227: 3 << 7 === 384. Actual: ' + (3 << 7)); +} + + +if (7 << 7 !== 896) { + throw new Test262Error('#228: 7 << 7 === 896. Actual: ' + (7 << 7)); +} + + +if (15 << 7 !== 1920) { + throw new Test262Error('#229: 15 << 7 === 1920. Actual: ' + (15 << 7)); +} + + +if (31 << 7 !== 3968) { + throw new Test262Error('#230: 31 << 7 === 3968. Actual: ' + (31 << 7)); +} + + +if (63 << 7 !== 8064) { + throw new Test262Error('#231: 63 << 7 === 8064. Actual: ' + (63 << 7)); +} + + +if (127 << 7 !== 16256) { + throw new Test262Error('#232: 127 << 7 === 16256. Actual: ' + (127 << 7)); +} + + +if (255 << 7 !== 32640) { + throw new Test262Error('#233: 255 << 7 === 32640. Actual: ' + (255 << 7)); +} + + +if (511 << 7 !== 65408) { + throw new Test262Error('#234: 511 << 7 === 65408. Actual: ' + (511 << 7)); +} + + +if (1023 << 7 !== 130944) { + throw new Test262Error('#235: 1023 << 7 === 130944. Actual: ' + (1023 << 7)); +} + + +if (2047 << 7 !== 262016) { + throw new Test262Error('#236: 2047 << 7 === 262016. Actual: ' + (2047 << 7)); +} + + +if (4095 << 7 !== 524160) { + throw new Test262Error('#237: 4095 << 7 === 524160. Actual: ' + (4095 << 7)); +} + + +if (8191 << 7 !== 1048448) { + throw new Test262Error('#238: 8191 << 7 === 1048448. Actual: ' + (8191 << 7)); +} + + +if (16383 << 7 !== 2097024) { + throw new Test262Error('#239: 16383 << 7 === 2097024. Actual: ' + (16383 << 7)); +} + + +if (32767 << 7 !== 4194176) { + throw new Test262Error('#240: 32767 << 7 === 4194176. Actual: ' + (32767 << 7)); +} + + +if (65535 << 7 !== 8388480) { + throw new Test262Error('#241: 65535 << 7 === 8388480. Actual: ' + (65535 << 7)); +} + + +if (131071 << 7 !== 16777088) { + throw new Test262Error('#242: 131071 << 7 === 16777088. Actual: ' + (131071 << 7)); +} + + +if (262143 << 7 !== 33554304) { + throw new Test262Error('#243: 262143 << 7 === 33554304. Actual: ' + (262143 << 7)); +} + + +if (524287 << 7 !== 67108736) { + throw new Test262Error('#244: 524287 << 7 === 67108736. Actual: ' + (524287 << 7)); +} + + +if (1048575 << 7 !== 134217600) { + throw new Test262Error('#245: 1048575 << 7 === 134217600. Actual: ' + (1048575 << 7)); +} + + +if (2097151 << 7 !== 268435328) { + throw new Test262Error('#246: 2097151 << 7 === 268435328. Actual: ' + (2097151 << 7)); +} + + +if (4194303 << 7 !== 536870784) { + throw new Test262Error('#247: 4194303 << 7 === 536870784. Actual: ' + (4194303 << 7)); +} + + +if (8388607 << 7 !== 1073741696) { + throw new Test262Error('#248: 8388607 << 7 === 1073741696. Actual: ' + (8388607 << 7)); +} + + +if (16777215 << 7 !== 2147483520) { + throw new Test262Error('#249: 16777215 << 7 === 2147483520. Actual: ' + (16777215 << 7)); +} + + +if (33554431 << 7 !== -128) { + throw new Test262Error('#250: 33554431 << 7 === -128. Actual: ' + (33554431 << 7)); +} + + +if (67108863 << 7 !== -128) { + throw new Test262Error('#251: 67108863 << 7 === -128. Actual: ' + (67108863 << 7)); +} + + +if (134217727 << 7 !== -128) { + throw new Test262Error('#252: 134217727 << 7 === -128. Actual: ' + (134217727 << 7)); +} + + +if (268435455 << 7 !== -128) { + throw new Test262Error('#253: 268435455 << 7 === -128. Actual: ' + (268435455 << 7)); +} + + +if (536870911 << 7 !== -128) { + throw new Test262Error('#254: 536870911 << 7 === -128. Actual: ' + (536870911 << 7)); +} + + +if (1073741823 << 7 !== -128) { + throw new Test262Error('#255: 1073741823 << 7 === -128. Actual: ' + (1073741823 << 7)); +} + + +if (2147483647 << 7 !== -128) { + throw new Test262Error('#256: 2147483647 << 7 === -128. Actual: ' + (2147483647 << 7)); +} + + +if (0 << 8 !== 0) { + throw new Test262Error('#257: 0 << 8 === 0. Actual: ' + (0 << 8)); +} + + +if (1 << 8 !== 256) { + throw new Test262Error('#258: 1 << 8 === 256. Actual: ' + (1 << 8)); +} + + +if (3 << 8 !== 768) { + throw new Test262Error('#259: 3 << 8 === 768. Actual: ' + (3 << 8)); +} + + +if (7 << 8 !== 1792) { + throw new Test262Error('#260: 7 << 8 === 1792. Actual: ' + (7 << 8)); +} + + +if (15 << 8 !== 3840) { + throw new Test262Error('#261: 15 << 8 === 3840. Actual: ' + (15 << 8)); +} + + +if (31 << 8 !== 7936) { + throw new Test262Error('#262: 31 << 8 === 7936. Actual: ' + (31 << 8)); +} + + +if (63 << 8 !== 16128) { + throw new Test262Error('#263: 63 << 8 === 16128. Actual: ' + (63 << 8)); +} + + +if (127 << 8 !== 32512) { + throw new Test262Error('#264: 127 << 8 === 32512. Actual: ' + (127 << 8)); +} + + +if (255 << 8 !== 65280) { + throw new Test262Error('#265: 255 << 8 === 65280. Actual: ' + (255 << 8)); +} + + +if (511 << 8 !== 130816) { + throw new Test262Error('#266: 511 << 8 === 130816. Actual: ' + (511 << 8)); +} + + +if (1023 << 8 !== 261888) { + throw new Test262Error('#267: 1023 << 8 === 261888. Actual: ' + (1023 << 8)); +} + + +if (2047 << 8 !== 524032) { + throw new Test262Error('#268: 2047 << 8 === 524032. Actual: ' + (2047 << 8)); +} + + +if (4095 << 8 !== 1048320) { + throw new Test262Error('#269: 4095 << 8 === 1048320. Actual: ' + (4095 << 8)); +} + + +if (8191 << 8 !== 2096896) { + throw new Test262Error('#270: 8191 << 8 === 2096896. Actual: ' + (8191 << 8)); +} + + +if (16383 << 8 !== 4194048) { + throw new Test262Error('#271: 16383 << 8 === 4194048. Actual: ' + (16383 << 8)); +} + + +if (32767 << 8 !== 8388352) { + throw new Test262Error('#272: 32767 << 8 === 8388352. Actual: ' + (32767 << 8)); +} + + +if (65535 << 8 !== 16776960) { + throw new Test262Error('#273: 65535 << 8 === 16776960. Actual: ' + (65535 << 8)); +} + + +if (131071 << 8 !== 33554176) { + throw new Test262Error('#274: 131071 << 8 === 33554176. Actual: ' + (131071 << 8)); +} + + +if (262143 << 8 !== 67108608) { + throw new Test262Error('#275: 262143 << 8 === 67108608. Actual: ' + (262143 << 8)); +} + + +if (524287 << 8 !== 134217472) { + throw new Test262Error('#276: 524287 << 8 === 134217472. Actual: ' + (524287 << 8)); +} + + +if (1048575 << 8 !== 268435200) { + throw new Test262Error('#277: 1048575 << 8 === 268435200. Actual: ' + (1048575 << 8)); +} + + +if (2097151 << 8 !== 536870656) { + throw new Test262Error('#278: 2097151 << 8 === 536870656. Actual: ' + (2097151 << 8)); +} + + +if (4194303 << 8 !== 1073741568) { + throw new Test262Error('#279: 4194303 << 8 === 1073741568. Actual: ' + (4194303 << 8)); +} + + +if (8388607 << 8 !== 2147483392) { + throw new Test262Error('#280: 8388607 << 8 === 2147483392. Actual: ' + (8388607 << 8)); +} + + +if (16777215 << 8 !== -256) { + throw new Test262Error('#281: 16777215 << 8 === -256. Actual: ' + (16777215 << 8)); +} + + +if (33554431 << 8 !== -256) { + throw new Test262Error('#282: 33554431 << 8 === -256. Actual: ' + (33554431 << 8)); +} + + +if (67108863 << 8 !== -256) { + throw new Test262Error('#283: 67108863 << 8 === -256. Actual: ' + (67108863 << 8)); +} + + +if (134217727 << 8 !== -256) { + throw new Test262Error('#284: 134217727 << 8 === -256. Actual: ' + (134217727 << 8)); +} + + +if (268435455 << 8 !== -256) { + throw new Test262Error('#285: 268435455 << 8 === -256. Actual: ' + (268435455 << 8)); +} + + +if (536870911 << 8 !== -256) { + throw new Test262Error('#286: 536870911 << 8 === -256. Actual: ' + (536870911 << 8)); +} + + +if (1073741823 << 8 !== -256) { + throw new Test262Error('#287: 1073741823 << 8 === -256. Actual: ' + (1073741823 << 8)); +} + + +if (2147483647 << 8 !== -256) { + throw new Test262Error('#288: 2147483647 << 8 === -256. Actual: ' + (2147483647 << 8)); +} + + +if (0 << 9 !== 0) { + throw new Test262Error('#289: 0 << 9 === 0. Actual: ' + (0 << 9)); +} + + +if (1 << 9 !== 512) { + throw new Test262Error('#290: 1 << 9 === 512. Actual: ' + (1 << 9)); +} + + +if (3 << 9 !== 1536) { + throw new Test262Error('#291: 3 << 9 === 1536. Actual: ' + (3 << 9)); +} + + +if (7 << 9 !== 3584) { + throw new Test262Error('#292: 7 << 9 === 3584. Actual: ' + (7 << 9)); +} + + +if (15 << 9 !== 7680) { + throw new Test262Error('#293: 15 << 9 === 7680. Actual: ' + (15 << 9)); +} + + +if (31 << 9 !== 15872) { + throw new Test262Error('#294: 31 << 9 === 15872. Actual: ' + (31 << 9)); +} + + +if (63 << 9 !== 32256) { + throw new Test262Error('#295: 63 << 9 === 32256. Actual: ' + (63 << 9)); +} + + +if (127 << 9 !== 65024) { + throw new Test262Error('#296: 127 << 9 === 65024. Actual: ' + (127 << 9)); +} + + +if (255 << 9 !== 130560) { + throw new Test262Error('#297: 255 << 9 === 130560. Actual: ' + (255 << 9)); +} + + +if (511 << 9 !== 261632) { + throw new Test262Error('#298: 511 << 9 === 261632. Actual: ' + (511 << 9)); +} + + +if (1023 << 9 !== 523776) { + throw new Test262Error('#299: 1023 << 9 === 523776. Actual: ' + (1023 << 9)); +} + + +if (2047 << 9 !== 1048064) { + throw new Test262Error('#300: 2047 << 9 === 1048064. Actual: ' + (2047 << 9)); +} + + +if (4095 << 9 !== 2096640) { + throw new Test262Error('#301: 4095 << 9 === 2096640. Actual: ' + (4095 << 9)); +} + + +if (8191 << 9 !== 4193792) { + throw new Test262Error('#302: 8191 << 9 === 4193792. Actual: ' + (8191 << 9)); +} + + +if (16383 << 9 !== 8388096) { + throw new Test262Error('#303: 16383 << 9 === 8388096. Actual: ' + (16383 << 9)); +} + + +if (32767 << 9 !== 16776704) { + throw new Test262Error('#304: 32767 << 9 === 16776704. Actual: ' + (32767 << 9)); +} + + +if (65535 << 9 !== 33553920) { + throw new Test262Error('#305: 65535 << 9 === 33553920. Actual: ' + (65535 << 9)); +} + + +if (131071 << 9 !== 67108352) { + throw new Test262Error('#306: 131071 << 9 === 67108352. Actual: ' + (131071 << 9)); +} + + +if (262143 << 9 !== 134217216) { + throw new Test262Error('#307: 262143 << 9 === 134217216. Actual: ' + (262143 << 9)); +} + + +if (524287 << 9 !== 268434944) { + throw new Test262Error('#308: 524287 << 9 === 268434944. Actual: ' + (524287 << 9)); +} + + +if (1048575 << 9 !== 536870400) { + throw new Test262Error('#309: 1048575 << 9 === 536870400. Actual: ' + (1048575 << 9)); +} + + +if (2097151 << 9 !== 1073741312) { + throw new Test262Error('#310: 2097151 << 9 === 1073741312. Actual: ' + (2097151 << 9)); +} + + +if (4194303 << 9 !== 2147483136) { + throw new Test262Error('#311: 4194303 << 9 === 2147483136. Actual: ' + (4194303 << 9)); +} + + +if (8388607 << 9 !== -512) { + throw new Test262Error('#312: 8388607 << 9 === -512. Actual: ' + (8388607 << 9)); +} + + +if (16777215 << 9 !== -512) { + throw new Test262Error('#313: 16777215 << 9 === -512. Actual: ' + (16777215 << 9)); +} + + +if (33554431 << 9 !== -512) { + throw new Test262Error('#314: 33554431 << 9 === -512. Actual: ' + (33554431 << 9)); +} + + +if (67108863 << 9 !== -512) { + throw new Test262Error('#315: 67108863 << 9 === -512. Actual: ' + (67108863 << 9)); +} + + +if (134217727 << 9 !== -512) { + throw new Test262Error('#316: 134217727 << 9 === -512. Actual: ' + (134217727 << 9)); +} + + +if (268435455 << 9 !== -512) { + throw new Test262Error('#317: 268435455 << 9 === -512. Actual: ' + (268435455 << 9)); +} + + +if (536870911 << 9 !== -512) { + throw new Test262Error('#318: 536870911 << 9 === -512. Actual: ' + (536870911 << 9)); +} + + +if (1073741823 << 9 !== -512) { + throw new Test262Error('#319: 1073741823 << 9 === -512. Actual: ' + (1073741823 << 9)); +} + + +if (2147483647 << 9 !== -512) { + throw new Test262Error('#320: 2147483647 << 9 === -512. Actual: ' + (2147483647 << 9)); +} + + +if (0 << 10 !== 0) { + throw new Test262Error('#321: 0 << 10 === 0. Actual: ' + (0 << 10)); +} + + +if (1 << 10 !== 1024) { + throw new Test262Error('#322: 1 << 10 === 1024. Actual: ' + (1 << 10)); +} + + +if (3 << 10 !== 3072) { + throw new Test262Error('#323: 3 << 10 === 3072. Actual: ' + (3 << 10)); +} + + +if (7 << 10 !== 7168) { + throw new Test262Error('#324: 7 << 10 === 7168. Actual: ' + (7 << 10)); +} + + +if (15 << 10 !== 15360) { + throw new Test262Error('#325: 15 << 10 === 15360. Actual: ' + (15 << 10)); +} + + +if (31 << 10 !== 31744) { + throw new Test262Error('#326: 31 << 10 === 31744. Actual: ' + (31 << 10)); +} + + +if (63 << 10 !== 64512) { + throw new Test262Error('#327: 63 << 10 === 64512. Actual: ' + (63 << 10)); +} + + +if (127 << 10 !== 130048) { + throw new Test262Error('#328: 127 << 10 === 130048. Actual: ' + (127 << 10)); +} + + +if (255 << 10 !== 261120) { + throw new Test262Error('#329: 255 << 10 === 261120. Actual: ' + (255 << 10)); +} + + +if (511 << 10 !== 523264) { + throw new Test262Error('#330: 511 << 10 === 523264. Actual: ' + (511 << 10)); +} + + +if (1023 << 10 !== 1047552) { + throw new Test262Error('#331: 1023 << 10 === 1047552. Actual: ' + (1023 << 10)); +} + + +if (2047 << 10 !== 2096128) { + throw new Test262Error('#332: 2047 << 10 === 2096128. Actual: ' + (2047 << 10)); +} + + +if (4095 << 10 !== 4193280) { + throw new Test262Error('#333: 4095 << 10 === 4193280. Actual: ' + (4095 << 10)); +} + + +if (8191 << 10 !== 8387584) { + throw new Test262Error('#334: 8191 << 10 === 8387584. Actual: ' + (8191 << 10)); +} + + +if (16383 << 10 !== 16776192) { + throw new Test262Error('#335: 16383 << 10 === 16776192. Actual: ' + (16383 << 10)); +} + + +if (32767 << 10 !== 33553408) { + throw new Test262Error('#336: 32767 << 10 === 33553408. Actual: ' + (32767 << 10)); +} + + +if (65535 << 10 !== 67107840) { + throw new Test262Error('#337: 65535 << 10 === 67107840. Actual: ' + (65535 << 10)); +} + + +if (131071 << 10 !== 134216704) { + throw new Test262Error('#338: 131071 << 10 === 134216704. Actual: ' + (131071 << 10)); +} + + +if (262143 << 10 !== 268434432) { + throw new Test262Error('#339: 262143 << 10 === 268434432. Actual: ' + (262143 << 10)); +} + + +if (524287 << 10 !== 536869888) { + throw new Test262Error('#340: 524287 << 10 === 536869888. Actual: ' + (524287 << 10)); +} + + +if (1048575 << 10 !== 1073740800) { + throw new Test262Error('#341: 1048575 << 10 === 1073740800. Actual: ' + (1048575 << 10)); +} + + +if (2097151 << 10 !== 2147482624) { + throw new Test262Error('#342: 2097151 << 10 === 2147482624. Actual: ' + (2097151 << 10)); +} + + +if (4194303 << 10 !== -1024) { + throw new Test262Error('#343: 4194303 << 10 === -1024. Actual: ' + (4194303 << 10)); +} + + +if (8388607 << 10 !== -1024) { + throw new Test262Error('#344: 8388607 << 10 === -1024. Actual: ' + (8388607 << 10)); +} + + +if (16777215 << 10 !== -1024) { + throw new Test262Error('#345: 16777215 << 10 === -1024. Actual: ' + (16777215 << 10)); +} + + +if (33554431 << 10 !== -1024) { + throw new Test262Error('#346: 33554431 << 10 === -1024. Actual: ' + (33554431 << 10)); +} + + +if (67108863 << 10 !== -1024) { + throw new Test262Error('#347: 67108863 << 10 === -1024. Actual: ' + (67108863 << 10)); +} + + +if (134217727 << 10 !== -1024) { + throw new Test262Error('#348: 134217727 << 10 === -1024. Actual: ' + (134217727 << 10)); +} + + +if (268435455 << 10 !== -1024) { + throw new Test262Error('#349: 268435455 << 10 === -1024. Actual: ' + (268435455 << 10)); +} + + +if (536870911 << 10 !== -1024) { + throw new Test262Error('#350: 536870911 << 10 === -1024. Actual: ' + (536870911 << 10)); +} + + +if (1073741823 << 10 !== -1024) { + throw new Test262Error('#351: 1073741823 << 10 === -1024. Actual: ' + (1073741823 << 10)); +} + + +if (2147483647 << 10 !== -1024) { + throw new Test262Error('#352: 2147483647 << 10 === -1024. Actual: ' + (2147483647 << 10)); +} + + +if (0 << 11 !== 0) { + throw new Test262Error('#353: 0 << 11 === 0. Actual: ' + (0 << 11)); +} + + +if (1 << 11 !== 2048) { + throw new Test262Error('#354: 1 << 11 === 2048. Actual: ' + (1 << 11)); +} + + +if (3 << 11 !== 6144) { + throw new Test262Error('#355: 3 << 11 === 6144. Actual: ' + (3 << 11)); +} + + +if (7 << 11 !== 14336) { + throw new Test262Error('#356: 7 << 11 === 14336. Actual: ' + (7 << 11)); +} + + +if (15 << 11 !== 30720) { + throw new Test262Error('#357: 15 << 11 === 30720. Actual: ' + (15 << 11)); +} + + +if (31 << 11 !== 63488) { + throw new Test262Error('#358: 31 << 11 === 63488. Actual: ' + (31 << 11)); +} + + +if (63 << 11 !== 129024) { + throw new Test262Error('#359: 63 << 11 === 129024. Actual: ' + (63 << 11)); +} + + +if (127 << 11 !== 260096) { + throw new Test262Error('#360: 127 << 11 === 260096. Actual: ' + (127 << 11)); +} + + +if (255 << 11 !== 522240) { + throw new Test262Error('#361: 255 << 11 === 522240. Actual: ' + (255 << 11)); +} + + +if (511 << 11 !== 1046528) { + throw new Test262Error('#362: 511 << 11 === 1046528. Actual: ' + (511 << 11)); +} + + +if (1023 << 11 !== 2095104) { + throw new Test262Error('#363: 1023 << 11 === 2095104. Actual: ' + (1023 << 11)); +} + + +if (2047 << 11 !== 4192256) { + throw new Test262Error('#364: 2047 << 11 === 4192256. Actual: ' + (2047 << 11)); +} + + +if (4095 << 11 !== 8386560) { + throw new Test262Error('#365: 4095 << 11 === 8386560. Actual: ' + (4095 << 11)); +} + + +if (8191 << 11 !== 16775168) { + throw new Test262Error('#366: 8191 << 11 === 16775168. Actual: ' + (8191 << 11)); +} + + +if (16383 << 11 !== 33552384) { + throw new Test262Error('#367: 16383 << 11 === 33552384. Actual: ' + (16383 << 11)); +} + + +if (32767 << 11 !== 67106816) { + throw new Test262Error('#368: 32767 << 11 === 67106816. Actual: ' + (32767 << 11)); +} + + +if (65535 << 11 !== 134215680) { + throw new Test262Error('#369: 65535 << 11 === 134215680. Actual: ' + (65535 << 11)); +} + + +if (131071 << 11 !== 268433408) { + throw new Test262Error('#370: 131071 << 11 === 268433408. Actual: ' + (131071 << 11)); +} + + +if (262143 << 11 !== 536868864) { + throw new Test262Error('#371: 262143 << 11 === 536868864. Actual: ' + (262143 << 11)); +} + + +if (524287 << 11 !== 1073739776) { + throw new Test262Error('#372: 524287 << 11 === 1073739776. Actual: ' + (524287 << 11)); +} + + +if (1048575 << 11 !== 2147481600) { + throw new Test262Error('#373: 1048575 << 11 === 2147481600. Actual: ' + (1048575 << 11)); +} + + +if (2097151 << 11 !== -2048) { + throw new Test262Error('#374: 2097151 << 11 === -2048. Actual: ' + (2097151 << 11)); +} + + +if (4194303 << 11 !== -2048) { + throw new Test262Error('#375: 4194303 << 11 === -2048. Actual: ' + (4194303 << 11)); +} + + +if (8388607 << 11 !== -2048) { + throw new Test262Error('#376: 8388607 << 11 === -2048. Actual: ' + (8388607 << 11)); +} + + +if (16777215 << 11 !== -2048) { + throw new Test262Error('#377: 16777215 << 11 === -2048. Actual: ' + (16777215 << 11)); +} + + +if (33554431 << 11 !== -2048) { + throw new Test262Error('#378: 33554431 << 11 === -2048. Actual: ' + (33554431 << 11)); +} + + +if (67108863 << 11 !== -2048) { + throw new Test262Error('#379: 67108863 << 11 === -2048. Actual: ' + (67108863 << 11)); +} + + +if (134217727 << 11 !== -2048) { + throw new Test262Error('#380: 134217727 << 11 === -2048. Actual: ' + (134217727 << 11)); +} + + +if (268435455 << 11 !== -2048) { + throw new Test262Error('#381: 268435455 << 11 === -2048. Actual: ' + (268435455 << 11)); +} + + +if (536870911 << 11 !== -2048) { + throw new Test262Error('#382: 536870911 << 11 === -2048. Actual: ' + (536870911 << 11)); +} + + +if (1073741823 << 11 !== -2048) { + throw new Test262Error('#383: 1073741823 << 11 === -2048. Actual: ' + (1073741823 << 11)); +} + + +if (2147483647 << 11 !== -2048) { + throw new Test262Error('#384: 2147483647 << 11 === -2048. Actual: ' + (2147483647 << 11)); +} + + +if (0 << 12 !== 0) { + throw new Test262Error('#385: 0 << 12 === 0. Actual: ' + (0 << 12)); +} + + +if (1 << 12 !== 4096) { + throw new Test262Error('#386: 1 << 12 === 4096. Actual: ' + (1 << 12)); +} + + +if (3 << 12 !== 12288) { + throw new Test262Error('#387: 3 << 12 === 12288. Actual: ' + (3 << 12)); +} + + +if (7 << 12 !== 28672) { + throw new Test262Error('#388: 7 << 12 === 28672. Actual: ' + (7 << 12)); +} + + +if (15 << 12 !== 61440) { + throw new Test262Error('#389: 15 << 12 === 61440. Actual: ' + (15 << 12)); +} + + +if (31 << 12 !== 126976) { + throw new Test262Error('#390: 31 << 12 === 126976. Actual: ' + (31 << 12)); +} + + +if (63 << 12 !== 258048) { + throw new Test262Error('#391: 63 << 12 === 258048. Actual: ' + (63 << 12)); +} + + +if (127 << 12 !== 520192) { + throw new Test262Error('#392: 127 << 12 === 520192. Actual: ' + (127 << 12)); +} + + +if (255 << 12 !== 1044480) { + throw new Test262Error('#393: 255 << 12 === 1044480. Actual: ' + (255 << 12)); +} + + +if (511 << 12 !== 2093056) { + throw new Test262Error('#394: 511 << 12 === 2093056. Actual: ' + (511 << 12)); +} + + +if (1023 << 12 !== 4190208) { + throw new Test262Error('#395: 1023 << 12 === 4190208. Actual: ' + (1023 << 12)); +} + + +if (2047 << 12 !== 8384512) { + throw new Test262Error('#396: 2047 << 12 === 8384512. Actual: ' + (2047 << 12)); +} + + +if (4095 << 12 !== 16773120) { + throw new Test262Error('#397: 4095 << 12 === 16773120. Actual: ' + (4095 << 12)); +} + + +if (8191 << 12 !== 33550336) { + throw new Test262Error('#398: 8191 << 12 === 33550336. Actual: ' + (8191 << 12)); +} + + +if (16383 << 12 !== 67104768) { + throw new Test262Error('#399: 16383 << 12 === 67104768. Actual: ' + (16383 << 12)); +} + + +if (32767 << 12 !== 134213632) { + throw new Test262Error('#400: 32767 << 12 === 134213632. Actual: ' + (32767 << 12)); +} + + +if (65535 << 12 !== 268431360) { + throw new Test262Error('#401: 65535 << 12 === 268431360. Actual: ' + (65535 << 12)); +} + + +if (131071 << 12 !== 536866816) { + throw new Test262Error('#402: 131071 << 12 === 536866816. Actual: ' + (131071 << 12)); +} + + +if (262143 << 12 !== 1073737728) { + throw new Test262Error('#403: 262143 << 12 === 1073737728. Actual: ' + (262143 << 12)); +} + + +if (524287 << 12 !== 2147479552) { + throw new Test262Error('#404: 524287 << 12 === 2147479552. Actual: ' + (524287 << 12)); +} + + +if (1048575 << 12 !== -4096) { + throw new Test262Error('#405: 1048575 << 12 === -4096. Actual: ' + (1048575 << 12)); +} + + +if (2097151 << 12 !== -4096) { + throw new Test262Error('#406: 2097151 << 12 === -4096. Actual: ' + (2097151 << 12)); +} + + +if (4194303 << 12 !== -4096) { + throw new Test262Error('#407: 4194303 << 12 === -4096. Actual: ' + (4194303 << 12)); +} + + +if (8388607 << 12 !== -4096) { + throw new Test262Error('#408: 8388607 << 12 === -4096. Actual: ' + (8388607 << 12)); +} + + +if (16777215 << 12 !== -4096) { + throw new Test262Error('#409: 16777215 << 12 === -4096. Actual: ' + (16777215 << 12)); +} + + +if (33554431 << 12 !== -4096) { + throw new Test262Error('#410: 33554431 << 12 === -4096. Actual: ' + (33554431 << 12)); +} + + +if (67108863 << 12 !== -4096) { + throw new Test262Error('#411: 67108863 << 12 === -4096. Actual: ' + (67108863 << 12)); +} + + +if (134217727 << 12 !== -4096) { + throw new Test262Error('#412: 134217727 << 12 === -4096. Actual: ' + (134217727 << 12)); +} + + +if (268435455 << 12 !== -4096) { + throw new Test262Error('#413: 268435455 << 12 === -4096. Actual: ' + (268435455 << 12)); +} + + +if (536870911 << 12 !== -4096) { + throw new Test262Error('#414: 536870911 << 12 === -4096. Actual: ' + (536870911 << 12)); +} + + +if (1073741823 << 12 !== -4096) { + throw new Test262Error('#415: 1073741823 << 12 === -4096. Actual: ' + (1073741823 << 12)); +} + + +if (2147483647 << 12 !== -4096) { + throw new Test262Error('#416: 2147483647 << 12 === -4096. Actual: ' + (2147483647 << 12)); +} + + +if (0 << 13 !== 0) { + throw new Test262Error('#417: 0 << 13 === 0. Actual: ' + (0 << 13)); +} + + +if (1 << 13 !== 8192) { + throw new Test262Error('#418: 1 << 13 === 8192. Actual: ' + (1 << 13)); +} + + +if (3 << 13 !== 24576) { + throw new Test262Error('#419: 3 << 13 === 24576. Actual: ' + (3 << 13)); +} + + +if (7 << 13 !== 57344) { + throw new Test262Error('#420: 7 << 13 === 57344. Actual: ' + (7 << 13)); +} + + +if (15 << 13 !== 122880) { + throw new Test262Error('#421: 15 << 13 === 122880. Actual: ' + (15 << 13)); +} + + +if (31 << 13 !== 253952) { + throw new Test262Error('#422: 31 << 13 === 253952. Actual: ' + (31 << 13)); +} + + +if (63 << 13 !== 516096) { + throw new Test262Error('#423: 63 << 13 === 516096. Actual: ' + (63 << 13)); +} + + +if (127 << 13 !== 1040384) { + throw new Test262Error('#424: 127 << 13 === 1040384. Actual: ' + (127 << 13)); +} + + +if (255 << 13 !== 2088960) { + throw new Test262Error('#425: 255 << 13 === 2088960. Actual: ' + (255 << 13)); +} + + +if (511 << 13 !== 4186112) { + throw new Test262Error('#426: 511 << 13 === 4186112. Actual: ' + (511 << 13)); +} + + +if (1023 << 13 !== 8380416) { + throw new Test262Error('#427: 1023 << 13 === 8380416. Actual: ' + (1023 << 13)); +} + + +if (2047 << 13 !== 16769024) { + throw new Test262Error('#428: 2047 << 13 === 16769024. Actual: ' + (2047 << 13)); +} + + +if (4095 << 13 !== 33546240) { + throw new Test262Error('#429: 4095 << 13 === 33546240. Actual: ' + (4095 << 13)); +} + + +if (8191 << 13 !== 67100672) { + throw new Test262Error('#430: 8191 << 13 === 67100672. Actual: ' + (8191 << 13)); +} + + +if (16383 << 13 !== 134209536) { + throw new Test262Error('#431: 16383 << 13 === 134209536. Actual: ' + (16383 << 13)); +} + + +if (32767 << 13 !== 268427264) { + throw new Test262Error('#432: 32767 << 13 === 268427264. Actual: ' + (32767 << 13)); +} + + +if (65535 << 13 !== 536862720) { + throw new Test262Error('#433: 65535 << 13 === 536862720. Actual: ' + (65535 << 13)); +} + + +if (131071 << 13 !== 1073733632) { + throw new Test262Error('#434: 131071 << 13 === 1073733632. Actual: ' + (131071 << 13)); +} + + +if (262143 << 13 !== 2147475456) { + throw new Test262Error('#435: 262143 << 13 === 2147475456. Actual: ' + (262143 << 13)); +} + + +if (524287 << 13 !== -8192) { + throw new Test262Error('#436: 524287 << 13 === -8192. Actual: ' + (524287 << 13)); +} + + +if (1048575 << 13 !== -8192) { + throw new Test262Error('#437: 1048575 << 13 === -8192. Actual: ' + (1048575 << 13)); +} + + +if (2097151 << 13 !== -8192) { + throw new Test262Error('#438: 2097151 << 13 === -8192. Actual: ' + (2097151 << 13)); +} + + +if (4194303 << 13 !== -8192) { + throw new Test262Error('#439: 4194303 << 13 === -8192. Actual: ' + (4194303 << 13)); +} + + +if (8388607 << 13 !== -8192) { + throw new Test262Error('#440: 8388607 << 13 === -8192. Actual: ' + (8388607 << 13)); +} + + +if (16777215 << 13 !== -8192) { + throw new Test262Error('#441: 16777215 << 13 === -8192. Actual: ' + (16777215 << 13)); +} + + +if (33554431 << 13 !== -8192) { + throw new Test262Error('#442: 33554431 << 13 === -8192. Actual: ' + (33554431 << 13)); +} + + +if (67108863 << 13 !== -8192) { + throw new Test262Error('#443: 67108863 << 13 === -8192. Actual: ' + (67108863 << 13)); +} + + +if (134217727 << 13 !== -8192) { + throw new Test262Error('#444: 134217727 << 13 === -8192. Actual: ' + (134217727 << 13)); +} + + +if (268435455 << 13 !== -8192) { + throw new Test262Error('#445: 268435455 << 13 === -8192. Actual: ' + (268435455 << 13)); +} + + +if (536870911 << 13 !== -8192) { + throw new Test262Error('#446: 536870911 << 13 === -8192. Actual: ' + (536870911 << 13)); +} + + +if (1073741823 << 13 !== -8192) { + throw new Test262Error('#447: 1073741823 << 13 === -8192. Actual: ' + (1073741823 << 13)); +} + + +if (2147483647 << 13 !== -8192) { + throw new Test262Error('#448: 2147483647 << 13 === -8192. Actual: ' + (2147483647 << 13)); +} + + +if (0 << 14 !== 0) { + throw new Test262Error('#449: 0 << 14 === 0. Actual: ' + (0 << 14)); +} + + +if (1 << 14 !== 16384) { + throw new Test262Error('#450: 1 << 14 === 16384. Actual: ' + (1 << 14)); +} + + +if (3 << 14 !== 49152) { + throw new Test262Error('#451: 3 << 14 === 49152. Actual: ' + (3 << 14)); +} + + +if (7 << 14 !== 114688) { + throw new Test262Error('#452: 7 << 14 === 114688. Actual: ' + (7 << 14)); +} + + +if (15 << 14 !== 245760) { + throw new Test262Error('#453: 15 << 14 === 245760. Actual: ' + (15 << 14)); +} + + +if (31 << 14 !== 507904) { + throw new Test262Error('#454: 31 << 14 === 507904. Actual: ' + (31 << 14)); +} + + +if (63 << 14 !== 1032192) { + throw new Test262Error('#455: 63 << 14 === 1032192. Actual: ' + (63 << 14)); +} + + +if (127 << 14 !== 2080768) { + throw new Test262Error('#456: 127 << 14 === 2080768. Actual: ' + (127 << 14)); +} + + +if (255 << 14 !== 4177920) { + throw new Test262Error('#457: 255 << 14 === 4177920. Actual: ' + (255 << 14)); +} + + +if (511 << 14 !== 8372224) { + throw new Test262Error('#458: 511 << 14 === 8372224. Actual: ' + (511 << 14)); +} + + +if (1023 << 14 !== 16760832) { + throw new Test262Error('#459: 1023 << 14 === 16760832. Actual: ' + (1023 << 14)); +} + + +if (2047 << 14 !== 33538048) { + throw new Test262Error('#460: 2047 << 14 === 33538048. Actual: ' + (2047 << 14)); +} + + +if (4095 << 14 !== 67092480) { + throw new Test262Error('#461: 4095 << 14 === 67092480. Actual: ' + (4095 << 14)); +} + + +if (8191 << 14 !== 134201344) { + throw new Test262Error('#462: 8191 << 14 === 134201344. Actual: ' + (8191 << 14)); +} + + +if (16383 << 14 !== 268419072) { + throw new Test262Error('#463: 16383 << 14 === 268419072. Actual: ' + (16383 << 14)); +} + + +if (32767 << 14 !== 536854528) { + throw new Test262Error('#464: 32767 << 14 === 536854528. Actual: ' + (32767 << 14)); +} + + +if (65535 << 14 !== 1073725440) { + throw new Test262Error('#465: 65535 << 14 === 1073725440. Actual: ' + (65535 << 14)); +} + + +if (131071 << 14 !== 2147467264) { + throw new Test262Error('#466: 131071 << 14 === 2147467264. Actual: ' + (131071 << 14)); +} + + +if (262143 << 14 !== -16384) { + throw new Test262Error('#467: 262143 << 14 === -16384. Actual: ' + (262143 << 14)); +} + + +if (524287 << 14 !== -16384) { + throw new Test262Error('#468: 524287 << 14 === -16384. Actual: ' + (524287 << 14)); +} + + +if (1048575 << 14 !== -16384) { + throw new Test262Error('#469: 1048575 << 14 === -16384. Actual: ' + (1048575 << 14)); +} + + +if (2097151 << 14 !== -16384) { + throw new Test262Error('#470: 2097151 << 14 === -16384. Actual: ' + (2097151 << 14)); +} + + +if (4194303 << 14 !== -16384) { + throw new Test262Error('#471: 4194303 << 14 === -16384. Actual: ' + (4194303 << 14)); +} + + +if (8388607 << 14 !== -16384) { + throw new Test262Error('#472: 8388607 << 14 === -16384. Actual: ' + (8388607 << 14)); +} + + +if (16777215 << 14 !== -16384) { + throw new Test262Error('#473: 16777215 << 14 === -16384. Actual: ' + (16777215 << 14)); +} + + +if (33554431 << 14 !== -16384) { + throw new Test262Error('#474: 33554431 << 14 === -16384. Actual: ' + (33554431 << 14)); +} + + +if (67108863 << 14 !== -16384) { + throw new Test262Error('#475: 67108863 << 14 === -16384. Actual: ' + (67108863 << 14)); +} + + +if (134217727 << 14 !== -16384) { + throw new Test262Error('#476: 134217727 << 14 === -16384. Actual: ' + (134217727 << 14)); +} + + +if (268435455 << 14 !== -16384) { + throw new Test262Error('#477: 268435455 << 14 === -16384. Actual: ' + (268435455 << 14)); +} + + +if (536870911 << 14 !== -16384) { + throw new Test262Error('#478: 536870911 << 14 === -16384. Actual: ' + (536870911 << 14)); +} + + +if (1073741823 << 14 !== -16384) { + throw new Test262Error('#479: 1073741823 << 14 === -16384. Actual: ' + (1073741823 << 14)); +} + + +if (2147483647 << 14 !== -16384) { + throw new Test262Error('#480: 2147483647 << 14 === -16384. Actual: ' + (2147483647 << 14)); +} + + +if (0 << 15 !== 0) { + throw new Test262Error('#481: 0 << 15 === 0. Actual: ' + (0 << 15)); +} + + +if (1 << 15 !== 32768) { + throw new Test262Error('#482: 1 << 15 === 32768. Actual: ' + (1 << 15)); +} + + +if (3 << 15 !== 98304) { + throw new Test262Error('#483: 3 << 15 === 98304. Actual: ' + (3 << 15)); +} + + +if (7 << 15 !== 229376) { + throw new Test262Error('#484: 7 << 15 === 229376. Actual: ' + (7 << 15)); +} + + +if (15 << 15 !== 491520) { + throw new Test262Error('#485: 15 << 15 === 491520. Actual: ' + (15 << 15)); +} + + +if (31 << 15 !== 1015808) { + throw new Test262Error('#486: 31 << 15 === 1015808. Actual: ' + (31 << 15)); +} + + +if (63 << 15 !== 2064384) { + throw new Test262Error('#487: 63 << 15 === 2064384. Actual: ' + (63 << 15)); +} + + +if (127 << 15 !== 4161536) { + throw new Test262Error('#488: 127 << 15 === 4161536. Actual: ' + (127 << 15)); +} + + +if (255 << 15 !== 8355840) { + throw new Test262Error('#489: 255 << 15 === 8355840. Actual: ' + (255 << 15)); +} + + +if (511 << 15 !== 16744448) { + throw new Test262Error('#490: 511 << 15 === 16744448. Actual: ' + (511 << 15)); +} + + +if (1023 << 15 !== 33521664) { + throw new Test262Error('#491: 1023 << 15 === 33521664. Actual: ' + (1023 << 15)); +} + + +if (2047 << 15 !== 67076096) { + throw new Test262Error('#492: 2047 << 15 === 67076096. Actual: ' + (2047 << 15)); +} + + +if (4095 << 15 !== 134184960) { + throw new Test262Error('#493: 4095 << 15 === 134184960. Actual: ' + (4095 << 15)); +} + + +if (8191 << 15 !== 268402688) { + throw new Test262Error('#494: 8191 << 15 === 268402688. Actual: ' + (8191 << 15)); +} + + +if (16383 << 15 !== 536838144) { + throw new Test262Error('#495: 16383 << 15 === 536838144. Actual: ' + (16383 << 15)); +} + + +if (32767 << 15 !== 1073709056) { + throw new Test262Error('#496: 32767 << 15 === 1073709056. Actual: ' + (32767 << 15)); +} + + +if (65535 << 15 !== 2147450880) { + throw new Test262Error('#497: 65535 << 15 === 2147450880. Actual: ' + (65535 << 15)); +} + + +if (131071 << 15 !== -32768) { + throw new Test262Error('#498: 131071 << 15 === -32768. Actual: ' + (131071 << 15)); +} + + +if (262143 << 15 !== -32768) { + throw new Test262Error('#499: 262143 << 15 === -32768. Actual: ' + (262143 << 15)); +} + + +if (524287 << 15 !== -32768) { + throw new Test262Error('#500: 524287 << 15 === -32768. Actual: ' + (524287 << 15)); +} + + +if (1048575 << 15 !== -32768) { + throw new Test262Error('#501: 1048575 << 15 === -32768. Actual: ' + (1048575 << 15)); +} + + +if (2097151 << 15 !== -32768) { + throw new Test262Error('#502: 2097151 << 15 === -32768. Actual: ' + (2097151 << 15)); +} + + +if (4194303 << 15 !== -32768) { + throw new Test262Error('#503: 4194303 << 15 === -32768. Actual: ' + (4194303 << 15)); +} + + +if (8388607 << 15 !== -32768) { + throw new Test262Error('#504: 8388607 << 15 === -32768. Actual: ' + (8388607 << 15)); +} + + +if (16777215 << 15 !== -32768) { + throw new Test262Error('#505: 16777215 << 15 === -32768. Actual: ' + (16777215 << 15)); +} + + +if (33554431 << 15 !== -32768) { + throw new Test262Error('#506: 33554431 << 15 === -32768. Actual: ' + (33554431 << 15)); +} + + +if (67108863 << 15 !== -32768) { + throw new Test262Error('#507: 67108863 << 15 === -32768. Actual: ' + (67108863 << 15)); +} + + +if (134217727 << 15 !== -32768) { + throw new Test262Error('#508: 134217727 << 15 === -32768. Actual: ' + (134217727 << 15)); +} + + +if (268435455 << 15 !== -32768) { + throw new Test262Error('#509: 268435455 << 15 === -32768. Actual: ' + (268435455 << 15)); +} + + +if (536870911 << 15 !== -32768) { + throw new Test262Error('#510: 536870911 << 15 === -32768. Actual: ' + (536870911 << 15)); +} + + +if (1073741823 << 15 !== -32768) { + throw new Test262Error('#511: 1073741823 << 15 === -32768. Actual: ' + (1073741823 << 15)); +} + + +if (2147483647 << 15 !== -32768) { + throw new Test262Error('#512: 2147483647 << 15 === -32768. Actual: ' + (2147483647 << 15)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T4.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T4.js new file mode 100644 index 0000000000..b3748aeb64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A4_T4.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x << y in distinct points +es5id: 11.7.1_A4_T4 +description: ShiftExpression = 2^n - 1, n = 16...31 +---*/ + +//CHECK + +if (0 << 16 !== 0) { + throw new Test262Error('#513: 0 << 16 === 0. Actual: ' + (0 << 16)); +} + + +if (1 << 16 !== 65536) { + throw new Test262Error('#514: 1 << 16 === 65536. Actual: ' + (1 << 16)); +} + + +if (3 << 16 !== 196608) { + throw new Test262Error('#515: 3 << 16 === 196608. Actual: ' + (3 << 16)); +} + + +if (7 << 16 !== 458752) { + throw new Test262Error('#516: 7 << 16 === 458752. Actual: ' + (7 << 16)); +} + + +if (15 << 16 !== 983040) { + throw new Test262Error('#517: 15 << 16 === 983040. Actual: ' + (15 << 16)); +} + + +if (31 << 16 !== 2031616) { + throw new Test262Error('#518: 31 << 16 === 2031616. Actual: ' + (31 << 16)); +} + + +if (63 << 16 !== 4128768) { + throw new Test262Error('#519: 63 << 16 === 4128768. Actual: ' + (63 << 16)); +} + + +if (127 << 16 !== 8323072) { + throw new Test262Error('#520: 127 << 16 === 8323072. Actual: ' + (127 << 16)); +} + + +if (255 << 16 !== 16711680) { + throw new Test262Error('#521: 255 << 16 === 16711680. Actual: ' + (255 << 16)); +} + + +if (511 << 16 !== 33488896) { + throw new Test262Error('#522: 511 << 16 === 33488896. Actual: ' + (511 << 16)); +} + + +if (1023 << 16 !== 67043328) { + throw new Test262Error('#523: 1023 << 16 === 67043328. Actual: ' + (1023 << 16)); +} + + +if (2047 << 16 !== 134152192) { + throw new Test262Error('#524: 2047 << 16 === 134152192. Actual: ' + (2047 << 16)); +} + + +if (4095 << 16 !== 268369920) { + throw new Test262Error('#525: 4095 << 16 === 268369920. Actual: ' + (4095 << 16)); +} + + +if (8191 << 16 !== 536805376) { + throw new Test262Error('#526: 8191 << 16 === 536805376. Actual: ' + (8191 << 16)); +} + + +if (16383 << 16 !== 1073676288) { + throw new Test262Error('#527: 16383 << 16 === 1073676288. Actual: ' + (16383 << 16)); +} + + +if (32767 << 16 !== 2147418112) { + throw new Test262Error('#528: 32767 << 16 === 2147418112. Actual: ' + (32767 << 16)); +} + + +if (65535 << 16 !== -65536) { + throw new Test262Error('#529: 65535 << 16 === -65536. Actual: ' + (65535 << 16)); +} + + +if (131071 << 16 !== -65536) { + throw new Test262Error('#530: 131071 << 16 === -65536. Actual: ' + (131071 << 16)); +} + + +if (262143 << 16 !== -65536) { + throw new Test262Error('#531: 262143 << 16 === -65536. Actual: ' + (262143 << 16)); +} + + +if (524287 << 16 !== -65536) { + throw new Test262Error('#532: 524287 << 16 === -65536. Actual: ' + (524287 << 16)); +} + + +if (1048575 << 16 !== -65536) { + throw new Test262Error('#533: 1048575 << 16 === -65536. Actual: ' + (1048575 << 16)); +} + + +if (2097151 << 16 !== -65536) { + throw new Test262Error('#534: 2097151 << 16 === -65536. Actual: ' + (2097151 << 16)); +} + + +if (4194303 << 16 !== -65536) { + throw new Test262Error('#535: 4194303 << 16 === -65536. Actual: ' + (4194303 << 16)); +} + + +if (8388607 << 16 !== -65536) { + throw new Test262Error('#536: 8388607 << 16 === -65536. Actual: ' + (8388607 << 16)); +} + + +if (16777215 << 16 !== -65536) { + throw new Test262Error('#537: 16777215 << 16 === -65536. Actual: ' + (16777215 << 16)); +} + + +if (33554431 << 16 !== -65536) { + throw new Test262Error('#538: 33554431 << 16 === -65536. Actual: ' + (33554431 << 16)); +} + + +if (67108863 << 16 !== -65536) { + throw new Test262Error('#539: 67108863 << 16 === -65536. Actual: ' + (67108863 << 16)); +} + + +if (134217727 << 16 !== -65536) { + throw new Test262Error('#540: 134217727 << 16 === -65536. Actual: ' + (134217727 << 16)); +} + + +if (268435455 << 16 !== -65536) { + throw new Test262Error('#541: 268435455 << 16 === -65536. Actual: ' + (268435455 << 16)); +} + + +if (536870911 << 16 !== -65536) { + throw new Test262Error('#542: 536870911 << 16 === -65536. Actual: ' + (536870911 << 16)); +} + + +if (1073741823 << 16 !== -65536) { + throw new Test262Error('#543: 1073741823 << 16 === -65536. Actual: ' + (1073741823 << 16)); +} + + +if (2147483647 << 16 !== -65536) { + throw new Test262Error('#544: 2147483647 << 16 === -65536. Actual: ' + (2147483647 << 16)); +} + + +if (0 << 17 !== 0) { + throw new Test262Error('#545: 0 << 17 === 0. Actual: ' + (0 << 17)); +} + + +if (1 << 17 !== 131072) { + throw new Test262Error('#546: 1 << 17 === 131072. Actual: ' + (1 << 17)); +} + + +if (3 << 17 !== 393216) { + throw new Test262Error('#547: 3 << 17 === 393216. Actual: ' + (3 << 17)); +} + + +if (7 << 17 !== 917504) { + throw new Test262Error('#548: 7 << 17 === 917504. Actual: ' + (7 << 17)); +} + + +if (15 << 17 !== 1966080) { + throw new Test262Error('#549: 15 << 17 === 1966080. Actual: ' + (15 << 17)); +} + + +if (31 << 17 !== 4063232) { + throw new Test262Error('#550: 31 << 17 === 4063232. Actual: ' + (31 << 17)); +} + + +if (63 << 17 !== 8257536) { + throw new Test262Error('#551: 63 << 17 === 8257536. Actual: ' + (63 << 17)); +} + + +if (127 << 17 !== 16646144) { + throw new Test262Error('#552: 127 << 17 === 16646144. Actual: ' + (127 << 17)); +} + + +if (255 << 17 !== 33423360) { + throw new Test262Error('#553: 255 << 17 === 33423360. Actual: ' + (255 << 17)); +} + + +if (511 << 17 !== 66977792) { + throw new Test262Error('#554: 511 << 17 === 66977792. Actual: ' + (511 << 17)); +} + + +if (1023 << 17 !== 134086656) { + throw new Test262Error('#555: 1023 << 17 === 134086656. Actual: ' + (1023 << 17)); +} + + +if (2047 << 17 !== 268304384) { + throw new Test262Error('#556: 2047 << 17 === 268304384. Actual: ' + (2047 << 17)); +} + + +if (4095 << 17 !== 536739840) { + throw new Test262Error('#557: 4095 << 17 === 536739840. Actual: ' + (4095 << 17)); +} + + +if (8191 << 17 !== 1073610752) { + throw new Test262Error('#558: 8191 << 17 === 1073610752. Actual: ' + (8191 << 17)); +} + + +if (16383 << 17 !== 2147352576) { + throw new Test262Error('#559: 16383 << 17 === 2147352576. Actual: ' + (16383 << 17)); +} + + +if (32767 << 17 !== -131072) { + throw new Test262Error('#560: 32767 << 17 === -131072. Actual: ' + (32767 << 17)); +} + + +if (65535 << 17 !== -131072) { + throw new Test262Error('#561: 65535 << 17 === -131072. Actual: ' + (65535 << 17)); +} + + +if (131071 << 17 !== -131072) { + throw new Test262Error('#562: 131071 << 17 === -131072. Actual: ' + (131071 << 17)); +} + + +if (262143 << 17 !== -131072) { + throw new Test262Error('#563: 262143 << 17 === -131072. Actual: ' + (262143 << 17)); +} + + +if (524287 << 17 !== -131072) { + throw new Test262Error('#564: 524287 << 17 === -131072. Actual: ' + (524287 << 17)); +} + + +if (1048575 << 17 !== -131072) { + throw new Test262Error('#565: 1048575 << 17 === -131072. Actual: ' + (1048575 << 17)); +} + + +if (2097151 << 17 !== -131072) { + throw new Test262Error('#566: 2097151 << 17 === -131072. Actual: ' + (2097151 << 17)); +} + + +if (4194303 << 17 !== -131072) { + throw new Test262Error('#567: 4194303 << 17 === -131072. Actual: ' + (4194303 << 17)); +} + + +if (8388607 << 17 !== -131072) { + throw new Test262Error('#568: 8388607 << 17 === -131072. Actual: ' + (8388607 << 17)); +} + + +if (16777215 << 17 !== -131072) { + throw new Test262Error('#569: 16777215 << 17 === -131072. Actual: ' + (16777215 << 17)); +} + + +if (33554431 << 17 !== -131072) { + throw new Test262Error('#570: 33554431 << 17 === -131072. Actual: ' + (33554431 << 17)); +} + + +if (67108863 << 17 !== -131072) { + throw new Test262Error('#571: 67108863 << 17 === -131072. Actual: ' + (67108863 << 17)); +} + + +if (134217727 << 17 !== -131072) { + throw new Test262Error('#572: 134217727 << 17 === -131072. Actual: ' + (134217727 << 17)); +} + + +if (268435455 << 17 !== -131072) { + throw new Test262Error('#573: 268435455 << 17 === -131072. Actual: ' + (268435455 << 17)); +} + + +if (536870911 << 17 !== -131072) { + throw new Test262Error('#574: 536870911 << 17 === -131072. Actual: ' + (536870911 << 17)); +} + + +if (1073741823 << 17 !== -131072) { + throw new Test262Error('#575: 1073741823 << 17 === -131072. Actual: ' + (1073741823 << 17)); +} + + +if (2147483647 << 17 !== -131072) { + throw new Test262Error('#576: 2147483647 << 17 === -131072. Actual: ' + (2147483647 << 17)); +} + + +if (0 << 18 !== 0) { + throw new Test262Error('#577: 0 << 18 === 0. Actual: ' + (0 << 18)); +} + + +if (1 << 18 !== 262144) { + throw new Test262Error('#578: 1 << 18 === 262144. Actual: ' + (1 << 18)); +} + + +if (3 << 18 !== 786432) { + throw new Test262Error('#579: 3 << 18 === 786432. Actual: ' + (3 << 18)); +} + + +if (7 << 18 !== 1835008) { + throw new Test262Error('#580: 7 << 18 === 1835008. Actual: ' + (7 << 18)); +} + + +if (15 << 18 !== 3932160) { + throw new Test262Error('#581: 15 << 18 === 3932160. Actual: ' + (15 << 18)); +} + + +if (31 << 18 !== 8126464) { + throw new Test262Error('#582: 31 << 18 === 8126464. Actual: ' + (31 << 18)); +} + + +if (63 << 18 !== 16515072) { + throw new Test262Error('#583: 63 << 18 === 16515072. Actual: ' + (63 << 18)); +} + + +if (127 << 18 !== 33292288) { + throw new Test262Error('#584: 127 << 18 === 33292288. Actual: ' + (127 << 18)); +} + + +if (255 << 18 !== 66846720) { + throw new Test262Error('#585: 255 << 18 === 66846720. Actual: ' + (255 << 18)); +} + + +if (511 << 18 !== 133955584) { + throw new Test262Error('#586: 511 << 18 === 133955584. Actual: ' + (511 << 18)); +} + + +if (1023 << 18 !== 268173312) { + throw new Test262Error('#587: 1023 << 18 === 268173312. Actual: ' + (1023 << 18)); +} + + +if (2047 << 18 !== 536608768) { + throw new Test262Error('#588: 2047 << 18 === 536608768. Actual: ' + (2047 << 18)); +} + + +if (4095 << 18 !== 1073479680) { + throw new Test262Error('#589: 4095 << 18 === 1073479680. Actual: ' + (4095 << 18)); +} + + +if (8191 << 18 !== 2147221504) { + throw new Test262Error('#590: 8191 << 18 === 2147221504. Actual: ' + (8191 << 18)); +} + + +if (16383 << 18 !== -262144) { + throw new Test262Error('#591: 16383 << 18 === -262144. Actual: ' + (16383 << 18)); +} + + +if (32767 << 18 !== -262144) { + throw new Test262Error('#592: 32767 << 18 === -262144. Actual: ' + (32767 << 18)); +} + + +if (65535 << 18 !== -262144) { + throw new Test262Error('#593: 65535 << 18 === -262144. Actual: ' + (65535 << 18)); +} + + +if (131071 << 18 !== -262144) { + throw new Test262Error('#594: 131071 << 18 === -262144. Actual: ' + (131071 << 18)); +} + + +if (262143 << 18 !== -262144) { + throw new Test262Error('#595: 262143 << 18 === -262144. Actual: ' + (262143 << 18)); +} + + +if (524287 << 18 !== -262144) { + throw new Test262Error('#596: 524287 << 18 === -262144. Actual: ' + (524287 << 18)); +} + + +if (1048575 << 18 !== -262144) { + throw new Test262Error('#597: 1048575 << 18 === -262144. Actual: ' + (1048575 << 18)); +} + + +if (2097151 << 18 !== -262144) { + throw new Test262Error('#598: 2097151 << 18 === -262144. Actual: ' + (2097151 << 18)); +} + + +if (4194303 << 18 !== -262144) { + throw new Test262Error('#599: 4194303 << 18 === -262144. Actual: ' + (4194303 << 18)); +} + + +if (8388607 << 18 !== -262144) { + throw new Test262Error('#600: 8388607 << 18 === -262144. Actual: ' + (8388607 << 18)); +} + + +if (16777215 << 18 !== -262144) { + throw new Test262Error('#601: 16777215 << 18 === -262144. Actual: ' + (16777215 << 18)); +} + + +if (33554431 << 18 !== -262144) { + throw new Test262Error('#602: 33554431 << 18 === -262144. Actual: ' + (33554431 << 18)); +} + + +if (67108863 << 18 !== -262144) { + throw new Test262Error('#603: 67108863 << 18 === -262144. Actual: ' + (67108863 << 18)); +} + + +if (134217727 << 18 !== -262144) { + throw new Test262Error('#604: 134217727 << 18 === -262144. Actual: ' + (134217727 << 18)); +} + + +if (268435455 << 18 !== -262144) { + throw new Test262Error('#605: 268435455 << 18 === -262144. Actual: ' + (268435455 << 18)); +} + + +if (536870911 << 18 !== -262144) { + throw new Test262Error('#606: 536870911 << 18 === -262144. Actual: ' + (536870911 << 18)); +} + + +if (1073741823 << 18 !== -262144) { + throw new Test262Error('#607: 1073741823 << 18 === -262144. Actual: ' + (1073741823 << 18)); +} + + +if (2147483647 << 18 !== -262144) { + throw new Test262Error('#608: 2147483647 << 18 === -262144. Actual: ' + (2147483647 << 18)); +} + + +if (0 << 19 !== 0) { + throw new Test262Error('#609: 0 << 19 === 0. Actual: ' + (0 << 19)); +} + + +if (1 << 19 !== 524288) { + throw new Test262Error('#610: 1 << 19 === 524288. Actual: ' + (1 << 19)); +} + + +if (3 << 19 !== 1572864) { + throw new Test262Error('#611: 3 << 19 === 1572864. Actual: ' + (3 << 19)); +} + + +if (7 << 19 !== 3670016) { + throw new Test262Error('#612: 7 << 19 === 3670016. Actual: ' + (7 << 19)); +} + + +if (15 << 19 !== 7864320) { + throw new Test262Error('#613: 15 << 19 === 7864320. Actual: ' + (15 << 19)); +} + + +if (31 << 19 !== 16252928) { + throw new Test262Error('#614: 31 << 19 === 16252928. Actual: ' + (31 << 19)); +} + + +if (63 << 19 !== 33030144) { + throw new Test262Error('#615: 63 << 19 === 33030144. Actual: ' + (63 << 19)); +} + + +if (127 << 19 !== 66584576) { + throw new Test262Error('#616: 127 << 19 === 66584576. Actual: ' + (127 << 19)); +} + + +if (255 << 19 !== 133693440) { + throw new Test262Error('#617: 255 << 19 === 133693440. Actual: ' + (255 << 19)); +} + + +if (511 << 19 !== 267911168) { + throw new Test262Error('#618: 511 << 19 === 267911168. Actual: ' + (511 << 19)); +} + + +if (1023 << 19 !== 536346624) { + throw new Test262Error('#619: 1023 << 19 === 536346624. Actual: ' + (1023 << 19)); +} + + +if (2047 << 19 !== 1073217536) { + throw new Test262Error('#620: 2047 << 19 === 1073217536. Actual: ' + (2047 << 19)); +} + + +if (4095 << 19 !== 2146959360) { + throw new Test262Error('#621: 4095 << 19 === 2146959360. Actual: ' + (4095 << 19)); +} + + +if (8191 << 19 !== -524288) { + throw new Test262Error('#622: 8191 << 19 === -524288. Actual: ' + (8191 << 19)); +} + + +if (16383 << 19 !== -524288) { + throw new Test262Error('#623: 16383 << 19 === -524288. Actual: ' + (16383 << 19)); +} + + +if (32767 << 19 !== -524288) { + throw new Test262Error('#624: 32767 << 19 === -524288. Actual: ' + (32767 << 19)); +} + + +if (65535 << 19 !== -524288) { + throw new Test262Error('#625: 65535 << 19 === -524288. Actual: ' + (65535 << 19)); +} + + +if (131071 << 19 !== -524288) { + throw new Test262Error('#626: 131071 << 19 === -524288. Actual: ' + (131071 << 19)); +} + + +if (262143 << 19 !== -524288) { + throw new Test262Error('#627: 262143 << 19 === -524288. Actual: ' + (262143 << 19)); +} + + +if (524287 << 19 !== -524288) { + throw new Test262Error('#628: 524287 << 19 === -524288. Actual: ' + (524287 << 19)); +} + + +if (1048575 << 19 !== -524288) { + throw new Test262Error('#629: 1048575 << 19 === -524288. Actual: ' + (1048575 << 19)); +} + + +if (2097151 << 19 !== -524288) { + throw new Test262Error('#630: 2097151 << 19 === -524288. Actual: ' + (2097151 << 19)); +} + + +if (4194303 << 19 !== -524288) { + throw new Test262Error('#631: 4194303 << 19 === -524288. Actual: ' + (4194303 << 19)); +} + + +if (8388607 << 19 !== -524288) { + throw new Test262Error('#632: 8388607 << 19 === -524288. Actual: ' + (8388607 << 19)); +} + + +if (16777215 << 19 !== -524288) { + throw new Test262Error('#633: 16777215 << 19 === -524288. Actual: ' + (16777215 << 19)); +} + + +if (33554431 << 19 !== -524288) { + throw new Test262Error('#634: 33554431 << 19 === -524288. Actual: ' + (33554431 << 19)); +} + + +if (67108863 << 19 !== -524288) { + throw new Test262Error('#635: 67108863 << 19 === -524288. Actual: ' + (67108863 << 19)); +} + + +if (134217727 << 19 !== -524288) { + throw new Test262Error('#636: 134217727 << 19 === -524288. Actual: ' + (134217727 << 19)); +} + + +if (268435455 << 19 !== -524288) { + throw new Test262Error('#637: 268435455 << 19 === -524288. Actual: ' + (268435455 << 19)); +} + + +if (536870911 << 19 !== -524288) { + throw new Test262Error('#638: 536870911 << 19 === -524288. Actual: ' + (536870911 << 19)); +} + + +if (1073741823 << 19 !== -524288) { + throw new Test262Error('#639: 1073741823 << 19 === -524288. Actual: ' + (1073741823 << 19)); +} + + +if (2147483647 << 19 !== -524288) { + throw new Test262Error('#640: 2147483647 << 19 === -524288. Actual: ' + (2147483647 << 19)); +} + + +if (0 << 20 !== 0) { + throw new Test262Error('#641: 0 << 20 === 0. Actual: ' + (0 << 20)); +} + + +if (1 << 20 !== 1048576) { + throw new Test262Error('#642: 1 << 20 === 1048576. Actual: ' + (1 << 20)); +} + + +if (3 << 20 !== 3145728) { + throw new Test262Error('#643: 3 << 20 === 3145728. Actual: ' + (3 << 20)); +} + + +if (7 << 20 !== 7340032) { + throw new Test262Error('#644: 7 << 20 === 7340032. Actual: ' + (7 << 20)); +} + + +if (15 << 20 !== 15728640) { + throw new Test262Error('#645: 15 << 20 === 15728640. Actual: ' + (15 << 20)); +} + + +if (31 << 20 !== 32505856) { + throw new Test262Error('#646: 31 << 20 === 32505856. Actual: ' + (31 << 20)); +} + + +if (63 << 20 !== 66060288) { + throw new Test262Error('#647: 63 << 20 === 66060288. Actual: ' + (63 << 20)); +} + + +if (127 << 20 !== 133169152) { + throw new Test262Error('#648: 127 << 20 === 133169152. Actual: ' + (127 << 20)); +} + + +if (255 << 20 !== 267386880) { + throw new Test262Error('#649: 255 << 20 === 267386880. Actual: ' + (255 << 20)); +} + + +if (511 << 20 !== 535822336) { + throw new Test262Error('#650: 511 << 20 === 535822336. Actual: ' + (511 << 20)); +} + + +if (1023 << 20 !== 1072693248) { + throw new Test262Error('#651: 1023 << 20 === 1072693248. Actual: ' + (1023 << 20)); +} + + +if (2047 << 20 !== 2146435072) { + throw new Test262Error('#652: 2047 << 20 === 2146435072. Actual: ' + (2047 << 20)); +} + + +if (4095 << 20 !== -1048576) { + throw new Test262Error('#653: 4095 << 20 === -1048576. Actual: ' + (4095 << 20)); +} + + +if (8191 << 20 !== -1048576) { + throw new Test262Error('#654: 8191 << 20 === -1048576. Actual: ' + (8191 << 20)); +} + + +if (16383 << 20 !== -1048576) { + throw new Test262Error('#655: 16383 << 20 === -1048576. Actual: ' + (16383 << 20)); +} + + +if (32767 << 20 !== -1048576) { + throw new Test262Error('#656: 32767 << 20 === -1048576. Actual: ' + (32767 << 20)); +} + + +if (65535 << 20 !== -1048576) { + throw new Test262Error('#657: 65535 << 20 === -1048576. Actual: ' + (65535 << 20)); +} + + +if (131071 << 20 !== -1048576) { + throw new Test262Error('#658: 131071 << 20 === -1048576. Actual: ' + (131071 << 20)); +} + + +if (262143 << 20 !== -1048576) { + throw new Test262Error('#659: 262143 << 20 === -1048576. Actual: ' + (262143 << 20)); +} + + +if (524287 << 20 !== -1048576) { + throw new Test262Error('#660: 524287 << 20 === -1048576. Actual: ' + (524287 << 20)); +} + + +if (1048575 << 20 !== -1048576) { + throw new Test262Error('#661: 1048575 << 20 === -1048576. Actual: ' + (1048575 << 20)); +} + + +if (2097151 << 20 !== -1048576) { + throw new Test262Error('#662: 2097151 << 20 === -1048576. Actual: ' + (2097151 << 20)); +} + + +if (4194303 << 20 !== -1048576) { + throw new Test262Error('#663: 4194303 << 20 === -1048576. Actual: ' + (4194303 << 20)); +} + + +if (8388607 << 20 !== -1048576) { + throw new Test262Error('#664: 8388607 << 20 === -1048576. Actual: ' + (8388607 << 20)); +} + + +if (16777215 << 20 !== -1048576) { + throw new Test262Error('#665: 16777215 << 20 === -1048576. Actual: ' + (16777215 << 20)); +} + + +if (33554431 << 20 !== -1048576) { + throw new Test262Error('#666: 33554431 << 20 === -1048576. Actual: ' + (33554431 << 20)); +} + + +if (67108863 << 20 !== -1048576) { + throw new Test262Error('#667: 67108863 << 20 === -1048576. Actual: ' + (67108863 << 20)); +} + + +if (134217727 << 20 !== -1048576) { + throw new Test262Error('#668: 134217727 << 20 === -1048576. Actual: ' + (134217727 << 20)); +} + + +if (268435455 << 20 !== -1048576) { + throw new Test262Error('#669: 268435455 << 20 === -1048576. Actual: ' + (268435455 << 20)); +} + + +if (536870911 << 20 !== -1048576) { + throw new Test262Error('#670: 536870911 << 20 === -1048576. Actual: ' + (536870911 << 20)); +} + + +if (1073741823 << 20 !== -1048576) { + throw new Test262Error('#671: 1073741823 << 20 === -1048576. Actual: ' + (1073741823 << 20)); +} + + +if (2147483647 << 20 !== -1048576) { + throw new Test262Error('#672: 2147483647 << 20 === -1048576. Actual: ' + (2147483647 << 20)); +} + + +if (0 << 21 !== 0) { + throw new Test262Error('#673: 0 << 21 === 0. Actual: ' + (0 << 21)); +} + + +if (1 << 21 !== 2097152) { + throw new Test262Error('#674: 1 << 21 === 2097152. Actual: ' + (1 << 21)); +} + + +if (3 << 21 !== 6291456) { + throw new Test262Error('#675: 3 << 21 === 6291456. Actual: ' + (3 << 21)); +} + + +if (7 << 21 !== 14680064) { + throw new Test262Error('#676: 7 << 21 === 14680064. Actual: ' + (7 << 21)); +} + + +if (15 << 21 !== 31457280) { + throw new Test262Error('#677: 15 << 21 === 31457280. Actual: ' + (15 << 21)); +} + + +if (31 << 21 !== 65011712) { + throw new Test262Error('#678: 31 << 21 === 65011712. Actual: ' + (31 << 21)); +} + + +if (63 << 21 !== 132120576) { + throw new Test262Error('#679: 63 << 21 === 132120576. Actual: ' + (63 << 21)); +} + + +if (127 << 21 !== 266338304) { + throw new Test262Error('#680: 127 << 21 === 266338304. Actual: ' + (127 << 21)); +} + + +if (255 << 21 !== 534773760) { + throw new Test262Error('#681: 255 << 21 === 534773760. Actual: ' + (255 << 21)); +} + + +if (511 << 21 !== 1071644672) { + throw new Test262Error('#682: 511 << 21 === 1071644672. Actual: ' + (511 << 21)); +} + + +if (1023 << 21 !== 2145386496) { + throw new Test262Error('#683: 1023 << 21 === 2145386496. Actual: ' + (1023 << 21)); +} + + +if (2047 << 21 !== -2097152) { + throw new Test262Error('#684: 2047 << 21 === -2097152. Actual: ' + (2047 << 21)); +} + + +if (4095 << 21 !== -2097152) { + throw new Test262Error('#685: 4095 << 21 === -2097152. Actual: ' + (4095 << 21)); +} + + +if (8191 << 21 !== -2097152) { + throw new Test262Error('#686: 8191 << 21 === -2097152. Actual: ' + (8191 << 21)); +} + + +if (16383 << 21 !== -2097152) { + throw new Test262Error('#687: 16383 << 21 === -2097152. Actual: ' + (16383 << 21)); +} + + +if (32767 << 21 !== -2097152) { + throw new Test262Error('#688: 32767 << 21 === -2097152. Actual: ' + (32767 << 21)); +} + + +if (65535 << 21 !== -2097152) { + throw new Test262Error('#689: 65535 << 21 === -2097152. Actual: ' + (65535 << 21)); +} + + +if (131071 << 21 !== -2097152) { + throw new Test262Error('#690: 131071 << 21 === -2097152. Actual: ' + (131071 << 21)); +} + + +if (262143 << 21 !== -2097152) { + throw new Test262Error('#691: 262143 << 21 === -2097152. Actual: ' + (262143 << 21)); +} + + +if (524287 << 21 !== -2097152) { + throw new Test262Error('#692: 524287 << 21 === -2097152. Actual: ' + (524287 << 21)); +} + + +if (1048575 << 21 !== -2097152) { + throw new Test262Error('#693: 1048575 << 21 === -2097152. Actual: ' + (1048575 << 21)); +} + + +if (2097151 << 21 !== -2097152) { + throw new Test262Error('#694: 2097151 << 21 === -2097152. Actual: ' + (2097151 << 21)); +} + + +if (4194303 << 21 !== -2097152) { + throw new Test262Error('#695: 4194303 << 21 === -2097152. Actual: ' + (4194303 << 21)); +} + + +if (8388607 << 21 !== -2097152) { + throw new Test262Error('#696: 8388607 << 21 === -2097152. Actual: ' + (8388607 << 21)); +} + + +if (16777215 << 21 !== -2097152) { + throw new Test262Error('#697: 16777215 << 21 === -2097152. Actual: ' + (16777215 << 21)); +} + + +if (33554431 << 21 !== -2097152) { + throw new Test262Error('#698: 33554431 << 21 === -2097152. Actual: ' + (33554431 << 21)); +} + + +if (67108863 << 21 !== -2097152) { + throw new Test262Error('#699: 67108863 << 21 === -2097152. Actual: ' + (67108863 << 21)); +} + + +if (134217727 << 21 !== -2097152) { + throw new Test262Error('#700: 134217727 << 21 === -2097152. Actual: ' + (134217727 << 21)); +} + + +if (268435455 << 21 !== -2097152) { + throw new Test262Error('#701: 268435455 << 21 === -2097152. Actual: ' + (268435455 << 21)); +} + + +if (536870911 << 21 !== -2097152) { + throw new Test262Error('#702: 536870911 << 21 === -2097152. Actual: ' + (536870911 << 21)); +} + + +if (1073741823 << 21 !== -2097152) { + throw new Test262Error('#703: 1073741823 << 21 === -2097152. Actual: ' + (1073741823 << 21)); +} + + +if (2147483647 << 21 !== -2097152) { + throw new Test262Error('#704: 2147483647 << 21 === -2097152. Actual: ' + (2147483647 << 21)); +} + + +if (0 << 22 !== 0) { + throw new Test262Error('#705: 0 << 22 === 0. Actual: ' + (0 << 22)); +} + + +if (1 << 22 !== 4194304) { + throw new Test262Error('#706: 1 << 22 === 4194304. Actual: ' + (1 << 22)); +} + + +if (3 << 22 !== 12582912) { + throw new Test262Error('#707: 3 << 22 === 12582912. Actual: ' + (3 << 22)); +} + + +if (7 << 22 !== 29360128) { + throw new Test262Error('#708: 7 << 22 === 29360128. Actual: ' + (7 << 22)); +} + + +if (15 << 22 !== 62914560) { + throw new Test262Error('#709: 15 << 22 === 62914560. Actual: ' + (15 << 22)); +} + + +if (31 << 22 !== 130023424) { + throw new Test262Error('#710: 31 << 22 === 130023424. Actual: ' + (31 << 22)); +} + + +if (63 << 22 !== 264241152) { + throw new Test262Error('#711: 63 << 22 === 264241152. Actual: ' + (63 << 22)); +} + + +if (127 << 22 !== 532676608) { + throw new Test262Error('#712: 127 << 22 === 532676608. Actual: ' + (127 << 22)); +} + + +if (255 << 22 !== 1069547520) { + throw new Test262Error('#713: 255 << 22 === 1069547520. Actual: ' + (255 << 22)); +} + + +if (511 << 22 !== 2143289344) { + throw new Test262Error('#714: 511 << 22 === 2143289344. Actual: ' + (511 << 22)); +} + + +if (1023 << 22 !== -4194304) { + throw new Test262Error('#715: 1023 << 22 === -4194304. Actual: ' + (1023 << 22)); +} + + +if (2047 << 22 !== -4194304) { + throw new Test262Error('#716: 2047 << 22 === -4194304. Actual: ' + (2047 << 22)); +} + + +if (4095 << 22 !== -4194304) { + throw new Test262Error('#717: 4095 << 22 === -4194304. Actual: ' + (4095 << 22)); +} + + +if (8191 << 22 !== -4194304) { + throw new Test262Error('#718: 8191 << 22 === -4194304. Actual: ' + (8191 << 22)); +} + + +if (16383 << 22 !== -4194304) { + throw new Test262Error('#719: 16383 << 22 === -4194304. Actual: ' + (16383 << 22)); +} + + +if (32767 << 22 !== -4194304) { + throw new Test262Error('#720: 32767 << 22 === -4194304. Actual: ' + (32767 << 22)); +} + + +if (65535 << 22 !== -4194304) { + throw new Test262Error('#721: 65535 << 22 === -4194304. Actual: ' + (65535 << 22)); +} + + +if (131071 << 22 !== -4194304) { + throw new Test262Error('#722: 131071 << 22 === -4194304. Actual: ' + (131071 << 22)); +} + + +if (262143 << 22 !== -4194304) { + throw new Test262Error('#723: 262143 << 22 === -4194304. Actual: ' + (262143 << 22)); +} + + +if (524287 << 22 !== -4194304) { + throw new Test262Error('#724: 524287 << 22 === -4194304. Actual: ' + (524287 << 22)); +} + + +if (1048575 << 22 !== -4194304) { + throw new Test262Error('#725: 1048575 << 22 === -4194304. Actual: ' + (1048575 << 22)); +} + + +if (2097151 << 22 !== -4194304) { + throw new Test262Error('#726: 2097151 << 22 === -4194304. Actual: ' + (2097151 << 22)); +} + + +if (4194303 << 22 !== -4194304) { + throw new Test262Error('#727: 4194303 << 22 === -4194304. Actual: ' + (4194303 << 22)); +} + + +if (8388607 << 22 !== -4194304) { + throw new Test262Error('#728: 8388607 << 22 === -4194304. Actual: ' + (8388607 << 22)); +} + + +if (16777215 << 22 !== -4194304) { + throw new Test262Error('#729: 16777215 << 22 === -4194304. Actual: ' + (16777215 << 22)); +} + + +if (33554431 << 22 !== -4194304) { + throw new Test262Error('#730: 33554431 << 22 === -4194304. Actual: ' + (33554431 << 22)); +} + + +if (67108863 << 22 !== -4194304) { + throw new Test262Error('#731: 67108863 << 22 === -4194304. Actual: ' + (67108863 << 22)); +} + + +if (134217727 << 22 !== -4194304) { + throw new Test262Error('#732: 134217727 << 22 === -4194304. Actual: ' + (134217727 << 22)); +} + + +if (268435455 << 22 !== -4194304) { + throw new Test262Error('#733: 268435455 << 22 === -4194304. Actual: ' + (268435455 << 22)); +} + + +if (536870911 << 22 !== -4194304) { + throw new Test262Error('#734: 536870911 << 22 === -4194304. Actual: ' + (536870911 << 22)); +} + + +if (1073741823 << 22 !== -4194304) { + throw new Test262Error('#735: 1073741823 << 22 === -4194304. Actual: ' + (1073741823 << 22)); +} + + +if (2147483647 << 22 !== -4194304) { + throw new Test262Error('#736: 2147483647 << 22 === -4194304. Actual: ' + (2147483647 << 22)); +} + + +if (0 << 23 !== 0) { + throw new Test262Error('#737: 0 << 23 === 0. Actual: ' + (0 << 23)); +} + + +if (1 << 23 !== 8388608) { + throw new Test262Error('#738: 1 << 23 === 8388608. Actual: ' + (1 << 23)); +} + + +if (3 << 23 !== 25165824) { + throw new Test262Error('#739: 3 << 23 === 25165824. Actual: ' + (3 << 23)); +} + + +if (7 << 23 !== 58720256) { + throw new Test262Error('#740: 7 << 23 === 58720256. Actual: ' + (7 << 23)); +} + + +if (15 << 23 !== 125829120) { + throw new Test262Error('#741: 15 << 23 === 125829120. Actual: ' + (15 << 23)); +} + + +if (31 << 23 !== 260046848) { + throw new Test262Error('#742: 31 << 23 === 260046848. Actual: ' + (31 << 23)); +} + + +if (63 << 23 !== 528482304) { + throw new Test262Error('#743: 63 << 23 === 528482304. Actual: ' + (63 << 23)); +} + + +if (127 << 23 !== 1065353216) { + throw new Test262Error('#744: 127 << 23 === 1065353216. Actual: ' + (127 << 23)); +} + + +if (255 << 23 !== 2139095040) { + throw new Test262Error('#745: 255 << 23 === 2139095040. Actual: ' + (255 << 23)); +} + + +if (511 << 23 !== -8388608) { + throw new Test262Error('#746: 511 << 23 === -8388608. Actual: ' + (511 << 23)); +} + + +if (1023 << 23 !== -8388608) { + throw new Test262Error('#747: 1023 << 23 === -8388608. Actual: ' + (1023 << 23)); +} + + +if (2047 << 23 !== -8388608) { + throw new Test262Error('#748: 2047 << 23 === -8388608. Actual: ' + (2047 << 23)); +} + + +if (4095 << 23 !== -8388608) { + throw new Test262Error('#749: 4095 << 23 === -8388608. Actual: ' + (4095 << 23)); +} + + +if (8191 << 23 !== -8388608) { + throw new Test262Error('#750: 8191 << 23 === -8388608. Actual: ' + (8191 << 23)); +} + + +if (16383 << 23 !== -8388608) { + throw new Test262Error('#751: 16383 << 23 === -8388608. Actual: ' + (16383 << 23)); +} + + +if (32767 << 23 !== -8388608) { + throw new Test262Error('#752: 32767 << 23 === -8388608. Actual: ' + (32767 << 23)); +} + + +if (65535 << 23 !== -8388608) { + throw new Test262Error('#753: 65535 << 23 === -8388608. Actual: ' + (65535 << 23)); +} + + +if (131071 << 23 !== -8388608) { + throw new Test262Error('#754: 131071 << 23 === -8388608. Actual: ' + (131071 << 23)); +} + + +if (262143 << 23 !== -8388608) { + throw new Test262Error('#755: 262143 << 23 === -8388608. Actual: ' + (262143 << 23)); +} + + +if (524287 << 23 !== -8388608) { + throw new Test262Error('#756: 524287 << 23 === -8388608. Actual: ' + (524287 << 23)); +} + + +if (1048575 << 23 !== -8388608) { + throw new Test262Error('#757: 1048575 << 23 === -8388608. Actual: ' + (1048575 << 23)); +} + + +if (2097151 << 23 !== -8388608) { + throw new Test262Error('#758: 2097151 << 23 === -8388608. Actual: ' + (2097151 << 23)); +} + + +if (4194303 << 23 !== -8388608) { + throw new Test262Error('#759: 4194303 << 23 === -8388608. Actual: ' + (4194303 << 23)); +} + + +if (8388607 << 23 !== -8388608) { + throw new Test262Error('#760: 8388607 << 23 === -8388608. Actual: ' + (8388607 << 23)); +} + + +if (16777215 << 23 !== -8388608) { + throw new Test262Error('#761: 16777215 << 23 === -8388608. Actual: ' + (16777215 << 23)); +} + + +if (33554431 << 23 !== -8388608) { + throw new Test262Error('#762: 33554431 << 23 === -8388608. Actual: ' + (33554431 << 23)); +} + + +if (67108863 << 23 !== -8388608) { + throw new Test262Error('#763: 67108863 << 23 === -8388608. Actual: ' + (67108863 << 23)); +} + + +if (134217727 << 23 !== -8388608) { + throw new Test262Error('#764: 134217727 << 23 === -8388608. Actual: ' + (134217727 << 23)); +} + + +if (268435455 << 23 !== -8388608) { + throw new Test262Error('#765: 268435455 << 23 === -8388608. Actual: ' + (268435455 << 23)); +} + + +if (536870911 << 23 !== -8388608) { + throw new Test262Error('#766: 536870911 << 23 === -8388608. Actual: ' + (536870911 << 23)); +} + + +if (1073741823 << 23 !== -8388608) { + throw new Test262Error('#767: 1073741823 << 23 === -8388608. Actual: ' + (1073741823 << 23)); +} + + +if (2147483647 << 23 !== -8388608) { + throw new Test262Error('#768: 2147483647 << 23 === -8388608. Actual: ' + (2147483647 << 23)); +} + + +if (0 << 24 !== 0) { + throw new Test262Error('#769: 0 << 24 === 0. Actual: ' + (0 << 24)); +} + + +if (1 << 24 !== 16777216) { + throw new Test262Error('#770: 1 << 24 === 16777216. Actual: ' + (1 << 24)); +} + + +if (3 << 24 !== 50331648) { + throw new Test262Error('#771: 3 << 24 === 50331648. Actual: ' + (3 << 24)); +} + + +if (7 << 24 !== 117440512) { + throw new Test262Error('#772: 7 << 24 === 117440512. Actual: ' + (7 << 24)); +} + + +if (15 << 24 !== 251658240) { + throw new Test262Error('#773: 15 << 24 === 251658240. Actual: ' + (15 << 24)); +} + + +if (31 << 24 !== 520093696) { + throw new Test262Error('#774: 31 << 24 === 520093696. Actual: ' + (31 << 24)); +} + + +if (63 << 24 !== 1056964608) { + throw new Test262Error('#775: 63 << 24 === 1056964608. Actual: ' + (63 << 24)); +} + + +if (127 << 24 !== 2130706432) { + throw new Test262Error('#776: 127 << 24 === 2130706432. Actual: ' + (127 << 24)); +} + + +if (255 << 24 !== -16777216) { + throw new Test262Error('#777: 255 << 24 === -16777216. Actual: ' + (255 << 24)); +} + + +if (511 << 24 !== -16777216) { + throw new Test262Error('#778: 511 << 24 === -16777216. Actual: ' + (511 << 24)); +} + + +if (1023 << 24 !== -16777216) { + throw new Test262Error('#779: 1023 << 24 === -16777216. Actual: ' + (1023 << 24)); +} + + +if (2047 << 24 !== -16777216) { + throw new Test262Error('#780: 2047 << 24 === -16777216. Actual: ' + (2047 << 24)); +} + + +if (4095 << 24 !== -16777216) { + throw new Test262Error('#781: 4095 << 24 === -16777216. Actual: ' + (4095 << 24)); +} + + +if (8191 << 24 !== -16777216) { + throw new Test262Error('#782: 8191 << 24 === -16777216. Actual: ' + (8191 << 24)); +} + + +if (16383 << 24 !== -16777216) { + throw new Test262Error('#783: 16383 << 24 === -16777216. Actual: ' + (16383 << 24)); +} + + +if (32767 << 24 !== -16777216) { + throw new Test262Error('#784: 32767 << 24 === -16777216. Actual: ' + (32767 << 24)); +} + + +if (65535 << 24 !== -16777216) { + throw new Test262Error('#785: 65535 << 24 === -16777216. Actual: ' + (65535 << 24)); +} + + +if (131071 << 24 !== -16777216) { + throw new Test262Error('#786: 131071 << 24 === -16777216. Actual: ' + (131071 << 24)); +} + + +if (262143 << 24 !== -16777216) { + throw new Test262Error('#787: 262143 << 24 === -16777216. Actual: ' + (262143 << 24)); +} + + +if (524287 << 24 !== -16777216) { + throw new Test262Error('#788: 524287 << 24 === -16777216. Actual: ' + (524287 << 24)); +} + + +if (1048575 << 24 !== -16777216) { + throw new Test262Error('#789: 1048575 << 24 === -16777216. Actual: ' + (1048575 << 24)); +} + + +if (2097151 << 24 !== -16777216) { + throw new Test262Error('#790: 2097151 << 24 === -16777216. Actual: ' + (2097151 << 24)); +} + + +if (4194303 << 24 !== -16777216) { + throw new Test262Error('#791: 4194303 << 24 === -16777216. Actual: ' + (4194303 << 24)); +} + + +if (8388607 << 24 !== -16777216) { + throw new Test262Error('#792: 8388607 << 24 === -16777216. Actual: ' + (8388607 << 24)); +} + + +if (16777215 << 24 !== -16777216) { + throw new Test262Error('#793: 16777215 << 24 === -16777216. Actual: ' + (16777215 << 24)); +} + + +if (33554431 << 24 !== -16777216) { + throw new Test262Error('#794: 33554431 << 24 === -16777216. Actual: ' + (33554431 << 24)); +} + + +if (67108863 << 24 !== -16777216) { + throw new Test262Error('#795: 67108863 << 24 === -16777216. Actual: ' + (67108863 << 24)); +} + + +if (134217727 << 24 !== -16777216) { + throw new Test262Error('#796: 134217727 << 24 === -16777216. Actual: ' + (134217727 << 24)); +} + + +if (268435455 << 24 !== -16777216) { + throw new Test262Error('#797: 268435455 << 24 === -16777216. Actual: ' + (268435455 << 24)); +} + + +if (536870911 << 24 !== -16777216) { + throw new Test262Error('#798: 536870911 << 24 === -16777216. Actual: ' + (536870911 << 24)); +} + + +if (1073741823 << 24 !== -16777216) { + throw new Test262Error('#799: 1073741823 << 24 === -16777216. Actual: ' + (1073741823 << 24)); +} + + +if (2147483647 << 24 !== -16777216) { + throw new Test262Error('#800: 2147483647 << 24 === -16777216. Actual: ' + (2147483647 << 24)); +} + + +if (0 << 25 !== 0) { + throw new Test262Error('#801: 0 << 25 === 0. Actual: ' + (0 << 25)); +} + + +if (1 << 25 !== 33554432) { + throw new Test262Error('#802: 1 << 25 === 33554432. Actual: ' + (1 << 25)); +} + + +if (3 << 25 !== 100663296) { + throw new Test262Error('#803: 3 << 25 === 100663296. Actual: ' + (3 << 25)); +} + + +if (7 << 25 !== 234881024) { + throw new Test262Error('#804: 7 << 25 === 234881024. Actual: ' + (7 << 25)); +} + + +if (15 << 25 !== 503316480) { + throw new Test262Error('#805: 15 << 25 === 503316480. Actual: ' + (15 << 25)); +} + + +if (31 << 25 !== 1040187392) { + throw new Test262Error('#806: 31 << 25 === 1040187392. Actual: ' + (31 << 25)); +} + + +if (63 << 25 !== 2113929216) { + throw new Test262Error('#807: 63 << 25 === 2113929216. Actual: ' + (63 << 25)); +} + + +if (127 << 25 !== -33554432) { + throw new Test262Error('#808: 127 << 25 === -33554432. Actual: ' + (127 << 25)); +} + + +if (255 << 25 !== -33554432) { + throw new Test262Error('#809: 255 << 25 === -33554432. Actual: ' + (255 << 25)); +} + + +if (511 << 25 !== -33554432) { + throw new Test262Error('#810: 511 << 25 === -33554432. Actual: ' + (511 << 25)); +} + + +if (1023 << 25 !== -33554432) { + throw new Test262Error('#811: 1023 << 25 === -33554432. Actual: ' + (1023 << 25)); +} + + +if (2047 << 25 !== -33554432) { + throw new Test262Error('#812: 2047 << 25 === -33554432. Actual: ' + (2047 << 25)); +} + + +if (4095 << 25 !== -33554432) { + throw new Test262Error('#813: 4095 << 25 === -33554432. Actual: ' + (4095 << 25)); +} + + +if (8191 << 25 !== -33554432) { + throw new Test262Error('#814: 8191 << 25 === -33554432. Actual: ' + (8191 << 25)); +} + + +if (16383 << 25 !== -33554432) { + throw new Test262Error('#815: 16383 << 25 === -33554432. Actual: ' + (16383 << 25)); +} + + +if (32767 << 25 !== -33554432) { + throw new Test262Error('#816: 32767 << 25 === -33554432. Actual: ' + (32767 << 25)); +} + + +if (65535 << 25 !== -33554432) { + throw new Test262Error('#817: 65535 << 25 === -33554432. Actual: ' + (65535 << 25)); +} + + +if (131071 << 25 !== -33554432) { + throw new Test262Error('#818: 131071 << 25 === -33554432. Actual: ' + (131071 << 25)); +} + + +if (262143 << 25 !== -33554432) { + throw new Test262Error('#819: 262143 << 25 === -33554432. Actual: ' + (262143 << 25)); +} + + +if (524287 << 25 !== -33554432) { + throw new Test262Error('#820: 524287 << 25 === -33554432. Actual: ' + (524287 << 25)); +} + + +if (1048575 << 25 !== -33554432) { + throw new Test262Error('#821: 1048575 << 25 === -33554432. Actual: ' + (1048575 << 25)); +} + + +if (2097151 << 25 !== -33554432) { + throw new Test262Error('#822: 2097151 << 25 === -33554432. Actual: ' + (2097151 << 25)); +} + + +if (4194303 << 25 !== -33554432) { + throw new Test262Error('#823: 4194303 << 25 === -33554432. Actual: ' + (4194303 << 25)); +} + + +if (8388607 << 25 !== -33554432) { + throw new Test262Error('#824: 8388607 << 25 === -33554432. Actual: ' + (8388607 << 25)); +} + + +if (16777215 << 25 !== -33554432) { + throw new Test262Error('#825: 16777215 << 25 === -33554432. Actual: ' + (16777215 << 25)); +} + + +if (33554431 << 25 !== -33554432) { + throw new Test262Error('#826: 33554431 << 25 === -33554432. Actual: ' + (33554431 << 25)); +} + + +if (67108863 << 25 !== -33554432) { + throw new Test262Error('#827: 67108863 << 25 === -33554432. Actual: ' + (67108863 << 25)); +} + + +if (134217727 << 25 !== -33554432) { + throw new Test262Error('#828: 134217727 << 25 === -33554432. Actual: ' + (134217727 << 25)); +} + + +if (268435455 << 25 !== -33554432) { + throw new Test262Error('#829: 268435455 << 25 === -33554432. Actual: ' + (268435455 << 25)); +} + + +if (536870911 << 25 !== -33554432) { + throw new Test262Error('#830: 536870911 << 25 === -33554432. Actual: ' + (536870911 << 25)); +} + + +if (1073741823 << 25 !== -33554432) { + throw new Test262Error('#831: 1073741823 << 25 === -33554432. Actual: ' + (1073741823 << 25)); +} + + +if (2147483647 << 25 !== -33554432) { + throw new Test262Error('#832: 2147483647 << 25 === -33554432. Actual: ' + (2147483647 << 25)); +} + + +if (0 << 26 !== 0) { + throw new Test262Error('#833: 0 << 26 === 0. Actual: ' + (0 << 26)); +} + + +if (1 << 26 !== 67108864) { + throw new Test262Error('#834: 1 << 26 === 67108864. Actual: ' + (1 << 26)); +} + + +if (3 << 26 !== 201326592) { + throw new Test262Error('#835: 3 << 26 === 201326592. Actual: ' + (3 << 26)); +} + + +if (7 << 26 !== 469762048) { + throw new Test262Error('#836: 7 << 26 === 469762048. Actual: ' + (7 << 26)); +} + + +if (15 << 26 !== 1006632960) { + throw new Test262Error('#837: 15 << 26 === 1006632960. Actual: ' + (15 << 26)); +} + + +if (31 << 26 !== 2080374784) { + throw new Test262Error('#838: 31 << 26 === 2080374784. Actual: ' + (31 << 26)); +} + + +if (63 << 26 !== -67108864) { + throw new Test262Error('#839: 63 << 26 === -67108864. Actual: ' + (63 << 26)); +} + + +if (127 << 26 !== -67108864) { + throw new Test262Error('#840: 127 << 26 === -67108864. Actual: ' + (127 << 26)); +} + + +if (255 << 26 !== -67108864) { + throw new Test262Error('#841: 255 << 26 === -67108864. Actual: ' + (255 << 26)); +} + + +if (511 << 26 !== -67108864) { + throw new Test262Error('#842: 511 << 26 === -67108864. Actual: ' + (511 << 26)); +} + + +if (1023 << 26 !== -67108864) { + throw new Test262Error('#843: 1023 << 26 === -67108864. Actual: ' + (1023 << 26)); +} + + +if (2047 << 26 !== -67108864) { + throw new Test262Error('#844: 2047 << 26 === -67108864. Actual: ' + (2047 << 26)); +} + + +if (4095 << 26 !== -67108864) { + throw new Test262Error('#845: 4095 << 26 === -67108864. Actual: ' + (4095 << 26)); +} + + +if (8191 << 26 !== -67108864) { + throw new Test262Error('#846: 8191 << 26 === -67108864. Actual: ' + (8191 << 26)); +} + + +if (16383 << 26 !== -67108864) { + throw new Test262Error('#847: 16383 << 26 === -67108864. Actual: ' + (16383 << 26)); +} + + +if (32767 << 26 !== -67108864) { + throw new Test262Error('#848: 32767 << 26 === -67108864. Actual: ' + (32767 << 26)); +} + + +if (65535 << 26 !== -67108864) { + throw new Test262Error('#849: 65535 << 26 === -67108864. Actual: ' + (65535 << 26)); +} + + +if (131071 << 26 !== -67108864) { + throw new Test262Error('#850: 131071 << 26 === -67108864. Actual: ' + (131071 << 26)); +} + + +if (262143 << 26 !== -67108864) { + throw new Test262Error('#851: 262143 << 26 === -67108864. Actual: ' + (262143 << 26)); +} + + +if (524287 << 26 !== -67108864) { + throw new Test262Error('#852: 524287 << 26 === -67108864. Actual: ' + (524287 << 26)); +} + + +if (1048575 << 26 !== -67108864) { + throw new Test262Error('#853: 1048575 << 26 === -67108864. Actual: ' + (1048575 << 26)); +} + + +if (2097151 << 26 !== -67108864) { + throw new Test262Error('#854: 2097151 << 26 === -67108864. Actual: ' + (2097151 << 26)); +} + + +if (4194303 << 26 !== -67108864) { + throw new Test262Error('#855: 4194303 << 26 === -67108864. Actual: ' + (4194303 << 26)); +} + + +if (8388607 << 26 !== -67108864) { + throw new Test262Error('#856: 8388607 << 26 === -67108864. Actual: ' + (8388607 << 26)); +} + + +if (16777215 << 26 !== -67108864) { + throw new Test262Error('#857: 16777215 << 26 === -67108864. Actual: ' + (16777215 << 26)); +} + + +if (33554431 << 26 !== -67108864) { + throw new Test262Error('#858: 33554431 << 26 === -67108864. Actual: ' + (33554431 << 26)); +} + + +if (67108863 << 26 !== -67108864) { + throw new Test262Error('#859: 67108863 << 26 === -67108864. Actual: ' + (67108863 << 26)); +} + + +if (134217727 << 26 !== -67108864) { + throw new Test262Error('#860: 134217727 << 26 === -67108864. Actual: ' + (134217727 << 26)); +} + + +if (268435455 << 26 !== -67108864) { + throw new Test262Error('#861: 268435455 << 26 === -67108864. Actual: ' + (268435455 << 26)); +} + + +if (536870911 << 26 !== -67108864) { + throw new Test262Error('#862: 536870911 << 26 === -67108864. Actual: ' + (536870911 << 26)); +} + + +if (1073741823 << 26 !== -67108864) { + throw new Test262Error('#863: 1073741823 << 26 === -67108864. Actual: ' + (1073741823 << 26)); +} + + +if (2147483647 << 26 !== -67108864) { + throw new Test262Error('#864: 2147483647 << 26 === -67108864. Actual: ' + (2147483647 << 26)); +} + + +if (0 << 27 !== 0) { + throw new Test262Error('#865: 0 << 27 === 0. Actual: ' + (0 << 27)); +} + + +if (1 << 27 !== 134217728) { + throw new Test262Error('#866: 1 << 27 === 134217728. Actual: ' + (1 << 27)); +} + + +if (3 << 27 !== 402653184) { + throw new Test262Error('#867: 3 << 27 === 402653184. Actual: ' + (3 << 27)); +} + + +if (7 << 27 !== 939524096) { + throw new Test262Error('#868: 7 << 27 === 939524096. Actual: ' + (7 << 27)); +} + + +if (15 << 27 !== 2013265920) { + throw new Test262Error('#869: 15 << 27 === 2013265920. Actual: ' + (15 << 27)); +} + + +if (31 << 27 !== -134217728) { + throw new Test262Error('#870: 31 << 27 === -134217728. Actual: ' + (31 << 27)); +} + + +if (63 << 27 !== -134217728) { + throw new Test262Error('#871: 63 << 27 === -134217728. Actual: ' + (63 << 27)); +} + + +if (127 << 27 !== -134217728) { + throw new Test262Error('#872: 127 << 27 === -134217728. Actual: ' + (127 << 27)); +} + + +if (255 << 27 !== -134217728) { + throw new Test262Error('#873: 255 << 27 === -134217728. Actual: ' + (255 << 27)); +} + + +if (511 << 27 !== -134217728) { + throw new Test262Error('#874: 511 << 27 === -134217728. Actual: ' + (511 << 27)); +} + + +if (1023 << 27 !== -134217728) { + throw new Test262Error('#875: 1023 << 27 === -134217728. Actual: ' + (1023 << 27)); +} + + +if (2047 << 27 !== -134217728) { + throw new Test262Error('#876: 2047 << 27 === -134217728. Actual: ' + (2047 << 27)); +} + + +if (4095 << 27 !== -134217728) { + throw new Test262Error('#877: 4095 << 27 === -134217728. Actual: ' + (4095 << 27)); +} + + +if (8191 << 27 !== -134217728) { + throw new Test262Error('#878: 8191 << 27 === -134217728. Actual: ' + (8191 << 27)); +} + + +if (16383 << 27 !== -134217728) { + throw new Test262Error('#879: 16383 << 27 === -134217728. Actual: ' + (16383 << 27)); +} + + +if (32767 << 27 !== -134217728) { + throw new Test262Error('#880: 32767 << 27 === -134217728. Actual: ' + (32767 << 27)); +} + + +if (65535 << 27 !== -134217728) { + throw new Test262Error('#881: 65535 << 27 === -134217728. Actual: ' + (65535 << 27)); +} + + +if (131071 << 27 !== -134217728) { + throw new Test262Error('#882: 131071 << 27 === -134217728. Actual: ' + (131071 << 27)); +} + + +if (262143 << 27 !== -134217728) { + throw new Test262Error('#883: 262143 << 27 === -134217728. Actual: ' + (262143 << 27)); +} + + +if (524287 << 27 !== -134217728) { + throw new Test262Error('#884: 524287 << 27 === -134217728. Actual: ' + (524287 << 27)); +} + + +if (1048575 << 27 !== -134217728) { + throw new Test262Error('#885: 1048575 << 27 === -134217728. Actual: ' + (1048575 << 27)); +} + + +if (2097151 << 27 !== -134217728) { + throw new Test262Error('#886: 2097151 << 27 === -134217728. Actual: ' + (2097151 << 27)); +} + + +if (4194303 << 27 !== -134217728) { + throw new Test262Error('#887: 4194303 << 27 === -134217728. Actual: ' + (4194303 << 27)); +} + + +if (8388607 << 27 !== -134217728) { + throw new Test262Error('#888: 8388607 << 27 === -134217728. Actual: ' + (8388607 << 27)); +} + + +if (16777215 << 27 !== -134217728) { + throw new Test262Error('#889: 16777215 << 27 === -134217728. Actual: ' + (16777215 << 27)); +} + + +if (33554431 << 27 !== -134217728) { + throw new Test262Error('#890: 33554431 << 27 === -134217728. Actual: ' + (33554431 << 27)); +} + + +if (67108863 << 27 !== -134217728) { + throw new Test262Error('#891: 67108863 << 27 === -134217728. Actual: ' + (67108863 << 27)); +} + + +if (134217727 << 27 !== -134217728) { + throw new Test262Error('#892: 134217727 << 27 === -134217728. Actual: ' + (134217727 << 27)); +} + + +if (268435455 << 27 !== -134217728) { + throw new Test262Error('#893: 268435455 << 27 === -134217728. Actual: ' + (268435455 << 27)); +} + + +if (536870911 << 27 !== -134217728) { + throw new Test262Error('#894: 536870911 << 27 === -134217728. Actual: ' + (536870911 << 27)); +} + + +if (1073741823 << 27 !== -134217728) { + throw new Test262Error('#895: 1073741823 << 27 === -134217728. Actual: ' + (1073741823 << 27)); +} + + +if (2147483647 << 27 !== -134217728) { + throw new Test262Error('#896: 2147483647 << 27 === -134217728. Actual: ' + (2147483647 << 27)); +} + + +if (0 << 28 !== 0) { + throw new Test262Error('#897: 0 << 28 === 0. Actual: ' + (0 << 28)); +} + + +if (1 << 28 !== 268435456) { + throw new Test262Error('#898: 1 << 28 === 268435456. Actual: ' + (1 << 28)); +} + + +if (3 << 28 !== 805306368) { + throw new Test262Error('#899: 3 << 28 === 805306368. Actual: ' + (3 << 28)); +} + + +if (7 << 28 !== 1879048192) { + throw new Test262Error('#900: 7 << 28 === 1879048192. Actual: ' + (7 << 28)); +} + + +if (15 << 28 !== -268435456) { + throw new Test262Error('#901: 15 << 28 === -268435456. Actual: ' + (15 << 28)); +} + + +if (31 << 28 !== -268435456) { + throw new Test262Error('#902: 31 << 28 === -268435456. Actual: ' + (31 << 28)); +} + + +if (63 << 28 !== -268435456) { + throw new Test262Error('#903: 63 << 28 === -268435456. Actual: ' + (63 << 28)); +} + + +if (127 << 28 !== -268435456) { + throw new Test262Error('#904: 127 << 28 === -268435456. Actual: ' + (127 << 28)); +} + + +if (255 << 28 !== -268435456) { + throw new Test262Error('#905: 255 << 28 === -268435456. Actual: ' + (255 << 28)); +} + + +if (511 << 28 !== -268435456) { + throw new Test262Error('#906: 511 << 28 === -268435456. Actual: ' + (511 << 28)); +} + + +if (1023 << 28 !== -268435456) { + throw new Test262Error('#907: 1023 << 28 === -268435456. Actual: ' + (1023 << 28)); +} + + +if (2047 << 28 !== -268435456) { + throw new Test262Error('#908: 2047 << 28 === -268435456. Actual: ' + (2047 << 28)); +} + + +if (4095 << 28 !== -268435456) { + throw new Test262Error('#909: 4095 << 28 === -268435456. Actual: ' + (4095 << 28)); +} + + +if (8191 << 28 !== -268435456) { + throw new Test262Error('#910: 8191 << 28 === -268435456. Actual: ' + (8191 << 28)); +} + + +if (16383 << 28 !== -268435456) { + throw new Test262Error('#911: 16383 << 28 === -268435456. Actual: ' + (16383 << 28)); +} + + +if (32767 << 28 !== -268435456) { + throw new Test262Error('#912: 32767 << 28 === -268435456. Actual: ' + (32767 << 28)); +} + + +if (65535 << 28 !== -268435456) { + throw new Test262Error('#913: 65535 << 28 === -268435456. Actual: ' + (65535 << 28)); +} + + +if (131071 << 28 !== -268435456) { + throw new Test262Error('#914: 131071 << 28 === -268435456. Actual: ' + (131071 << 28)); +} + + +if (262143 << 28 !== -268435456) { + throw new Test262Error('#915: 262143 << 28 === -268435456. Actual: ' + (262143 << 28)); +} + + +if (524287 << 28 !== -268435456) { + throw new Test262Error('#916: 524287 << 28 === -268435456. Actual: ' + (524287 << 28)); +} + + +if (1048575 << 28 !== -268435456) { + throw new Test262Error('#917: 1048575 << 28 === -268435456. Actual: ' + (1048575 << 28)); +} + + +if (2097151 << 28 !== -268435456) { + throw new Test262Error('#918: 2097151 << 28 === -268435456. Actual: ' + (2097151 << 28)); +} + + +if (4194303 << 28 !== -268435456) { + throw new Test262Error('#919: 4194303 << 28 === -268435456. Actual: ' + (4194303 << 28)); +} + + +if (8388607 << 28 !== -268435456) { + throw new Test262Error('#920: 8388607 << 28 === -268435456. Actual: ' + (8388607 << 28)); +} + + +if (16777215 << 28 !== -268435456) { + throw new Test262Error('#921: 16777215 << 28 === -268435456. Actual: ' + (16777215 << 28)); +} + + +if (33554431 << 28 !== -268435456) { + throw new Test262Error('#922: 33554431 << 28 === -268435456. Actual: ' + (33554431 << 28)); +} + + +if (67108863 << 28 !== -268435456) { + throw new Test262Error('#923: 67108863 << 28 === -268435456. Actual: ' + (67108863 << 28)); +} + + +if (134217727 << 28 !== -268435456) { + throw new Test262Error('#924: 134217727 << 28 === -268435456. Actual: ' + (134217727 << 28)); +} + + +if (268435455 << 28 !== -268435456) { + throw new Test262Error('#925: 268435455 << 28 === -268435456. Actual: ' + (268435455 << 28)); +} + + +if (536870911 << 28 !== -268435456) { + throw new Test262Error('#926: 536870911 << 28 === -268435456. Actual: ' + (536870911 << 28)); +} + + +if (1073741823 << 28 !== -268435456) { + throw new Test262Error('#927: 1073741823 << 28 === -268435456. Actual: ' + (1073741823 << 28)); +} + + +if (2147483647 << 28 !== -268435456) { + throw new Test262Error('#928: 2147483647 << 28 === -268435456. Actual: ' + (2147483647 << 28)); +} + + +if (0 << 29 !== 0) { + throw new Test262Error('#929: 0 << 29 === 0. Actual: ' + (0 << 29)); +} + + +if (1 << 29 !== 536870912) { + throw new Test262Error('#930: 1 << 29 === 536870912. Actual: ' + (1 << 29)); +} + + +if (3 << 29 !== 1610612736) { + throw new Test262Error('#931: 3 << 29 === 1610612736. Actual: ' + (3 << 29)); +} + + +if (7 << 29 !== -536870912) { + throw new Test262Error('#932: 7 << 29 === -536870912. Actual: ' + (7 << 29)); +} + + +if (15 << 29 !== -536870912) { + throw new Test262Error('#933: 15 << 29 === -536870912. Actual: ' + (15 << 29)); +} + + +if (31 << 29 !== -536870912) { + throw new Test262Error('#934: 31 << 29 === -536870912. Actual: ' + (31 << 29)); +} + + +if (63 << 29 !== -536870912) { + throw new Test262Error('#935: 63 << 29 === -536870912. Actual: ' + (63 << 29)); +} + + +if (127 << 29 !== -536870912) { + throw new Test262Error('#936: 127 << 29 === -536870912. Actual: ' + (127 << 29)); +} + + +if (255 << 29 !== -536870912) { + throw new Test262Error('#937: 255 << 29 === -536870912. Actual: ' + (255 << 29)); +} + + +if (511 << 29 !== -536870912) { + throw new Test262Error('#938: 511 << 29 === -536870912. Actual: ' + (511 << 29)); +} + + +if (1023 << 29 !== -536870912) { + throw new Test262Error('#939: 1023 << 29 === -536870912. Actual: ' + (1023 << 29)); +} + + +if (2047 << 29 !== -536870912) { + throw new Test262Error('#940: 2047 << 29 === -536870912. Actual: ' + (2047 << 29)); +} + + +if (4095 << 29 !== -536870912) { + throw new Test262Error('#941: 4095 << 29 === -536870912. Actual: ' + (4095 << 29)); +} + + +if (8191 << 29 !== -536870912) { + throw new Test262Error('#942: 8191 << 29 === -536870912. Actual: ' + (8191 << 29)); +} + + +if (16383 << 29 !== -536870912) { + throw new Test262Error('#943: 16383 << 29 === -536870912. Actual: ' + (16383 << 29)); +} + + +if (32767 << 29 !== -536870912) { + throw new Test262Error('#944: 32767 << 29 === -536870912. Actual: ' + (32767 << 29)); +} + + +if (65535 << 29 !== -536870912) { + throw new Test262Error('#945: 65535 << 29 === -536870912. Actual: ' + (65535 << 29)); +} + + +if (131071 << 29 !== -536870912) { + throw new Test262Error('#946: 131071 << 29 === -536870912. Actual: ' + (131071 << 29)); +} + + +if (262143 << 29 !== -536870912) { + throw new Test262Error('#947: 262143 << 29 === -536870912. Actual: ' + (262143 << 29)); +} + + +if (524287 << 29 !== -536870912) { + throw new Test262Error('#948: 524287 << 29 === -536870912. Actual: ' + (524287 << 29)); +} + + +if (1048575 << 29 !== -536870912) { + throw new Test262Error('#949: 1048575 << 29 === -536870912. Actual: ' + (1048575 << 29)); +} + + +if (2097151 << 29 !== -536870912) { + throw new Test262Error('#950: 2097151 << 29 === -536870912. Actual: ' + (2097151 << 29)); +} + + +if (4194303 << 29 !== -536870912) { + throw new Test262Error('#951: 4194303 << 29 === -536870912. Actual: ' + (4194303 << 29)); +} + + +if (8388607 << 29 !== -536870912) { + throw new Test262Error('#952: 8388607 << 29 === -536870912. Actual: ' + (8388607 << 29)); +} + + +if (16777215 << 29 !== -536870912) { + throw new Test262Error('#953: 16777215 << 29 === -536870912. Actual: ' + (16777215 << 29)); +} + + +if (33554431 << 29 !== -536870912) { + throw new Test262Error('#954: 33554431 << 29 === -536870912. Actual: ' + (33554431 << 29)); +} + + +if (67108863 << 29 !== -536870912) { + throw new Test262Error('#955: 67108863 << 29 === -536870912. Actual: ' + (67108863 << 29)); +} + + +if (134217727 << 29 !== -536870912) { + throw new Test262Error('#956: 134217727 << 29 === -536870912. Actual: ' + (134217727 << 29)); +} + + +if (268435455 << 29 !== -536870912) { + throw new Test262Error('#957: 268435455 << 29 === -536870912. Actual: ' + (268435455 << 29)); +} + + +if (536870911 << 29 !== -536870912) { + throw new Test262Error('#958: 536870911 << 29 === -536870912. Actual: ' + (536870911 << 29)); +} + + +if (1073741823 << 29 !== -536870912) { + throw new Test262Error('#959: 1073741823 << 29 === -536870912. Actual: ' + (1073741823 << 29)); +} + + +if (2147483647 << 29 !== -536870912) { + throw new Test262Error('#960: 2147483647 << 29 === -536870912. Actual: ' + (2147483647 << 29)); +} + + +if (0 << 30 !== 0) { + throw new Test262Error('#961: 0 << 30 === 0. Actual: ' + (0 << 30)); +} + + +if (1 << 30 !== 1073741824) { + throw new Test262Error('#962: 1 << 30 === 1073741824. Actual: ' + (1 << 30)); +} + + +if (3 << 30 !== -1073741824) { + throw new Test262Error('#963: 3 << 30 === -1073741824. Actual: ' + (3 << 30)); +} + + +if (7 << 30 !== -1073741824) { + throw new Test262Error('#964: 7 << 30 === -1073741824. Actual: ' + (7 << 30)); +} + + +if (15 << 30 !== -1073741824) { + throw new Test262Error('#965: 15 << 30 === -1073741824. Actual: ' + (15 << 30)); +} + + +if (31 << 30 !== -1073741824) { + throw new Test262Error('#966: 31 << 30 === -1073741824. Actual: ' + (31 << 30)); +} + + +if (63 << 30 !== -1073741824) { + throw new Test262Error('#967: 63 << 30 === -1073741824. Actual: ' + (63 << 30)); +} + + +if (127 << 30 !== -1073741824) { + throw new Test262Error('#968: 127 << 30 === -1073741824. Actual: ' + (127 << 30)); +} + + +if (255 << 30 !== -1073741824) { + throw new Test262Error('#969: 255 << 30 === -1073741824. Actual: ' + (255 << 30)); +} + + +if (511 << 30 !== -1073741824) { + throw new Test262Error('#970: 511 << 30 === -1073741824. Actual: ' + (511 << 30)); +} + + +if (1023 << 30 !== -1073741824) { + throw new Test262Error('#971: 1023 << 30 === -1073741824. Actual: ' + (1023 << 30)); +} + + +if (2047 << 30 !== -1073741824) { + throw new Test262Error('#972: 2047 << 30 === -1073741824. Actual: ' + (2047 << 30)); +} + + +if (4095 << 30 !== -1073741824) { + throw new Test262Error('#973: 4095 << 30 === -1073741824. Actual: ' + (4095 << 30)); +} + + +if (8191 << 30 !== -1073741824) { + throw new Test262Error('#974: 8191 << 30 === -1073741824. Actual: ' + (8191 << 30)); +} + + +if (16383 << 30 !== -1073741824) { + throw new Test262Error('#975: 16383 << 30 === -1073741824. Actual: ' + (16383 << 30)); +} + + +if (32767 << 30 !== -1073741824) { + throw new Test262Error('#976: 32767 << 30 === -1073741824. Actual: ' + (32767 << 30)); +} + + +if (65535 << 30 !== -1073741824) { + throw new Test262Error('#977: 65535 << 30 === -1073741824. Actual: ' + (65535 << 30)); +} + + +if (131071 << 30 !== -1073741824) { + throw new Test262Error('#978: 131071 << 30 === -1073741824. Actual: ' + (131071 << 30)); +} + + +if (262143 << 30 !== -1073741824) { + throw new Test262Error('#979: 262143 << 30 === -1073741824. Actual: ' + (262143 << 30)); +} + + +if (524287 << 30 !== -1073741824) { + throw new Test262Error('#980: 524287 << 30 === -1073741824. Actual: ' + (524287 << 30)); +} + + +if (1048575 << 30 !== -1073741824) { + throw new Test262Error('#981: 1048575 << 30 === -1073741824. Actual: ' + (1048575 << 30)); +} + + +if (2097151 << 30 !== -1073741824) { + throw new Test262Error('#982: 2097151 << 30 === -1073741824. Actual: ' + (2097151 << 30)); +} + + +if (4194303 << 30 !== -1073741824) { + throw new Test262Error('#983: 4194303 << 30 === -1073741824. Actual: ' + (4194303 << 30)); +} + + +if (8388607 << 30 !== -1073741824) { + throw new Test262Error('#984: 8388607 << 30 === -1073741824. Actual: ' + (8388607 << 30)); +} + + +if (16777215 << 30 !== -1073741824) { + throw new Test262Error('#985: 16777215 << 30 === -1073741824. Actual: ' + (16777215 << 30)); +} + + +if (33554431 << 30 !== -1073741824) { + throw new Test262Error('#986: 33554431 << 30 === -1073741824. Actual: ' + (33554431 << 30)); +} + + +if (67108863 << 30 !== -1073741824) { + throw new Test262Error('#987: 67108863 << 30 === -1073741824. Actual: ' + (67108863 << 30)); +} + + +if (134217727 << 30 !== -1073741824) { + throw new Test262Error('#988: 134217727 << 30 === -1073741824. Actual: ' + (134217727 << 30)); +} + + +if (268435455 << 30 !== -1073741824) { + throw new Test262Error('#989: 268435455 << 30 === -1073741824. Actual: ' + (268435455 << 30)); +} + + +if (536870911 << 30 !== -1073741824) { + throw new Test262Error('#990: 536870911 << 30 === -1073741824. Actual: ' + (536870911 << 30)); +} + + +if (1073741823 << 30 !== -1073741824) { + throw new Test262Error('#991: 1073741823 << 30 === -1073741824. Actual: ' + (1073741823 << 30)); +} + + +if (2147483647 << 30 !== -1073741824) { + throw new Test262Error('#992: 2147483647 << 30 === -1073741824. Actual: ' + (2147483647 << 30)); +} + + +if (0 << 31 !== 0) { + throw new Test262Error('#993: 0 << 31 === 0. Actual: ' + (0 << 31)); +} + + +if (1 << 31 !== -2147483648) { + throw new Test262Error('#994: 1 << 31 === -2147483648. Actual: ' + (1 << 31)); +} + + +if (3 << 31 !== -2147483648) { + throw new Test262Error('#995: 3 << 31 === -2147483648. Actual: ' + (3 << 31)); +} + + +if (7 << 31 !== -2147483648) { + throw new Test262Error('#996: 7 << 31 === -2147483648. Actual: ' + (7 << 31)); +} + + +if (15 << 31 !== -2147483648) { + throw new Test262Error('#997: 15 << 31 === -2147483648. Actual: ' + (15 << 31)); +} + + +if (31 << 31 !== -2147483648) { + throw new Test262Error('#998: 31 << 31 === -2147483648. Actual: ' + (31 << 31)); +} + + +if (63 << 31 !== -2147483648) { + throw new Test262Error('#999: 63 << 31 === -2147483648. Actual: ' + (63 << 31)); +} + + +if (127 << 31 !== -2147483648) { + throw new Test262Error('#1000: 127 << 31 === -2147483648. Actual: ' + (127 << 31)); +} + + +if (255 << 31 !== -2147483648) { + throw new Test262Error('#1001: 255 << 31 === -2147483648. Actual: ' + (255 << 31)); +} + + +if (511 << 31 !== -2147483648) { + throw new Test262Error('#1002: 511 << 31 === -2147483648. Actual: ' + (511 << 31)); +} + + +if (1023 << 31 !== -2147483648) { + throw new Test262Error('#1003: 1023 << 31 === -2147483648. Actual: ' + (1023 << 31)); +} + + +if (2047 << 31 !== -2147483648) { + throw new Test262Error('#1004: 2047 << 31 === -2147483648. Actual: ' + (2047 << 31)); +} + + +if (4095 << 31 !== -2147483648) { + throw new Test262Error('#1005: 4095 << 31 === -2147483648. Actual: ' + (4095 << 31)); +} + + +if (8191 << 31 !== -2147483648) { + throw new Test262Error('#1006: 8191 << 31 === -2147483648. Actual: ' + (8191 << 31)); +} + + +if (16383 << 31 !== -2147483648) { + throw new Test262Error('#1007: 16383 << 31 === -2147483648. Actual: ' + (16383 << 31)); +} + + +if (32767 << 31 !== -2147483648) { + throw new Test262Error('#1008: 32767 << 31 === -2147483648. Actual: ' + (32767 << 31)); +} + + +if (65535 << 31 !== -2147483648) { + throw new Test262Error('#1009: 65535 << 31 === -2147483648. Actual: ' + (65535 << 31)); +} + + +if (131071 << 31 !== -2147483648) { + throw new Test262Error('#1010: 131071 << 31 === -2147483648. Actual: ' + (131071 << 31)); +} + + +if (262143 << 31 !== -2147483648) { + throw new Test262Error('#1011: 262143 << 31 === -2147483648. Actual: ' + (262143 << 31)); +} + + +if (524287 << 31 !== -2147483648) { + throw new Test262Error('#1012: 524287 << 31 === -2147483648. Actual: ' + (524287 << 31)); +} + + +if (1048575 << 31 !== -2147483648) { + throw new Test262Error('#1013: 1048575 << 31 === -2147483648. Actual: ' + (1048575 << 31)); +} + + +if (2097151 << 31 !== -2147483648) { + throw new Test262Error('#1014: 2097151 << 31 === -2147483648. Actual: ' + (2097151 << 31)); +} + + +if (4194303 << 31 !== -2147483648) { + throw new Test262Error('#1015: 4194303 << 31 === -2147483648. Actual: ' + (4194303 << 31)); +} + + +if (8388607 << 31 !== -2147483648) { + throw new Test262Error('#1016: 8388607 << 31 === -2147483648. Actual: ' + (8388607 << 31)); +} + + +if (16777215 << 31 !== -2147483648) { + throw new Test262Error('#1017: 16777215 << 31 === -2147483648. Actual: ' + (16777215 << 31)); +} + + +if (33554431 << 31 !== -2147483648) { + throw new Test262Error('#1018: 33554431 << 31 === -2147483648. Actual: ' + (33554431 << 31)); +} + + +if (67108863 << 31 !== -2147483648) { + throw new Test262Error('#1019: 67108863 << 31 === -2147483648. Actual: ' + (67108863 << 31)); +} + + +if (134217727 << 31 !== -2147483648) { + throw new Test262Error('#1020: 134217727 << 31 === -2147483648. Actual: ' + (134217727 << 31)); +} + + +if (268435455 << 31 !== -2147483648) { + throw new Test262Error('#1021: 268435455 << 31 === -2147483648. Actual: ' + (268435455 << 31)); +} + + +if (536870911 << 31 !== -2147483648) { + throw new Test262Error('#1022: 536870911 << 31 === -2147483648. Actual: ' + (536870911 << 31)); +} + + +if (1073741823 << 31 !== -2147483648) { + throw new Test262Error('#1023: 1073741823 << 31 === -2147483648. Actual: ' + (1073741823 << 31)); +} + + +if (2147483647 << 31 !== -2147483648) { + throw new Test262Error('#1024: 2147483647 << 31 === -2147483648. Actual: ' + (2147483647 << 31)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.1_T1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.1_T1.js new file mode 100644 index 0000000000..e7fa051a10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.1_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y uses ToInt32(ShiftExpression) +es5id: 11.7.1_A5.1_T1 +description: Checking boundary points +---*/ + +//CHECK#1 +if (2147483648.1 << 0 !== -2147483648) { + throw new Test262Error('#1: 2147483648.1 << 0 === -2147483648. Actual: ' + (2147483648.1 << 0)); +} + +//CHECK#2 +if (4294967296.1 << 0 !== 0) { + throw new Test262Error('#2: 4294967296.1 << 0 === 0. Actual: ' + (4294967296.1 << 0)); +} + +//CHECK#3 +if (6442450944.1 << 0 !== -2147483648) { + throw new Test262Error('#3: 6442450944.1 << 0 === -2147483648. Actual: ' + (6442450944.1 << 0)); +} + +//CHECK#4 +if (4294967295.1 << 0 !== -1) { + throw new Test262Error('#4: 4294967295.1 << 0 === -1. Actual: ' + (4294967295.1 << 0)); +} + +//CHECK#5 +if (6442450943.1 << 0 !== 2147483647) { + throw new Test262Error('#5: 6442450943.1 << 0 === 2147483647. Actual: ' + (6442450943.1 << 0)); +} + +//CHECK#6 +if (-2147483649.1 << 0 !== 2147483647) { + throw new Test262Error('#6: -2147483649.1 << 0 === 2147483647. Actual: ' + (-2147483649.1 << 0)); +} + +//CHECK#7 +if (-4294967297.1 << 0 !== -1) { + throw new Test262Error('#7: -4294967297.1 << 0 === -1. Actual: ' + (-4294967297.1 << 0)); +} + +//CHECK#8 +if (-6442450945.1 << 0 !== 2147483647) { + throw new Test262Error('#8: -6442450945.1 << 0 === 2147483647. Actual: ' + (-6442450945.1 << 0)); +} + +//CHECK#9 +if (-4294967296.1 << 0 !== 0) { + throw new Test262Error('#9: -4294967296.1 << 0 === 0 . Actual: ' + (-4294967296.1 << 0)); +} + +//CHECK#10 +if (-6442450944.1 << 0 !== -2147483648) { + throw new Test262Error('#10: -6442450944.1 << 0 === -2147483648. Actual: ' + (-6442450944.1 << 0)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.2_T1.js b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.2_T1.js new file mode 100644 index 0000000000..738fecab91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S11.7.1_A5.2_T1.js @@ -0,0 +1,330 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x << y uses ToUint32(AdditiveExpression) & 31 +es5id: 11.7.1_A5.2_T1 +description: Checking distinct points +---*/ + +//CHECK#1 +if (1 << -32.1 !== 1) { + throw new Test262Error('#1: 1 << -32.1 === 1. Actual: ' + (1 << -32.1)); +} + +//CHECK#2 +if (1 << -31.1 !== 2) { + throw new Test262Error('#2: 1 << -31.1 === 2. Actual: ' + (1 << -31.1)); +} + +//CHECK#3 +if (1 << -30.1 !== 4) { + throw new Test262Error('#3: 1 << -30.1 === 4. Actual: ' + (1 << -30.1)); +} + +//CHECK#4 +if (1 << -29.1 !== 8) { + throw new Test262Error('#4: 1 << -29.1 === 8. Actual: ' + (1 << -29.1)); +} + +//CHECK#5 +if (1 << -28.1 !== 16) { + throw new Test262Error('#5: 1 << -28.1 === 16. Actual: ' + (1 << -28.1)); +} + +//CHECK#6 +if (1 << -27.1 !== 32) { + throw new Test262Error('#6: 1 << -27.1 === 32. Actual: ' + (1 << -27.1)); +} + +//CHECK#7 +if (1 << -26.1 !== 64) { + throw new Test262Error('#7: 1 << -26.1 === 64. Actual: ' + (1 << -26.1)); +} + +//CHECK#8 +if (1 << -25.1 !== 128) { + throw new Test262Error('#8: 1 << -25.1 === 128. Actual: ' + (1 << -25.1)); +} + +//CHECK#9 +if (1 << -24.1 !== 256) { + throw new Test262Error('#9: 1 << -24.1 === 256. Actual: ' + (1 << -24.1)); +} + +//CHECK#10 +if (1 << -23.1 !== 512) { + throw new Test262Error('#10: 1 << -23.1 === 512. Actual: ' + (1 << -23.1)); +} + +//CHECK#11 +if (1 << -22.1 !== 1024) { + throw new Test262Error('#11: 1 << -22.1 === 1024. Actual: ' + (1 << -22.1)); +} + +//CHECK#12 +if (1 << -21.1 !== 2048) { + throw new Test262Error('#12: 1 << -21.1 === 2048. Actual: ' + (1 << -21.1)); +} + +//CHECK#13 +if (1 << -20.1 !== 4096) { + throw new Test262Error('#13: 1 << -20.1 === 4096. Actual: ' + (1 << -20.1)); +} + +//CHECK#14 +if (1 << -19.1 !== 8192) { + throw new Test262Error('#14: 1 << -19.1 === 8192. Actual: ' + (1 << -19.1)); +} + +//CHECK#15 +if (1 << -18.1 !== 16384) { + throw new Test262Error('#15: 1 << -18.1 === 16384. Actual: ' + (1 << -18.1)); +} + +//CHECK#16 +if (1 << -17.1 !== 32768) { + throw new Test262Error('#16: 1 << -17.1 === 32768. Actual: ' + (1 << -17.1)); +} + +//CHECK#17 +if (1 << -16.1 !== 65536) { + throw new Test262Error('#17: 1 << -16.1 === 65536. Actual: ' + (1 << -16.1)); +} + +//CHECK#18 +if (1 << -15.1 !== 131072) { + throw new Test262Error('#18: 1 << -15.1 === 131072. Actual: ' + (1 << -15.1)); +} + +//CHECK#19 +if (1 << -14.1 !== 262144) { + throw new Test262Error('#19: 1 << -14.1 === 262144. Actual: ' + (1 << -14.1)); +} + +//CHECK#20 +if (1 << -13.1 !== 524288) { + throw new Test262Error('#20: 1 << -13.1 === 524288. Actual: ' + (1 << -13.1)); +} + +//CHECK#21 +if (1 << -12.1 !== 1048576) { + throw new Test262Error('#21: 1 << -12.1 === 1048576. Actual: ' + (1 << -12.1)); +} + +//CHECK#22 +if (1 << -11.1 !== 2097152) { + throw new Test262Error('#22: 1 << -11.1 === 2097152. Actual: ' + (1 << -11.1)); +} + +//CHECK#23 +if (1 << -10.1 !== 4194304) { + throw new Test262Error('#23: 1 << -10.1 === 4194304. Actual: ' + (1 << -10.1)); +} + +//CHECK#24 +if (1 << -9.1 !== 8388608) { + throw new Test262Error('#24: 1 << -9.1 === 8388608. Actual: ' + (1 << -9.1)); +} + +//CHECK#25 +if (1 << -8.1 !== 16777216) { + throw new Test262Error('#25: 1 << -8.1 === 16777216. Actual: ' + (1 << -8.1)); +} + +//CHECK#26 +if (1 << -7.1 !== 33554432) { + throw new Test262Error('#26: 1 << -7.1 === 33554432. Actual: ' + (1 << -7.1)); +} + +//CHECK#27 +if (1 << -6.1 !== 67108864) { + throw new Test262Error('#27: 1 << -6.1 === 67108864. Actual: ' + (1 << -6.1)); +} + +//CHECK#28 +if (1 << -5.1 !== 134217728) { + throw new Test262Error('#28: 1 << -5.1 === 134217728. Actual: ' + (1 << -5.1)); +} + +//CHECK#29 +if (1 << -4.1 !== 268435456) { + throw new Test262Error('#29: 1 << -4.1 === 268435456. Actual: ' + (1 << -4.1)); +} + +//CHECK#30 +if (1 << -3.1 !== 536870912) { + throw new Test262Error('#30: 1 << -3.1 === 536870912. Actual: ' + (1 << -3.1)); +} + +//CHECK#31 +if (1 << -2.1 !== 1073741824) { + throw new Test262Error('#31: 1 << -2.1 === 1073741824. Actual: ' + (1 << -2.1)); +} + +//CHECK#32 +if (1 << -1.1 !== -2147483648) { + throw new Test262Error('#32: 1 << -1.1 === -2147483648. Actual: ' + (1 << -1.1)); +} + +//CHECK#33 +if (1 << 32.1 !== 1) { + throw new Test262Error('#33: 1 << 32.1 === 1. Actual: ' + (1 << 32.1)); +} + +//CHECK#34 +if (1 << 33.1 !== 2) { + throw new Test262Error('#34: 1 << 33.1 === 2. Actual: ' + (1 << 33.1)); +} + +//CHECK#35 +if (1 << 34.1 !== 4) { + throw new Test262Error('#35: 1 << 34.1 === 4. Actual: ' + (1 << 34.1)); +} + +//CHECK#36 +if (1 << 35.1 !== 8) { + throw new Test262Error('#36: 1 << 35.1 === 8. Actual: ' + (1 << 35.1)); +} + +//CHECK#37 +if (1 << 36.1 !== 16) { + throw new Test262Error('#37: 1 << 36.1 === 16. Actual: ' + (1 << 36.1)); +} + +//CHECK#38 +if (1 << 37.1 !== 32) { + throw new Test262Error('#38: 1 << 37.1 === 32. Actual: ' + (1 << 37.1)); +} + +//CHECK#39 +if (1 << 38.1 !== 64) { + throw new Test262Error('#39: 1 << 38.1 === 64. Actual: ' + (1 << 38.1)); +} + +//CHECK#40 +if (1 << 39.1 !== 128) { + throw new Test262Error('#40: 1 << 39.1 === 128. Actual: ' + (1 << 39.1)); +} + +//CHECK#41 +if (1 << 40.1 !== 256) { + throw new Test262Error('#41: 1 << 40.1 === 256. Actual: ' + (1 << 40.1)); +} + +//CHECK#42 +if (1 << 41.1 !== 512) { + throw new Test262Error('#42: 1 << 41.1 === 512. Actual: ' + (1 << 41.1)); +} + +//CHECK#43 +if (1 << 42.1 !== 1024) { + throw new Test262Error('#43: 1 << 42.1 === 1024. Actual: ' + (1 << 42.1)); +} + +//CHECK#44 +if (1 << 43.1 !== 2048) { + throw new Test262Error('#44: 1 << 43.1 === 2048. Actual: ' + (1 << 43.1)); +} + +//CHECK#45 +if (1 << 44.1 !== 4096) { + throw new Test262Error('#45: 1 << 44.1 === 4096. Actual: ' + (1 << 44.1)); +} + +//CHECK#46 +if (1 << 45.1 !== 8192) { + throw new Test262Error('#46: 1 << 45.1 === 8192. Actual: ' + (1 << 45.1)); +} + +//CHECK#47 +if (1 << 46.1 !== 16384) { + throw new Test262Error('#47: 1 << 46.1 === 16384. Actual: ' + (1 << 46.1)); +} + +//CHECK#48 +if (1 << 47.1 !== 32768) { + throw new Test262Error('#48: 1 << 47.1 === 32768. Actual: ' + (1 << 47.1)); +} + +//CHECK#49 +if (1 << 48.1 !== 65536) { + throw new Test262Error('#49: 1 << 48.1 === 65536. Actual: ' + (1 << 48.1)); +} + +//CHECK#50 +if (1 << 49.1 !== 131072) { + throw new Test262Error('#50: 1 << 49.1 === 131072. Actual: ' + (1 << 49.1)); +} + +//CHECK#51 +if (1 << 50.1 !== 262144) { + throw new Test262Error('#51: 1 << 50.1 === 262144. Actual: ' + (1 << 50.1)); +} + +//CHECK#52 +if (1 << 51.1 !== 524288) { + throw new Test262Error('#52: 1 << 51.1 === 524288. Actual: ' + (1 << 51.1)); +} + +//CHECK#53 +if (1 << 52.1 !== 1048576) { + throw new Test262Error('#53: 1 << 52.1 === 1048576. Actual: ' + (1 << 52.1)); +} + +//CHECK#54 +if (1 << 53.1 !== 2097152) { + throw new Test262Error('#54: 1 << 53.1 === 2097152. Actual: ' + (1 << 53.1)); +} + +//CHECK#55 +if (1 << 54.1 !== 4194304) { + throw new Test262Error('#55: 1 << 54.1 === 4194304. Actual: ' + (1 << 54.1)); +} + +//CHECK#56 +if (1 << 55.1 !== 8388608) { + throw new Test262Error('#56: 1 << 55.1 === 8388608. Actual: ' + (1 << 55.1)); +} + +//CHECK#57 +if (1 << 56.1 !== 16777216) { + throw new Test262Error('#57: 1 << 56.1 === 16777216. Actual: ' + (1 << 56.1)); +} + +//CHECK#58 +if (1 << 57.1 !== 33554432) { + throw new Test262Error('#58: 1 << 57.1 === 33554432. Actual: ' + (1 << 57.1)); +} + +//CHECK#59 +if (1 << 58.1 !== 67108864) { + throw new Test262Error('#59: 1 << 58.1 === 67108864. Actual: ' + (1 << 58.1)); +} + +//CHECK#60 +if (1 << 59.1 !== 134217728) { + throw new Test262Error('#60: 1 << 59.1 === 134217728. Actual: ' + (1 << 59.1)); +} + +//CHECK#61 +if (1 << 60.1 !== 268435456) { + throw new Test262Error('#61: 1 << 60.1 === 268435456. Actual: ' + (1 << 60.1)); +} + +//CHECK#62 +if (1 << 61.1 !== 536870912) { + throw new Test262Error('#62: 1 << 61.1 === 536870912. Actual: ' + (1 << 61.1)); +} + +//CHECK#63 +if (1 << 62.1 !== 1073741824) { + throw new Test262Error('#63: 1 << 62.1 === 1073741824. Actual: ' + (1 << 62.1)); +} + +//CHECK#64 +if (1 << 63.1 !== -2147483648) { + throw new Test262Error('#64: 1 << 63.1 === -2147483648. Actual: ' + (1 << 63.1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A1_T1.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A1_T1.js new file mode 100644 index 0000000000..8b7a7cd3c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A1_T1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If value is NaN, +0, -0, +Infinity, or -Infinity, return +0 +es5id: 9.5_A1_T1 +description: For testing use operator <<0 +---*/ + +// CHECK#1 +if ((Number.NaN << 0) !== +0) { + throw new Test262Error('#1.1: (Number.NaN << 0) === 0. Actual: ' + ((Number.NaN << 0))); +} else if (1/(Number.NaN << 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: (Number.NaN << 0) === +0. Actual: -0'); +} + +// CHECK#2 +if ((Number("abc") << 0) !== +0) { + throw new Test262Error('#2.1: (Number("abc") << 0) === 0. Actual: ' + ((Number("abc") << 0))); +} else if (1/(0 << 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (0 << 0) === +0. Actual: -0'); +} + +// CHECK#3 +if ((0 << 0) !== +0) { + throw new Test262Error('#3.1: (0 << 0) === 0. Actual: ' + ((0 << 0))); +} else if (1/(0 << 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3.2: (0 << 0) === +0. Actual: -0'); +} + +// CHECK#4 +if ((-0 << 0) !== +0) { + throw new Test262Error("#4.1: (-0 << 0) === 0"); +} else if (1/(-0 << 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error("#4.2: (-0 << 0) === +0. Actual: -0"); +} + +// CHECK#5 +if ((Number.POSITIVE_INFINITY << 0) !== +0) { + throw new Test262Error('#5.1: (Number.POSITIVE_INFINITY << 0) === 0. Actual: ' + ((Number.POSITIVE_INFINITY << 0))); +} else if (1/(Number.POSITIVE_INFINITY << 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5.2: (Number.POSITIVE_INFINITY << 0) === +0. Actual: -0'); +} + +// CHECK#6 +if ((Number.NEGATIVE_INFINITY << 0) !== +0) { + throw new Test262Error("#6.1: (Number.NEGATIVE_INFINITY << 0) === 0"); +} else if (1/(Number.NEGATIVE_INFINITY << 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error("#6.2: (Number.NEGATIVE_INFINITY << 0) === +0. Actual: -0"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.1_T1.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.1_T1.js new file mode 100644 index 0000000000..2b7875c873 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.1_T1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: ToInt32 returns values between -2^31 and 2^31-1 +es5id: 9.5_A2.1_T1 +description: > + Converting some numbers, which are in\outside of Int32 scopes, + with <<0 operator +---*/ + +// CHECK#1 +if ((-2147483647 << 0) !== -2147483647) { + throw new Test262Error('#1: (-2147483647 << 0) === -2147483647. Actual: ' + ((-2147483647 << 0))); +} + +// CHECK#2 +if ((-2147483648 << 0) !== -2147483648) { + throw new Test262Error('#2: (-2147483648 << 0) === -2147483648. Actual: ' + ((-2147483648 << 0))); +} + +// CHECK#3 +if ((-2147483649 << 0) !== 2147483647) { + throw new Test262Error('#3: (-2147483649 << 0) === 2147483647. Actual: ' + ((-2147483649 << 0))); +} + +// CHECK#4 +if ((-4294967296 << 0) !== 0) { + throw new Test262Error('#4: (-4294967296 << 0) === 0. Actual: ' + ((-4294967296 << 0))); +} + +// CHECK#5 +if ((2147483646 << 0) !== 2147483646) { + throw new Test262Error('#5: (2147483646 << 0) === 2147483646. Actual: ' + ((2147483646 << 0))); +} + +// CHECK#6 +if ((2147483647 << 0) !== 2147483647) { + throw new Test262Error('#6: (2147483647 << 0) === 2147483647. Actual: ' + ((2147483647 << 0))); +} + +// CHECK#7 +if ((2147483648 << 0) !== -2147483648) { + throw new Test262Error('#7: (2147483648 << 0) === -2147483648. Actual: ' + ((2147483648 << 0))); +} + +// CHECK#8 +if ((4294967296 << 0) !== 0) { + throw new Test262Error('#8: (4294967296 << 0) === 0. Actual: ' + ((4294967296 << 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.2_T1.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.2_T1.js new file mode 100644 index 0000000000..c65eb693eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.2_T1.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compute result modulo 2^32 +es5id: 9.5_A2.2_T1 +description: Use operator <<0 +---*/ + +// CHECK#1 +if ((-2147483647 << 0) !== -2147483647) { + throw new Test262Error('#1: (-2147483647 << 0) === -2147483647. Actual: ' + ((-2147483647 << 0))); +} + +// CHECK#2 +if ((-2147483648 << 0) !== -2147483648) { + throw new Test262Error('#2: (-2147483648 << 0) === -2147483648. Actual: ' + ((-2147483648 << 0))); +} + +// CHECK#3 +if ((-2147483649 << 0) !== 2147483647) { + throw new Test262Error('#3: (-2147483649 << 0) === 2147483647. Actual: ' + ((-2147483649 << 0))); +} + +// CHECK#4 +if ((4294967295 << 0) !== -1) { + throw new Test262Error('#4: (4294967295 << 0) === -1. Actual: ' + ((4294967295 << 0))); +} + +// CHECK#5 +if ((4294967296 << 0) !== 0) { + throw new Test262Error('#5: (4294967296 << 0) === 0. Actual: ' + ((4294967296 << 0))); +} + +// CHECK#6 +if ((4294967297 << 0) !== 1) { + throw new Test262Error('#6: (4294967297 << 0) === 1. Actual: ' + ((4294967297 << 0))); +} + +// CHECK#7 +if ((-4294967295 << 0) !== 1) { + throw new Test262Error('#7: (-4294967295 << 0) === 1. Actual: ' + ((-4294967295 << 0))); +} + +// CHECK#8 +if ((-4294967296 << 0) !== 0) { + throw new Test262Error('#8: (-4294967296 << 0) === 0. Actual: ' + ((-4294967296 << 0))); +} + +// CHECK#9 +if ((-4294967297 << 0) !== -1) { + throw new Test262Error('#9: (-4294967297 << 0) === -1. Actual: ' + ((-4294967297 << 0))); +} + +// CHECK#10 +if ((8589934591 << 0) !== -1) { + throw new Test262Error('#10: (8589934591 << 0) === -1. Actual: ' + ((8589934591 << 0))); +} + +// CHECK#11 +if ((8589934592 << 0) !== 0) { + throw new Test262Error('#11: (8589934592 << 0) === 0. Actual: ' + ((8589934592 << 0))); +} + +// CHECK#12 +if ((8589934593 << 0) !== 1) { + throw new Test262Error('#12: (8589934593 << 0) === 1. Actual: ' + ((8589934593 << 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.3_T1.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.3_T1.js new file mode 100644 index 0000000000..62f175c31a --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A2.3_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If result is greater than or equal to 2^31, return result -2^32 +es5id: 9.5_A2.3_T1 +description: Use operator <<0 +---*/ + +// CHECK#1 +if ((2147483647 << 0) !== 2147483647) { + throw new Test262Error('#1: (2147483647 << 0) === 2147483647. Actual: ' + ((2147483647 << 0))); +} + +// CHECK#2 +if ((2147483648 << 0) !== -2147483648) { + throw new Test262Error('#2: (2147483648 << 0) === -2147483648. Actual: ' + ((2147483648 << 0))); +} + +// CHECK#3 +if ((2147483649 << 0) !== -2147483647) { + throw new Test262Error('#3: (2147483649 << 0) === -2147483647. Actual: ' + ((2147483649 << 0))); +} + +// CHECK#4 +if ((4294967295 << 0) !== -1) { + throw new Test262Error('#4: (4294967295 << 0) === -1. Actual: ' + ((4294967295 << 0))); +} + +// CHECK#5 +if ((4294967296 << 0) !== 0) { + throw new Test262Error('#5: (4294967296 << 0) === 0. Actual: ' + ((4294967296 << 0))); +} + +// CHECK#6 +if ((4294967297 << 0) !== 1) { + throw new Test262Error('#6: (4294967297 << 0) === 1. Actual: ' + ((4294967297 << 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T1.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T1.js new file mode 100644 index 0000000000..b4c38f9b4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.5_A3.1_T1 +description: Type(x) is Boolean +---*/ + +// CHECK#1 +if ((new Boolean(true) << 0) !== 1) { + throw new Test262Error('#1: (new Boolean(true) << 0) === 1. Actual: ' + ((new Boolean(true) << 0))); +} + +// CHECK#2 +if ((false << 0) !== 0) { + throw new Test262Error('#2: (false << 0) === 0. Actual: ' + ((false << 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T2.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T2.js new file mode 100644 index 0000000000..e5c3f65aed --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.5_A3.1_T2 +description: Type(x) is Number +---*/ + +// CHECK#1 +if ((new Number(1) << 0) !== 1) { + throw new Test262Error('#1: (new Number(1) << 0) === 1. Actual: ' + ((new Number(1) << 0))); +} + +// CHECK#2 +if ((-1.234 << 0) !== -1) { + throw new Test262Error('#2: (-1.234 << 0) === -1. Actual: ' + ((-1.234 << 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T3.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T3.js new file mode 100644 index 0000000000..df08a74522 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.5_A3.1_T3 +description: Type(x) is String +---*/ + +// CHECK#1 +if ((new String(1) << 0) !== 1) { + throw new Test262Error('#1: (new String(1) << 0) === 1. Actual: ' + ((new String(1) << 0))); +} + +// CHECK#2 +if (("-1.234" << 0) !== -1) { + throw new Test262Error('#2: ("-1.234" << 0) === -1. Actual: ' + (("-1.234" << 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.2_T1.js b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.2_T1.js new file mode 100644 index 0000000000..3a9da5f9c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/S9.5_A3.2_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses floor, abs +es5id: 9.5_A3.2_T1 +description: Use operator <<0 +---*/ + +// CHECK#1 +if ((1.2345 << 0) !== 1) { + throw new Test262Error('#1: (1.2345 << 0) === 1. Actual: ' + ((1.2345 << 0))); +} + +// CHECK#2 +if ((-5.4321 << 0) !== -5) { + throw new Test262Error('#2: (-5.4321 << 0) === -5. Actual: ' + ((-5.4321 << 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/bigint-and-number.js b/js/src/tests/test262/language/expressions/left-shift/bigint-and-number.js new file mode 100644 index 0000000000..d47cd779b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-left-shift-operator-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for left-shift operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n << 1; +}, '1n << 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 << 1n; +}, '1 << 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) << 1; +}, 'Object(1n) << 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 << Object(1n); +}, '1 << Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n << Object(1); +}, '1n << Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) << 1n; +}, 'Object(1) << 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) << Object(1); +}, 'Object(1n) << Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) << Object(1n); +}, 'Object(1) << Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n << NaN; +}, '1n << NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN << 1n; +}, 'NaN << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << Infinity; +}, '1n << Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity << 1n; +}, 'Infinity << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << true; +}, '1n << true throws TypeError'); + +assert.throws(TypeError, function() { + true << 1n; +}, 'true << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << '1'; +}, '1n << "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' << 1n; +}, '"1" << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << null; +}, '1n << null throws TypeError'); + +assert.throws(TypeError, function() { + null << 1n; +}, 'null << 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n << undefined; +}, '1n << undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined << 1n; +}, 'undefined << 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/bigint-errors.js b/js/src/tests/test262/language/expressions/left-shift/bigint-errors.js new file mode 100644 index 0000000000..fdde3937c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: left-shift operator ToNumeric with BigInt operands +esid: sec-left-shift-operator-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') << 0n; +}, 'Symbol("1") << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << Symbol('1'); +}, '0n << Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) << 0n; +}, 'Object(Symbol("1")) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << Object(Symbol('1')); +}, '0n << Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) << 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n << {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) << 0n; +}, '({valueOf: function() {return Symbol("1");}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n << {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) << 0n; +}, '({toString: function() {return Symbol("1");}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + toString: function() { + return Symbol('1'); + } + }; +}, '0n << {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/left-shift/bigint-non-primitive.js new file mode 100644 index 0000000000..2ecd5f2c0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/bigint-non-primitive.js @@ -0,0 +1,89 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Left shift for non-primitive BigInt values +esid: sec-left-shift-operator-runtime-semantics-evaluation +info: | + ShiftExpression : ShiftExpression << AdditiveExpression + + 1. Let lref be the result of evaluating ShiftExpression. + 2. Let lval be ? GetValue(lref). + 3. Let rref be the result of evaluating AdditiveExpression. + 4. Let rval be ? GetValue(rref). + 5. Let lnum be ? ToNumeric(lval). + 6. Let rnum be ? ToNumeric(rval). + 7. If Type(lnum) does not equal Type(rnum), throw a TypeError exception. + 8. Let T be Type(lnum). + 9. Return T::leftShift(lnum, rnum). + +features: [BigInt, Symbol.toPrimitive] +---*/ +assert.sameValue(Object(0b101n) << 1n, 0b1010n, 'The result of (Object(0b101n) << 1n) is 0b1010n'); + +assert.sameValue( + Object(0b101n) << Object(1n), + 0b1010n, + 'The result of (Object(0b101n) << Object(1n)) is 0b1010n' +); + +function err() { + throw new Test262Error(); +} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} << 1n, 0b1010n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) << 1n) is 0b1010n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} << 1n, 0b1010n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) << 1n) is 0b1010n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} << 1n, 0b1010n, 'The result of (({toString: function() {return 0b101n;}}) << 1n) is 0b1010n'); + +assert.sameValue(0b101n << { + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err +}, 0b1010n, 'The result of (0b101n << {[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err}) is 0b1010n'); + +assert.sameValue(0b101n << { + valueOf: function() { + return 1n; + }, + + toString: err +}, 0b1010n, 'The result of (0b101n << {valueOf: function() {return 1n;}, toString: err}) is 0b1010n'); + +assert.sameValue(0b101n << { + toString: function() { + return 1n; + } +}, 0b1010n, 'The result of (0b101n << {toString: function() {return 1n;}}) is 0b1010n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + } +} << { + valueOf: function() { + return 1n; + } +}, 0b1010n, 'The result of (({valueOf: function() {return 0b101n;}}) << {valueOf: function() {return 1n;}}) is 0b1010n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/left-shift/bigint-toprimitive.js new file mode 100644 index 0000000000..7f340ea505 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: left-shift operator ToNumeric with BigInt operands +esid: sec-left-shift-operator-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) << 1n) is 4n'); + +assert.sameValue(1n << { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} << 1n, 4n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) << 1n) is 4n'); + +assert.sameValue(1n << { + valueOf: function() { + return 2n; + }, + + toString: err +}, 4n, 'The result of (1n << {valueOf: function() {return 2n;}, toString: err}) is 4n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({toString: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + toString: function() { + return 2n; + } +}, 4n, 'The result of (1n << {toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + valueOf: null, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (1n << {valueOf: null, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (1n << {valueOf: 1, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (1n << {valueOf: {}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (1n << {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (1n << {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 4n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) << 0n; +}, '({[Symbol.toPrimitive]: 1}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + [Symbol.toPrimitive]: 1 + }; +}, '0n << {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) << 0n; +}, '({[Symbol.toPrimitive]: {}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + [Symbol.toPrimitive]: {} + }; +}, '0n << {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) << 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n << {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) << 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n << {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) << 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) << 0n throws MyError'); + +assert.throws(MyError, function() { + 0n << { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n << {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) << 0n; +}, '({valueOf: function() {throw new MyError();}}) << 0n throws MyError'); + +assert.throws(MyError, function() { + 0n << { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n << {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) << 0n; +}, '({toString: function() {throw new MyError();}}) << 0n throws MyError'); + +assert.throws(MyError, function() { + 0n << { + toString: function() { + throw new MyError(); + } + }; +}, '0n << {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) << 0n; +}, '({valueOf: null, toString: null}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + valueOf: null, + toString: null + }; +}, '0n << {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) << 0n; +}, '({valueOf: 1, toString: 1}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + valueOf: 1, + toString: 1 + }; +}, '0n << {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) << 0n; +}, '({valueOf: {}, toString: {}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + valueOf: {}, + toString: {} + }; +}, '0n << {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) << 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n << {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) << 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) << 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n << { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n << {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/left-shift/bigint-wrapped-values.js new file mode 100644 index 0000000000..c92ac53e31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: left-shift operator ToNumeric with BigInt operands +esid: sec-left-shift-operator-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) << 1n, 4n, 'The result of (Object(2n) << 1n) is 4n'); +assert.sameValue(1n << Object(2n), 4n, 'The result of (1n << Object(2n)) is 4n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 4n, 'The result of (1n << {[Symbol.toPrimitive]: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({valueOf: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + valueOf: function() { + return 2n; + } +}, 4n, 'The result of (1n << {valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} << 1n, 4n, 'The result of (({toString: function() {return 2n;}}) << 1n) is 4n'); + +assert.sameValue(1n << { + toString: function() { + return 2n; + } +}, 4n, 'The result of (1n << {toString: function() {return 2n;}}) is 4n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/bigint.js b/js/src/tests/test262/language/expressions/left-shift/bigint.js new file mode 100644 index 0000000000..14b4c33d6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/bigint.js @@ -0,0 +1,110 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Left shift for BigInt values +esid: sec-numeric-types-bigint-leftShift +info: | + BigInt::leftShift (x, y) + + The abstract operation BigInt::leftShift with two arguments x and y of BigInt: + + 1. If y < 0, + a. Return a BigInt representing x divided by 2-y, rounding down to the nearest integer, including for negative numbers. + 2. Return a BigInt representing x multiplied by 2y. + + NOTE: Semantics here should be equivalent to a bitwise shift, treating the BigInt as an infinite length string of binary two's complement digits. + +features: [BigInt] +---*/ + +assert.sameValue(0n << 0n, 0n, "0n << 0n === 0n"); +assert.sameValue(0b101n << 1n, 0b1010n, "0b101n << 1n === 0b1010n"); +assert.sameValue(0b101n << 2n, 0b10100n, "0b101n << 2n === 0b10100n"); +assert.sameValue(0b101n << 3n, 0b101000n, "0b101n << 3n === 0b101000n"); +assert.sameValue(0b101n << -1n, 0b10n, "0b101n << -1n === 0b10n"); +assert.sameValue(0b101n << -2n, 1n, "0b101n << -2n === 1n"); +assert.sameValue(0b101n << -3n, 0n, "0b101n << -3n === 0n"); +assert.sameValue(0n << 128n, 0n, "0n << 128n === 0n"); +assert.sameValue(0n << -128n, 0n, "0n << -128n === 0n"); +assert.sameValue(0x246n << 0n, 0x246n, "0x246n << 0n === 0x246n"); +assert.sameValue(0x246n << 127n, 0x12300000000000000000000000000000000n, "0x246n << 127n === 0x12300000000000000000000000000000000n"); +assert.sameValue(0x246n << 128n, 0x24600000000000000000000000000000000n, "0x246n << 128n === 0x24600000000000000000000000000000000n"); +assert.sameValue(0x246n << 129n, 0x48c00000000000000000000000000000000n, "0x246n << 129n === 0x48c00000000000000000000000000000000n"); +assert.sameValue(0x246n << -128n, 0n, "0x246n << -128n === 0n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << 64n, 0x123456789abcdef0fedcba98765432123456780000000000000000n, + "0x123456789abcdef0fedcba9876543212345678n << 64n === 0x123456789abcdef0fedcba98765432123456780000000000000000n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << 32n, 0x123456789abcdef0fedcba987654321234567800000000n, + "0x123456789abcdef0fedcba9876543212345678n << 32n === 0x123456789abcdef0fedcba987654321234567800000000n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << 16n, 0x123456789abcdef0fedcba98765432123456780000n, + "0x123456789abcdef0fedcba9876543212345678n << 16n === 0x123456789abcdef0fedcba98765432123456780000n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << 0n, 0x123456789abcdef0fedcba9876543212345678n, + "0x123456789abcdef0fedcba9876543212345678n << 0n === 0x123456789abcdef0fedcba9876543212345678n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << -16n, 0x123456789abcdef0fedcba987654321234n, + "0x123456789abcdef0fedcba9876543212345678n << -16n === 0x123456789abcdef0fedcba987654321234n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << -32n, 0x123456789abcdef0fedcba98765432n, + "0x123456789abcdef0fedcba9876543212345678n << -32n === 0x123456789abcdef0fedcba98765432n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << -64n, 0x123456789abcdef0fedcban, + "0x123456789abcdef0fedcba9876543212345678n << -64n === 0x123456789abcdef0fedcban"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << -127n, 0x2468acn, + "0x123456789abcdef0fedcba9876543212345678n << -127n === 0x2468acn"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << -128n, 0x123456n, + "0x123456789abcdef0fedcba9876543212345678n << -128n === 0x123456n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n << -129n, 0x91a2bn, + "0x123456789abcdef0fedcba9876543212345678n << -129n === 0x91a2bn"); +assert.sameValue(-5n << 1n, -0xan, "-5n << 1n === -0xan"); +assert.sameValue(-5n << 2n, -0x14n, "-5n << 2n === -0x14n"); +assert.sameValue(-5n << 3n, -0x28n, "-5n << 3n === -0x28n"); +assert.sameValue(-5n << -1n, -3n, "-5n << -1n === -3n"); +assert.sameValue(-5n << -2n, -2n, "-5n << -2n === -2n"); +assert.sameValue(-5n << -3n, -1n, "-5n << -3n === -1n"); +assert.sameValue(-1n << 128n, -0x100000000000000000000000000000000n, "-1n << 128n === -0x100000000000000000000000000000000n"); +assert.sameValue(-1n << 0n, -1n, "-1n << 0n === -1n"); +assert.sameValue(-1n << -128n, -1n, "-1n << -128n === -1n"); +assert.sameValue(-0x246n << 0n, -0x246n, "-0x246n << 0n === -0x246n"); +assert.sameValue(-0x246n << 127n, -0x12300000000000000000000000000000000n, "-0x246n << 127n === -0x12300000000000000000000000000000000n"); +assert.sameValue(-0x246n << 128n, -0x24600000000000000000000000000000000n, "-0x246n << 128n === -0x24600000000000000000000000000000000n"); +assert.sameValue(-0x246n << 129n, -0x48c00000000000000000000000000000000n, "-0x246n << 129n === -0x48c00000000000000000000000000000000n"); +assert.sameValue(-0x246n << -128n, -1n, "-0x246n << -128n === -1n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << 64n, -0x123456789abcdef0fedcba98765432123456780000000000000000n, + "-0x123456789abcdef0fedcba9876543212345678n << 64n === -0x123456789abcdef0fedcba98765432123456780000000000000000n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << 32n, -0x123456789abcdef0fedcba987654321234567800000000n, + "-0x123456789abcdef0fedcba9876543212345678n << 32n === -0x123456789abcdef0fedcba987654321234567800000000n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << 16n, -0x123456789abcdef0fedcba98765432123456780000n, + "-0x123456789abcdef0fedcba9876543212345678n << 16n === -0x123456789abcdef0fedcba98765432123456780000n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << 0n, -0x123456789abcdef0fedcba9876543212345678n, + "-0x123456789abcdef0fedcba9876543212345678n << 0n === -0x123456789abcdef0fedcba9876543212345678n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << -16n, -0x123456789abcdef0fedcba987654321235n, + "-0x123456789abcdef0fedcba9876543212345678n << -16n === -0x123456789abcdef0fedcba987654321235n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << -32n, -0x123456789abcdef0fedcba98765433n, + "-0x123456789abcdef0fedcba9876543212345678n << -32n === -0x123456789abcdef0fedcba98765433n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << -64n, -0x123456789abcdef0fedcbbn, + "-0x123456789abcdef0fedcba9876543212345678n << -64n === -0x123456789abcdef0fedcbbn"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << -127n, -0x2468adn, + "-0x123456789abcdef0fedcba9876543212345678n << -127n === -0x2468adn"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << -128n, -0x123457n, + "-0x123456789abcdef0fedcba9876543212345678n << -128n === -0x123457n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n << -129n, -0x91a2cn, + "-0x123456789abcdef0fedcba9876543212345678n << -129n === -0x91a2cn"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/browser.js b/js/src/tests/test262/language/expressions/left-shift/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/left-shift/order-of-evaluation.js b/js/src/tests/test262/language/expressions/left-shift/order-of-evaluation.js new file mode 100644 index 0000000000..f330a413c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/left-shift/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-left-shift-operator-runtime-semantics-evaluation +description: Type coercion order of operations for left-shift operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() << (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() << (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() << (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() << (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() << (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() << (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/left-shift/shell.js b/js/src/tests/test262/language/expressions/left-shift/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-1.js new file mode 100644 index 0000000000..d1eefba85d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-1.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.3-1 +description: > + 11.8.3 Less-than-or-equal Operator - Partial left to right order + enforced when using Less-than-or-equal operator: valueOf <= valueOf +---*/ + +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + valueOf: function () { + return 2; + } +}; + +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-2.js new file mode 100644 index 0000000000..817042fdc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-2.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.3-2 +description: > + 11.8.3 Less-than-or-equal Operator - Partial left to right order + enforced when using Less-than-or-equal operator: valueOf <= + toString +---*/ + +var accessed = false; +var obj1 = { + valueOf: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + toString: function () { + return 2; + } +}; + +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-3.js b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-3.js new file mode 100644 index 0000000000..313b48a897 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-3.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.3-3 +description: > + 11.8.3 Less-than-or-equal Operator - Partial left to right order + enforced when using Less-than-or-equal operator: toString <= + valueOf +---*/ + +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + valueOf: function () { + return 2; + } +}; + +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-4.js b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-4.js new file mode 100644 index 0000000000..43d86b258b --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/11.8.3-4.js @@ -0,0 +1,28 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.8.3-4 +description: > + 11.8.3 Less-than-or-equal Operator - Partial left to right order + enforced when using Less-than-or-equal operator: toString <= + toString +---*/ + +var accessed = false; +var obj1 = { + toString: function () { + accessed = true; + return 4; + } +}; +var obj2 = { + toString: function () { + return 2; + } +}; + +assert.sameValue(obj1 <= obj2, false, 'The result of (obj1 <= obj2) is false'); +assert.sameValue(accessed, true, 'The value of accessed is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A1.js new file mode 100644 index 0000000000..e928e5837d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between RelationalExpression and "<=" or + between "<=" and ShiftExpression are allowed +es5id: 11.8.3_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009<=\u00091") !== true) { + throw new Test262Error('#1: (1\\u0009<=\\u00091) === true'); +} + +//CHECK#2 +if (eval("1\u000B<=\u000B1") !== true) { + throw new Test262Error('#2: (1\\u000B<=\\u000B1) === true'); +} + +//CHECK#3 +if (eval("1\u000C<=\u000C1") !== true) { + throw new Test262Error('#3: (1\\u000C<=\\u000C1) === true'); +} + +//CHECK#4 +if (eval("1\u0020<=\u00201") !== true) { + throw new Test262Error('#4: (1\\u0020<=\\u00201) === true'); +} + +//CHECK#5 +if (eval("1\u00A0<=\u00A01") !== true) { + throw new Test262Error('#5: (1\\u00A0<=\\u00A01) === true'); +} + +//CHECK#6 +if (eval("1\u000A<=\u000A1") !== true) { + throw new Test262Error('#6: (1\\u000A<=\\u000A1) === true'); +} + +//CHECK#7 +if (eval("1\u000D<=\u000D1") !== true) { + throw new Test262Error('#7: (1\\u000D<=\\u000D1) === true'); +} + +//CHECK#8 +if (eval("1\u2028<=\u20281") !== true) { + throw new Test262Error('#8: (1\\u2028<=\\u20281) === true'); +} + +//CHECK#9 +if (eval("1\u2029<=\u20291") !== true) { + throw new Test262Error('#9: (1\\u2029<=\\u20291) === true'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== true) { + throw new Test262Error('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T1.js new file mode 100644 index 0000000000..56ab138ad9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x <= y uses GetValue +es5id: 11.8.3_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 <= 1 !== true) { + throw new Test262Error('#1: 1 <= 1 === true'); +} + +//CHECK#2 +var x = 1; +if (x <= 1 !== true) { + throw new Test262Error('#2: var x = 1; x <= 1 === true'); +} + +//CHECK#3 +var y = 1; +if (1 <= y !== true) { + throw new Test262Error('#3: var y = 1; 1 <= y === true'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x <= y !== true) { + throw new Test262Error('#4: var x = 1; var y = 1; x <= y === true'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop <= objecty.prop !== true) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop <= objecty.prop === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T2.js new file mode 100644 index 0000000000..156d9e2236 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x <= y uses GetValue +es5id: 11.8.3_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x <= 1; + throw new Test262Error('#1.1: x <= 1 throw ReferenceError. Actual: ' + (x <= 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x <= 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T3.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T3.js new file mode 100644 index 0000000000..3d9e500057 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x <= y uses GetValue +es5id: 11.8.3_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 <= y; + throw new Test262Error('#1.1: 1 <= y throw ReferenceError. Actual: ' + (1 <= y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 <= y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.2_T1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.2_T1.js new file mode 100644 index 0000000000..1e8abda2c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x <= y uses [[Default Value]] +es5id: 11.8.3_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 0}} <= 1 !== true) { + throw new Test262Error('#1: {valueOf: function() {return 1}} <= 1 === true. Actual: ' + ({valueOf: function() {return 1}} <= 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 0}, toString: function() {return 2}} <= 1 !== true) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} <= 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} <= 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 0}, toString: function() {return {}}} <= 1 !== true) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} <= 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} <= 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 0}, toString: function() {throw "error"}} <= 1 !== true) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} <= 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} <= 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 0}, toString: function() {throw "error"}} <= 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 0}, toString: function() {throw "error"}} <= 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 <= {toString: function() {return 2}} !== true) { + throw new Test262Error('#5: 1 <= {toString: function() {return 2}} === true. Actual: ' + (1 <= {toString: function() {return 2}})); +} + +//CHECK#6 +if (1 <= {valueOf: function() {return {}}, toString: function() {return 2}} !== true) { + throw new Test262Error('#6: 1 <= {valueOf: function() {return {}}, toString: function() {return 2}} === true. Actual: ' + (1 <= {valueOf: function() {return {}}, toString: function() {return 2}})); +} + +//CHECK#7 +try { + 1 <= {valueOf: function() {throw "error"}, toString: function() {return 2}}; + throw new Test262Error('#7.1: 1 <= {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (1 <= {valueOf: function() {throw "error"}, toString: function() {return 2}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 <= {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 <= {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 <= {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 <= {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 <= {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.3_T1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.3_T1.js new file mode 100644 index 0000000000..07cac99b9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.3_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: In ES5, First expression should be evaluated first. +es5id: 11.8.3_A2.3_T1 +description: Checking that operands of a "<=" evaluate left-to-right +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x <= y; + throw new Test262Error('#1.1: Should have thrown'); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression should be evaluated first'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: Failed with: ' + e); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T1.js new file mode 100644 index 0000000000..14125473bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.3_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) <= x !== true) { + throw new Test262Error('#1: var x = 0; (x = 1) <= x === true'); +} + +//CHECK#2 +var x = 1; +if (x <= (x = 0) !== false) { + throw new Test262Error('#2: var x = 1; x <= (x = 0) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T2.js new file mode 100644 index 0000000000..c97a332d2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.3_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() <= y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() <= y() throw "x". Actual: ' + (x() <= y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() <= y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T3.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T3.js new file mode 100644 index 0000000000..8741fd4dbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.3_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x <= (x = 1); + throw new Test262Error('#1.1: x <= (x = 1) throw ReferenceError. Actual: ' + (x <= (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x <= (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T4.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T4.js new file mode 100644 index 0000000000..5ccc52661b --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.3_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) <= y !== true) { + throw new Test262Error('#1: (y = 1) <= y === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.1.js new file mode 100644 index 0000000000..0863ebd9e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + boolean and Boolean object +---*/ + +//CHECK#1 +if (true <= true !== true) { + throw new Test262Error('#1: true <= true === true'); +} + +//CHECK#2 +if (new Boolean(true) <= true !== true) { + throw new Test262Error('#2: new Boolean(true) <= true === true'); +} + +//CHECK#3 +if (true <= new Boolean(true) !== true) { + throw new Test262Error('#3: true <= new Boolean(true) === true'); +} + +//CHECK#4 +if (new Boolean(true) <= new Boolean(true) !== true) { + throw new Test262Error('#4: new Boolean(true) <= new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.2.js new file mode 100644 index 0000000000..7c187c7e94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + number and Number object +---*/ + +//CHECK#1 +if (1 <= 1 !== true) { + throw new Test262Error('#1: 1 <= 1 === true'); +} + +//CHECK#2 +if (new Number(1) <= 1 !== true) { + throw new Test262Error('#2: new Number(1) <= 1 === true'); +} + +//CHECK#3 +if (1 <= new Number(1) !== true) { + throw new Test262Error('#3: 1 <= new Number(1) === true'); +} + +//CHECK#4 +if (new Number(1) <= new Number(1) !== true) { + throw new Test262Error('#4: new Number(1) <= new Number(1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.3.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.3.js new file mode 100644 index 0000000000..433897032d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T1.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T1.3 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Null and + Undefined +---*/ + +//CHECK#1 +if (null <= undefined !== false) { + throw new Test262Error('#1: null <= undefined === false'); +} + +//CHECK#2 +if (undefined <= null !== false) { + throw new Test262Error('#2: undefined <= null === false'); +} + +//CHECK#3 +if (undefined <= undefined !== false) { + throw new Test262Error('#3: undefined <= undefined === false'); +} + +//CHECK#4 +if (null <= null !== true) { + throw new Test262Error('#4: null <= null === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.1.js new file mode 100644 index 0000000000..527e47a93f --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.1 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true <= 1 !== true) { + throw new Test262Error('#1: true <= 1 === true'); +} + +//CHECK#2 +if (1 <= true !== true) { + throw new Test262Error('#2: 1 <= true === true'); +} + +//CHECK#3 +if (new Boolean(true) <= 1 !== true) { + throw new Test262Error('#3: new Boolean(true) <= 1 === true'); +} + +//CHECK#4 +if (1 <= new Boolean(true) !== true) { + throw new Test262Error('#4: 1 <= new Boolean(true) === true'); +} + +//CHECK#5 +if (true <= new Number(1) !== true) { + throw new Test262Error('#5: true <= new Number(1) === true'); +} + +//CHECK#6 +if (new Number(1) <= true !== true) { + throw new Test262Error('#6: new Number(1) <= true === true'); +} + +//CHECK#7 +if (new Boolean(true) <= new Number(1) !== true) { + throw new Test262Error('#7: new Boolean(true) <= new Number(1) === true'); +} + +//CHECK#8 +if (new Number(1) <= new Boolean(true) !== true) { + throw new Test262Error('#8: new Number(1) <= new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.2.js new file mode 100644 index 0000000000..059ba891a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.2 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and String + (primitive and object) +---*/ + +//CHECK#1 +if ("1" <= 1 !== true) { + throw new Test262Error('#1: "1" <= 1 === true'); +} + +//CHECK#2 +if (1 <= "1" !== true) { + throw new Test262Error('#2: 1 <= "1" === true'); +} + +//CHECK#3 +if (new String("1") <= 1 !== true) { + throw new Test262Error('#3: new String("1") <= 1 === true'); +} + +//CHECK#4 +if (1 <= new String("1") !== true) { + throw new Test262Error('#4: 1 <= new String("1") === true'); +} + +//CHECK#5 +if ("1" <= new Number(1) !== true) { + throw new Test262Error('#5: "1" <= new Number(1) === true'); +} + +//CHECK#6 +if (new Number(1) <= "1" !== true) { + throw new Test262Error('#6: new Number(1) <= "1" === true'); +} + +//CHECK#7 +if (new String("1") <= new Number(1) !== true) { + throw new Test262Error('#7: new String("1") <= new Number(1) === true'); +} + +//CHECK#8 +if (new Number(1) <= new String("1") !== true) { + throw new Test262Error('#8: new Number(1) <= new String("1") === true'); +} + +//CHECK#9 +if ("x" <= 1 !== false) { + throw new Test262Error('#9: "x" <= 1 === false'); +} + +//CHECK#10 +if (1 <= "x" !== false) { + throw new Test262Error('#10: 1 <= "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.3.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.3.js new file mode 100644 index 0000000000..d69e6f7abd --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.3 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 <= null !== false) { + throw new Test262Error('#1: 1 <= null === false'); +} + +//CHECK#2 +if (null <= 1 !== true) { + throw new Test262Error('#2: null <= 1 === true'); +} + +//CHECK#3 +if (new Number(1) <= null !== false) { + throw new Test262Error('#3: new Number(1) <= null === false'); +} + +//CHECK#4 +if (null <= new Number(1) !== true) { + throw new Test262Error('#4: null <= new Number(1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.4.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.4.js new file mode 100644 index 0000000000..b404c11e44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.4 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 <= undefined !== false) { + throw new Test262Error('#1: 1 <= undefined === false'); +} + +//CHECK#2 +if (undefined <= 1 !== false) { + throw new Test262Error('#2: undefined <= 1 === false'); +} + +//CHECK#3 +if (new Number(1) <= undefined !== false) { + throw new Test262Error('#3: new Number(1) <= undefined === false'); +} + +//CHECK#4 +if (undefined <= new Number(1) !== false) { + throw new Test262Error('#4: undefined <= new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.5.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.5.js new file mode 100644 index 0000000000..f3ce523db5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.5.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.5 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true <= "1" !== true) { + throw new Test262Error('#1: true <= "1" === true'); +} + +//CHECK#2 +if ("1" <= true !== true) { + throw new Test262Error('#2: "1" <= true === true'); +} + +//CHECK#3 +if (new Boolean(true) <= "1" !== true) { + throw new Test262Error('#3: new Boolean(true) <= "1" === true'); +} + +//CHECK#4 +if ("1" <= new Boolean(true) !== true) { + throw new Test262Error('#4: "1" <= new Boolean(true) === true'); +} + +//CHECK#5 +if (true <= new String("1") !== true) { + throw new Test262Error('#5: true <= new String("1") === true'); +} + +//CHECK#6 +if (new String("1") <= true !== true) { + throw new Test262Error('#6: new String("1") <= true === true'); +} + +//CHECK#7 +if (new Boolean(true) <= new String("1") !== true) { + throw new Test262Error('#7: new Boolean(true) <= new String("1") === true'); +} + +//CHECK#8 +if (new String("1") <= new Boolean(true) !== true) { + throw new Test262Error('#8: new String("1") <= new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.6.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.6.js new file mode 100644 index 0000000000..89a0cd9ccb --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.6 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" <= undefined !== false) { + throw new Test262Error('#1: "1" <= undefined === false'); +} + +//CHECK#2 +if (undefined <= "1" !== false) { + throw new Test262Error('#2: undefined <= "1" === false'); +} + +//CHECK#3 +if (new String("1") <= undefined !== false) { + throw new Test262Error('#3: new String("1") <= undefined === false'); +} + +//CHECK#4 +if (undefined <= new String("1") !== false) { + throw new Test262Error('#4: undefined <= new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.7.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.7.js new file mode 100644 index 0000000000..14c96a4d1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.7.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.7 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" <= null !== false) { + throw new Test262Error('#1: "1" <= null === false'); +} + +//CHECK#2 +if (null <= "1" !== true) { + throw new Test262Error('#2: null <= "1" === true'); +} + +//CHECK#3 +if (new String("1") <= null !== false) { + throw new Test262Error('#3: new String("1") <= null === false'); +} + +//CHECK#4 +if (null <= new String("1") !== true) { + throw new Test262Error('#4: null <= new String("1") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.8.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.8.js new file mode 100644 index 0000000000..d3823076c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.8 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true <= undefined !== false) { + throw new Test262Error('#1: true <= undefined === false'); +} + +//CHECK#2 +if (undefined <= true !== false) { + throw new Test262Error('#2: undefined <= true === false'); +} + +//CHECK#3 +if (new Boolean(true) <= undefined !== false) { + throw new Test262Error('#3: new Boolean(true) <= undefined === false'); +} + +//CHECK#4 +if (undefined <= new Boolean(true) !== false) { + throw new Test262Error('#4: undefined <= new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.9.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.9.js new file mode 100644 index 0000000000..48b4977b75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.1_T2.9.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToNumber(x) <= ToNumber(y), if Type(Primitive(x)) + is not String or Type(Primitive(y)) is not String +es5id: 11.8.3_A3.1_T2.9 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true <= null !== false) { + throw new Test262Error('#1: true <= null === false'); +} + +//CHECK#2 +if (null <= true !== true) { + throw new Test262Error('#2: null <= true === true'); +} + +//CHECK#3 +if (new Boolean(true) <= null !== false) { + throw new Test262Error('#3: new Boolean(true) <= null === false'); +} + +//CHECK#4 +if (null <= new Boolean(true) !== true) { + throw new Test262Error('#4: null <= new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.1.js new file mode 100644 index 0000000000..baa7c16469 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToString(x) <= ToString(y), if Type(Primitive(x)) + is String and Type(Primitive(y)) is String +es5id: 11.8.3_A3.2_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + string and String object +---*/ + +//CHECK#1 +if ("1" <= "1" !== true) { + throw new Test262Error('#1: "1" <= "1" === true'); +} + +//CHECK#2 +if (new String("1") <= "1" !== true) { + throw new Test262Error('#2: new String("1") <= "1" === true'); +} + +//CHECK#3 +if ("1" <= new String("1") !== true) { + throw new Test262Error('#3: "1" <= new String("1") === true'); +} + +//CHECK#4 +if (new String("1") <= new String("1") !== true) { + throw new Test262Error('#4: new String("1") <= new String("1") === true'); +} + +//CHECK#5 +if ("x" <= "1" !== false) { + throw new Test262Error('#5: "x" <= "1" === false'); +} + +//CHECK#6 +if ("1" <= "x" !== true) { + throw new Test262Error('#6: "1" <= "x" === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.2.js new file mode 100644 index 0000000000..d78fe25095 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A3.2_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x <= y returns ToString(x) <= ToString(y), if Type(Primitive(x)) + is String and Type(Primitive(y)) is String +es5id: 11.8.3_A3.2_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Object + object and Function object +---*/ + +//CHECK#1 +if (({} <= function(){return 1}) !== ({}.toString() <= function(){return 1}.toString())) { + throw new Test262Error('#1: ({} <= function(){return 1}) === ({}.toString() <= function(){return 1}.toString())'); +} + +//CHECK#2 +if ((function(){return 1} <= {}) !== (function(){return 1}.toString() <= {}.toString())) { + throw new Test262Error('#2: (function(){return 1} <= {}) === (function(){return 1}.toString() <= {}.toString())'); +} + +//CHECK#3 +if ((function(){return 1} <= function(){return 1}) !== (function(){return 1}.toString() <= function(){return 1}.toString())) { + throw new Test262Error('#3: (function(){return 1} <= function(){return 1}) === (function(){return 1}.toString() <= function(){return 1}.toString())'); +} + +//CHECK#4 +if (({} <= {}) !== ({}.toString() <= {}.toString())) { + throw new Test262Error('#4: ({} <= {}) === ({}.toString() <= {}.toString())'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.1.js new file mode 100644 index 0000000000..b4d2f12c1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.3_A4.1 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NaN <= 0) !== false) { + throw new Test262Error('#1: (NaN <= 0) === false'); +} + +//CHECK#2 +if ((Number.NaN <= 1.1) !== false) { + throw new Test262Error('#2: (NaN <= 1.1) === false'); +} + +//CHECK#3 +if ((Number.NaN <= -1.1) !== false) { + throw new Test262Error('#3: (NaN <= -1.1) === false'); +} + +//CHECK#4 +if ((Number.NaN <= Number.NaN) !== false) { + throw new Test262Error('#4: (NaN <= NaN) === false'); +} + +//CHECK#5 +if ((Number.NaN <= Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (NaN <= +Infinity) === false'); +} + +//CHECK#6 +if ((Number.NaN <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#6: (NaN <= -Infinity) === false'); +} + +//CHECK#7 +if ((Number.NaN <= Number.MAX_VALUE) !== false) { + throw new Test262Error('#7: (NaN <= Number.MAX_VALUE) === false'); +} + +//CHECK#8 +if ((Number.NaN <= Number.MIN_VALUE) !== false) { + throw new Test262Error('#8: (NaN <= Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.10.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.10.js new file mode 100644 index 0000000000..711ed7bc85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.10.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is a prefix of x and x !== y, return false +es5id: 11.8.3_A4.10 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x " <= "x") !== false) { + throw new Test262Error('#1: ("x " <= "x") === false'); +} + +//CHECK#2 +if (("x" <= "") !== false) { + throw new Test262Error('#2: ("x" <= "") === false'); +} + +//CHECK#3 +if (("abcd" <= "ab") !== false) { + throw new Test262Error('#3: ("abcd" <= ab") === false'); +} + +//CHECK#4 +if (("abc\u0064" <= "abcd") !== true) { + throw new Test262Error('#4: ("abc\\u0064" <= abcd") === true'); +} + +//CHECK#5 +if (("x" + "y" <= "x") !== false) { + throw new Test262Error('#5: ("x" + "y" <= "x") === false'); +} + +//CHECK#6 +var x = "x"; +if ((x + 'y' <= x) !== false) { + throw new Test262Error('#6: var x = "x"; (x + "y" <= x) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.11.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.11.js new file mode 100644 index 0000000000..0032e86476 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.11.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is a prefix of y, return true +es5id: 11.8.3_A4.11 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" <= "x") !== true) { + throw new Test262Error('#1: ("x" <= "x") === true'); +} + +//CHECK#2 +if (("" <= "x") !== true) { + throw new Test262Error('#2: ("" <= "x") === true'); +} + +//CHECK#3 +if (("ab" <= "abcd") !== true) { + throw new Test262Error('#3: ("ab" <= abcd") === true'); +} + +//CHECK#4 +if (("abcd" <= "abc\u0064") !== true) { + throw new Test262Error('#4: ("abcd" <= abc\\u0064") === true'); +} + +//CHECK#5 +if (("x" <= "x" + "y") !== true) { + throw new Test262Error('#5: ("x" <= "x" + "y") === true'); +} + +//CHECK#6 +var x = "x"; +if ((x <= x + "y") !== true) { + throw new Test262Error('#6: var x = "x"; (x <= x + "y") === true'); +} + +//CHECK#7 +if (("a\u0000" <= "a\u0000a") !== true) { + throw new Test262Error('#7: ("a\\u0000" <= "a\\u0000a") === true'); +} + +//CHECK#8 +if (("x" <= " x") !== false) { + throw new Test262Error('#8: ("x" <= " x") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T1.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T1.js new file mode 100644 index 0000000000..80fd56581c --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T1.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.3_A4.12_T1 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("xx" <= "xy") !== true) { + throw new Test262Error('#1: ("xx" <= "xy") === true'); +} + +//CHECK#2 +if (("xy" <= "xx") !== false) { + throw new Test262Error('#2: ("xy" <= "xx") === false'); +} + +//CHECK#3 +if (("x" <= "y") !== true) { + throw new Test262Error('#3: ("x" <= y") === true'); +} + +//CHECK#4 +if (("aab" <= "aba") !== true) { + throw new Test262Error('#4: ("aab" <= aba") === true'); +} + +//CHECK#5 +if (("\u0061\u0061\u0061\u0062" <= "\u0061\u0061\u0061\u0061") !== false) { + throw new Test262Error('#5: ("\\u0061\\u0061\\u0061\\u0062" <= \\u0061\\u0061\\u0061\\u0061") === false'); +} + +//CHECK#6 +if (("a\u0000a" <= "a\u0000b") !== true) { + throw new Test262Error('#6: ("a\\u0000a" <= "a\\u0000b") === true'); +} + +//CHECK#7 +if (("aB" <= "aa") !== true) { + throw new Test262Error('#7: ("aB" <= aa") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T2.js new file mode 100644 index 0000000000..d05373f83c --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.12_T2.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.3_A4.12_T2 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("0" <= "x") !== true) { + throw new Test262Error('#1: ("0" <= "x") !== true'); +} + +//CHECK#2 +if (("-" <= "0") !== true) { + throw new Test262Error('#2: ("-" <= "0") !== true'); +} + +//CHECK#3 +if (("." <= "0") !== true) { + throw new Test262Error('#3: ("." <= "0") !== true'); +} + +//CHECK#4 +if (("+" <= "-") !== true) { + throw new Test262Error('#4: ("+" <= "-") !== true'); +} + +//CHECK#5 +if (("-0" <= "-1") !== true) { + throw new Test262Error('#5: ("-0" <= "-1") !== true'); +} + +//CHECK#6 +if (("+1" <= "-1") !== true) { + throw new Test262Error('#6: ("+1" <= "-1") !== true'); +} + +//CHECK#7 +if (("1" <= "1e-10") !== true) { +throw new Test262Error('#7: ("1" <= "1e-10") !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.2.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.2.js new file mode 100644 index 0000000000..3a9d065ce3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.3_A4.2 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 <= Number.NaN) !== false) { + throw new Test262Error('#1: (0 <= NaN) === false'); +} + +//CHECK#2 +if ((1.1 <= Number.NaN) !== false) { + throw new Test262Error('#2: (1.1 <= NaN) === false'); +} + +//CHECK#3 +if ((-1.1 <= Number.NaN) !== false) { + throw new Test262Error('#3: (-1.1 <= NaN) === false'); +} + +//CHECK#4 +if ((Number.NaN <= Number.NaN) !== false) { + throw new Test262Error('#4: (NaN <= NaN) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY <= Number.NaN) !== false) { + throw new Test262Error('#5: (+Infinity <= NaN) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY <= Number.NaN) !== false) { + throw new Test262Error('#6: (-Infinity <= NaN) === false'); +} + +//CHECK#7 +if ((Number.MAX_VALUE <= Number.NaN) !== false) { + throw new Test262Error('#7: (Number.MAX_VALUE <= NaN) === false'); +} + +//CHECK#8 +if ((Number.MIN_VALUE <= Number.NaN) !== false) { + throw new Test262Error('#8: (Number.MIN_VALUE <= NaN) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.3.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.3.js new file mode 100644 index 0000000000..0c06e22b95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x and y are the same number value, return true +es5id: 11.8.3_A4.3 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 <= 1) !== true) { + throw new Test262Error('#1: (1 <= 1) === true'); +} + +//CHECK#2 +if ((1.1 <= 1.1) !== true) { + throw new Test262Error('#2: (1.1 <= 1.1) === true'); +} + +//CHECK#3 +if ((-1.1 <= -1.1) !== true) { + throw new Test262Error('#3: (-1.1 <= -1.1) === true'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: (-Infinity <= -Infinity) === true'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#5: (+Infinity <= +Infinity) === true'); +} + +//CHECK#6 +if ((Number.MAX_VALUE <= Number.MAX_VALUE) !== true) { + throw new Test262Error('#6: (Number.MAX_VALUE <= Number.MAX_VALUE) === true'); +} + +//CHECK#7 +if ((Number.MIN_VALUE <= Number.MIN_VALUE) !== true) { + throw new Test262Error('#7: (Number.MIN_VALUE <= Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.4.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.4.js new file mode 100644 index 0000000000..faf35e29de --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If either x or y is +0 and the other is -0, return true +es5id: 11.8.3_A4.4 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((0 <= 0) !== true) { + throw new Test262Error('#1: (0 <= 0) === true'); +} + +//CHECK#2 +if ((-0 <= -0) !== true) { + throw new Test262Error('#2: (-0 <= -0) === true'); +} + +//CHECK#3 +if ((+0 <= -0) !== true) { + throw new Test262Error('#3: (+0 <= -0) === true'); +} + +//CHECK#4 +if ((-0 <= +0) !== true) { + throw new Test262Error('#4: (-0 <= +0) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.5.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.5.js new file mode 100644 index 0000000000..01679a8e52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.5.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +Infinity and x !== y, return false +es5id: 11.8.3_A4.5 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY <= 0) !== false) { + throw new Test262Error('#1: (+Infinity <= 0) === false'); +} + +//CHECK#2 +if ((Number.POSITIVE_INFINITY <= 1.1) !== false) { + throw new Test262Error('#2: (+Infinity <= 1.1) === false'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY <= -1.1) !== false) { + throw new Test262Error('#3: (+Infinity <= -1.1) === false'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#4: (+Infinity <= -Infinity) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY <= Number.MAX_VALUE) !== false) { + throw new Test262Error('#5: (+Infinity <= Number.MAX_VALUE) === false'); +} + +//CHECK#6 +if ((Number.POSITIVE_INFINITY <= Number.MIN_VALUE) !== false) { + throw new Test262Error('#6: (+Infinity <= Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.6.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.6.js new file mode 100644 index 0000000000..07ce893de2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.6.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is +Infinity and x !== y, return true +es5id: 11.8.3_A4.6 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#1: (0 <= +Infinity) === true'); +} + +//CHECK#2 +if ((1.1 <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#2: (1.1 <= +Infinity) === true'); +} + +//CHECK#3 +if ((-1.1 <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#3: (-1.1 <= +Infinity) === true'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: (-Infinity <= +Infinity) === true'); +} + +//CHECK#5 +if ((Number.MAX_VALUE <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#5: (Number.MAX_VALUE <= +Infinity) === true'); +} + +//CHECK#6 +if ((Number.MIN_VALUE <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#6: (Number.MIN_VALUE <= +Infinity) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.7.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.7.js new file mode 100644 index 0000000000..87f93efc78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.7.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity, return true +es5id: 11.8.3_A4.7 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NEGATIVE_INFINITY <= 0) !== true) { + throw new Test262Error('#1: (-Infinity <= 0) === true'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY <= 1.1) !== true) { + throw new Test262Error('#2: (-Infinity <= 1.1) === true'); +} + +//CHECK#3 +if ((Number.NEGATIVE_INFINITY <= -1.1) !== true) { + throw new Test262Error('#3: (-Infinity <= -1.1) === true'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY <= Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: (-Infinity <= +Infinity) === true'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY <= Number.MAX_VALUE) !== true) { + throw new Test262Error('#5: (-Infinity <= Number.MAX_VALUE) === true'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY <= Number.MIN_VALUE) !== true) { + throw new Test262Error('#6: (-Infinity <= Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.8.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.8.js new file mode 100644 index 0000000000..a861a06ae5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.8.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is -Infinity and x !== y, return false +es5id: 11.8.3_A4.8 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#1: (0 <= -Infinity) === false'); +} + +//CHECK#2 +if ((1.1 <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#2: (1.1 <= -Infinity) === false'); +} + +//CHECK#3 +if ((-1.1 <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#3: (-1.1 <= -Infinity) === false'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#4: (+Infinity <= -Infinity) === false'); +} + +//CHECK#5 +if ((Number.MAX_VALUE <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#5: (Number.MAX_VALUE <= -Infinity) === false'); +} + +//CHECK#6 +if ((Number.MIN_VALUE <= Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#6: (Number.MIN_VALUE <= -Infinity) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.9.js b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.9.js new file mode 100644 index 0000000000..36bd3703e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/S11.8.3_A4.9.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If x is less or equal than y and these values are both finite non-zero, + return true; otherwise, return false +es5id: 11.8.3_A4.9 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1.1 <= 1) !== false) { + throw new Test262Error('#1: (1.1 <= 1) === false'); +} + +//CHECK#2 +if ((1 <= 1.1) !== true) { + throw new Test262Error('#2: (1 <= 1.1) === true'); +} + +//CHECK#3 +if ((-1.1 <= -1) !== true) { + throw new Test262Error('#3: (-1.1 <= -1) === true'); +} + +//CHECK#4 +if ((-1 <= -1.1) !== false) { + throw new Test262Error('#4: (-1 <= -1.1) === false'); +} + +//CHECK#5 +if ((0 <= 0.1) !== true) { + throw new Test262Error('#5: (0 <= 0.1) === true'); +} + +//CHECK#6 +if ((-0.1 <= 0) !== true) { + throw new Test262Error('#6: (-0.1 <= 0) === true'); +} + +//CHECK#7 +if ((Number.MAX_VALUE/2 <= Number.MAX_VALUE) !== true) { + throw new Test262Error('#7: (Number.MAX_VALUE/2 <= Number.MAX_VALUE) === true'); +} + +//CHECK#8 +if ((Number.MIN_VALUE <= Number.MIN_VALUE*2) !== true) { + throw new Test262Error('#8: (Number.MIN_VALUE <= Number.MIN_VALUE*2) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-bigint.js new file mode 100644 index 0000000000..b797a7bfc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-bigint.js @@ -0,0 +1,166 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and BigInt values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + + sec-numeric-types-bigint-lessThan + BigInt::lessThan (x, y) + + The abstract operation BigInt::lessThan with two arguments x and y of BigInt type returns true if x is less than y and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n <= 0n, true, 'The result of (0n <= 0n) is true'); +assert.sameValue(1n <= 1n, true, 'The result of (1n <= 1n) is true'); +assert.sameValue(-1n <= -1n, true, 'The result of (-1n <= -1n) is true'); +assert.sameValue(0n <= -0n, true, 'The result of (0n <= -0n) is true'); +assert.sameValue(-0n <= 0n, true, 'The result of (-0n <= 0n) is true'); +assert.sameValue(0n <= 1n, true, 'The result of (0n <= 1n) is true'); +assert.sameValue(1n <= 0n, false, 'The result of (1n <= 0n) is false'); +assert.sameValue(0n <= -1n, false, 'The result of (0n <= -1n) is false'); +assert.sameValue(-1n <= 0n, true, 'The result of (-1n <= 0n) is true'); +assert.sameValue(1n <= -1n, false, 'The result of (1n <= -1n) is false'); +assert.sameValue(-1n <= 1n, true, 'The result of (-1n <= 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n <= 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n <= 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n <= 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n <= 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n <= -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n <= -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n <= -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n <= -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n <= 0n, + false, + 'The result of (0x10000000000000000n <= 0n) is false' +); + +assert.sameValue( + 0n <= 0x10000000000000000n, + true, + 'The result of (0n <= 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n <= 1n, + false, + 'The result of (0x10000000000000000n <= 1n) is false' +); + +assert.sameValue( + 1n <= 0x10000000000000000n, + true, + 'The result of (1n <= 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n <= -1n, + false, + 'The result of (0x10000000000000000n <= -1n) is false' +); + +assert.sameValue( + -1n <= 0x10000000000000000n, + true, + 'The result of (-1n <= 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n <= 0n, + false, + 'The result of (0x10000000000000001n <= 0n) is false' +); + +assert.sameValue( + 0n <= 0x10000000000000001n, + true, + 'The result of (0n <= 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n <= 0n, + true, + 'The result of (-0x10000000000000000n <= 0n) is true' +); + +assert.sameValue( + 0n <= -0x10000000000000000n, + false, + 'The result of (0n <= -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n <= 1n, + true, + 'The result of (-0x10000000000000000n <= 1n) is true' +); + +assert.sameValue( + 1n <= -0x10000000000000000n, + false, + 'The result of (1n <= -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n <= -1n, + true, + 'The result of (-0x10000000000000000n <= -1n) is true' +); + +assert.sameValue( + -1n <= -0x10000000000000000n, + false, + 'The result of (-1n <= -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n <= 0n, + true, + 'The result of (-0x10000000000000001n <= 0n) is true' +); + +assert.sameValue( + 0n <= -0x10000000000000001n, + false, + 'The result of (0n <= -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n <= 0x100000000n, + false, + 'The result of (0x10000000000000000n <= 0x100000000n) is false' +); + +assert.sameValue( + 0x100000000n <= 0x10000000000000000n, + true, + 'The result of (0x100000000n <= 0x10000000000000000n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js new file mode 100644 index 0000000000..272e197422 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-incomparable-string.js @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue('0n' <= 1n, false, 'The result of ("0n" <= 1n) is false'); +assert.sameValue('0.' <= 1n, false, 'The result of ("0." <= 1n) is false'); +assert.sameValue('.0' <= 1n, false, 'The result of (".0" <= 1n) is false'); +assert.sameValue('0/1' <= 1n, false, 'The result of ("0/1" <= 1n) is false'); +assert.sameValue('z0' <= 1n, false, 'The result of ("z0" <= 1n) is false'); +assert.sameValue('0z' <= 1n, false, 'The result of ("0z" <= 1n) is false'); +assert.sameValue('++0' <= 1n, false, 'The result of ("++0" <= 1n) is false'); +assert.sameValue('--0' <= 1n, false, 'The result of ("--0" <= 1n) is false'); +assert.sameValue('0e0' <= 1n, false, 'The result of ("0e0" <= 1n) is false'); +assert.sameValue('Infinity' <= 1n, false, 'The result of ("Infinity" <= 1n) is false'); +assert.sameValue(0n <= '1n', false, 'The result of (0n <= "1n") is false'); +assert.sameValue(0n <= '1.', false, 'The result of (0n <= "1.") is false'); +assert.sameValue(0n <= '.1', false, 'The result of (0n <= ".1") is false'); +assert.sameValue(0n <= '1/1', false, 'The result of (0n <= "1/1") is false'); +assert.sameValue(0n <= 'z1', false, 'The result of (0n <= "z1") is false'); +assert.sameValue(0n <= '1z', false, 'The result of (0n <= "1z") is false'); +assert.sameValue(0n <= '++1', false, 'The result of (0n <= "++1") is false'); +assert.sameValue(0n <= '--1', false, 'The result of (0n <= "--1") is false'); +assert.sameValue(0n <= '1e0', false, 'The result of (0n <= "1e0") is false'); +assert.sameValue(0n <= 'Infinity', false, 'The result of (0n <= "Infinity") is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-non-finite.js new file mode 100644 index 0000000000..db5ed7370b --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and non-finite Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. +features: [BigInt] +---*/ +assert.sameValue(1n <= Infinity, true, 'The result of (1n <= Infinity) is true'); +assert.sameValue(Infinity <= 1n, false, 'The result of (Infinity <= 1n) is false'); +assert.sameValue(-1n <= Infinity, true, 'The result of (-1n <= Infinity) is true'); +assert.sameValue(Infinity <= -1n, false, 'The result of (Infinity <= -1n) is false'); +assert.sameValue(1n <= -Infinity, false, 'The result of (1n <= -Infinity) is false'); +assert.sameValue(-Infinity <= 1n, true, 'The result of (-Infinity <= 1n) is true'); +assert.sameValue(-1n <= -Infinity, false, 'The result of (-1n <= -Infinity) is false'); +assert.sameValue(-Infinity <= -1n, true, 'The result of (-Infinity <= -1n) is true'); +assert.sameValue(0n <= NaN, false, 'The result of (0n <= NaN) is false'); +assert.sameValue(NaN <= 0n, false, 'The result of (NaN <= 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number-extremes.js new file mode 100644 index 0000000000..0f2c8e2904 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number-extremes.js @@ -0,0 +1,56 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(1n <= Number.MAX_VALUE, true, 'The result of (1n <= Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE <= 1n, false, 'The result of (Number.MAX_VALUE <= 1n) is false'); + +assert.sameValue( + 1n <= -Number.MAX_VALUE, + false, + 'The result of (1n <= -Number.MAX_VALUE) is false' +); + +assert.sameValue(-Number.MAX_VALUE <= 1n, true, 'The result of (-Number.MAX_VALUE <= 1n) is true'); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn <= Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn <= Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE <= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + false, + 'The result of (Number.MAX_VALUE <= 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n <= Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n <= Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE <= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + true, + 'The result of (Number.MAX_VALUE <= 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number.js b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number.js new file mode 100644 index 0000000000..7dbc454b0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-number.js @@ -0,0 +1,58 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(0n <= 0, true, 'The result of (0n <= 0) is true'); +assert.sameValue(0 <= 0n, true, 'The result of (0 <= 0n) is true'); +assert.sameValue(0n <= -0, true, 'The result of (0n <= -0) is true'); +assert.sameValue(-0 <= 0n, true, 'The result of (-0 <= 0n) is true'); +assert.sameValue(0n <= 0.000000000001, true, 'The result of (0n <= 0.000000000001) is true'); +assert.sameValue(0.000000000001 <= 0n, false, 'The result of (0.000000000001 <= 0n) is false'); +assert.sameValue(0n <= 1, true, 'The result of (0n <= 1) is true'); +assert.sameValue(1 <= 0n, false, 'The result of (1 <= 0n) is false'); +assert.sameValue(1n <= 0, false, 'The result of (1n <= 0) is false'); +assert.sameValue(0 <= 1n, true, 'The result of (0 <= 1n) is true'); +assert.sameValue(1n <= 0.999999999999, false, 'The result of (1n <= 0.999999999999) is false'); +assert.sameValue(0.999999999999 <= 1n, true, 'The result of (0.999999999999 <= 1n) is true'); +assert.sameValue(1n <= 1, true, 'The result of (1n <= 1) is true'); +assert.sameValue(1 <= 1n, true, 'The result of (1 <= 1n) is true'); +assert.sameValue(0n <= Number.MIN_VALUE, true, 'The result of (0n <= Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE <= 0n, false, 'The result of (Number.MIN_VALUE <= 0n) is false'); + +assert.sameValue( + 0n <= -Number.MIN_VALUE, + false, + 'The result of (0n <= -Number.MIN_VALUE) is false' +); + +assert.sameValue(-Number.MIN_VALUE <= 0n, true, 'The result of (-Number.MIN_VALUE <= 0n) is true'); + +assert.sameValue( + -10n <= Number.MIN_VALUE, + true, + 'The result of (-10n <= Number.MIN_VALUE) is true' +); + +assert.sameValue( + Number.MIN_VALUE <= -10n, + false, + 'The result of (Number.MIN_VALUE <= -10n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-string.js b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-string.js new file mode 100644 index 0000000000..b3563adab1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than-or-equal/bigint-and-string.js @@ -0,0 +1,53 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n <= '0', true, 'The result of (0n <= "0") is true'); +assert.sameValue('0' <= 0n, true, 'The result of ("0" <= 0n) is true'); +assert.sameValue(0n <= '1', true, 'The result of (0n <= "1") is true'); +assert.sameValue('0' <= 1n, true, 'The result of ("0" <= 1n) is true'); +assert.sameValue(1n <= '0', false, 'The result of (1n <= "0") is false'); +assert.sameValue('1' <= 0n, false, 'The result of ("1" <= 0n) is false'); +assert.sameValue(0n <= '', true, 'The result of (0n <= "") is true'); +assert.sameValue('' <= 0n, true, 'The result of ("" <= 0n) is true'); +assert.sameValue(0n <= '1', true, 'The result of (0n <= "1") is true'); +assert.sameValue('' <= 1n, true, 'The result of ("" <= 1n) is true'); +assert.sameValue(1n <= '', false, 'The result of (1n <= "") is false'); +assert.sameValue('1' <= 0n, false, 'The result of ("1" <= 0n) is false'); +assert.sameValue(1n <= '1', true, 'The result of (1n <= "1") is true'); +assert.sameValue('1' <= 1n, true, 'The result of ("1" <= 1n) is true'); +assert.sameValue(1n <= '-1', false, 'The result of (1n <= "-1") is false'); +assert.sameValue('1' <= -1n, false, 'The result of ("1" <= -1n) is false'); +assert.sameValue(-1n <= '1', true, 'The result of (-1n <= "1") is true'); +assert.sameValue('-1' <= 1n, true, 'The result of ("-1" <= 1n) is true'); +assert.sameValue(-1n <= '-1', true, 'The result of (-1n <= "-1") is true'); +assert.sameValue('-1' <= -1n, true, 'The result of ("-1" <= -1n) is true'); + +assert.sameValue( + 9007199254740993n <= '9007199254740992', + false, + 'The result of (9007199254740993n <= "9007199254740992") is false' +); + +assert.sameValue( + '9007199254740993' <= 9007199254740992n, + false, + 'The result of ("9007199254740993" <= 9007199254740992n) is false' +); + +assert.sameValue( + -9007199254740992n <= '-9007199254740993', + false, + 'The result of (-9007199254740992n <= "-9007199254740993") is false' +); + +assert.sameValue( + '-9007199254740992' <= -9007199254740993n, + false, + 'The result of ("-9007199254740992" <= -9007199254740993n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/browser.js b/js/src/tests/test262/language/expressions/less-than-or-equal/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/less-than-or-equal/shell.js b/js/src/tests/test262/language/expressions/less-than-or-equal/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A1.js new file mode 100644 index 0000000000..8645567c87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between RelationalExpression and "<" or + between "<" and ShiftExpression are allowed +es5id: 11.8.1_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("0\u0009<\u00091") !== true) { + throw new Test262Error('#1: (0\\u0009<\\u00091) === true'); +} + +//CHECK#2 +if (eval("0\u000B<\u000B1") !== true) { + throw new Test262Error('#2: (0\\u000B<\\u000B1) === true'); +} + +//CHECK#3 +if (eval("0\u000C<\u000C1") !== true) { + throw new Test262Error('#3: (0\\u000C<\\u000C1) === true'); +} + +//CHECK#4 +if (eval("0\u0020<\u00201") !== true) { + throw new Test262Error('#4: (0\\u0020<\\u00201) === true'); +} + +//CHECK#5 +if (eval("0\u00A0<\u00A01") !== true) { + throw new Test262Error('#5: (0\\u00A0<\\u00A01) === true'); +} + +//CHECK#6 +if (eval("0\u000A<\u000A1") !== true) { + throw new Test262Error('#6: (0\\u000A<\\u000A1) === true'); +} + +//CHECK#7 +if (eval("0\u000D<\u000D1") !== true) { + throw new Test262Error('#7: (0\\u000D<\\u000D1) === true'); +} + +//CHECK#8 +if (eval("0\u2028<\u20281") !== true) { + throw new Test262Error('#8: (0\\u2028<\\u20281) === true'); +} + +//CHECK#9 +if (eval("0\u2029<\u20291") !== true) { + throw new Test262Error('#9: (0\\u2029<\\u20291) === true'); +} + +//CHECK#10 +if (eval("0\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029<\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== true) { + throw new Test262Error('#10: (0\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029<\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T1.js new file mode 100644 index 0000000000..7f756de376 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x < y uses GetValue +es5id: 11.8.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 < 2 !== true) { + throw new Test262Error('#1: 1 < 2 === true'); +} + +//CHECK#2 +var x = 1; +if (x < 2 !== true) { + throw new Test262Error('#2: var x = 1; x < 2 === true'); +} + +//CHECK#3 +var y = 2; +if (1 < y !== true) { + throw new Test262Error('#3: var y = 2; 1 < y === true'); +} + +//CHECK#4 +var x = 1; +var y = 2; +if (x < y !== true) { + throw new Test262Error('#4: var x = 1; var y = 2; x < y === true'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 2; +if (objectx.prop < objecty.prop !== true) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 2; objectx.prop < objecty.prop === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T2.js new file mode 100644 index 0000000000..83b8207530 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x < y uses GetValue +es5id: 11.8.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x < 1; + throw new Test262Error('#1.1: x < 1 throw ReferenceError. Actual: ' + (x < 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x < 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T3.js new file mode 100644 index 0000000000..014b370c53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x < y uses GetValue +es5id: 11.8.1_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 < y; + throw new Test262Error('#1.1: 1 < y throw ReferenceError. Actual: ' + (1 < y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 < y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.2_T1.js new file mode 100644 index 0000000000..de80d4865b --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x < y uses [[Default Value]] +es5id: 11.8.1_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 0}} < 1 !== true) { + throw new Test262Error('#1: {valueOf: function() {return 1}} < 1 === true. Actual: ' + ({valueOf: function() {return 1}} < 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 0}, toString: function() {return 2}} < 1 !== true) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} < 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} < 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 0}, toString: function() {return {}}} < 1 !== true) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} < 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} < 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 0}, toString: function() {throw "error"}} < 1 !== true) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} < 1 === true. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} < 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 0}, toString: function() {throw "error"}} < 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 0}, toString: function() {throw "error"}} < 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 < {toString: function() {return 2}} !== true) { + throw new Test262Error('#5: 1 < {toString: function() {return 2}} === true. Actual: ' + (1 < {toString: function() {return 2}})); +} + +//CHECK#6 +if (1 < {valueOf: function() {return {}}, toString: function() {return 2}} !== true) { + throw new Test262Error('#6: 1 < {valueOf: function() {return {}}, toString: function() {return 2}} === true. Actual: ' + (1 < {valueOf: function() {return {}}, toString: function() {return 2}})); +} + +//CHECK#7 +try { + 1 < {valueOf: function() {throw "error"}, toString: function() {return 2}}; + throw new Test262Error('#7.1: 1 < {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (1 < {valueOf: function() {throw "error"}, toString: function() {return 2}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 < {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 < {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 < {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 < {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 < {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.3_T1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.3_T1.js new file mode 100644 index 0000000000..7f077891bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.8.1_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x < y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x < y throw "x". Actual: ' + (x < y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x < y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T1.js new file mode 100644 index 0000000000..09aa62afb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 1; +if ((x = 0) < x !== false) { + throw new Test262Error('#1: var x = 1; (x = 0) < x === false'); +} + +//CHECK#2 +var x = 0; +if (x < (x = 1) !== true) { + throw new Test262Error('#2: var x = 0; x < (x = 1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T2.js new file mode 100644 index 0000000000..a02e747a2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() < y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() < y() throw "x". Actual: ' + (x() < y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() < y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T3.js new file mode 100644 index 0000000000..54cdb69d41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.1_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x < (x = 1); + throw new Test262Error('#1.1: x < (x = 1) throw ReferenceError. Actual: ' + (x < (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x < (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T4.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T4.js new file mode 100644 index 0000000000..e687039bd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.8.1_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) < y !== false) { + throw new Test262Error('#1: (y = 1) < y === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.1.js new file mode 100644 index 0000000000..b5e1a07c2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + boolean and Boolean object +---*/ + +//CHECK#1 +if (true < true !== false) { + throw new Test262Error('#1: true < true === false'); +} + +//CHECK#2 +if (new Boolean(true) < true !== false) { + throw new Test262Error('#2: new Boolean(true) < true === false'); +} + +//CHECK#3 +if (true < new Boolean(true) !== false) { + throw new Test262Error('#3: true < new Boolean(true) === false'); +} + +//CHECK#4 +if (new Boolean(true) < new Boolean(true) !== false) { + throw new Test262Error('#4: new Boolean(true) < new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.2.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.2.js new file mode 100644 index 0000000000..49821129ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + number and Number object +---*/ + +//CHECK#1 +if (1 < 1 !== false) { + throw new Test262Error('#1: 1 < 1 === false'); +} + +//CHECK#2 +if (new Number(1) < 1 !== false) { + throw new Test262Error('#2: new Number(1) < 1 === false'); +} + +//CHECK#3 +if (1 < new Number(1) !== false) { + throw new Test262Error('#3: 1 < new Number(1) === false'); +} + +//CHECK#4 +if (new Number(1) < new Number(1) !== false) { + throw new Test262Error('#4: new Number(1) < new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.3.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.3.js new file mode 100644 index 0000000000..36742c87c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T1.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T1.3 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Null and + Undefined +---*/ + +//CHECK#1 +if (null < undefined !== false) { + throw new Test262Error('#1: null < undefined === false'); +} + +//CHECK#2 +if (undefined < null !== false) { + throw new Test262Error('#2: undefined < null === false'); +} + +//CHECK#3 +if (undefined < undefined !== false) { + throw new Test262Error('#3: undefined < undefined === false'); +} + +//CHECK#4 +if (null < null !== false) { + throw new Test262Error('#4: null < null === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.1.js new file mode 100644 index 0000000000..2a77f8a6c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.1 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types are Number (primitive or object) or Boolean (primitive and + object) +---*/ + +//CHECK#1 +if (true < 1 !== false) { + throw new Test262Error('#1: true < 1 === false'); +} + +//CHECK#2 +if (1 < true !== false) { + throw new Test262Error('#2: 1 < true === false'); +} + +//CHECK#3 +if (new Boolean(true) < 1 !== false) { + throw new Test262Error('#3: new Boolean(true) < 1 === false'); +} + +//CHECK#4 +if (1 < new Boolean(true) !== false) { + throw new Test262Error('#4: 1 < new Boolean(true) === false'); +} + +//CHECK#5 +if (true < new Number(1) !== false) { + throw new Test262Error('#5: true < new Number(1) === false'); +} + +//CHECK#6 +if (new Number(1) < true !== false) { + throw new Test262Error('#6: new Number(1) < true === false'); +} + +//CHECK#7 +if (new Boolean(true) < new Number(1) !== false) { + throw new Test262Error('#7: new Boolean(true) < new Number(1) === false'); +} + +//CHECK#8 +if (new Number(1) < new Boolean(true) !== false) { + throw new Test262Error('#8: new Number(1) < new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.2.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.2.js new file mode 100644 index 0000000000..51f303eed2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.2 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and String + (primitive and object) +---*/ + +//CHECK#1 +if ("1" < 1 !== false) { + throw new Test262Error('#1: "1" < 1 === false'); +} + +//CHECK#2 +if (1 < "1" !== false) { + throw new Test262Error('#2: 1 < "1" === false'); +} + +//CHECK#3 +if (new String("1") < 1 !== false) { + throw new Test262Error('#3: new String("1") < 1 === false'); +} + +//CHECK#4 +if (1 < new String("1") !== false) { + throw new Test262Error('#4: 1 < new String("1") === false'); +} + +//CHECK#5 +if ("1" < new Number(1) !== false) { + throw new Test262Error('#5: "1" < new Number(1) === false'); +} + +//CHECK#6 +if (new Number(1) < "1" !== false) { + throw new Test262Error('#6: new Number(1) < "1" === false'); +} + +//CHECK#7 +if (new String("1") < new Number(1) !== false) { + throw new Test262Error('#7: new String("1") < new Number(1) === false'); +} + +//CHECK#8 +if (new Number(1) < new String("1") !== false) { + throw new Test262Error('#8: new Number(1) < new String("1") === false'); +} + +//CHECK#9 +if ("x" < 1 !== false) { + throw new Test262Error('#9: "x" < 1 === false'); +} + +//CHECK#10 +if (1 < "x" !== false) { + throw new Test262Error('#10: 1 < "x" === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.3.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.3.js new file mode 100644 index 0000000000..5a538c7e39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.3.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.3 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 < null !== false) { + throw new Test262Error('#1: 1 < null === false'); +} + +//CHECK#2 +if (null < 1 !== true) { + throw new Test262Error('#2: null < 1 === true'); +} + +//CHECK#3 +if (new Number(1) < null !== false) { + throw new Test262Error('#3: new Number(1) < null === false'); +} + +//CHECK#4 +if (null < new Number(1) !== true) { + throw new Test262Error('#4: null < new Number(1) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.4.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.4.js new file mode 100644 index 0000000000..6cb79f6e26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.4 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 < undefined !== false) { + throw new Test262Error('#1: 1 < undefined === false'); +} + +//CHECK#2 +if (undefined < 1 !== false) { + throw new Test262Error('#2: undefined < 1 === false'); +} + +//CHECK#3 +if (new Number(1) < undefined !== false) { + throw new Test262Error('#3: new Number(1) < undefined === false'); +} + +//CHECK#4 +if (undefined < new Number(1) !== false) { + throw new Test262Error('#4: undefined < new Number(1) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.5.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.5.js new file mode 100644 index 0000000000..e5c9a3fb95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.5.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.5 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Boolean + (primitive and object) +---*/ + +//CHECK#1 +if (true < "1" !== false) { + throw new Test262Error('#1: true < "1" === false'); +} + +//CHECK#2 +if ("1" < true !== false) { + throw new Test262Error('#2: "1" < true === false'); +} + +//CHECK#3 +if (new Boolean(true) < "1" !== false) { + throw new Test262Error('#3: new Boolean(true) < "1" === false'); +} + +//CHECK#4 +if ("1" < new Boolean(true) !== false) { + throw new Test262Error('#4: "1" < new Boolean(true) === false'); +} + +//CHECK#5 +if (true < new String("1") !== false) { + throw new Test262Error('#5: true < new String("1") === false'); +} + +//CHECK#6 +if (new String("1") < true !== false) { + throw new Test262Error('#6: new String("1") < true === false'); +} + +//CHECK#7 +if (new Boolean(true) < new String("1") !== false) { + throw new Test262Error('#7: new Boolean(true) < new String("1") === false'); +} + +//CHECK#8 +if (new String("1") < new Boolean(true) !== false) { + throw new Test262Error('#8: new String("1") < new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.6.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.6.js new file mode 100644 index 0000000000..cf7de4540c --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.6 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" < undefined !== false) { + throw new Test262Error('#1: "1" < undefined === false'); +} + +//CHECK#2 +if (undefined < "1" !== false) { + throw new Test262Error('#2: undefined < "1" === false'); +} + +//CHECK#3 +if (new String("1") < undefined !== false) { + throw new Test262Error('#3: new String("1") < undefined === false'); +} + +//CHECK#4 +if (undefined < new String("1") !== false) { + throw new Test262Error('#4: undefined < new String("1") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.7.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.7.js new file mode 100644 index 0000000000..247c16a40b --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.7.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.7 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" < null !== false) { + throw new Test262Error('#1: "1" < null === false'); +} + +//CHECK#2 +if (null < "1" !== true) { + throw new Test262Error('#2: null < "1" === true'); +} + +//CHECK#3 +if (new String("1") < null !== false) { + throw new Test262Error('#3: new String("1") < null === false'); +} + +//CHECK#4 +if (null < new String("1") !== true) { + throw new Test262Error('#4: null < new String("1") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.8.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.8.js new file mode 100644 index 0000000000..bfbf45c144 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.8.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.8 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true < undefined !== false) { + throw new Test262Error('#1: true < undefined === false'); +} + +//CHECK#2 +if (undefined < true !== false) { + throw new Test262Error('#2: undefined < true === false'); +} + +//CHECK#3 +if (new Boolean(true) < undefined !== false) { + throw new Test262Error('#3: new Boolean(true) < undefined === false'); +} + +//CHECK#4 +if (undefined < new Boolean(true) !== false) { + throw new Test262Error('#4: undefined < new Boolean(true) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.9.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.9.js new file mode 100644 index 0000000000..811a7bf30b --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.1_T2.9.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(Primitive(x)) is not String or Type(Primitive(y)) is not String, + then operator x < y returns ToNumber(x) < ToNumber(y) +es5id: 11.8.1_A3.1_T2.9 +description: > + Type(Primitive(x)) is different from Type(Primitive(y)) and both + types vary between Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true < null !== false) { + throw new Test262Error('#1: true < null === false'); +} + +//CHECK#2 +if (null < true !== true) { + throw new Test262Error('#2: null < true === true'); +} + +//CHECK#3 +if (new Boolean(true) < null !== false) { + throw new Test262Error('#3: new Boolean(true) < null === false'); +} + +//CHECK#4 +if (null < new Boolean(true) !== true) { + throw new Test262Error('#4: null < new Boolean(true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.1.js new file mode 100644 index 0000000000..51e3889438 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x < y returns ToString(x) < ToString(y), if Type(Primitive(x)) + is String and Type(Primitive(y)) is String +es5id: 11.8.1_A3.2_T1.1 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between primitive + string and String object +---*/ + +//CHECK#1 +if ("1" < "1" !== false) { + throw new Test262Error('#1: "1" < "1" === false'); +} + +//CHECK#2 +if (new String("1") < "1" !== false) { + throw new Test262Error('#2: new String("1") < "1" === false'); +} + +//CHECK#3 +if ("1" < new String("1") !== false) { + throw new Test262Error('#3: "1" < new String("1") === false'); +} + +//CHECK#4 +if (new String("1") < new String("1") !== false) { + throw new Test262Error('#4: new String("1") < new String("1") === false'); +} + +//CHECK#5 +if ("x" < "1" !== false) { + throw new Test262Error('#5: "x" < "1" === false'); +} + +//CHECK#6 +if ("1" < "x" !== true) { + throw new Test262Error('#6: "1" < "x" === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.2.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.2.js new file mode 100644 index 0000000000..8f09b4df81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A3.2_T1.2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Operator x < y returns ToString(x) < ToString(y), if Type(Primitive(x)) + is String and Type(Primitive(y)) is String +es5id: 11.8.1_A3.2_T1.2 +description: > + Type(Primitive(x)) and Type(Primitive(y)) vary between Object + object and Function object +---*/ + +//CHECK#1 +if (({} < function(){return 1}) !== ({}.toString() < function(){return 1}.toString())) { + throw new Test262Error('#1: ({} < function(){return 1}) === ({}.toString() < function(){return 1}.toString())'); +} + +//CHECK#2 +if ((function(){return 1} < {}) !== (function(){return 1}.toString() < {}.toString())) { + throw new Test262Error('#2: (function(){return 1} < {}) === (function(){return 1}.toString() < {}.toString())'); +} + +//CHECK#3 +if ((function(){return 1} < function(){return 1}) !== (function(){return 1}.toString() < function(){return 1}.toString())) { + throw new Test262Error('#3: (function(){return 1} < function(){return 1}) === (function(){return 1}.toString() < function(){return 1}.toString())'); +} + +//CHECK#4 +if (({} < {}) !== ({}.toString() < {}.toString())) { + throw new Test262Error('#4: ({} < {}) === ({}.toString() < {}.toString())'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.1.js new file mode 100644 index 0000000000..fd700762b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.1.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.1_A4.1 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NaN < 0) !== false) { + throw new Test262Error('#1: (NaN < 0) === false'); +} + +//CHECK#2 +if ((Number.NaN < 1.1) !== false) { + throw new Test262Error('#2: (NaN < 1.1) === false'); +} + +//CHECK#3 +if ((Number.NaN < -1.1) !== false) { + throw new Test262Error('#3: (NaN < -1.1) === false'); +} + +//CHECK#4 +if ((Number.NaN < Number.NaN) !== false) { + throw new Test262Error('#4: (NaN < NaN) === false'); +} + +//CHECK#5 +if ((Number.NaN < Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (NaN < +Infinity) === false'); +} + +//CHECK#6 +if ((Number.NaN < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#6: (NaN < -Infinity) === false'); +} + +//CHECK#7 +if ((Number.NaN < Number.MAX_VALUE) !== false) { + throw new Test262Error('#7: (NaN < Number.MAX_VALUE) === false'); +} + +//CHECK#8 +if ((Number.NaN < Number.MIN_VALUE) !== false) { + throw new Test262Error('#8: (NaN < Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.10.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.10.js new file mode 100644 index 0000000000..8003899b37 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.10.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is a prefix of x, return false +es5id: 11.8.1_A4.10 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" < "x") !== false) { + throw new Test262Error('#1: ("x" < "x") === false'); +} + +//CHECK#2 +if (("x" < "") !== false) { + throw new Test262Error('#2: ("x" < "") === false'); +} + +//CHECK#3 +if (("abcd" < "ab") !== false) { + throw new Test262Error('#3: ("abcd" < ab") === false'); +} + +//CHECK#4 +if (("abc\u0064" < "abcd") !== false) { + throw new Test262Error('#4: ("abc\\u0064" < abcd") === false'); +} + +//CHECK#5 +if (("x" + "y" < "x") !== false) { + throw new Test262Error('#5: ("x" + "y" < "x") === false'); +} + +//CHECK#6 +var x = "x"; +if ((x + "y" < x) !== false) { + throw new Test262Error('#6: var x = "x"; (x + "y" < x) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.11.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.11.js new file mode 100644 index 0000000000..0b917a8e79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.11.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is a prefix of y and x !== y, return true +es5id: 11.8.1_A4.11 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("x" < "x ") !== true) { + throw new Test262Error('#1: ("x" < "x ") === true'); +} + +//CHECK#2 +if (("" < "x") !== true) { + throw new Test262Error('#2: ("" < "x") === true'); +} + +//CHECK#3 +if (("ab" < "abcd") !== true) { + throw new Test262Error('#3: ("ab" < abcd") === true'); +} + +//CHECK#4 +if (("abcd" < "abc\u0064") !== false) { + throw new Test262Error('#4: ("abcd" < abc\\u0064") === false'); +} + +//CHECK#5 +if (("x" < "x" + "y") !== true) { + throw new Test262Error('#5: ("x" < "x" + "y") === true'); +} + +//CHECK#6 +var x = "x"; +if ((x < x + "y") !== true) { + throw new Test262Error('#6: var x = "x"; (x < x + "y") === true'); +} + +//CHECK#7 +if (("a\u0000" < "a\u0000a") !== true) { + throw new Test262Error('#7: ("a\\u0000" < "a\\u0000a") === true'); +} + +//CHECK#8 +if (("x" < " x") !== false) { + throw new Test262Error('#8: ("x" < " x") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T1.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T1.js new file mode 100644 index 0000000000..6befe2fd94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T1.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.1_A4.12_T1 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("xx" < "xy") !== true) { + throw new Test262Error('#1: ("xx" < "xy") === true'); +} + +//CHECK#2 +if (("xy" < "xx") !== false) { + throw new Test262Error('#2: ("xy" < "xx") === false'); +} + +//CHECK#3 +if (("x" < "y") !== true) { + throw new Test262Error('#3: ("x" < y") === true'); +} + +//CHECK#4 +if (("aab" < "aba") !== true) { + throw new Test262Error('#4: ("aab" < aba") === true'); +} + +//CHECK#5 +if (("\u0061\u0061\u0061\u0062" < "\u0061\u0061\u0061\u0061") !== false) { + throw new Test262Error('#5: ("\\u0061\\u0061\\u0061\\u0062" < \\u0061\\u0061\\u0061\\u0061") === false'); +} + +//CHECK#6 +if (("a\u0000a" < "a\u0000b") !== true) { + throw new Test262Error('#6: ("a\\u0000a" < "a\\u0000b") === true'); +} + +//CHECK#7 +if (("aB" < "aa") !== true) { + throw new Test262Error('#7: ("aB" < aa") === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T2.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T2.js new file mode 100644 index 0000000000..f6cc75ba64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.12_T2.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If neither x, nor y is a prefix of each other, returned result of strings + comparison applies a simple lexicographic ordering to the sequences of + code point value values +es5id: 11.8.1_A4.12_T2 +description: x and y are string primitives +---*/ + +//CHECK#1 +if (("0" < "x") !== true) { + throw new Test262Error('#1: ("0" < "x") !== true'); +} + +//CHECK#2 +if (("-" < "0") !== true) { + throw new Test262Error('#2: ("-" < "0") !== true'); +} + +//CHECK#3 +if (("." < "0") !== true) { + throw new Test262Error('#3: ("." < "0") !== true'); +} + +//CHECK#4 +if (("+" < "-") !== true) { + throw new Test262Error('#4: ("+" < "-") !== true'); +} + +//CHECK#5 +if (("-0" < "-1") !== true) { + throw new Test262Error('#5: ("-0" < "-1") !== true'); +} + +//CHECK#6 +if (("+1" < "-1") !== true) { + throw new Test262Error('#6: ("+1" < "-1") !== true'); +} + +//CHECK#7 +if (("1" < "1e-10") !== true) { +throw new Test262Error('#7: ("1" < "1e-10") !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.2.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.2.js new file mode 100644 index 0000000000..77c0d45965 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.2.js @@ -0,0 +1,50 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is NaN, return false (if result in 11.8.5 is undefined, return false) +es5id: 11.8.1_A4.2 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 < Number.NaN) !== false) { + throw new Test262Error('#1: (0 < NaN) === false'); +} + +//CHECK#2 +if ((1.1 < Number.NaN) !== false) { + throw new Test262Error('#2: (1.1 < NaN) === false'); +} + +//CHECK#3 +if ((-1.1 < Number.NaN) !== false) { + throw new Test262Error('#3: (-1.1 < NaN) === false'); +} + +//CHECK#4 +if ((Number.NaN < Number.NaN) !== false) { + throw new Test262Error('#4: (NaN < NaN) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY < Number.NaN) !== false) { + throw new Test262Error('#5: (+Infinity < NaN) === false'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY < Number.NaN) !== false) { + throw new Test262Error('#6: (-Infinity < NaN) === false'); +} + +//CHECK#7 +if ((Number.MAX_VALUE < Number.NaN) !== false) { + throw new Test262Error('#7: (Number.MAX_VALUE < NaN) === false'); +} + +//CHECK#8 +if ((Number.MIN_VALUE < Number.NaN) !== false) { + throw new Test262Error('#8: (Number.MIN_VALUE < NaN) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.3.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.3.js new file mode 100644 index 0000000000..922ace4e4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.3.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x and y are the same number value, return false +es5id: 11.8.1_A4.3 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1 < 1) !== false) { + throw new Test262Error('#1: (1 < 1) === false'); +} + +//CHECK#2 +if ((1.1 < 1.1) !== false) { + throw new Test262Error('#2: (1.1 < 1.1) === false'); +} + +//CHECK#3 +if ((-1.1 < -1.1) !== false) { + throw new Test262Error('#3: (-1.1 < -1.1) === false'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#4: (-Infinity < -Infinity) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#5: (+Infinity < +Infinity) === false'); +} + +//CHECK#6 +if ((Number.MAX_VALUE < Number.MAX_VALUE) !== false) { + throw new Test262Error('#6: (Number.MAX_VALUE < Number.MAX_VALUE) === false'); +} + +//CHECK#7 +if ((Number.MIN_VALUE < Number.MIN_VALUE) !== false) { + throw new Test262Error('#7: (Number.MIN_VALUE < Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.4.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.4.js new file mode 100644 index 0000000000..5af768ba90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x and y are +0 and -0, return false +es5id: 11.8.1_A4.4 +description: Checking all combinations +---*/ + +//CHECK#1 +if ((0 < 0) !== false) { + throw new Test262Error('#1: (0 < 0) === false'); +} + +//CHECK#2 +if ((-0 < -0) !== false) { + throw new Test262Error('#2: (-0 < -0) === false'); +} + +//CHECK#3 +if ((+0 < -0) !== false) { + throw new Test262Error('#3: (+0 < -0) === false'); +} + +//CHECK#4 +if ((-0 < +0) !== false) { + throw new Test262Error('#4: (-0 < +0) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.5.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.5.js new file mode 100644 index 0000000000..37870b819e --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.5.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +Infinity, return false +es5id: 11.8.1_A4.5 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.POSITIVE_INFINITY < 0) !== false) { + throw new Test262Error('#1: (+Infinity < 0) === false'); +} + +//CHECK#2 +if ((Number.POSITIVE_INFINITY < 1.1) !== false) { + throw new Test262Error('#2: (+Infinity < 1.1) === false'); +} + +//CHECK#3 +if ((Number.POSITIVE_INFINITY < -1.1) !== false) { + throw new Test262Error('#3: (+Infinity < -1.1) === false'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#4: (+Infinity < -Infinity) === false'); +} + +//CHECK#5 +if ((Number.POSITIVE_INFINITY < Number.MAX_VALUE) !== false) { + throw new Test262Error('#5: (+Infinity < Number.MAX_VALUE) === false'); +} + +//CHECK#6 +if ((Number.POSITIVE_INFINITY < Number.MIN_VALUE) !== false) { + throw new Test262Error('#6: (+Infinity < Number.MIN_VALUE) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.6.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.6.js new file mode 100644 index 0000000000..aa76327c3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.6.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is +Infinity and x !== y, return true +es5id: 11.8.1_A4.6 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 < Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#1: (0 < +Infinity) === true'); +} + +//CHECK#2 +if ((1.1 < Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#2: (1.1 < +Infinity) === true'); +} + +//CHECK#3 +if ((-1.1 < Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#3: (-1.1 < +Infinity) === true'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY < Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: (-Infinity < +Infinity) === true'); +} + +//CHECK#5 +if ((Number.MAX_VALUE < Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#5: (Number.MAX_VALUE < +Infinity) === true'); +} + +//CHECK#6 +if ((Number.MIN_VALUE < Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#6: (Number.MIN_VALUE < +Infinity) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.7.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.7.js new file mode 100644 index 0000000000..5f988d3890 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.7.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is -Infinity and x !== y, return true +es5id: 11.8.1_A4.7 +description: y is number primitive +---*/ + +//CHECK#1 +if ((Number.NEGATIVE_INFINITY < 0) !== true) { + throw new Test262Error('#1: (-Infinity < 0) === true'); +} + +//CHECK#2 +if ((Number.NEGATIVE_INFINITY < 1.1) !== true) { + throw new Test262Error('#2: (-Infinity < 1.1) === true'); +} + +//CHECK#3 +if ((Number.NEGATIVE_INFINITY < -1.1) !== true) { + throw new Test262Error('#3: (-Infinity < -1.1) === true'); +} + +//CHECK#4 +if ((Number.NEGATIVE_INFINITY < Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: (-Infinity < +Infinity) === true'); +} + +//CHECK#5 +if ((Number.NEGATIVE_INFINITY < Number.MAX_VALUE) !== true) { + throw new Test262Error('#5: (-Infinity < Number.MAX_VALUE) === true'); +} + +//CHECK#6 +if ((Number.NEGATIVE_INFINITY < Number.MIN_VALUE) !== true) { + throw new Test262Error('#6: (-Infinity < Number.MIN_VALUE) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.8.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.8.js new file mode 100644 index 0000000000..8b70e2fc21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.8.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If y is -Infinity, return false +es5id: 11.8.1_A4.8 +description: x is number primitive +---*/ + +//CHECK#1 +if ((0 < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#1: (0 < -Infinity) === false'); +} + +//CHECK#2 +if ((1.1 < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#2: (1.1 < -Infinity) === false'); +} + +//CHECK#3 +if ((-1.1 < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#3: (-1.1 < -Infinity) === false'); +} + +//CHECK#4 +if ((Number.POSITIVE_INFINITY < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#4: (+Infinity < -Infinity) === false'); +} + +//CHECK#5 +if ((Number.MAX_VALUE < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#5: (Number.MAX_VALUE < -Infinity) === false'); +} + +//CHECK#6 +if ((Number.MIN_VALUE < Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#6: (Number.MIN_VALUE < -Infinity) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.9.js b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.9.js new file mode 100644 index 0000000000..bbfd6b8295 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/S11.8.1_A4.9.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If x is less than y and these values are both finite non-zero, return + true; otherwise, return false +es5id: 11.8.1_A4.9 +description: x and y are number primitives +---*/ + +//CHECK#1 +if ((1.1 < 1) !== false) { + throw new Test262Error('#1: (1.1 < 1) === false'); +} + +//CHECK#2 +if ((1 < 1.1) !== true) { + throw new Test262Error('#2: (1 < 1.1) === true'); +} + +//CHECK#3 +if ((-1.1 < -1) !== true) { + throw new Test262Error('#3: (-1.1 < -1) === true'); +} + +//CHECK#4 +if ((-1 < -1.1) !== false) { + throw new Test262Error('#4: (-1 < -1.1) === false'); +} + +//CHECK#5 +if ((0 < 0.1) !== true) { + throw new Test262Error('#5: (0 < 0.1) === true'); +} + +//CHECK#6 +if ((-0.1 < 0) !== true) { + throw new Test262Error('#6: (-0.1 < 0) === true'); +} + +//CHECK#7 +if ((Number.MAX_VALUE/2 < Number.MAX_VALUE) !== true) { + throw new Test262Error('#7: (Number.MAX_VALUE/2 < Number.MAX_VALUE) === true'); +} + +//CHECK#8 +if ((Number.MIN_VALUE < Number.MIN_VALUE*2) !== true) { + throw new Test262Error('#8: (Number.MIN_VALUE < Number.MIN_VALUE*2) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-bigint.js new file mode 100644 index 0000000000..a43049200d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-bigint.js @@ -0,0 +1,166 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and BigInt values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + + sec-numeric-types-bigint-lessThan + BigInt::lessThan (x, y) + + The abstract operation BigInt::lessThan with two arguments x and y of BigInt type returns true if x is less than y and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n < 0n, false, 'The result of (0n < 0n) is false'); +assert.sameValue(1n < 1n, false, 'The result of (1n < 1n) is false'); +assert.sameValue(-1n < -1n, false, 'The result of (-1n < -1n) is false'); +assert.sameValue(0n < -0n, false, 'The result of (0n < -0n) is false'); +assert.sameValue(-0n < 0n, false, 'The result of (-0n < 0n) is false'); +assert.sameValue(0n < 1n, true, 'The result of (0n < 1n) is true'); +assert.sameValue(1n < 0n, false, 'The result of (1n < 0n) is false'); +assert.sameValue(0n < -1n, false, 'The result of (0n < -1n) is false'); +assert.sameValue(-1n < 0n, true, 'The result of (-1n < 0n) is true'); +assert.sameValue(1n < -1n, false, 'The result of (1n < -1n) is false'); +assert.sameValue(-1n < 1n, true, 'The result of (-1n < 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n < 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n < 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n < 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n < 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n < -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n < -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n < -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n < -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n < 0n, + false, + 'The result of (0x10000000000000000n < 0n) is false' +); + +assert.sameValue( + 0n < 0x10000000000000000n, + true, + 'The result of (0n < 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n < 1n, + false, + 'The result of (0x10000000000000000n < 1n) is false' +); + +assert.sameValue( + 1n < 0x10000000000000000n, + true, + 'The result of (1n < 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n < -1n, + false, + 'The result of (0x10000000000000000n < -1n) is false' +); + +assert.sameValue( + -1n < 0x10000000000000000n, + true, + 'The result of (-1n < 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n < 0n, + false, + 'The result of (0x10000000000000001n < 0n) is false' +); + +assert.sameValue( + 0n < 0x10000000000000001n, + true, + 'The result of (0n < 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n < 0n, + true, + 'The result of (-0x10000000000000000n < 0n) is true' +); + +assert.sameValue( + 0n < -0x10000000000000000n, + false, + 'The result of (0n < -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n < 1n, + true, + 'The result of (-0x10000000000000000n < 1n) is true' +); + +assert.sameValue( + 1n < -0x10000000000000000n, + false, + 'The result of (1n < -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n < -1n, + true, + 'The result of (-0x10000000000000000n < -1n) is true' +); + +assert.sameValue( + -1n < -0x10000000000000000n, + false, + 'The result of (-1n < -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n < 0n, + true, + 'The result of (-0x10000000000000001n < 0n) is true' +); + +assert.sameValue( + 0n < -0x10000000000000001n, + false, + 'The result of (0n < -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n < 0x100000000n, + false, + 'The result of (0x10000000000000000n < 0x100000000n) is false' +); + +assert.sameValue( + 0x100000000n < 0x10000000000000000n, + true, + 'The result of (0x100000000n < 0x10000000000000000n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-boolean.js new file mode 100644 index 0000000000..439b2bd27f --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-boolean.js @@ -0,0 +1,23 @@ +// Copyright (C) 2018 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and boolean values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n < false, false, 'The result of (0n < false) is false'); +assert.sameValue(false < 0n, false, 'The result of (false < 0n) is false'); +assert.sameValue(0n < true, true, 'The result of (0n < true) is true'); +assert.sameValue(true < 0n, false, 'The result of (true < 0n) is false'); +assert.sameValue(1n < false, false, 'The result of (1n < false) is false'); +assert.sameValue(false < 1n, true, 'The result of (false < 1n) is true'); +assert.sameValue(1n < true, false, 'The result of (1n < true) is false'); +assert.sameValue(true < 1n, false, 'The result of (true < 1n) is false'); +assert.sameValue(31n < true, false, 'The result of (31n < true) is false'); +assert.sameValue(true < 31n, true, 'The result of (true < 31n) is true'); +assert.sameValue(-3n < true, true, 'The result of (-3n < true) is true'); +assert.sameValue(true < -3n, false, 'The result of (true < -3n) is false'); +assert.sameValue(-3n < false, true, 'The result of (-3n < false) is true'); +assert.sameValue(false < -3n, false, 'The result of (false < -3n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-incomparable-string.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-incomparable-string.js new file mode 100644 index 0000000000..67a4532d7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-incomparable-string.js @@ -0,0 +1,29 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue('0n' < 1n, false, 'The result of ("0n" < 1n) is false'); +assert.sameValue('0.' < 1n, false, 'The result of ("0." < 1n) is false'); +assert.sameValue('.0' < 1n, false, 'The result of (".0" < 1n) is false'); +assert.sameValue('0/1' < 1n, false, 'The result of ("0/1" < 1n) is false'); +assert.sameValue('z0' < 1n, false, 'The result of ("z0" < 1n) is false'); +assert.sameValue('0z' < 1n, false, 'The result of ("0z" < 1n) is false'); +assert.sameValue('++0' < 1n, false, 'The result of ("++0" < 1n) is false'); +assert.sameValue('--0' < 1n, false, 'The result of ("--0" < 1n) is false'); +assert.sameValue('0e0' < 1n, false, 'The result of ("0e0" < 1n) is false'); +assert.sameValue('Infinity' < 1n, false, 'The result of ("Infinity" < 1n) is false'); +assert.sameValue(0n < '1n', false, 'The result of (0n < "1n") is false'); +assert.sameValue(0n < '1.', false, 'The result of (0n < "1.") is false'); +assert.sameValue(0n < '.1', false, 'The result of (0n < ".1") is false'); +assert.sameValue(0n < '1/1', false, 'The result of (0n < "1/1") is false'); +assert.sameValue(0n < 'z1', false, 'The result of (0n < "z1") is false'); +assert.sameValue(0n < '1z', false, 'The result of (0n < "1z") is false'); +assert.sameValue(0n < '++1', false, 'The result of (0n < "++1") is false'); +assert.sameValue(0n < '--1', false, 'The result of (0n < "--1") is false'); +assert.sameValue(0n < '1e0', false, 'The result of (0n < "1e0") is false'); +assert.sameValue(0n < 'Infinity', false, 'The result of (0n < "Infinity") is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-non-finite.js new file mode 100644 index 0000000000..96a74f6d49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-non-finite.js @@ -0,0 +1,31 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and non-finite Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. +features: [BigInt] +---*/ +assert.sameValue(1n < Infinity, true, 'The result of (1n < Infinity) is true'); +assert.sameValue(Infinity < 1n, false, 'The result of (Infinity < 1n) is false'); +assert.sameValue(-1n < Infinity, true, 'The result of (-1n < Infinity) is true'); +assert.sameValue(Infinity < -1n, false, 'The result of (Infinity < -1n) is false'); +assert.sameValue(1n < -Infinity, false, 'The result of (1n < -Infinity) is false'); +assert.sameValue(-Infinity < 1n, true, 'The result of (-Infinity < 1n) is true'); +assert.sameValue(-1n < -Infinity, false, 'The result of (-1n < -Infinity) is false'); +assert.sameValue(-Infinity < -1n, true, 'The result of (-Infinity < -1n) is true'); +assert.sameValue(0n < NaN, false, 'The result of (0n < NaN) is false'); +assert.sameValue(NaN < 0n, false, 'The result of (NaN < 0n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-number-extremes.js new file mode 100644 index 0000000000..7f912f9bad --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-number-extremes.js @@ -0,0 +1,50 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of large BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(1n < Number.MAX_VALUE, true, 'The result of (1n < Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE < 1n, false, 'The result of (Number.MAX_VALUE < 1n) is false'); +assert.sameValue(1n < -Number.MAX_VALUE, false, 'The result of (1n < -Number.MAX_VALUE) is false'); +assert.sameValue(-Number.MAX_VALUE < 1n, true, 'The result of (-Number.MAX_VALUE < 1n) is true'); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn < Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn < Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE < 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + false, + 'The result of (Number.MAX_VALUE < 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n < Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n < Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE < 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + true, + 'The result of (Number.MAX_VALUE < 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-number.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-number.js new file mode 100644 index 0000000000..4661da4db7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-number.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Comparisons of BigInt and Number values +esid: sec-abstract-relational-comparison +info: | + ... + 3. If both px and py are Strings, then + ... + 4. Else, + a. Let nx be ? ToNumeric(px). Because px and py are primitive values evaluation order is not important. + b. Let ny be ? ToNumeric(py). + c. If Type(nx) is Type(ny), return ? Type(nx)::lessThan(nx, ny). + d. Assert: Type(nx) is BigInt and Type(ny) is Number, or if Type(nx) is Number and Type(ny) is BigInt. + e. If x or y are any of NaN, return undefined. + f. If x is -∞, or y is +∞, return true. + g. If x is +∞, or y is -∞, return false. + h. If the mathematical value of nx is less than the mathematical value of ny, return true, otherwise return false. +features: [BigInt] +---*/ +assert.sameValue(0n < 0, false, 'The result of (0n < 0) is false'); +assert.sameValue(0 < 0n, false, 'The result of (0 < 0n) is false'); +assert.sameValue(0n < -0, false, 'The result of (0n < -0) is false'); +assert.sameValue(-0 < 0n, false, 'The result of (-0 < 0n) is false'); +assert.sameValue(0n < 0.000000000001, true, 'The result of (0n < 0.000000000001) is true'); +assert.sameValue(0.000000000001 < 0n, false, 'The result of (0.000000000001 < 0n) is false'); +assert.sameValue(0n < 1, true, 'The result of (0n < 1) is true'); +assert.sameValue(1 < 0n, false, 'The result of (1 < 0n) is false'); +assert.sameValue(1n < 0, false, 'The result of (1n < 0) is false'); +assert.sameValue(0 < 1n, true, 'The result of (0 < 1n) is true'); +assert.sameValue(1n < 0.999999999999, false, 'The result of (1n < 0.999999999999) is false'); +assert.sameValue(0.999999999999 < 1n, true, 'The result of (0.999999999999 < 1n) is true'); +assert.sameValue(1n < 1, false, 'The result of (1n < 1) is false'); +assert.sameValue(1 < 1n, false, 'The result of (1 < 1n) is false'); +assert.sameValue(0n < Number.MIN_VALUE, true, 'The result of (0n < Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE < 0n, false, 'The result of (Number.MIN_VALUE < 0n) is false'); +assert.sameValue(0n < -Number.MIN_VALUE, false, 'The result of (0n < -Number.MIN_VALUE) is false'); +assert.sameValue(-Number.MIN_VALUE < 0n, true, 'The result of (-Number.MIN_VALUE < 0n) is true'); +assert.sameValue(-10n < Number.MIN_VALUE, true, 'The result of (-10n < Number.MIN_VALUE) is true'); + +assert.sameValue( + Number.MIN_VALUE < -10n, + false, + 'The result of (Number.MIN_VALUE < -10n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-string.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-string.js new file mode 100644 index 0000000000..27cdda783a --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-string.js @@ -0,0 +1,62 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and string values +esid: sec-abstract-relational-comparison +features: [BigInt] +---*/ +assert.sameValue(0n < '0', false, 'The result of (0n < "0") is false'); +assert.sameValue('0' < 0n, false, 'The result of ("0" < 0n) is false'); +assert.sameValue(0n < '1', true, 'The result of (0n < "1") is true'); +assert.sameValue('0' < 1n, true, 'The result of ("0" < 1n) is true'); +assert.sameValue(1n < '0', false, 'The result of (1n < "0") is false'); +assert.sameValue('1' < 0n, false, 'The result of ("1" < 0n) is false'); +assert.sameValue(0n < '', false, 'The result of (0n < "") is false'); +assert.sameValue('' < 0n, false, 'The result of ("" < 0n) is false'); +assert.sameValue(0n < '1', true, 'The result of (0n < "1") is true'); +assert.sameValue('' < 1n, true, 'The result of ("" < 1n) is true'); +assert.sameValue(1n < '', false, 'The result of (1n < "") is false'); +assert.sameValue('1' < 0n, false, 'The result of ("1" < 0n) is false'); +assert.sameValue(1n < '1', false, 'The result of (1n < "1") is false'); +assert.sameValue('1' < 1n, false, 'The result of ("1" < 1n) is false'); +assert.sameValue(1n < '-1', false, 'The result of (1n < "-1") is false'); +assert.sameValue('1' < -1n, false, 'The result of ("1" < -1n) is false'); +assert.sameValue(-1n < '1', true, 'The result of (-1n < "1") is true'); +assert.sameValue('-1' < 1n, true, 'The result of ("-1" < 1n) is true'); +assert.sameValue(-1n < '-1', false, 'The result of (-1n < "-1") is false'); +assert.sameValue('-1' < -1n, false, 'The result of ("-1" < -1n) is false'); +assert.sameValue('0x10' < 15n, false, 'The result of ("0x10" < 15n) is false'); +assert.sameValue('0x10' < 16n, false, 'The result of ("0x10" < 16n) is false'); +assert.sameValue('0x10' < 17n, true, 'The result of ("0x10" < 17n) is true'); +assert.sameValue('0o10' < 7n, false, 'The result of ("0o10" < 7n) is false'); +assert.sameValue('0o10' < 8n, false, 'The result of ("0o10" < 8n) is false'); +assert.sameValue('0o10' < 9n, true, 'The result of ("0o10" < 9n) is true'); +assert.sameValue('0b10' < 1n, false, 'The result of ("0b10" < 1n) is false'); +assert.sameValue('0b10' < 2n, false, 'The result of ("0b10" < 2n) is false'); +assert.sameValue('0b10' < 3n, true, 'The result of ("0b10" < 3n) is true'); + +assert.sameValue( + 9007199254740993n < '9007199254740992', + false, + 'The result of (9007199254740993n < "9007199254740992") is false' +); + +assert.sameValue( + '9007199254740993' < 9007199254740992n, + false, + 'The result of ("9007199254740993" < 9007199254740992n) is false' +); + +assert.sameValue( + -9007199254740992n < '-9007199254740993', + false, + 'The result of (-9007199254740992n < "-9007199254740993") is false' +); + +assert.sameValue( + '-9007199254740992' < -9007199254740993n, + false, + 'The result of ("-9007199254740992" < -9007199254740993n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/bigint-and-symbol.js b/js/src/tests/test262/language/expressions/less-than/bigint-and-symbol.js new file mode 100644 index 0000000000..f6382f64d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/less-than/bigint-and-symbol.js @@ -0,0 +1,16 @@ +// Copyright (C) 2018 Caio Lima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Relational comparison of BigInt and Symbol values +esid: sec-abstract-relational-comparison +features: [BigInt, Symbol] +---*/ +assert.throws(TypeError, function() { + 3n < Symbol('2'); +}, '3n < Symbol("2") throws TypeError'); + +assert.throws(TypeError, function() { + Symbol('2') < 3n; +}, 'Symbol("2") < 3n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/less-than/browser.js b/js/src/tests/test262/language/expressions/less-than/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/less-than/shell.js b/js/src/tests/test262/language/expressions/less-than/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A1.js new file mode 100644 index 0000000000..d52841641b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LogicalANDExpression and "&&" or + between "&&" and BitwiseORExpression are allowed +es5id: 11.11.1_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if ((eval("true\u0009&&\u0009true")) !== true) { + throw new Test262Error('#1: (true\\u0009&&\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("true\u000B&&\u000Btrue")) !== true) { + throw new Test262Error('#2: (true\\u000B&&\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("true\u000C&&\u000Ctrue")) !== true) { + throw new Test262Error('#3: (true\\u000C&&\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("true\u0020&&\u0020true")) !== true) { + throw new Test262Error('#4: (true\\u0020&&\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("true\u00A0&&\u00A0true")) !== true) { + throw new Test262Error('#5: (true\\u00A0&&\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("true\u000A&&\u000Atrue")) !== true) { + throw new Test262Error('#6: (true\\u000A&&\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("true\u000D&&\u000Dtrue")) !== true) { + throw new Test262Error('#7: (true\\u000D&&\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("true\u2028&&\u2028true")) !== true) { + throw new Test262Error('#8: (true\\u2028&&\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("true\u2029&&\u2029true")) !== true) { + throw new Test262Error('#9: (true\\u2029&&\\u2029true) === true'); +} + + +//CHECK#10 +if ((eval("true\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029&&\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) { + throw new Test262Error('#10: (true\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029&&\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T1.js new file mode 100644 index 0000000000..0bb7dc4c78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T1.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((false && true) !== false) { + throw new Test262Error('#1: (false && true) === false'); +} + +//CHECK#2 +if ((true && false) !== false) { + throw new Test262Error('#2: (true && false) === false'); +} + +//CHECK#3 +var x = false; +if ((x && true) !== false) { + throw new Test262Error('#3: var x = false; (x && true) === false'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((true && y) !== y) { + throw new Test262Error('#4: var y = new Boolean(false); (true && y) === y'); +} + +//CHECK#5 +var x = false; +var y = true; +if ((x && y) !== false) { + throw new Test262Error('#5: var x = false; var y = true; (x && y) === false'); +} + +//CHECK#6 +var x = true; +var y = new Boolean(false); +if ((x && y) !== y) { + throw new Test262Error('#6: var x = true; var y = new Boolean(false); (x && y) === y'); +} + +//CHECK#7 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = true; +objecty.prop = 1.1; +if ((objectx.prop && objecty.prop) !== objecty.prop) { + throw new Test262Error('#7: var objectx = new Object(); var objecty = new Object(); objectx.prop = true; objecty.prop = 1; (objectx.prop && objecty.prop) === objecty.prop'); +} + +//CHECK#8 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 0; +objecty.prop = true; +if ((objectx.prop && objecty.prop) !== objectx.prop) { + throw new Test262Error('#8: var objectx = new Object(); var objecty = new Object(); objectx.prop = 0; objecty.prop = true; (objectx.prop && objecty.prop) === objectx.prop'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T2.js new file mode 100644 index 0000000000..5fc58c4986 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x && true; + throw new Test262Error('#1.1: x && true throw ReferenceError. Actual: ' + (x && true)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x && true throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T3.js new file mode 100644 index 0000000000..81ad311406 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T3 +description: > + If ToBoolean(x) is true and GetBase(y) is null, throw + ReferenceError +---*/ + +//CHECK#1 +try { + true && y; + throw new Test262Error('#1.1: true && y throw ReferenceError. Actual: ' + (true && y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: true && y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T4.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T4.js new file mode 100644 index 0000000000..07df92a28a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.1_T4.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x && y uses GetValue +es5id: 11.11.1_A2.1_T4 +description: If ToBoolean(x) is false and GetBase(y) is null, return false +---*/ + +//CHECK#1 +if ((false && x) !== false) { + throw new Test262Error('#1: (false && x) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T1.js new file mode 100644 index 0000000000..66bbb4150c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = false; +if (((x = true) && x) !== true) { + throw new Test262Error('#1: var x = false; ((x = true) && x) === true'); +} + +//CHECK#2 +var x = false; +if ((x && (x = true)) !== false) { + throw new Test262Error('#2: var x = false; (x && (x = true)) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T2.js new file mode 100644 index 0000000000..5916178650 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() && y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() && y() throw "x". Actual: ' + (x() && y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() && y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T3.js new file mode 100644 index 0000000000..07ce5795bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.1_A2.4_T3 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +try { + x && (x = true); + throw new Test262Error('#1.1: x && (x = true) throw ReferenceError. Actual: ' + (x && (x = true))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x && (x = true) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if (((y = true) && y) !== true) { + throw new Test262Error('#2: ((y = true) && y) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T1.js new file mode 100644 index 0000000000..67e5e7642a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T1 +description: > + Type(x) is primitive boolean and Type(y) is changed between + primitive boolean and Boolean object +---*/ + +//CHECK#1 +if ((false && true) !== false) { + throw new Test262Error('#1: (false && true) === false'); +} + +//CHECK#2 +if ((false && false) !== false) { + throw new Test262Error('#2: (false && false) === false'); +} + +//CHECK#3 +if ((false && new Boolean(true)) !== false) { + throw new Test262Error('#3: (false && new Boolean(true)) === false'); +} + +//CHECK#4 +if ((false && new Boolean(false)) !== false) { + throw new Test262Error('#4: (false && new Boolean(false)) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T2.js new file mode 100644 index 0000000000..254b02785c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T2.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((-0 && -1) !== 0) { + throw new Test262Error('#1.1: (-0 && -1) === 0'); +} else { + if ((1 / (-0 && -1)) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: (-0 && -1) === -0'); + } +} + +//CHECK#2 +if ((0 && new Number(-1)) !== 0) { + throw new Test262Error('#2.1: (0 && new Number(-1)) === 0'); +} else { + if ((1 / (0 && new Number(-1))) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (0 && new Number(-1)) === +0'); + } +} + +//CHECK#3 +if ((isNaN(NaN && 1)) !== true) { + throw new Test262Error('#3: (NaN && 1) === Not-a-Number'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T3.js new file mode 100644 index 0000000000..c16aa63aea --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("" && "1") !== "") { + throw new Test262Error('#1: ("" && "1") === ""'); +} + +//CHECK#2 +if (("" && new String("1")) !== "") { + throw new Test262Error('#2: ("" && new String("1")) === ""'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T4.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T4.js new file mode 100644 index 0000000000..e9274ae612 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return x +es5id: 11.11.1_A3_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((undefined && true) !== undefined) { + throw new Test262Error('#1: (undefined && true) === undefined'); +} + +//CHECK#2 +if ((null && false) !== null) { + throw new Test262Error('#2: (null && false) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T1.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T1.js new file mode 100644 index 0000000000..1018d63a9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if ((true && true) !== true) { + throw new Test262Error('#1: (true && true) === true'); +} + +//CHECK#2 +if ((true && false) !== false) { + throw new Test262Error('#2: (true && false) === false'); +} + +//CHECK#3 +var y = new Boolean(true); +if ((new Boolean(true) && y) !== y) { + throw new Test262Error('#3: (var y = new Boolean(true); (new Boolean(true) && y) === y'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((new Boolean(true) && y) !== y) { + throw new Test262Error('#4: (var y = new Boolean(false); (new Boolean(true) && y) === y'); +} + +//CHECK#5 +var y = new Boolean(true); +if ((new Boolean(false) && y) !== y) { + throw new Test262Error('#5: (var y = new Boolean(true); (new Boolean(false) && y) === y'); +} + +//CHECK#6 +var y = new Boolean(false); +if ((new Boolean(false) && y) !== y) { + throw new Test262Error('#6: (var y = new Boolean(false); (new Boolean(false) && y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T2.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T2.js new file mode 100644 index 0000000000..b370c3ffae --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T2.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((-1 && -0) !== 0) { + throw new Test262Error('#1.1: (-1 && -0) === 0'); +} else { + if ((1 / (-1 && -0)) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: (-1 && -0) === -0'); + } +} + +//CHECK#2 +if ((-1 && 0) !== 0) { + throw new Test262Error('#2.1: (-1 && 0) === 0'); +} else { + if ((1 / (-1 && 0)) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (-1 && 0) === +0'); + } +} + +//CHECK#3 +if ((isNaN(0.1 && NaN)) !== true) { + throw new Test262Error('#3: (0.1 && NaN) === Not-a-Number'); +} + +//CHECK#4 +var y = new Number(0); +if ((new Number(-1) && y) !== y) { + throw new Test262Error('#4: (var y = new Number(0); (new Number(-1) && y) === y'); +} + +//CHECK#5 +var y = new Number(NaN); +if ((new Number(0) && y) !== y) { + throw new Test262Error('#5: (var y = new Number(NaN); (new Number(0) && y) === y'); +} + +//CHECK#6 +var y = new Number(-1); +if ((new Number(NaN) && y) !== y) { + throw new Test262Error('#6: (var y = new Number(-1); (new Number(NaN) && y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T3.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T3.js new file mode 100644 index 0000000000..ebd38af02b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T3.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("0" && "-1") !== "-1") { + throw new Test262Error('#-1: ("0" && "-1") === "-1"'); +} + +//CHECK#2 +if (("-1" && "x") !== "x") { + throw new Test262Error('#2: ("-1" && "x") === "x"'); +} + +//CHECK#3 +var y = new String(-1); +if ((new String("-1") && y) !== y) { + throw new Test262Error('#3: (var y = new String(-1); (new String("-1") && y) === y'); +} + +//CHECK#4 +var y = new String(NaN); +if ((new String("0") && y) !== y) { + throw new Test262Error('#4: (var y = new String(NaN); (new String("0") && y) === y'); +} + +//CHECK#5 +var y = new String("-x"); +if ((new String("x") && y) !== y) { + throw new Test262Error('#5: (var y = new String("-x"); (new String("x") && y) === y'); +} + +//CHECK#6 +var y = new String(-1); +if ((new String(NaN) && y) !== y) { + throw new Test262Error('#6: (var y = new String(-1); (new String(NaN) && y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T4.js b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T4.js new file mode 100644 index 0000000000..7c984e035f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/S11.11.1_A4_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return y +es5id: 11.11.1_A4_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((true && undefined) !== undefined) { + throw new Test262Error('#1: (true && undefined) === undefined'); +} + +//CHECK#2 +if ((true && null) !== null) { + throw new Test262Error('#2: (true && null) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/browser.js b/js/src/tests/test262/language/expressions/logical-and/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-and/shell.js b/js/src/tests/test262/language/expressions/logical-and/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-and/symbol-logical-and-evaluation.js b/js/src/tests/test262/language/expressions/logical-and/symbol-logical-and-evaluation.js new file mode 100644 index 0000000000..50698549f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/symbol-logical-and-evaluation.js @@ -0,0 +1,14 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.12.3 +description: > + "Logical AND" Symbol evaluation +features: [Symbol] +---*/ +var sym = Symbol(); + +assert.sameValue(sym && true, true, "`sym && true` is `true`"); +assert.sameValue(!sym && false, false, "`!sym && false` is `false`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-and/tco-right-strict.js b/js/src/tests/test262/language/expressions/logical-and/tco-right-strict.js new file mode 100644 index 0000000000..23e1590fda --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-and/tco-right-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return true && f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/browser.js b/js/src/tests/test262/language/expressions/logical-assignment/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js new file mode 100644 index 0000000000..600b575719 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-and.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/and.case +// - src/logical-assignment-private/default/getter-setter.template +/*--- +description: Logical-and assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *false*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +class C { + #setterCalledWith; + get #field() { + return true; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field &&= false; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), false, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), false, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js new file mode 100644 index 0000000000..8bb644f294 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-nullish.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/nullish.case +// - src/logical-assignment-private/default/getter-setter.template +/*--- +description: Nullish-coalescing assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. If _lval_ is neither *undefined* nor *null*, return _lval_. + ... + 6. Perform ? PutValue(_lref_, _rval_). + 7. Return _rval_. +---*/ + + +class C { + #setterCalledWith; + get #field() { + return null; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field ??= 1; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), 1, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js new file mode 100644 index 0000000000..769a1d4d16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-or.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/or.case +// - src/logical-assignment-private/default/getter-setter.template +/*--- +description: Logical-or assignment with target being a private reference (to an accessor property with getter and setter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *true*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +class C { + #setterCalledWith; + get #field() { + return false; + } + set #field(value) { + this.#setterCalledWith = value; + } + compoundAssignment() { + return this.#field ||= true; + } + setterCalledWithValue() { + return this.#setterCalledWith; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), true, "The expression should evaluate to the result"); +assert.sameValue(o.setterCalledWithValue(), true, "PutValue should call the setter with the result"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-and.js new file mode 100644 index 0000000000..3fbc6760d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-and.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/and.case +// - src/logical-assignment-private/default/getter-setter-short-circuit.template +/*--- +description: Logical-and assignment with target being a private reference (to an accessor property with getter and setter (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *false*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + setterWasCalled = false; + get #field() { + return false; + } + set #field(value) { + this.setterWasCalled = true; + } + compoundAssignment() { + return this.#field &&= doNotCall(); + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), false, "The expression should evaluate to the short-circuit value"); +assert(!o.setterWasCalled, "The setter should not be called"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-nullish.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-nullish.js new file mode 100644 index 0000000000..4933a5e99d --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-nullish.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/nullish.case +// - src/logical-assignment-private/default/getter-setter-short-circuit.template +/*--- +description: Nullish-coalescing assignment with target being a private reference (to an accessor property with getter and setter (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. If _lval_ is neither *undefined* nor *null*, return _lval_. + ... + 6. Perform ? PutValue(_lref_, _rval_). + 7. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + setterWasCalled = false; + get #field() { + return 1; + } + set #field(value) { + this.setterWasCalled = true; + } + compoundAssignment() { + return this.#field ??= doNotCall(); + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the short-circuit value"); +assert(!o.setterWasCalled, "The setter should not be called"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-or.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-or.js new file mode 100644 index 0000000000..ad8113b875 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-accessor-property-short-circuit-or.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/or.case +// - src/logical-assignment-private/default/getter-setter-short-circuit.template +/*--- +description: Logical-or assignment with target being a private reference (to an accessor property with getter and setter (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + ... + 5.c. Let _setter_ be _entry_.[[Set]]. + d. Perform ? Call(_setter_, _O_, « _value_ »). + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *true*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + setterWasCalled = false; + get #field() { + return true; + } + set #field(value) { + this.setterWasCalled = true; + } + compoundAssignment() { + return this.#field ||= doNotCall(); + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), true, "The expression should evaluate to the short-circuit value"); +assert(!o.setterWasCalled, "The setter should not be called"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js new file mode 100644 index 0000000000..48f9da1452 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-and.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/and.case +// - src/logical-assignment-private/default/data-property.template +/*--- +description: Logical-and assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *false*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +class C { + #field = true; + compoundAssignment() { + return this.#field &&= false; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), false, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), false, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-nullish.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-nullish.js new file mode 100644 index 0000000000..895371b4ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-nullish.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/nullish.case +// - src/logical-assignment-private/default/data-property.template +/*--- +description: Nullish-coalescing assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. If _lval_ is neither *undefined* nor *null*, return _lval_. + ... + 6. Perform ? PutValue(_lref_, _rval_). + 7. Return _rval_. +---*/ + + +class C { + #field = null; + compoundAssignment() { + return this.#field ??= 1; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), 1, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-or.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-or.js new file mode 100644 index 0000000000..ecd05f0a85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-or.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/or.case +// - src/logical-assignment-private/default/data-property.template +/*--- +description: Logical-or assignment with target being a private reference (to a field) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *true*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +class C { + #field = false; + compoundAssignment() { + return this.#field ||= true; + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), true, "The expression should evaluate to the result"); +assert.sameValue(o.fieldValue(), true, "PutValue should store the result in the private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-and.js new file mode 100644 index 0000000000..b97a76a866 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-and.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/and.case +// - src/logical-assignment-private/default/data-property-short-circuit.template +/*--- +description: Logical-and assignment with target being a private reference (to a field (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *false*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + #field = false; + compoundAssignment() { + return this.#field &&= doNotCall(); + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), false, "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-nullish.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-nullish.js new file mode 100644 index 0000000000..fa4568829b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-nullish.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/nullish.case +// - src/logical-assignment-private/default/data-property-short-circuit.template +/*--- +description: Nullish-coalescing assignment with target being a private reference (to a field (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. If _lval_ is neither *undefined* nor *null*, return _lval_. + ... + 6. Perform ? PutValue(_lref_, _rval_). + 7. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + #field = 1; + compoundAssignment() { + return this.#field ??= doNotCall(); + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-or.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-or.js new file mode 100644 index 0000000000..c1e2e206ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-data-property-short-circuit-or.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/or.case +// - src/logical-assignment-private/default/data-property-short-circuit.template +/*--- +description: Logical-or assignment with target being a private reference (to a field (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 3. If _entry_.[[Kind]] is ~field~, then + a. Set _entry_.[[Value]] to _value_. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *true*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + #field = true; + compoundAssignment() { + return this.#field ||= doNotCall(); + } + fieldValue() { + return this.#field; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), true, "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-and.js new file mode 100644 index 0000000000..94168ea59d --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-and.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/and.case +// - src/logical-assignment-private/default/method.template +/*--- +description: Logical-and assignment with target being a private reference (to a private method) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *false*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod &&= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result in a method private reference"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-nullish.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-nullish.js new file mode 100644 index 0000000000..aa1b7225c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-nullish.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/nullish.case +// - src/logical-assignment-private/default/method-short-circuit.template +/*--- +description: Nullish-coalescing assignment with target being a private reference (to a private method (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. If _lval_ is neither *undefined* nor *null*, return _lval_. + ... + 6. Perform ? PutValue(_lref_, _rval_). + 7. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod ??= doNotCall(); + } + getPrivateMethodFunctionObject() { + return this.#privateMethod; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), o.getPrivateMethodFunctionObject(), "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-or.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-or.js new file mode 100644 index 0000000000..b19dd8efe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-method-short-circuit-or.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/or.case +// - src/logical-assignment-private/default/method-short-circuit.template +/*--- +description: Logical-or assignment with target being a private reference (to a private method (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 4. Else if _entry_.[[Kind]] is ~method~, then + a. Throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *true*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + #privateMethod() {} + compoundAssignment() { + return this.#privateMethod ||= doNotCall(); + } + getPrivateMethodFunctionObject() { + return this.#privateMethod; + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), o.getPrivateMethodFunctionObject(), "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-and.js new file mode 100644 index 0000000000..6e47415ac7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-and.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/and.case +// - src/logical-assignment-private/default/getter.template +/*--- +description: Logical-and assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *false*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +class C { + get #field() { + return true; + } + compoundAssignment() { + return this.#field &&= false; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-nullish.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-nullish.js new file mode 100644 index 0000000000..45216d42a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-nullish.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/nullish.case +// - src/logical-assignment-private/default/getter.template +/*--- +description: Nullish-coalescing assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. If _lval_ is neither *undefined* nor *null*, return _lval_. + ... + 6. Perform ? PutValue(_lref_, _rval_). + 7. Return _rval_. +---*/ + + +class C { + get #field() { + return null; + } + compoundAssignment() { + return this.#field ??= 1; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-or.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-or.js new file mode 100644 index 0000000000..8c9695032e --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-or.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/or.case +// - src/logical-assignment-private/default/getter.template +/*--- +description: Logical-or assignment with target being a private reference (to an accessor property with getter) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *true*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +class C { + get #field() { + return false; + } + compoundAssignment() { + return this.#field ||= true; + } +} + +const o = new C(); +assert.throws(TypeError, () => o.compoundAssignment(), "PutValue throws when storing the result if no setter"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-and.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-and.js new file mode 100644 index 0000000000..f99b2c1a3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-and.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/and.case +// - src/logical-assignment-private/default/getter-short-circuit.template +/*--- +description: Logical-and assignment with target being a private reference (to an accessor property with getter (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *false*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + get #field() { + return false; + } + compoundAssignment() { + return this.#field &&= doNotCall(); + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), false, "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-nullish.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-nullish.js new file mode 100644 index 0000000000..00569dc546 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-nullish.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/nullish.case +// - src/logical-assignment-private/default/getter-short-circuit.template +/*--- +description: Nullish-coalescing assignment with target being a private reference (to an accessor property with getter (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. If _lval_ is neither *undefined* nor *null*, return _lval_. + ... + 6. Perform ? PutValue(_lref_, _rval_). + 7. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + get #field() { + return 1; + } + compoundAssignment() { + return this.#field ??= doNotCall(); + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), 1, "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-or.js b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-or.js new file mode 100644 index 0000000000..b776af7911 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/left-hand-side-private-reference-readonly-accessor-property-short-circuit-or.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/logical-assignment-private/or.case +// - src/logical-assignment-private/default/getter-short-circuit.template +/*--- +description: Logical-or assignment with target being a private reference (to an accessor property with getter (short-circuit version)) +esid: sec-assignment-operators-runtime-semantics-evaluation +features: [class-fields-private, logical-assignment-operators] +flags: [generated] +info: | + sec-property-accessors-runtime-semantics-evaluation + MemberExpression : MemberExpression `.` PrivateIdentifier + + 1. Let _baseReference_ be the result of evaluating |MemberExpression|. + 2. Let _baseValue_ be ? GetValue(_baseReference_). + 3. Let _fieldNameString_ be the StringValue of |PrivateIdentifier|. + 4. Return ! MakePrivateReference(_baseValue_, _fieldNameString_). + + PutValue (V, W) + ... + 5.b. If IsPrivateReference(_V_) is *true*, then + i. Return ? PrivateSet(_baseObj_, _V_.[[ReferencedName]], _W_). + + PrivateSet (O, P, value) + ... + 5.a. Assert: _entry_.[[Kind]] is ~accessor~. + b. If _entry_.[[Set]] is *undefined*, throw a *TypeError* exception. + + + sec-assignment-operators-runtime-semantics-evaluation + AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression + 1. Let _lref_ be the result of evaluating |LeftHandSideExpression|. + 2. Let _lval_ be ? GetValue(_lref_). + 3. Let _lbool_ be ! ToBoolean(_lval_). + 4. If _lbool_ is *true*, return _lval_. + ... + 7. Perform ? PutValue(_lref_, _rval_). + 8. Return _rval_. +---*/ + + +function doNotCall() { + throw new Test262Error("The right-hand side should not be evaluated"); +} + +class C { + get #field() { + return true; + } + compoundAssignment() { + return this.#field ||= doNotCall(); + } +} + +const o = new C(); +assert.sameValue(o.compoundAssignment(), true, "The expression should evaluate to the short-circuit value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-arguments-strict-strict.js new file mode 100644 index 0000000000..dfb9c91e3b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-arguments-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Logical Assignment + operator(&&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +arguments &&= 20; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-bigint.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-bigint.js new file mode 100644 index 0000000000..ee443220f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-bigint.js @@ -0,0 +1,29 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Logical And Assignment Operator +features: [BigInt, logical-assignment-operators] +info: | + AssignmentExpression: + LeftHandSideExpression &&= AssignmentExpression + + 1. Let lref be the result of evaluating LeftHandSideExpression. + 2. Let lval be ? GetValue(lref). + 3. Let lbool be ! ToBoolean(lval). + 4. If lbool is false, return lval. + 5. Let rref be the result of evaluating AssignmentExpression. + 6. Let rval be ? GetValue(rref). + 7. Perform ? PutValue(lref, rval). + 8. Return rval. + +---*/ + +var value = 0n; +assert.sameValue(value &&= 1n, 0n, "(value &&= 1n) === 0n; where value = 0n"); + +value = 2n; +assert.sameValue(value &&= 1n, 1n, "(value &&= 1n) === 1n; where value = 2n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-lhs-before-rhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-lhs-before-rhs.js new file mode 100644 index 0000000000..bd11e7b6d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-lhs-before-rhs.js @@ -0,0 +1,55 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + The LeftHandSideExpression is evaluated before the AssignmentExpression. +features: [logical-assignment-operators] + +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] &&= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] &&= expr(); +}); + +var count = 0; +var obj = {}; +function incr() { + return ++count; +} + +assert.sameValue(obj[incr()] &&= incr(), undefined, "obj[incr()] &&= incr()"); +assert.sameValue(obj[1], undefined, "obj[1]"); +assert.sameValue(count, 1, "count"); + +obj[2] = 1; +assert.sameValue(obj[incr()] &&= incr(), 3, "obj[incr()] &&= incr()"); +assert.sameValue(obj[2], 3, "obj[2]"); +assert.sameValue(count, 3, "count"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-arrow-function.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-arrow-function.js new file mode 100644 index 0000000000..3beba1cbae --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-arrow-function.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical And Assignment +info: | + AssignmentExpression: + LeftHandSideExpression &&= AssignmentExpression + + 5. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = 1; +value &&= () => {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-class-expression.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-class-expression.js new file mode 100644 index 0000000000..eb907f8dbd --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-class-expression.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical And Assignment +info: | + AssignmentExpression: + LeftHandSideExpression &&= AssignmentExpression + + 5. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = 1; +value &&= class {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-function.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-function.js new file mode 100644 index 0000000000..dd1dbe9ded --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-namedevaluation-function.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical And Assignment +info: | + AssignmentExpression: + LeftHandSideExpression &&= AssignmentExpression + + 5. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = 1; +value &&= function() {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-put-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-put-strict.js new file mode 100644 index 0000000000..ac3fca3891 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-put-strict.js @@ -0,0 +1,31 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if the LeftHandSide of a Logical + Assignment operator(&&=) is a reference to a data property with the + attribute value {[[Set]]:undefined} and PutValue step is reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + get: function() { + return 2; + }, + set: undefined, + enumerable: true, + configurable: true +}); + +assert.throws(TypeError, function() { + obj.prop &&= 1; +}); +assert.sameValue(obj.prop, 2, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-strict.js new file mode 100644 index 0000000000..9f730eead5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-no-set-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical + Assignment operator(&&=) is a reference to a data property with the + attribute value {[[Set]]:undefined} and PutValue step is not reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + get: function() { + return 0; + }, + set: undefined, + enumerable: true, + configurable: true +}); + +assert.sameValue(obj.prop &&= 1, 0, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-extensible-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-extensible-strict.js new file mode 100644 index 0000000000..d5b614d9c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-extensible-strict.js @@ -0,0 +1,22 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is not thrown if The LeftHandSide of a Logical + Assignment operator(&&=) is a reference to a non-existent property of an + object whose [[Extensible]] internal property is false. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.preventExtensions(obj); + +obj.prop &&= 1; +assert.sameValue(obj.prop, undefined, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-simple-lhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-simple-lhs.js new file mode 100644 index 0000000000..41ef1dbc56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-simple-lhs.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: > + It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is + not simple. +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] + +---*/ + +$DONOTEVALUATE(); + +function test() {} +test() &&= 1; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-put-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-put-strict.js new file mode 100644 index 0000000000..074dfa9b75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-put-strict.js @@ -0,0 +1,29 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if the LeftHandSide of a Logical + Assignment operator(&&=) is a reference to a data property with the + attribute value {[[Writable]]:false} and PutValue step is reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + value: 2, + writable: false, + enumerable: true, + configurable: true +}); + +assert.throws(TypeError, function() { + obj.prop &&= 1; +}); +assert.sameValue(obj.prop, 2, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-strict.js new file mode 100644 index 0000000000..befc13c134 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-non-writeable-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical + Assignment operator(&&=) is a reference to a data property with the + attribute value {[[Writable]]:false} and PutValue step is not reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + value: 0, + writable: false, + enumerable: true, + configurable: true +}); + +assert.sameValue(obj.prop &&= 1, 0, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-lhs-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-lhs-strict.js new file mode 100644 index 0000000000..8eaa75089f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-lhs-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Logical + Assignment operator(&&=) evaluates to an unresolvable reference +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +assert.throws(ReferenceError, function() { + unresolved &&= 1; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs-put.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs-put.js new file mode 100644 index 0000000000..d298e9324a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs-put.js @@ -0,0 +1,21 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is thrown if the AssignmentExpression of a Logical + Assignment operator(&&=) evaluates to an unresolvable reference and the + AssignmentExpression is evaluated. +features: [logical-assignment-operators] + +---*/ + +var value = 2; + +assert.throws(ReferenceError, function() { + value &&= unresolved; +}); +assert.sameValue(value, 2, "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs.js new file mode 100644 index 0000000000..631b5e9e3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator-unresolved-rhs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is not thrown if the AssignmentExpression of a Logical + Assignment operator(&&=) evaluates to an unresolvable reference and the + AssignmentExpression is not evaluated. +features: [logical-assignment-operators] + +---*/ + +var value = 0; + +assert.sameValue(value &&= unresolved, 0, "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator.js new file mode 100644 index 0000000000..68fcd7bbaa --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-assignment-operator.js @@ -0,0 +1,63 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Logical And Assignment Operator +info: | + AssignmentExpression: + LeftHandSideExpression &&= AssignmentExpression + + 1. Let lref be the result of evaluating LeftHandSideExpression. + 2. Let lval be ? GetValue(lref). + 3. Let lbool be ! ToBoolean(lval). + 4. If lbool is false, return lval. + 5. Let rref be the result of evaluating AssignmentExpression. + 6. Let rval be ? GetValue(rref). + 7. Perform ? PutValue(lref, rval). + 8. Return rval. +features: [logical-assignment-operators] + +---*/ + +var value = undefined; +assert.sameValue(value &&= 1, undefined, "(value &&= 1) === undefined; where value = undefined"); + +value = null; +assert.sameValue(value &&= 1, null, "(value &&= 1) === null where value = null"); + +value = false; +assert.sameValue(value &&= 1, false, "(value &&= 1) === false; where value = false"); + +value = 0; +assert.sameValue(value &&= 1, 0, "(value &&= 1) === 0; where value = 0"); + +value = -0; +assert.sameValue(value &&= 1, -0, "(value &&= 1) === -0; where value = -0"); + +value = NaN; +assert.sameValue(value &&= 1, NaN, "(value &&= 1) === NaN; where value = NaN"); + +value = ""; +assert.sameValue(value &&= 1, "", '(value &&= 1) === "" where value = ""'); + + + +value = true; +assert.sameValue(value &&= 1, 1, "(value &&= 1) === 1; where value = true"); + +value = 2; +assert.sameValue(value &&= 1, 1, "(value &&= 1) === 1; where value = 2"); + +value = "test"; +assert.sameValue(value &&= 1, 1, '(value &&= 1) === 1; where value = "test"'); + +var sym = Symbol(""); +value = sym; +assert.sameValue(value &&= 1, 1, "(value &&= 1) === 1; where value = Symbol()"); + +var obj = {}; +value = obj; +assert.sameValue(value &&= 1, 1, "(value &&= 1) === 1; where value = {}"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-eval-strict-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-eval-strict-strict.js new file mode 100644 index 0000000000..acd470f5e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-eval-strict-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Logical Assignment operator(&&=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +eval &&= 20; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-non-simple.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-non-simple.js new file mode 100644 index 0000000000..d80e71c5b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Logical "&&=" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +1 &&= 1; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-whitespace.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-whitespace.js new file mode 100644 index 0000000000..617b20e621 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-and-whitespace.js @@ -0,0 +1,60 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +esid: sec-assignment-operators +description: Checking by evaluating expression "x[...]&&=[...]y" +features: [logical-assignment-operators] +---*/ +var x; + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+0009 (expression)'); +assert.sameValue(x, 2, 'U+0009 (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+000B (expression)'); +assert.sameValue(x, 2, 'U+000B (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+000C (expression)'); +assert.sameValue(x, 2, 'U+000C (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+0020 (expression)'); +assert.sameValue(x, 2, 'U+0020 (side effect)'); + +x = 1; +assert.sameValue(x &&= 2, 2, 'U+00A0 (expression)'); +assert.sameValue(x, 2, 'U+00A0 (side effect)'); + +x = 1; +assert.sameValue(x +&&= +2, 2, 'U+000A (expression)'); +assert.sameValue(x, 2, 'U+000A (side effect)'); + +x = 1; +assert.sameValue(x +&&= +2, 2, 'U+000D (expression)'); +assert.sameValue(x, 2, 'U+000D (side effect)'); + +x = 1; +assert.sameValue(x
&&=
2, 2, 'U+2028 (expression)'); +assert.sameValue(x, 2, 'U+2028 (side effect)'); + +x = 1; +assert.sameValue(x
&&=
2, 2, 'U+2029 (expression)'); +assert.sameValue(x, 2, 'U+2029 (side effect)'); + +x = 1; +assert.sameValue(x   +

&&=   +

2, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 2, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-arguments-strict-strict.js new file mode 100644 index 0000000000..24ca0cdcb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-arguments-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Logical Assignment + operator(??=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +arguments ??= 20; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-bigint.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-bigint.js new file mode 100644 index 0000000000..149099ab3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-bigint.js @@ -0,0 +1,28 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Logical Nullish Assignment Operator +features: [BigInt, logical-assignment-operators] +info: | + AssignmentExpression: + LeftHandSideExpression ??= AssignmentExpression + + 1. Let lref be the result of evaluating LeftHandSideExpression. + 2. Let lval be ? GetValue(lref). + 3. If lval is neither undefined nor null, return lval. + 4. Let rref be the result of evaluating AssignmentExpression. + 5. Let rval be ? GetValue(rref). + 6. Perform ? PutValue(lref, rval). + 7. Return rval. + +---*/ + +var value = 0n; +assert.sameValue(value ??= 1n, 0n, "(value ??= 1n) === 0n; where value = 0n"); + +value = 2n; +assert.sameValue(value ??= 1n, 2n, "(value ??= 1n) === 2n; where value = 2n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-lhs-before-rhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-lhs-before-rhs.js new file mode 100644 index 0000000000..1976fb4f91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-lhs-before-rhs.js @@ -0,0 +1,55 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + The LeftHandSideExpression is evaluated before the AssignmentExpression. +features: [logical-assignment-operators] + +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] ??= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ??= expr(); +}); + +var count = 0; +var obj = {}; +function incr() { + return ++count; +} + +assert.sameValue(obj[incr()] ??= incr(), 2, "obj[incr()] ??= incr()"); +assert.sameValue(obj[1], 2, "obj[1]"); +assert.sameValue(count, 2, "count"); + +obj[3] = 1; +assert.sameValue(obj[incr()] ??= incr(), 1, "obj[incr()] ??= incr()"); +assert.sameValue(obj[3], 1, "obj[3]"); +assert.sameValue(count, 3, "count"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-arrow-function.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-arrow-function.js new file mode 100644 index 0000000000..424d5f70a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-arrow-function.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical Nullish Assignment +info: | + AssignmentExpression: + LeftHandSideExpression ??= AssignmentExpression + + 4. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = undefined; +value ??= () => {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-class-expression.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-class-expression.js new file mode 100644 index 0000000000..389a8e896b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-class-expression.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical Nullish Assignment +info: | + AssignmentExpression: + LeftHandSideExpression ??= AssignmentExpression + + 4. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = undefined; +value ??= class {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-function.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-function.js new file mode 100644 index 0000000000..f293f4c4cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-namedevaluation-function.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical Nullish Assignment +info: | + AssignmentExpression: + LeftHandSideExpression ??= AssignmentExpression + + 4. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = undefined; +value ??= function() {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-put-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-put-strict.js new file mode 100644 index 0000000000..8c7854d7b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-put-strict.js @@ -0,0 +1,31 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if the LeftHandSide of a Logical + Assignment operator(??=) is a reference to a data property with the + attribute value {[[Set]]:undefined} and PutValue step is reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + get: function() { + return undefined; + }, + set: undefined, + enumerable: true, + configurable: true +}); + +assert.throws(TypeError, function() { + obj.prop ??= 1; +}); +assert.sameValue(obj.prop, undefined, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-strict.js new file mode 100644 index 0000000000..f97739174b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-no-set-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical + Assignment operator(??=) is a reference to a data property with the + attribute value {[[Set]]:undefined} and PutValue step is not reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + get: function() { + return 0; + }, + set: undefined, + enumerable: true, + configurable: true +}); + +assert.sameValue(obj.prop ??= 1, 0, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-extensible-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-extensible-strict.js new file mode 100644 index 0000000000..0c9b91f3fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-extensible-strict.js @@ -0,0 +1,24 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a Logical + Assignment operator(??=) is a reference to a non-existent property + of an object whose [[Extensible]] internal property is false. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.preventExtensions(obj); + +assert.throws(TypeError, function() { + obj.prop ??= 1; +}); +assert.sameValue(obj.prop, undefined, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-simple-lhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-simple-lhs.js new file mode 100644 index 0000000000..3e7a46afc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-simple-lhs.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: > + It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is + not simple. +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] + +---*/ + +$DONOTEVALUATE(); + +function test() {} +test() ??= 1; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-put-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-put-strict.js new file mode 100644 index 0000000000..caef17b5d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-put-strict.js @@ -0,0 +1,29 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if the LeftHandSide of a Logical + Assignment operator(??=) is a reference to a data property with the + attribute value {[[Writable]]:false} and PutValue step is reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + value: undefined, + writable: false, + enumerable: true, + configurable: true +}); + +assert.throws(TypeError, function() { + obj.prop ??= 1; +}); +assert.sameValue(obj.prop, undefined, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-strict.js new file mode 100644 index 0000000000..1340ca9390 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-non-writeable-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical + Assignment operator(??=) is a reference to a data property with the + attribute value {[[Writable]]:false} and PutValue step is not reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + value: 0, + writable: false, + enumerable: true, + configurable: true +}); + +assert.sameValue(obj.prop ??= 1, 0, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-lhs-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-lhs-strict.js new file mode 100644 index 0000000000..6473ffe917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-lhs-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Logical + Assignment operator(??=) evaluates to an unresolvable reference +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +assert.throws(ReferenceError, function() { + unresolved ??= 1; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs-put.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs-put.js new file mode 100644 index 0000000000..70c1b469d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs-put.js @@ -0,0 +1,21 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is thrown if the AssignmentExpression of a Logical + Assignment operator(??=) evaluates to an unresolvable reference and the + AssignmentExpression is evaluated. +features: [logical-assignment-operators] + +---*/ + +var value = undefined; + +assert.throws(ReferenceError, function() { + value ??= unresolved; +}); +assert.sameValue(value, undefined, "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs.js new file mode 100644 index 0000000000..bc84537942 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator-unresolved-rhs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is not thrown if the AssignmentExpression of a Logical + Assignment operator(??=) evaluates to an unresolvable reference and the + AssignmentExpression is not evaluated. +features: [logical-assignment-operators] + +---*/ + +var value = 0; + +assert.sameValue(value ??= unresolved, 0, "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator.js new file mode 100644 index 0000000000..f3cec88728 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-assignment-operator.js @@ -0,0 +1,62 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Logical Nullish Assignment Operator +info: | + AssignmentExpression: + LeftHandSideExpression ??= AssignmentExpression + + 1. Let lref be the result of evaluating LeftHandSideExpression. + 2. Let lval be ? GetValue(lref). + 3. If lval is neither undefined nor null, return lval. + 4. Let rref be the result of evaluating AssignmentExpression. + 5. Let rval be ? GetValue(rref). + 6. Perform ? PutValue(lref, rval). + 7. Return rval. +features: [logical-assignment-operators] + +---*/ + +var value = undefined; +assert.sameValue(value ??= 1, 1, "(value ??= 1) === 1; where value = undefined"); + +value = null; +assert.sameValue(value ??= 1, 1, "(value ??= 1) === 1; where value = null"); + +value = false; +assert.sameValue(value ??= 1, false, "(value ??= 1) === false; where value = false"); + +value = 0; +assert.sameValue(value ??= 1, 0, "(value ??= 1) === 0; where value = 0"); + +value = -0; +assert.sameValue(value ??= 1, -0, "(value ??= 1) === -0; where value = -0"); + +value = NaN; +assert.sameValue(value ??= 1, NaN, "(value ??= 1) === NaN; where value = NaN"); + +value = ""; +assert.sameValue(value ??= 1, "", '(value ??= 1) === "" where value = ""'); + + + +value = true; +assert.sameValue(value ??= 1, true, "(value ??= 1) === true; where value = true"); + +value = 2; +assert.sameValue(value ??= 1, 2, "(value ??= 1) === 2; where value = 2"); + +value = "test"; +assert.sameValue(value ??= 1, "test", '(value ??= 1) === "test"; where value = "test"'); + +var sym = Symbol(""); +value = sym; +assert.sameValue(value ??= 1, sym, "(value ??= 1) === Symbol(); where value = Symbol()"); + +var obj = {}; +value = obj; +assert.sameValue(value ??= 1, obj, "(value ??= 1) === {}; where value = {}"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-eval-strict-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-eval-strict-strict.js new file mode 100644 index 0000000000..61ff3631bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-eval-strict-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Logical Assignment operator(??=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +eval ??= 20; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-non-simple.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-non-simple.js new file mode 100644 index 0000000000..7385dcf6e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Logical "??=" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +1 ??= 1; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-whitespace.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-whitespace.js new file mode 100644 index 0000000000..7d92163dd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-nullish-whitespace.js @@ -0,0 +1,60 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +esid: sec-assignment-operators +description: Checking by evaluating expression "x[...]??=[...]y" +features: [logical-assignment-operators] +---*/ +var x; + +x = null; +assert.sameValue(x ??= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = null; +assert.sameValue(x ??= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = null; +assert.sameValue(x +??= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = null; +assert.sameValue(x +??= +1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = null; +assert.sameValue(x
??=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = null; +assert.sameValue(x
??=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = null; +assert.sameValue(x   +

??=   +

1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-arguments-strict-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-arguments-strict-strict.js new file mode 100644 index 0000000000..48f2c6847c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-arguments-strict-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier arguments + appear as the LeftHandSideExpression of a Logical Assignment + operator(||=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +arguments ||= 20; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-bigint.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-bigint.js new file mode 100644 index 0000000000..bda9c537eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-bigint.js @@ -0,0 +1,29 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Logical Or Assignment Operator +features: [BigInt, logical-assignment-operators] +info: | + AssignmentExpression: + LeftHandSideExpression ||= AssignmentExpression + + 1. Let lref be the result of evaluating LeftHandSideExpression. + 2. Let lval be ? GetValue(lref). + 3. Let lbool be ! ToBoolean(lval). + 4. If lbool is true, return lval. + 5. Let rref be the result of evaluating AssignmentExpression. + 6. Let rval be ? GetValue(rref). + 7. Perform ? PutValue(lref, rval). + 8. Return rval. + +---*/ + +var value = 0n; +assert.sameValue(value ||= 1n, 1n, "(value ||= 1n) === 1n; where value = 0n"); + +value = 2n; +assert.sameValue(value ||= 1n, 2n, "(value ||= 1n) === 2n; where value = 2n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-lhs-before-rhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-lhs-before-rhs.js new file mode 100644 index 0000000000..f65d4acfff --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-lhs-before-rhs.js @@ -0,0 +1,55 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + The LeftHandSideExpression is evaluated before the AssignmentExpression. +features: [logical-assignment-operators] + +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop()] ||= expr(); +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + var expr = function() { + throw new Test262Error("right-hand side expression evaluated"); + }; + + base[prop] ||= expr(); +}); + +var count = 0; +var obj = {}; +function incr() { + return ++count; +} + +assert.sameValue(obj[incr()] ||= incr(), 2, "obj[incr()] ||= incr()"); +assert.sameValue(obj[1], 2, "obj[1]"); +assert.sameValue(count, 2, "count"); + +obj[3] = 1; +assert.sameValue(obj[incr()] ||= incr(), 1, "obj[incr()] ||= incr()"); +assert.sameValue(obj[3], 1, "obj[3]"); +assert.sameValue(count, 3, "count"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-arrow-function.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-arrow-function.js new file mode 100644 index 0000000000..19de1c8150 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-arrow-function.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical Or Assignment +info: | + AssignmentExpression: + LeftHandSideExpression ||= AssignmentExpression + + 5. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = 0; +value ||= () => {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-class-expression.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-class-expression.js new file mode 100644 index 0000000000..5c4aa91368 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-class-expression.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical Or Assignment +info: | + AssignmentExpression: + LeftHandSideExpression ||= AssignmentExpression + + 5. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = 0; +value ||= class {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-function.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-function.js new file mode 100644 index 0000000000..46c71f128b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-namedevaluation-function.js @@ -0,0 +1,22 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: NamedEvaluation of Logical Or Assignment +info: | + AssignmentExpression: + LeftHandSideExpression ||= AssignmentExpression + + 5. If IsAnonymousFunctionDefinition(AssignmentExpression) and IsIdentifierRef of LeftHandSideExpression are both true, then + a. Let rval be NamedEvaluation of AssignmentExpression with argument GetReferencedName(lref). +features: [logical-assignment-operators] + +---*/ + +var value = 0; +value ||= function() {}; + +assert.sameValue(value.name, "value", "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-put-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-put-strict.js new file mode 100644 index 0000000000..0d987baf23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-put-strict.js @@ -0,0 +1,31 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if the LeftHandSide of a Logical + Assignment operator(||=) is a reference to a data property with the + attribute value {[[Set]]:undefined} and PutValue step is reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + get: function() { + return 0; + }, + set: undefined, + enumerable: true, + configurable: true +}); + +assert.throws(TypeError, function() { + obj.prop ||= 1; +}); +assert.sameValue(obj.prop, 0, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-strict.js new file mode 100644 index 0000000000..3decdd426a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-no-set-strict.js @@ -0,0 +1,28 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical + Assignment operator(||=) is a reference to a data property with the + attribute value {[[Set]]:undefined} and PutValue step is not reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + get: function() { + return 2; + }, + set: undefined, + enumerable: true, + configurable: true +}); + +assert.sameValue(obj.prop ||= 1, 2, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-extensible-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-extensible-strict.js new file mode 100644 index 0000000000..6d3bd90e75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-extensible-strict.js @@ -0,0 +1,24 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if The LeftHandSide of a Logical + Assignment operator(||=) is a reference to a non-existent property + of an object whose [[Extensible]] internal property is false. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.preventExtensions(obj); + +assert.throws(TypeError, function() { + obj.prop ||= 1; +}); +assert.sameValue(obj.prop, undefined, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-simple-lhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-simple-lhs.js new file mode 100644 index 0000000000..fe6f770428 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-simple-lhs.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +description: > + It is a Syntax Error if AssignmentTargetType of LeftHandSideExpression is + not simple. +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] + +---*/ + +$DONOTEVALUATE(); + +function test() {} +test() ||= 1; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-put-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-put-strict.js new file mode 100644 index 0000000000..d534ad4358 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-put-strict.js @@ -0,0 +1,29 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is thrown if the LeftHandSide of a Logical + Assignment operator(||=) is a reference to a data property with the + attribute value {[[Writable]]:false} and PutValue step is reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + value: 0, + writable: false, + enumerable: true, + configurable: true +}); + +assert.throws(TypeError, function() { + obj.prop ||= 1; +}); +assert.sameValue(obj.prop, 0, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-strict.js new file mode 100644 index 0000000000..58097a20ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-non-writeable-strict.js @@ -0,0 +1,26 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + Strict Mode - TypeError is not thrown if the LeftHandSide of a Logical + Assignment operator(||=) is a reference to a data property with the + attribute value {[[Writable]]:false} and PutValue step is not reached. +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +var obj = {}; +Object.defineProperty(obj, "prop", { + value: 2, + writable: false, + enumerable: true, + configurable: true +}); + +assert.sameValue(obj.prop ||= 1, 2, "obj.prop"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-lhs-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-lhs-strict.js new file mode 100644 index 0000000000..e783ff5ff4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-lhs-strict.js @@ -0,0 +1,19 @@ +'use strict'; +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is thrown if the LeftHandSideExpression of a Logical + Assignment operator(||=) evaluates to an unresolvable reference +flags: [onlyStrict] +features: [logical-assignment-operators] + +---*/ + +assert.throws(ReferenceError, function() { + unresolved ||= 1; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs-put.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs-put.js new file mode 100644 index 0000000000..d482fe38d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs-put.js @@ -0,0 +1,21 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is thrown if the AssignmentExpression of a Logical + Assignment operator(||=) evaluates to an unresolvable reference and the + AssignmentExpression is evaluated. +features: [logical-assignment-operators] + +---*/ + +var value = 0; + +assert.throws(ReferenceError, function() { + value ||= unresolved; +}); +assert.sameValue(value, 0, "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs.js new file mode 100644 index 0000000000..6a41c574e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator-unresolved-rhs.js @@ -0,0 +1,18 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: > + ReferenceError is not thrown if the AssignmentExpression of a Logical + Assignment operator(||=) evaluates to an unresolvable reference and the + AssignmentExpression is not evaluated. +features: [logical-assignment-operators] + +---*/ + +var value = 2; + +assert.sameValue(value ||= unresolved, 2, "value"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator.js new file mode 100644 index 0000000000..6043caaf87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-assignment-operator.js @@ -0,0 +1,63 @@ +// Copyright (c) 2020 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-runtime-semantics-evaluation +description: Logical Or Assignment Operator +info: | + AssignmentExpression: + LeftHandSideExpression ||= AssignmentExpression + + 1. Let lref be the result of evaluating LeftHandSideExpression. + 2. Let lval be ? GetValue(lref). + 3. Let lbool be ! ToBoolean(lval). + 4. If lbool is true, return lval. + 5. Let rref be the result of evaluating AssignmentExpression. + 6. Let rval be ? GetValue(rref). + 7. Perform ? PutValue(lref, rval). + 8. Return rval. +features: [logical-assignment-operators] + +---*/ + +var value = undefined; +assert.sameValue(value ||= 1, 1, "(value ||= 1) === 1; where value = undefined"); + +value = null; +assert.sameValue(value ||= 1, 1, "(value ||= 1) === 1; where value = null"); + +value = false; +assert.sameValue(value ||= 1, 1, "(value ||= 1) === 1; where value = false"); + +value = 0; +assert.sameValue(value ||= 1, 1, "(value ||= 1) === 1; where value = 0"); + +value = -0; +assert.sameValue(value ||= 1, 1, "(value ||= 1) === 1; where value = -0"); + +value = NaN; +assert.sameValue(value ||= 1, 1, "(value ||= 1) === 1; where value = NaN"); + +value = ""; +assert.sameValue(value ||= 1, 1, '(value ||= 1) === 1; where value = ""'); + + + +value = true; +assert.sameValue(value ||= 1, true, "(value ||= 1) === true; where value = true"); + +value = 2; +assert.sameValue(value ||= 1, 2, "(value ||= 1) === 2; where value = 2"); + +value = "test"; +assert.sameValue(value ||= 1, "test", '(value ||= 1) === "test"; where value = "test"'); + +var sym = Symbol(""); +value = sym; +assert.sameValue(value ||= 1, sym, "(value ||= 1) === Symbol(); where value = Symbol()"); + +var obj = {}; +value = obj; +assert.sameValue(value ||= 1, obj, "(value ||= 1) === {}; where value = {}"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-eval-strict-strict.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-eval-strict-strict.js new file mode 100644 index 0000000000..d64e44e0b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-eval-strict-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators +description: > + Strict Mode - SyntaxError is thrown if the identifier eval appear + as the LeftHandSideExpression of a Logical Assignment operator(||=) +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +eval ||= 20; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-non-simple.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-non-simple.js new file mode 100644 index 0000000000..2c3195010b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-non-simple.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-assignment-operators-static-semantics-early-errors +info: | + It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. +description: Logical "||=" assignment with non-simple target +negative: + phase: parse + type: SyntaxError +features: [logical-assignment-operators] +---*/ +$DONOTEVALUATE(); + +1 ||= 1; diff --git a/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-whitespace.js b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-whitespace.js new file mode 100644 index 0000000000..d4091dcb2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-assignment/lgcl-or-whitespace.js @@ -0,0 +1,60 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LeftHandSideExpression and "@=" + or between "@=" and AssignmentExpression are allowed +esid: sec-assignment-operators +description: Checking by evaluating expression "x[...]||=[...]y" +features: [logical-assignment-operators] +---*/ +var x; + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+000B (expression)'); +assert.sameValue(x, 1, 'U+000B (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+000C (expression)'); +assert.sameValue(x, 1, 'U+000C (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+0020 (expression)'); +assert.sameValue(x, 1, 'U+0020 (side effect)'); + +x = 0; +assert.sameValue(x ||= 1, 1, 'U+00A0 (expression)'); +assert.sameValue(x, 1, 'U+00A0 (side effect)'); + +x = 0; +assert.sameValue(x +||= +1, 1, 'U+000A (expression)'); +assert.sameValue(x, 1, 'U+000A (side effect)'); + +x = 0; +assert.sameValue(x +||= +1, 1, 'U+000D (expression)'); +assert.sameValue(x, 1, 'U+000D (side effect)'); + +x = 0; +assert.sameValue(x
||=
1, 1, 'U+2028 (expression)'); +assert.sameValue(x, 1, 'U+2028 (side effect)'); + +x = 0; +assert.sameValue(x
||=
1, 1, 'U+2029 (expression)'); +assert.sameValue(x, 1, 'U+2029 (side effect)'); + +x = 0; +assert.sameValue(x   +

||=   +

1, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)'); +assert.sameValue(x, 1, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-assignment/shell.js b/js/src/tests/test262/language/expressions/logical-assignment/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A1.js new file mode 100644 index 0000000000..69be889416 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "!" and UnaryExpression are + allowed +es5id: 11.4.9_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("!\u0009true") !== false) { + throw new Test262Error('#true: !\\u0009true === false'); +} + +//CHECK#2 +if (eval("!\u000Btrue") !== false) { + throw new Test262Error('#2: !\\u000Btrue === false'); +} + +//CHECK#3 +if (eval("!\u000Ctrue") !== false) { + throw new Test262Error('#3: !\\u000Ctrue === false'); +} + +//CHECK#4 +if (eval("!\u0020true") !== false) { + throw new Test262Error('#4: !\\u0020 === false'); +} + +//CHECK#5 +if (eval("!\u00A0true") !== false) { + throw new Test262Error('#5: !\\u00A0true === false'); +} + +//CHECK#6 +if (eval("!\u000Atrue") !== false) { + throw new Test262Error('#6: !\\u000Atrue === false'); +} + +//CHECK#7 +if (eval("!\u000Dtrue") !== false) { + throw new Test262Error('#7: !\\u000Dtrue === false'); +} + +//CHECK#8 +if (eval("!\u2028true") !== false) { + throw new Test262Error('#8: !\\u2028true === false'); +} + +//CHECK#9 +if (eval("!\u2029true") !== false) { + throw new Test262Error('#9: !\\u2029true === false'); +} + +//CHECK#10 +if (eval("!\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true") !== false) { + throw new Test262Error('#10: !\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T1.js new file mode 100644 index 0000000000..1d584bbfdd --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x uses GetValue +es5id: 11.4.9_A2.1_T1 +description: Either Type(x) is not Reference or GetBase(x) is not null +---*/ + +//CHECK#1 +if (!true !== false) { + throw new Test262Error('#1: !true === false'); +} + +//CHECK#2 +if (!(!true) !== true) { + throw new Test262Error('#2: !(!true) === true'); +} + +//CHECK#3 +var x = true; +if (!x !== false) { + throw new Test262Error('#3: var x = true; !x === false'); +} + +//CHECK#4 +var x = true; +if (!(!x) !== true) { + throw new Test262Error('#4: var x = true; !(!x) === true'); +} + +//CHECK#5 +var object = new Object(); +object.prop = true; +if (!object.prop !== false) { + throw new Test262Error('#5: var object = new Object(); object.prop = true; !object.prop === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T2.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T2.js new file mode 100644 index 0000000000..dd171062da --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x uses GetValue +es5id: 11.4.9_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + !x; + throw new Test262Error('#1.1: !x throw ReferenceError. Actual: ' + (!x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: !x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.2_T1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.2_T1.js new file mode 100644 index 0000000000..20de3bbf3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.2_T1.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x uses [[Default Value]] +es5id: 11.4.9_A2.2_T1 +description: If Type(value) is Object, return false +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (!object !== false) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (!object !== false) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (!object !== false) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#4 +var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +if (!object !== false) { + throw new Test262Error('#4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (!object !== false) { + throw new Test262Error('#5: var object = {toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (!object !== false) { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#7 +var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +if (!object !== false) { + throw new Test262Error('#7: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#8 +var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +if (!object !== false) { + throw new Test262Error('#8: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T1.js new file mode 100644 index 0000000000..acd4dbdc44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +if (!false !== true) { + throw new Test262Error('#1: !false === true'); +} + +//CHECK#2 +if (!new Boolean(true) !== false) { + throw new Test262Error('#2: !new Boolean(true) === false'); +} + +//CHECK#3 +if (!new Boolean(false) !== false) { + throw new Test262Error('#3: !new Boolean(false) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T2.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T2.js new file mode 100644 index 0000000000..b53a2a9ff6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T2.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +if (!0.1 !== false) { + throw new Test262Error('#1: !0.1 === false'); +} + +//CHECK#2 +if (!new Number(-0.1) !== false) { + throw new Test262Error('#2: !new Number(-0.1) === false'); +} + +//CHECK#3 +if (!NaN !== true) { + throw new Test262Error('#3: !NaN === true'); +} + +//CHECK#4 +if (!new Number(NaN) !== false) { + throw new Test262Error('#4: !new Number(NaN) === false'); +} + +//CHECK#5 +if (!0 !== true) { + throw new Test262Error('#5: !0 === true'); +} + +//CHECK#6 +if (!new Number(0) !== false) { + throw new Test262Error('#6: !new Number(0) === false'); +} + +//CHECK#7 +if (!Infinity !== false) { + throw new Test262Error('#7: !Infinity === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T3.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T3.js new file mode 100644 index 0000000000..3c8a5a0da5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T3.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +if (!"1" !== false) { + throw new Test262Error('#1: !"1" === false'); +} + +//CHECK#2 +if (!new String("0") !== false) { + throw new Test262Error('#2: !new String("0") === false'); +} + +//CHECK#3 +if (!"x" !== false) { + throw new Test262Error('#3: !"x" === false'); +} + +//CHECK#4 +if (!"" !== true) { + throw new Test262Error('#4: !"" === true'); +} + +//CHECK#5 +if (!new String("") !== false) { + throw new Test262Error('#5: !new String("") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T4.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T4.js new file mode 100644 index 0000000000..99e5f34055 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +if (!void 0 !== true) { + throw new Test262Error('#1: !void 0 === true'); +} + +//CHECK#2 +if (!null !== true) { + throw new Test262Error('#2: !null === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T5.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T5.js new file mode 100644 index 0000000000..bea4afa376 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T5.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +if ((!{}) !== false) { + throw new Test262Error('#1: !({}) === false'); +} + +//CHECK#2 +if (!(function(){return 1}) !== false) { + throw new Test262Error('#2: !(function(){return 1}) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A1_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A1_T2.js new file mode 100644 index 0000000000..3c49018807 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A1_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of boolean conversion from undefined value is false +es5id: 9.2_A1_T2 +description: > + Undefined, void and others are converted to Boolean by implicit + transformation +---*/ + +// CHECK#1 +if (!(undefined) !== true) { + throw new Test262Error('#1: !(undefined) === true. Actual: ' + (!(undefined))); +} + +// CHECK#2 +if (!(void 0) !== true) { + throw new Test262Error('#2: !(undefined) === true. Actual: ' + (!(undefined))); +} + +// CHECK#3 +if (!(eval("var x")) !== true) { + throw new Test262Error('#3: !(eval("var x")) === true. Actual: ' + (!(eval("var x")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A2_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A2_T2.js new file mode 100644 index 0000000000..93d7f612e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A2_T2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of boolean conversion from null value is false +es5id: 9.2_A2_T2 +description: null convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(null) !== true) { + throw new Test262Error('#1: !(null) === true. Actual: ' + (!(null))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A3_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A3_T2.js new file mode 100644 index 0000000000..164d8c735f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A3_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of boolean conversion from boolean value is no conversion +es5id: 9.2_A3_T2 +description: true and false convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(true) !== false) { + throw new Test262Error('#1: !(true) === false. Actual: ' + (!(true))); +} + +// CHECK#2 +if (!(false) !== true) { + throw new Test262Error('#2: !(false) === true. Actual: ' + (!(false))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T2.js new file mode 100644 index 0000000000..1fe78c3313 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of boolean conversion from number value is false if the argument + is +0, -0, or NaN; otherwise, is true +es5id: 9.2_A4_T2 +description: +0, -0 and NaN convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(+0) !== true) { + throw new Test262Error('#1: !(+0) === true. Actual: ' + (!(+0))); +} + +// CHECK#2 +if (!(-0) !== true) { + throw new Test262Error('#2: !(-0) === true. Actual: ' + (!(-0))); +} + +// CHECK#3 +if (!(Number.NaN) !== true) { + throw new Test262Error('#3: !(Number.NaN) === true. Actual: ' + (!(Number.NaN))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T4.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T4.js new file mode 100644 index 0000000000..688012a841 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T4.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of boolean conversion from number value is false if the argument + is +0, -0, or NaN; otherwise, is true +es5id: 9.2_A4_T4 +description: > + Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, + Number.MAX_VALUE, Number.MIN_VALUE and some other numbers are + converted to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(Number.POSITIVE_INFINITY) !== false) { + throw new Test262Error('#1: !(+Infinity) === false. Actual: ' + (!(+Infinity))); +} + +// CHECK#2; +if (!(Number.NEGATIVE_INFINITY) !== false) { + throw new Test262Error('#2: !(-Infinity) === false. Actual: ' + (!(-Infinity))); +} + +// CHECK#3 +if (!(Number.MAX_VALUE) !== false) { + throw new Test262Error('#3: !(Number.MAX_VALUE) === false. Actual: ' + (!(Number.MAX_VALUE))); +} + +// CHECK#4 +if (!(Number.MIN_VALUE) !== false) { + throw new Test262Error('#4: !(Number.MIN_VALUE) === false. Actual: ' + (!(Number.MIN_VALUE))); +} + +// CHECK#5 +if (!(13) !== false) { + throw new Test262Error('#5: !(13) === false. Actual: ' + (!(13))); +} + +// CHECK#6 +if (!(-13) !== false) { + throw new Test262Error('#6: !(-13) === false. Actual: ' + (!(-13))); +} + +// CHECK#7 +if (!(1.3) !== false) { + throw new Test262Error('#7: !(1.3) === false. Actual: ' + (!(1.3))); +} + +// CHECK#8 +if (!(-1.3) !== false) { + throw new Test262Error('#8: !(-1.3) === false. Actual: ' + (!(-1.3))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T2.js new file mode 100644 index 0000000000..cff46bda4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of boolean conversion from nonempty string value (length is not + zero) is true; from empty String (length is zero) is false +es5id: 9.2_A5_T2 +description: "\"\" convert to Boolean by implicit transformation" +---*/ + +// CHECK#1 +if (!("") !== true) { + throw new Test262Error('#1: !("") === true. Actual: ' + (!(""))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T4.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T4.js new file mode 100644 index 0000000000..e28ed66b19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T4.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of boolean conversion from nonempty string value (length is not + zero) is true; from empty String (length is zero) is false +es5id: 9.2_A5_T4 +description: Any nonempty string convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(" ") !== false) { + throw new Test262Error('#1: !(" ") === false. Actual: ' + (!(" "))); +} + +// CHECK#2 +if (!("Nonempty String") !== false) { + throw new Test262Error('#2: !("Nonempty String") === false. Actual: ' + (!("Nonempty String"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A6_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A6_T2.js new file mode 100644 index 0000000000..f9f337fc0b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A6_T2.js @@ -0,0 +1,105 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of boolean conversion from object is true +es5id: 9.2_A6_T2 +description: Different objects convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(new Object()) !== false) { + throw new Test262Error('#1: !(new Object()) === false. Actual: ' + (!(new Object()))); +} + +// CHECK#2 +if (!(new String("")) !== false) { + throw new Test262Error('#2: !(new String("")) === false. Actual: ' + (!(new String("")))); +} + +// CHECK#3 +if (!(new String()) !== false) { + throw new Test262Error('#3: !(new String()) === false. Actual: ' + (!(new String()))); +} + +// CHECK#4 +if (!(new Boolean(true)) !== false) { + throw new Test262Error('#4: !(new Boolean(true)) === false. Actual: ' + (!(new Boolean(true)))); +} + +// CHECK#5 +if (!(new Boolean(false)) !== false) { + throw new Test262Error('#5: !(new Boolean(false)) === false. Actual: ' + (!(new Boolean(false)))); +} + +// CHECK#6 +if (!(new Boolean()) !== false) { + throw new Test262Error('#6: !(new Boolean()) === false. Actual: ' + (!(new Boolean()))); +} + +// CHECK#7 +if (!(new Array()) !== false) { + throw new Test262Error('#7: !(new Array()) === false. Actual: ' + (!(new Array()))); +} + +// CHECK#8 +if (!(new Number()) !== false) { + throw new Test262Error('#8: !(new Number()) === false. Actual: ' + (!(new Number()))); +} + +// CHECK#9 +if (!(new Number(-0)) !== false) { + throw new Test262Error('#9: !(new Number(-0)) === false. Actual: ' + (!(new Number(-0)))); +} + +// CHECK#10 +if (!(new Number(0)) !== false) { + throw new Test262Error('#10: !(new Number(0)) === false. Actual: ' + (!(new Number(0)))); +} + +// CHECK#11 +if (!(new Number()) !== false) { + throw new Test262Error('#11: !(new Number()) === false. Actual: ' + (!(new Number()))); +} + +// CHECK#12 +if (!(new Number(Number.NaN)) !== false) { + throw new Test262Error('#12: !(new Number(Number.NaN)) === false. Actual: ' + (!(new Number(Number.NaN)))); +} + +// CHECK#13 +if (!(new Number(-1)) !== false) { + throw new Test262Error('#13: !(new Number(-1)) === false. Actual: ' + (!(new Number(-1)))); +} + +// CHECK#14 +if (!(new Number(1)) !== false) { + throw new Test262Error('#14: !(new Number(1)) === false. Actual: ' + (!(new Number(1)))); +} + +// CHECK#15 +if (!(new Number(Number.POSITIVE_INFINITY)) !== false) { + throw new Test262Error('#15: !(new Number(Number.POSITIVE_INFINITY)) === false. Actual: ' + (!(new Number(Number.POSITIVE_INFINITY)))); +} + +// CHECK#16 +if (!(new Number(Number.NEGATIVE_INFINITY)) !== false) { + throw new Test262Error('#16: !(new Number(Number.NEGATIVE_INFINITY)) === false. Actual: ' + (!(new Number(Number.NEGATIVE_INFINITY)))); +} + +// CHECK#17 +if (!(new Function()) !== false) { + throw new Test262Error('#17: !(new Function()) === false. Actual: ' + (!(new Function()))); +} + +// CHECK#18 +if (!(new Date()) !== false) { + throw new Test262Error('#18: !(new Date()) === false. Actual: ' + (!(new Date()))); +} + +// CHECK#19 +if (!(new Date(0)) !== false) { + throw new Test262Error('#19: !(new Date(0)) === false. Actual: ' + (!(new Date(0)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/bigint.js b/js/src/tests/test262/language/expressions/logical-not/bigint.js new file mode 100644 index 0000000000..b67471f85f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/bigint.js @@ -0,0 +1,25 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Conversion of BigInt values to booleans +esid: sec-logical-not-operator-runtime-semantics-evaluation +info: | + UnaryExpression: ! UnaryExpression + + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ToBoolean(? GetValue(expr)). + 3. If oldValue is true, return false. + 4. Return true. + + ToBoolean ( argument ) + + BigInt: Return false if argument is 0n; otherwise return true. +features: [BigInt] +---*/ + +assert.sameValue(!0n, true, "!0n"); +assert.sameValue(!1n, false, "!1n"); +assert.sameValue(!-1n, false, "!-1n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/browser.js b/js/src/tests/test262/language/expressions/logical-not/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-not/shell.js b/js/src/tests/test262/language/expressions/logical-not/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-not/symbol-logical-not-evaluation.js b/js/src/tests/test262/language/expressions/logical-not/symbol-logical-not-evaluation.js new file mode 100644 index 0000000000..4b13fb5fe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/symbol-logical-not-evaluation.js @@ -0,0 +1,22 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.5.12.1 +description: > + "Logical Not" coercion operation on Symbols +features: [Symbol] +---*/ +var sym = Symbol(); + +assert.sameValue(!sym, false, "`!sym` is `false`"); +assert.sameValue(!!sym, true, "`!!sym` is `true`"); + +if (!sym) { + throw new Test262Error("ToBoolean(Symbol) always returns `true`"); +} else if (sym) { + assert(true, "`sym` evaluates to `true`"); +} else { + throw new Test262Error("ToBoolean(Symbol) always returns `true`"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A1.js new file mode 100644 index 0000000000..caa856412e --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A1.js @@ -0,0 +1,63 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between LogicalORExpression and "||" or + between "||" and LogicalANDExpression are allowed +es5id: 11.11.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if ((eval("false\u0009||\u0009true")) !== true) { + throw new Test262Error('#1: (false\\u0009||\\u0009true) === true'); +} + +//CHECK#2 +if ((eval("false\u000B||\u000Btrue")) !== true) { + throw new Test262Error('#2: (false\\u000B||\\u000Btrue) === true'); +} + +//CHECK#3 +if ((eval("false\u000C||\u000Ctrue")) !== true) { + throw new Test262Error('#3: (false\\u000C||\\u000Ctrue) === true'); +} + +//CHECK#4 +if ((eval("false\u0020||\u0020true")) !== true) { + throw new Test262Error('#4: (false\\u0020||\\u0020true) === true'); +} + +//CHECK#5 +if ((eval("false\u00A0||\u00A0true")) !== true) { + throw new Test262Error('#5: (false\\u00A0||\\u00A0true) === true'); +} + +//CHECK#6 +if ((eval("false\u000A||\u000Atrue")) !== true) { + throw new Test262Error('#6: (false\\u000A||\\u000Atrue) === true'); +} + +//CHECK#7 +if ((eval("false\u000D||\u000Dtrue")) !== true) { + throw new Test262Error('#7: (false\\u000D||\\u000Dtrue) === true'); +} + +//CHECK#8 +if ((eval("false\u2028||\u2028true")) !== true) { + throw new Test262Error('#8: (false\\u2028||\\u2028true) === true'); +} + +//CHECK#9 +if ((eval("false\u2029||\u2029true")) !== true) { + throw new Test262Error('#9: (false\\u2029||\\u2029true) === true'); +} + + +//CHECK#10 +if ((eval("false\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029||\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true")) !== true) { + throw new Test262Error('#10: (false\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029||\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T1.js new file mode 100644 index 0000000000..48d6e5d961 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T1.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x || y uses GetValue +es5id: 11.11.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if ((true || false) !== true) { + throw new Test262Error('#1: (true || false) === true'); +} + +//CHECK#2 +if ((false || true) !== true) { + throw new Test262Error('#2: (false || true) === true'); +} + +//CHECK#3 +var x = new Boolean(false); +if ((x || true) !== x) { + throw new Test262Error('#3: var x = Boolean(false); (x || true) === x'); +} + +//CHECK#4 +var y = new Boolean(true); +if ((false || y) !== y) { + throw new Test262Error('#4: var y = Boolean(true); (false || y) === y'); +} + +//CHECK#5 +var x = new Boolean(false); +var y = new Boolean(true); +if ((x || y) !== x) { + throw new Test262Error('#5: var x = new Boolean(false); var y = new Boolean(true); (x || y) === x'); +} + +//CHECK#6 +var x = false; +var y = new Boolean(true); +if ((x || y) !== y) { + throw new Test262Error('#6: var x = false; var y = new Boolean(true); (x || y) === y'); +} + +//CHECK#7 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = false; +objecty.prop = 1.1; +if ((objectx.prop || objecty.prop) !== objecty.prop) { + throw new Test262Error('#7: var objectx = new Object(); var objecty = new Object(); objectx.prop = false; objecty.prop = 1; (objectx.prop || objecty.prop) === objecty.prop'); +} + +//CHECK#8 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1.1; +objecty.prop = false; +if ((objectx.prop || objecty.prop) !== objectx.prop) { + throw new Test262Error('#8: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1.1; objecty.prop = false; (objectx.prop || objecty.prop) === objectx.prop'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T2.js new file mode 100644 index 0000000000..51aac7879e --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x || y uses GetValue +es5id: 11.11.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x || true; + throw new Test262Error('#1.1: x || true throw ReferenceError. Actual: ' + (x || true)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x || true throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T3.js new file mode 100644 index 0000000000..4b448a86cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T3.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x || y uses GetValue +es5id: 11.11.2_A2.1_T3 +description: > + If ToBoolean(x) is false and GetBase(y) is null, throw + ReferenceError +---*/ + +//CHECK#1 +try { + false || y; + throw new Test262Error('#1.1: false || y throw ReferenceError. Actual: ' + (false || y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: false || y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T4.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T4.js new file mode 100644 index 0000000000..a924d7b933 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.1_T4.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x || y uses GetValue +es5id: 11.11.2_A2.1_T4 +description: If ToBoolean(x) is true and GetBase(y) is null, return true +---*/ + +//CHECK#1 +if ((true || x) !== true) { + throw new Test262Error('#1: (true || x) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T1.js new file mode 100644 index 0000000000..bbeaf4902b --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = true; +if (((x = false) || x) !== false) { + throw new Test262Error('#1: var x = true; ((x = false) || x) === false'); +} + +//CHECK#2 +var x = true; +if ((x || (x = false)) !== true) { + throw new Test262Error('#2: var x = true; (x || (x = false)) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T2.js new file mode 100644 index 0000000000..f86dd21c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() || y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() || y() throw "x". Actual: ' + (x() || y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() || y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T3.js new file mode 100644 index 0000000000..536e682860 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A2.4_T3.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.11.2_A2.4_T3 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +try { + x || (x = true); + throw new Test262Error('#1.1: x || (x = true) throw ReferenceError. Actual: ' + (x || (x = true))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x || (x = true) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if (((y = true) || y) !== true) { + throw new Test262Error('#2: ((y = true) || y) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T1.js new file mode 100644 index 0000000000..c6200ed305 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return y +es5id: 11.11.2_A3_T1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if ((false || true) !== true) { + throw new Test262Error('#1: (false || true) === true'); +} + +//CHECK#2 +if ((false || false) !== false) { + throw new Test262Error('#2: (false || false) === false'); +} + +//CHECK#3 +var y = new Boolean(true); +if ((false || y) !== y) { + throw new Test262Error('#3: (var y = new Boolean(true); false || y) === y'); +} + +//CHECK#4 +var y = new Boolean(false); +if ((false || y) !== y) { + throw new Test262Error('#4: (var y = new Boolean(false); false || y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T2.js new file mode 100644 index 0000000000..f0db72dbcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T2.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return y +es5id: 11.11.2_A3_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((0 || -0) !== 0) { + throw new Test262Error('#1.1: (0 || -0) === 0'); +} else { + if ((1 / (0 || -0)) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: (0 || -0) === -0'); + } +} + +//CHECK#2 +if ((-0 || 0) !== 0) { + throw new Test262Error('#2.1: (-0 || 0) === 0'); +} else { + if ((1 / (-0 || 0)) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (-0 || 0) === +0'); + } +} + +//CHECK#3 +var y = new Number(-1); +if ((0 || y) !== y) { + throw new Test262Error('#3: (var y = new Number(-1); 0 || y) === y'); +} + +//CHECK#4 +var y = new Number(0); +if ((NaN || y) !== y) { + throw new Test262Error('#4: (var y = new Number(0); NaN || y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T3.js new file mode 100644 index 0000000000..20928072cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return y +es5id: 11.11.2_A3_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("" || "1") !== "1") { + throw new Test262Error('#1: ("" || "1") === "1"'); +} + +//CHECK#2 +var y = new String("1"); +if (("" || y) !== y) { + throw new Test262Error('#2: (var y = new String("1"); "" || y) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T4.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T4.js new file mode 100644 index 0000000000..a117545599 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is false, return y +es5id: 11.11.2_A3_T4 +description: Type(x) or Type(y) is changed between null and undefined +---*/ + +//CHECK#1 +if ((false || undefined) !== undefined) { + throw new Test262Error('#1: (false || undefined) === undefined'); +} + +//CHECK#2 +if ((false || null) !== null) { + throw new Test262Error('#2: (false || null) === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T1.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T1.js new file mode 100644 index 0000000000..63818db8e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return x +es5id: 11.11.2_A4_T1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (((true || true)) !== true) { + throw new Test262Error('#1: (true || true) === true'); +} + +//CHECK#2 +if ((true || false) !== true) { + throw new Test262Error('#2: (true || false) === true'); +} + +//CHECK#3 +var x = new Boolean(true); +if ((x || new Boolean(true)) !== x) { + throw new Test262Error('#3: (var x = new Boolean(true); (x || new Boolean(true)) === x'); +} + +//CHECK#4 +var x = new Boolean(true); +if ((x || new Boolean(false)) !== x) { + throw new Test262Error('#4: (var x = new Boolean(true); (x || new Boolean(false)) === x'); +} + +//CHECK#5 +var x = new Boolean(false); +if ((x || new Boolean(true)) !== x) { + throw new Test262Error('#5: (var x = new Boolean(false); (x || new Boolean(true)) === x'); +} + +//CHECK#6 +var x = new Boolean(false); +if ((x || new Boolean(false)) !== x) { + throw new Test262Error('#6: (var x = new Boolean(false); (x || new Boolean(false)) === x'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T2.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T2.js new file mode 100644 index 0000000000..272e94024c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T2.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return x +es5id: 11.11.2_A4_T2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if ((-1 || 1) !== -1) { + throw new Test262Error('#1: (-1 || 1) === -1'); +} + +//CHECK#2 +if ((1 || new Number(0)) !== 1) { + throw new Test262Error('#2: (1 || new Number(0)) === 1'); +} + +//CHECK#3 +if ((-1 || NaN) !== -1) { + throw new Test262Error('#3: (-1 || NaN) === -1'); +} + +//CHECK#4 +var x = new Number(-1); +if ((x || new Number(0)) !== x) { + throw new Test262Error('#4: (var x = new Number(-1); (x || new Number(-1)) === x'); +} + +//CHECK#5 +var x = new Number(NaN); +if ((x || new Number(1)) !== x) { + throw new Test262Error('#5: (var x = new Number(NaN); (x || new Number(1)) === x'); +} + +//CHECK#6 +var x = new Number(0); +if ((x || new Number(NaN)) !== x) { + throw new Test262Error('#6: (var x = new Number(0); (x || new Number(NaN)) === x'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T3.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T3.js new file mode 100644 index 0000000000..8a8f80a86a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T3.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return x +es5id: 11.11.2_A4_T3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if (("-1" || "1") !== "-1") { + throw new Test262Error('#-1: ("-1" || "1") === "-1"'); +} + +//CHECK#2 +if (("-1" || "x") !== "-1") { + throw new Test262Error('#2: ("-1" || "x") === "-1"'); +} + +//CHECK#3 +var x = new String("-1"); +if ((x || new String(-1)) !== x) { + throw new Test262Error('#3: (var x = new String("-1"); (x || new String(-1)) === x'); +} + +//CHECK#4 +var x = new String(NaN); +if ((x || new String("1")) !== x) { + throw new Test262Error('#4: (var x = new String(NaN); (x || new String("1")) === x'); +} + +//CHECK#5 +var x = new String("-x"); +if ((x || new String("x")) !== x) { + throw new Test262Error('#5: (var x = new String("-x"); (x || new String("x")) === x'); +} + +//CHECK#6 +var x = new String(0); +if ((x || new String(NaN)) !== x) { + throw new Test262Error('#6: (var x = new String(0); (x || new String(NaN)) === x'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T4.js b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T4.js new file mode 100644 index 0000000000..782faad38c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/S11.11.2_A4_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If ToBoolean(x) is true, return x +es5id: 11.11.2_A4_T4 +description: Type(x) or Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if ((true || undefined) !== true) { + throw new Test262Error('#1: (true || undefined) === true'); +} + +//CHECK#2 +if ((true || null) !== true) { + throw new Test262Error('#2: (true || null) === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/browser.js b/js/src/tests/test262/language/expressions/logical-or/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-or/shell.js b/js/src/tests/test262/language/expressions/logical-or/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/logical-or/symbol-logical-or-evaluation.js b/js/src/tests/test262/language/expressions/logical-or/symbol-logical-or-evaluation.js new file mode 100644 index 0000000000..7b5e765188 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/symbol-logical-or-evaluation.js @@ -0,0 +1,14 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.12.3 +description: > + "Logical OR" Symbol evaluation +features: [Symbol] +---*/ +var sym = Symbol(); + +assert.sameValue(!sym || true, true, "`!sym || true` is `true`"); +assert.sameValue(sym || false, sym, "`sym || false` is `sym`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-or/tco-right-strict.js b/js/src/tests/test262/language/expressions/logical-or/tco-right-strict.js new file mode 100644 index 0000000000..0bb70f0143 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-or/tco-right-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return false || f(n - 1); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A1.js new file mode 100644 index 0000000000..8060162fef --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between MultiplicativeExpression and "%" + or between "%" and UnaryExpression are allowed +es5id: 11.5.3_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009%\u00091") !== 0) { + throw new Test262Error('#1: 1\\u0009%\\u00091 === 0'); +} + +//CHECK#2 +if (eval("1\u000B%\u000B1") !== 0) { + throw new Test262Error('#2: 1\\u000B%\\u000B1 === 0'); +} + +//CHECK#3 +if (eval("1\u000C%\u000C1") !== 0) { + throw new Test262Error('#3: 1\\u000C%\\u000C1 === 0'); +} + +//CHECK#4 +if (eval("1\u0020%\u00201") !== 0) { + throw new Test262Error('#4: 1\\u0020%\\u00201 === 0'); +} + +//CHECK#5 +if (eval("1\u00A0%\u00A01") !== 0) { + throw new Test262Error('#5: 1\\u00A0%\\u00A01 === 0'); +} + +//CHECK#6 +if (eval("1\u000A%\u000A1") !== 0) { + throw new Test262Error('#6: 1\\u000A%\\u000A1 === 0'); +} + +//CHECK#7 +if (eval("1\u000D%\u000D1") !== 0) { + throw new Test262Error('#7: 1\\u000D%\\u000D1 === 0'); +} + +//CHECK#8 +if (eval("1\u2028%\u20281") !== 0) { + throw new Test262Error('#8: 1\\u2028%\\u20281 === 0'); +} + +//CHECK#9 +if (eval("1\u2029%\u20291") !== 0) { + throw new Test262Error('#9: 1\\u2029%\\u20291 === 0'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029%\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 0) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029%\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T1.js new file mode 100644 index 0000000000..25f7bd7a43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y uses GetValue +es5id: 11.5.3_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 % 2 !== 1) { + throw new Test262Error('#1: 1 % 2 === 1. Actual: ' + (1 % 2)); +} + +//CHECK#2 +var x = 1; +if (x % 2 !== 1) { + throw new Test262Error('#2: var x = 1; x % 2 === 1. Actual: ' + (x % 2)); +} + +//CHECK#3 +var y = 2; +if (1 % y !== 1) { + throw new Test262Error('#3: var y = 2; 1 % y === 1. Actual: ' + (1 % y)); +} + +//CHECK#4 +var x = 1; +var y = 2; +if (x % y !== 1) { + throw new Test262Error('#4: var x = 1; var y = 2; x % y === 1. Actual: ' + (x % y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 2; +if (objectx.prop % objecty.prop !== 1) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 2; objectx.prop % objecty.prop === 1. Actual: ' + (objectx.prop % objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T2.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T2.js new file mode 100644 index 0000000000..852ebd2c52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y uses GetValue +es5id: 11.5.3_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x % 1; + throw new Test262Error('#1.1: x % 1 throw ReferenceError. Actual: ' + (x % 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x % 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T3.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T3.js new file mode 100644 index 0000000000..319bbaecc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y uses GetValue +es5id: 11.5.3_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 % y; + throw new Test262Error('#1.1: 1 % y throw ReferenceError. Actual: ' + (1 % y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 % y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.2_T1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.2_T1.js new file mode 100644 index 0000000000..1f919aeb0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y uses [[Default Value]] +es5id: 11.5.3_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 1}} % 2 !== 1) { + throw new Test262Error('#1: {valueOf: function() {return 1}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}} % 2)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} % 2 !== 1) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} % 2)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} % 2 !== 1) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} % 2)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 !== 1) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} % 2)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} % 2 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 % {toString: function() {return 2}} !== 1) { + throw new Test262Error('#5: 1 % {toString: function() {return 2}} === 1. Actual: ' + (1 % {toString: function() {return 2}})); +} + +//CHECK#6 +if (1 % {valueOf: function() {return {}}, toString: function() {return 2}} !== 1) { + throw new Test262Error('#6: 1 % {valueOf: function() {return {}}, toString: function() {return 2}} === 1. Actual: ' + (1 % {valueOf: function() {return {}}, toString: function() {return 2}})); +} + +//CHECK#7 +try { + 1 % {valueOf: function() {throw "error"}, toString: function() {return 2}}; + throw new Test262Error('#7.1: 1 % {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (1 % {valueOf: function() {throw "error"}, toString: function() {return 2}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 % {valueOf: function() {throw "error"}, toString: function() {return 2}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 % {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 % {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 % {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 % {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.3_T1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.3_T1.js new file mode 100644 index 0000000000..ba0d3dbdb7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.5.3_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x % y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x % y throw "x". Actual: ' + (x % y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x % y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T1.js new file mode 100644 index 0000000000..2bfa99ff92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.3_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) % x !== 0) { + throw new Test262Error('#1: var x = 0; (x = 1) % x === 0. Actual: ' + ((x = 1) % x)); +} + +//CHECK#2 +var x = 1; +if (x % (x = 2) !== 1) { + throw new Test262Error('#2: var x = 1; x % (x = 2) === 1. Actual: ' + (x % (x = 2))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T2.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T2.js new file mode 100644 index 0000000000..4449a19fe1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.3_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() % y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() % y() throw "x". Actual: ' + (x() % y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() % y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T3.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T3.js new file mode 100644 index 0000000000..d0894ff321 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.3_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x % (x = 1); + throw new Test262Error('#1.1: x % (x = 1) throw ReferenceError. Actual: ' + (x % (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x % (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T4.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T4.js new file mode 100644 index 0000000000..359f52d905 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.3_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) % y !== 0) { + throw new Test262Error('#1: (y = 1) % y === 0. Actual: ' + ((y = 1) % y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.1.js new file mode 100644 index 0000000000..954d1c7f2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (true % true !== 0) { + throw new Test262Error('#1: true % true === 0. Actual: ' + (true % true)); +} + +//CHECK#2 +if (new Boolean(true) % true !== 0) { + throw new Test262Error('#2: new Boolean(true) % true === 0. Actual: ' + (new Boolean(true) % true)); +} + +//CHECK#3 +if (true % new Boolean(true) !== 0) { + throw new Test262Error('#3: true % new Boolean(true) === 0. Actual: ' + (true % new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) % new Boolean(true) !== 0) { + throw new Test262Error('#4: new Boolean(true) % new Boolean(true) === 0. Actual: ' + (new Boolean(true) % new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.2.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.2.js new file mode 100644 index 0000000000..270c8bf6ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if (1 % 1 !== 0) { + throw new Test262Error('#1: 1 % 1 === 0. Actual: ' + (1 % 1)); +} + +//CHECK#2 +if (new Number(1) % 1 !== 0) { + throw new Test262Error('#2: new Number(1) % 1 === 0. Actual: ' + (new Number(1) % 1)); +} + +//CHECK#3 +if (1 % new Number(1) !== 0) { + throw new Test262Error('#3: 1 % new Number(1) === 0. Actual: ' + (1 % new Number(1))); +} + +//CHECK#4 +if (new Number(1) % new Number(1) !== 0) { + throw new Test262Error('#4: new Number(1) % new Number(1) === 0. Actual: ' + (new Number(1) % new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.3.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.3.js new file mode 100644 index 0000000000..ee643e3510 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if ("1" % "1" !== 0) { + throw new Test262Error('#1: "1" % "1" === 0. Actual: ' + ("1" % "1")); +} + +//CHECK#2 +if (new String("1") % "1" !== 0) { + throw new Test262Error('#2: new String("1") % "1" === 0. Actual: ' + (new String("1") % "1")); +} + +//CHECK#3 +if ("1" % new String("1") !== 0) { + throw new Test262Error('#3: "1" % new String("1") === 0. Actual: ' + ("1" % new String("1"))); +} + +//CHECK#4 +if (new String("1") % new String("1") !== 0) { + throw new Test262Error('#4: new String("1") % new String("1") === 0. Actual: ' + (new String("1") % new String("1"))); +} + +//CHECK#5 +if (isNaN("x" % "1") !== true) { + throw new Test262Error('#5: "x" % "1" === Not-a-Number. Actual: ' + ("x" % "1")); +} + +//CHECK#6 +if (isNaN("1" % "x") !== true) { + throw new Test262Error('#6: "1" % "x" === Not-a-Number. Actual: ' + ("1" % "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.4.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.4.js new file mode 100644 index 0000000000..20245ed42c --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if (isNaN(null % undefined) !== true) { + throw new Test262Error('#1: null % undefined === Not-a-Number. Actual: ' + (null % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % null) !== true) { + throw new Test262Error('#2: undefined % null === Not-a-Number. Actual: ' + (undefined % null)); +} + +//CHECK#3 +if (isNaN(undefined % undefined) !== true) { + throw new Test262Error('#3: undefined % undefined === Not-a-Number. Actual: ' + (undefined % undefined)); +} + +//CHECK#4 +if (isNaN(null % null) !== true) { + throw new Test262Error('#4: null % null === Not-a-Number. Actual: ' + (null % null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.5.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.5.js new file mode 100644 index 0000000000..069d7d3854 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (isNaN({} % function(){return 1}) !== true) { + throw new Test262Error('#1: {} % function(){return 1} === Not-a-Number. Actual: ' + ({} % function(){return 1})); +} + +//CHECK#2 +if (isNaN(function(){return 1} % {}) !== true) { + throw new Test262Error('#2: function(){return 1} % {} === Not-a-Number. Actual: ' + (function(){return 1} % {})); +} + +//CHECK#3 +if (isNaN(function(){return 1} % function(){return 1}) !== true) { + throw new Test262Error('#3: function(){return 1} % function(){return 1} === Not-a-Number. Actual: ' + (function(){return 1} % function(){return 1})); +} + +//CHECK#4 +if (isNaN({} % {}) !== true) { + throw new Test262Error('#4: {} % {} === Not-a-Number. Actual: ' + ({} % {})); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.1.js new file mode 100644 index 0000000000..a2edf4faf1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true % 1 !== 0) { + throw new Test262Error('#1: true % 1 === 0. Actual: ' + (true % 1)); +} + +//CHECK#2 +if (1 % true !== 0) { + throw new Test262Error('#2: 1 % true === 0. Actual: ' + (1 % true)); +} + +//CHECK#3 +if (new Boolean(true) % 1 !== 0) { + throw new Test262Error('#3: new Boolean(true) % 1 === 0. Actual: ' + (new Boolean(true) % 1)); +} + +//CHECK#4 +if (1 % new Boolean(true) !== 0) { + throw new Test262Error('#4: 1 % new Boolean(true) === 0. Actual: ' + (1 % new Boolean(true))); +} + +//CHECK#5 +if (true % new Number(1) !== 0) { + throw new Test262Error('#5: true % new Number(1) === 0. Actual: ' + (true % new Number(1))); +} + +//CHECK#6 +if (new Number(1) % true !== 0) { + throw new Test262Error('#6: new Number(1) % true === 0. Actual: ' + (new Number(1) % true)); +} + +//CHECK#7 +if (new Boolean(true) % new Number(1) !== 0) { + throw new Test262Error('#7: new Boolean(true) % new Number(1) === 0. Actual: ' + (new Boolean(true) % new Number(1))); +} + +//CHECK#8 +if (new Number(1) % new Boolean(true) !== 0) { + throw new Test262Error('#8: new Number(1) % new Boolean(true) === 0. Actual: ' + (new Number(1) % new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.2.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.2.js new file mode 100644 index 0000000000..1aea5a8c07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if ("1" % 1 !== 0) { + throw new Test262Error('#1: "1" % 1 === 0. Actual: ' + ("1" % 1)); +} + +//CHECK#2 +if (1 % "1" !== 0) { + throw new Test262Error('#2: 1 % "1" === 0. Actual: ' + (1 % "1")); +} + +//CHECK#3 +if (new String("1") % 1 !== 0) { + throw new Test262Error('#3: new String("1") % 1 === 0. Actual: ' + (new String("1") % 1)); +} + +//CHECK#4 +if (1 % new String("1") !== 0) { + throw new Test262Error('#4: 1 % new String("1") === 0. Actual: ' + (1 % new String("1"))); +} + +//CHECK#5 +if ("1" % new Number(1) !== 0) { + throw new Test262Error('#5: "1" % new Number(1) === 0. Actual: ' + ("1" % new Number(1))); +} + +//CHECK#6 +if (new Number(1) % "1" !== 0) { + throw new Test262Error('#6: new Number(1) % "1" === 0. Actual: ' + (new Number(1) % "1")); +} + +//CHECK#7 +if (new String("1") % new Number(1) !== 0) { + throw new Test262Error('#7: new String("1") % new Number(1) === 0. Actual: ' + (new String("1") % new Number(1))); +} + +//CHECK#8 +if (new Number(1) % new String("1") !== 0) { + throw new Test262Error('#8: new Number(1) % new String("1") === 0. Actual: ' + (new Number(1) % new String("1"))); +} + +//CHECK#9 +if (isNaN("x" % 1) !== true) { + throw new Test262Error('#9: "x" % 1 === Not-a-Number. Actual: ' + ("x" % 1)); +} + +//CHECK#10 +if (isNaN(1 % "x") !== true) { + throw new Test262Error('#10: 1 % "x" === Not-a-Number. Actual: ' + (1 % "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.3.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.3.js new file mode 100644 index 0000000000..a71bff3cc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (isNaN(1 % null) !== true) { + throw new Test262Error('#1: 1 % null === Not-a-Number. Actual: ' + (1 % null)); +} + +//CHECK#2 +if (null % 1 !== 0) { + throw new Test262Error('#2: null % 1 === 0. Actual: ' + (null % 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) % null) !== true) { + throw new Test262Error('#3: new Number(1) % null === Not-a-Number. Actual: ' + (new Number(1) % null)); +} + +//CHECK#4 +if (null % new Number(1) !== 0) { + throw new Test262Error('#4: null % new Number(1) === 0. Actual: ' + (null % new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.4.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.4.js new file mode 100644 index 0000000000..16d0192bc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(1 % undefined) !== true) { + throw new Test262Error('#1: 1 % undefined === Not-a-Number. Actual: ' + (1 % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % 1) !== true) { + throw new Test262Error('#2: undefined % 1 === Not-a-Number. Actual: ' + (undefined % 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) % undefined) !== true) { + throw new Test262Error('#3: new Number(1) % undefined === Not-a-Number. Actual: ' + (new Number(1) % undefined)); +} + +//CHECK#4 +if (isNaN(undefined % new Number(1)) !== true) { + throw new Test262Error('#4: undefined % new Number(1) === Not-a-Number. Actual: ' + (undefined % new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.5.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.5.js new file mode 100644 index 0000000000..36580dd8b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true % "1" !== 0) { + throw new Test262Error('#1: true % "1" === 0. Actual: ' + (true % "1")); +} + +//CHECK#2 +if ("1" % true !== 0) { + throw new Test262Error('#2: "1" % true === 0. Actual: ' + ("1" % true)); +} + +//CHECK#3 +if (new Boolean(true) % "1" !== 0) { + throw new Test262Error('#3: new Boolean(true) % "1" === 0. Actual: ' + (new Boolean(true) % "1")); +} + +//CHECK#4 +if ("1" % new Boolean(true) !== 0) { + throw new Test262Error('#4: "1" % new Boolean(true) === 0. Actual: ' + ("1" % new Boolean(true))); +} + +//CHECK#5 +if (true % new String("1") !== 0) { + throw new Test262Error('#5: true % new String("1") === 0. Actual: ' + (true % new String("1"))); +} + +//CHECK#6 +if (new String("1") % true !== 0) { + throw new Test262Error('#6: new String("1") % true === 0. Actual: ' + (new String("1") % true)); +} + +//CHECK#7 +if (new Boolean(true) % new String("1") !== 0) { + throw new Test262Error('#7: new Boolean(true) % new String("1") === 0. Actual: ' + (new Boolean(true) % new String("1"))); +} + +//CHECK#8 +if (new String("1") % new Boolean(true) !== 0) { + throw new Test262Error('#8: new String("1") % new Boolean(true) === 0. Actual: ' + (new String("1") % new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.6.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.6.js new file mode 100644 index 0000000000..d9914c0537 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN("1" % undefined) !== true) { + throw new Test262Error('#1: "1" % undefined === Not-a-Number. Actual: ' + ("1" % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % "1") !== true) { + throw new Test262Error('#2: undefined % "1" === Not-a-Number. Actual: ' + (undefined % "1")); +} + +//CHECK#3 +if (isNaN(new String("1") % undefined) !== true) { + throw new Test262Error('#3: new String("1") % undefined === Not-a-Number. Actual: ' + (new String("1") % undefined)); +} + +//CHECK#4 +if (isNaN(undefined % new String("1")) !== true) { + throw new Test262Error('#4: undefined % new String("1") === Not-a-Number. Actual: ' + (undefined % new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.7.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.7.js new file mode 100644 index 0000000000..5797bcb9e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if (isNaN("1" % null) !== true) { + throw new Test262Error('#1: "1" % null === Not-a-Number. Actual: ' + ("1" % null)); +} + +//CHECK#2 +if (null % "1" !== 0) { + throw new Test262Error('#2: null % "1" === 0. Actual: ' + (null % "1")); +} + +//CHECK#3 +if (isNaN(new String("1") % null) !== true) { + throw new Test262Error('#3: new String("1") % null === Not-a-Number. Actual: ' + (new String("1") % null)); +} + +//CHECK#4 +if (null % new String("1") !== 0) { + throw new Test262Error('#4: null % new String("1") === 0. Actual: ' + (null % new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.8.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.8.js new file mode 100644 index 0000000000..465a2d3bcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(true % undefined) !== true) { + throw new Test262Error('#1: true % undefined === Not-a-Number. Actual: ' + (true % undefined)); +} + +//CHECK#2 +if (isNaN(undefined % true) !== true) { + throw new Test262Error('#2: undefined % true === Not-a-Number. Actual: ' + (undefined % true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) % undefined) !== true) { + throw new Test262Error('#3: new Boolean(true) % undefined === Not-a-Number. Actual: ' + (new Boolean(true) % undefined)); +} + +//CHECK#4 +if (isNaN(undefined % new Boolean(true)) !== true) { + throw new Test262Error('#4: undefined % new Boolean(true) === Not-a-Number. Actual: ' + (undefined % new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.9.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.9.js new file mode 100644 index 0000000000..083b555f4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x % y returns ToNumber(x) % ToNumber(y) +es5id: 11.5.3_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (isNaN(true % null) !== true) { + throw new Test262Error('#1: true % null === Not-a-Number. Actual: ' + (true % null)); +} + +//CHECK#2 +if (null % true !== 0) { + throw new Test262Error('#2: null % true === 0. Actual: ' + (null % true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) % null) !== true) { + throw new Test262Error('#3: new Boolean(true) % null === Not-a-Number. Actual: ' + (new Boolean(true) % null)); +} + +//CHECK#4 +if (null % new Boolean(true) !== 0) { + throw new Test262Error('#4: null % new Boolean(true) === 0. Actual: ' + (null % new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.1.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.1.js new file mode 100644 index 0000000000..19877b9f39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T1.1 +description: If either operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN % Number.NaN) !== true) { + throw new Test262Error('#1: NaN % NaN === Not-a-Number. Actual: ' + (NaN % NaN)); +} + +//CHECK#2 +if (isNaN(Number.NaN % +0) !== true) { + throw new Test262Error('#2: NaN % +0 === Not-a-Number. Actual: ' + (NaN % +0)); +} + +//CHECK#3 +if (isNaN(Number.NaN % -0) !== true) { + throw new Test262Error('#3: NaN % -0 === Not-a-Number. Actual: ' + (NaN % -0)); +} + +//CHECK#4 +if (isNaN(Number.NaN % Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: NaN % Infinity === Not-a-Number. Actual: ' + (NaN % Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NaN % Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: NaN % -Infinity === Not-a-Number. Actual: ' + (NaN % -Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NaN % Number.MAX_VALUE) !== true) { + throw new Test262Error('#6: NaN % Number.MAX_VALUE === Not-a-Number. Actual: ' + (NaN % Number.MAX_VALUE)); +} + +//CHECK#7 +if (isNaN(Number.NaN % Number.MIN_VALUE) !== true) { + throw new Test262Error('#7: NaN % Number.MIN_VALUE === Not-a-Number. Actual: ' + (NaN % Number.MIN_VALUE)); +} + +//CHECK#8 +if (isNaN(Number.NaN % 1) !== true) { + throw new Test262Error('#8: NaN % 1 === Not-a-Number. Actual: ' + (NaN % 1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.2.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.2.js new file mode 100644 index 0000000000..13c04f933a --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T1.2.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T1.2 +description: If either operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN % Number.NaN) !== true) { + throw new Test262Error('#1: NaN % NaN === Not-a-Number. Actual: ' + (NaN % NaN)); +} + +//CHECK#2 +if (isNaN(+0 % Number.NaN) !== true) { + throw new Test262Error('#2: +0 % NaN === Not-a-Number. Actual: ' + (+0 % NaN)); +} + +//CHECK#3 +if (isNaN(-0 % Number.NaN) !== true) { + throw new Test262Error('#3: -0 % NaN === Not-a-Number. Actual: ' + (-0 % NaN)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY % Number.NaN) !== true) { + throw new Test262Error('#4: Infinity % NaN === Not-a-Number. Actual: ' + (Infinity % NaN)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY % Number.NaN) !== true) { + throw new Test262Error('#5: -Infinity % NaN === Not-a-Number. Actual: ' + ( -Infinity % NaN)); +} + +//CHECK#6 +if (isNaN(Number.MAX_VALUE % Number.NaN) !== true) { + throw new Test262Error('#6: Number.MAX_VALUE % NaN === Not-a-Number. Actual: ' + (Number.MAX_VALUE % NaN)); +} + +//CHECK#7 +if (isNaN(Number.MIN_VALUE % Number.NaN) !== true) { + throw new Test262Error('#7: Number.MIN_VALUE % NaN === Not-a-Number. Actual: ' + (Number.MIN_VALUE % NaN)); +} + +//CHECK#8 +if (isNaN(1 % Number.NaN) !== true) { + throw new Test262Error('#8: 1 % NaN === Not-a-Number. Actual: ' + (1 % NaN)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T2.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T2.js new file mode 100644 index 0000000000..628073b433 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T2.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T2 +description: > + The sign of the finite non-zero value result equals the sign of + the divided +---*/ + +//CHECK#1 +if (1 % 1 !== 0) { + throw new Test262Error('#1.1: 1 % 1 === 0. Actual: ' + (1 % 1)); +} else { + if (1 / (1 % 1) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: 1 % 1 === + 0. Actual: -0'); + } +} + +//CHECK#2 +if (-1 % -1 !== -0) { + throw new Test262Error('#2.1: -1 % -1 === 0. Actual: ' + (-1 % -1)); +} else { + if (1 / (-1 % -1) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2.2: -1 % -1 === - 0. Actual: +0'); + } +} + +//CHECK#3 +if (-1 % 1 !== -0) { + throw new Test262Error('#3.1: -1 % 1 === 0. Actual: ' + (-1 % 1)); +} else { + if (1 / (-1 % 1) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#3.2: -1 % 1 === - 0. Actual: +0'); + } +} + +//CHECK#4 +if (1 % -1 !== 0) { + throw new Test262Error('#4.1: 1 % -1 === 0. Actual: ' + (1 % -1)); +} else { + if (1 / (1 % -1) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#4.2: 1 % -1 === + 0. Actual: -0'); + } +} + +//CHECK#5 +if (101 % 51 !== 50) { + throw new Test262Error('#5: 101 % 51 === 50. Actual: ' + (101 % 51)); +} + +//CHECK#6 +if (101 % -51 !== 50) { + throw new Test262Error('#6: 101 % -51 === 50. Actual: ' + (101 % -51)); +} + +//CHECK#7 +if (-101 % 51 !== -50) { + throw new Test262Error('#7: -101 % 51 === -50. Actual: ' + (-101 % 51)); +} + +//CHECK#8 +if (-101 % -51 !== -50) { + throw new Test262Error('#8: -101 % -51 === -50. Actual: ' + (-101 % -51)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T3.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T3.js new file mode 100644 index 0000000000..1b57aa2cf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T3.js @@ -0,0 +1,72 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T3 +description: If the dividend is an infinity results is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#1: -Infinity % Infinity === Not-a-Number. Actual: ' + (-Infinity % Infinity)); +} + +//CHECK#2 +if (isNaN(Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#2: -Infinity % -Infinity === Not-a-Number. Actual: ' + (-Infinity % -Infinity)); +} + +//CHECK#3 +if (isNaN(Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#3: Infinity % Infinity === Not-a-Number. Actual: ' + (Infinity % Infinity)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#4: Infinity % -Infinity === Not-a-Number. Actual: ' + (Infinity % -Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY % 1) !== true) { + throw new Test262Error('#5: Infinity % 1 === Not-a-Number. Actual: ' + (Infinity % 1)); +} + +//CHECK#6 +if (isNaN(Number.NEGATIVE_INFINITY % -1) !== true) { + throw new Test262Error('#6: -Infinity % -1 === Not-a-Number. Actual: ' + (-Infinity % -1)); +} + +//CHECK#7 +if (isNaN(Number.POSITIVE_INFINITY % 1) !== true) { + throw new Test262Error('#7: Infinity % 1 === Not-a-Number. Actual: ' + (Infinity % 1)); +} + +//CHECK#8 +if (isNaN(Number.POSITIVE_INFINITY % -1) !== true) { + throw new Test262Error('#8: Infinity % -1 === Not-a-Number. Actual: ' + (Infinity % -1)); +} + +//CHECK#9 +if (isNaN(Number.NEGATIVE_INFINITY % Number.MAX_VALUE) !== true) { + throw new Test262Error('#9: Infinity % Number.MAX_VALUE === Not-a-Number. Actual: ' + (Infinity % Number.MAX_VALUE)); +} + +//CHECK#10 +if (isNaN(Number.NEGATIVE_INFINITY % -Number.MAX_VALUE) !== true) { + throw new Test262Error('#10: -Infinity % -Number.MAX_VALUE === Not-a-Number. Actual: ' + (-Infinity % -Number.MAX_VALUE)); +} + +//CHECK#11 +if (isNaN(Number.POSITIVE_INFINITY % Number.MAX_VALUE) !== true) { + throw new Test262Error('#11: Infinity % Number.MAX_VALUE === Not-a-Number. Actual: ' + (Infinity % Number.MAX_VALUE)); +} + +//CHECK#12 +if (isNaN(Number.POSITIVE_INFINITY % -Number.MAX_VALUE) !== true) { + throw new Test262Error('#12: Infinity % -Number.MAX_VALUE === Not-a-Number. Actual: ' + (Infinity % -Number.MAX_VALUE)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T4.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T4.js new file mode 100644 index 0000000000..b1d627c7e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T4.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T4 +description: If the divisor is zero results is NaN +---*/ + +//CHECK#1 +if (isNaN(-0 % 0) !== true) { + throw new Test262Error('#1: -0 % 0 === Not-a-Number. Actual: ' + (-0 % 0)); +} + +//CHECK#2 +if (isNaN(-0 % -0) !== true) { + throw new Test262Error('#2: -0 % -0 === Not-a-Number. Actual: ' + (-0 % -0)); +} + +//CHECK#3 +if (isNaN(0 % 0) !== true) { + throw new Test262Error('#3: 0 % 0 === Not-a-Number. Actual: ' + (0 % 0)); +} + +//CHECK#4 +if (isNaN(0 % -0) !== true) { + throw new Test262Error('#4: 0 % -0 === Not-a-Number. Actual: ' + (0 % -0)); +} + +//CHECK#5 +if (isNaN(-1 % 0) !== true) { + throw new Test262Error('#5: 1 % 0 === Not-a-Number. Actual: ' + (1 % 0)); +} + +//CHECK#6 +if (isNaN(-1 % -0) !== true) { + throw new Test262Error('#6: -1 % -0 === Not-a-Number. Actual: ' + (-1 % -0)); +} + +//CHECK#7 +if (isNaN(1 % 0) !== true) { + throw new Test262Error('#7: 1 % 0 === Not-a-Number. Actual: ' + (1 % 0)); +} + +//CHECK#8 +if (isNaN(1 % -0) !== true) { + throw new Test262Error('#8: 1 % -0 === Not-a-Number. Actual: ' + (1 % -0)); +} + +//CHECK#9 +if (isNaN(Number.NEGATIVE_INFINITY % 0) !== true) { + throw new Test262Error('#9: Infinity % 0 === Not-a-Number. Actual: ' + (Infinity % 0)); +} + +//CHECK#10 +if (isNaN(Number.NEGATIVE_INFINITY % -0) !== true) { + throw new Test262Error('#10: -Infinity % -0 === Not-a-Number. Actual: ' + (-Infinity % -0)); +} + +//CHECK#11 +if (isNaN(Number.POSITIVE_INFINITY % 0) !== true) { + throw new Test262Error('#11: Infinity % 0 === Not-a-Number. Actual: ' + (Infinity % 0)); +} + +//CHECK#12 +if (isNaN(Number.POSITIVE_INFINITY % -0) !== true) { + throw new Test262Error('#12: Infinity % -0 === Not-a-Number. Actual: ' + (Infinity % -0)); +} + +//CHECK#13 +if (isNaN(Number.MIN_VALUE % 0) !== true) { + throw new Test262Error('#13: Number.MIN_VALUE % 0 === Not-a-Number. Actual: ' + (Number.MIN_VALUE % 0)); +} + +//CHECK#14 +if (isNaN(Number.MIN_VALUE % -0) !== true) { + throw new Test262Error('#14: -Number.MIN_VALUE % -0 === Not-a-Number. Actual: ' + (-Number.MIN_VALUE % -0)); +} + +//CHECK#15 +if (isNaN(Number.MAX_VALUE % 0) !== true) { + throw new Test262Error('#15: Number.MAX_VALUE % 0 === Not-a-Number. Actual: ' + (Number.MAX_VALUE % 0)); +} + +//CHECK#16 +if (isNaN(Number.MAX_VALUE % -0) !== true) { + throw new Test262Error('#16: Number.MAX_VALUE % -0 === Not-a-Number. Actual: ' + (Number.MAX_VALUE % -0)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T5.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T5.js new file mode 100644 index 0000000000..0f5d8a3c77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T5.js @@ -0,0 +1,108 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T5 +description: > + If dividend is finite and the divisor is an infinity, the result + equals the dividend +---*/ + +//CHECK#1 +if (1 % Number.NEGATIVE_INFINITY !== 1) { + throw new Test262Error('#1: 1 % -Infinity === 1. Actual: ' + (1 % -Infinity)); +} +//CHECK#2 +if (1 % Number.POSITIVE_INFINITY !==1) { + throw new Test262Error('#2: 1 % Infinity === 1. Actual: ' + (1 % Infinity)); +} + +//CHECK#3 +if (-1 % Number.POSITIVE_INFINITY !== -1) { + throw new Test262Error('#3: -1 % Infinity === -1. Actual: ' + (-1 % Infinity)); +} + +//CHECK#4 +if (-1 % Number.NEGATIVE_INFINITY !== -1) { + throw new Test262Error('#4: -1 % -Infinity === -1. Actual: ' + (-1 % -Infinity)); +} + +//CHECK#5 +if (0 % Number.POSITIVE_INFINITY !== 0) { + throw new Test262Error('#5.1: 0 % Infinity === 0. Actual: ' + (0 % Infinity)); +} else { + if (1 / (0 % Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5.2: 0 % Infinity === + 0. Actual: -0'); + } +} + +//CHECK#6 +if (0 % Number.NEGATIVE_INFINITY !== 0) { + throw new Test262Error('#6.1: 0 % -Infinity === 0. Actual: ' + (0 % -Infinity)); +} else { + if (1 / (0 % Number.NEGATIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#6.2: 0 % -Infinity === + 0. Actual: -0'); + } +} + +//CHECK#7 +if (-0 % Number.POSITIVE_INFINITY !== -0) { + throw new Test262Error('#7.1: -0 % Infinity === 0. Actual: ' + (-0 % Infinity)); +} else { + if (1 / (-0 % Number.POSITIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#7.2: -0 % Infinity === - 0. Actual: +0'); + } +} + +//CHECK#8 +if (-0 % Number.NEGATIVE_INFINITY !== -0) { + throw new Test262Error('#8.1: -0 % -Infinity === 0. Actual: ' + (-0 % -Infinity)); +} else { + if (1 / (-0 % Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#8.2: -0 % -Infinity === - 0. Actual: +0'); + } +} + +//CHECK#9 +if (Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== Number.MAX_VALUE) { + throw new Test262Error('#9: Number.MAX_VALUE % -Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % -Infinity)); +} + +//CHECK#10 +if (Number.MAX_VALUE % Number.POSITIVE_INFINITY !== Number.MAX_VALUE) { + throw new Test262Error('#10: Number.MAX_VALUE % Infinity === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE % Infinity)); +} + +//CHECK#11 +if (-Number.MAX_VALUE % Number.POSITIVE_INFINITY !== -Number.MAX_VALUE) { + throw new Test262Error('#11: -Number.MAX_VALUE % Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % Infinity)); +} + +//CHECK#12 +if (-Number.MAX_VALUE % Number.NEGATIVE_INFINITY !== -Number.MAX_VALUE) { + throw new Test262Error('#12: -Number.MAX_VALUE % -Infinity === -Number.MAX_VALUE. Actual: ' + (-Number.MAX_VALUE % -Infinity)); +} + +//CHECK#13 +if (Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== Number.MIN_VALUE) { + throw new Test262Error('#13: Number.MIN_VALUE % -Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % -Infinity)); +} +//CHECK#14 +if (Number.MIN_VALUE % Number.POSITIVE_INFINITY !== Number.MIN_VALUE) { + throw new Test262Error('#14: Number.MIN_VALUE % Infinity === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE % Infinity)); +} + +//CHECK#15 +if (-Number.MIN_VALUE % Number.POSITIVE_INFINITY !== -Number.MIN_VALUE) { + throw new Test262Error('#15: -Number.MIN_VALUE % Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % Infinity)); +} + +//CHECK#16 +if (-Number.MIN_VALUE % Number.NEGATIVE_INFINITY !== -Number.MIN_VALUE) { + throw new Test262Error('#16: -Number.MIN_VALUE % -Infinity === -Number.MIN_VALUE. Actual: ' + (-Number.MIN_VALUE % -Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T6.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T6.js new file mode 100644 index 0000000000..0664f1266d --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T6.js @@ -0,0 +1,86 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T6 +description: > + If dividend is a zero and the divisor is nonzero finite, the + result equals the dividend +---*/ + +//CHECK#1 +if (0 % 1 !== 0) { + throw new Test262Error('#1.1: 0 % 1 === 0. Actual: ' + (0 % 1)); +} else { + if (1 / (0 % 1) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: 0 % 1 === + 0. Actual: -0'); + } +} + +//CHECK#2 +if (0 % -1 !== 0) { + throw new Test262Error('#2.1: 0 % -1 === 0. Actual: ' + (0 % -1)); +} else { + if (1 / (0 % -1) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: 0 % -1 === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (-0 % 1 !== -0) { + throw new Test262Error('#3.1: -0 % 1 === 0. Actual: ' + (-0 % 1)); +} else { + if (1 / (-0 % 1) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#3.2: -0 % 1 === - 0. Actual: +0'); + } +} + +//CHECK#4 +if (-0 % -1 !== -0) { + throw new Test262Error('#4.1: -0 % -1 === 0. Actual: ' + (-0 % -1)); +} else { + if (1 / (-0 % -1) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4.2: 0 % -1 === - 0. Actual: +0'); + } +} + +//CHECK#5 +if (0 % Number.MAX_VALUE !== 0) { + throw new Test262Error('#5.1: 0 % Number.MAX_VALUE === 0. Actual: ' + (0 % Number.MAX_VALUE)); +} else { + if (1 / (0 % Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5.2: 0 % Number.MAX_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#6 +if (0 % Number.MIN_VALUE !== 0) { + throw new Test262Error('#6.1: 0 % Number.MIN_VALUE === 0. Actual: ' + (0 % Number.MIN_VALUE)); +} else { + if (1 / (0 % Number.MIN_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#6.2: 0 % Number.MIN_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#7 +if (-0 % Number.MAX_VALUE !== -0) { + throw new Test262Error('#7.1: -0 % Number.MAX_VALUE === 0. Actual: ' + (-0 % Number.MAX_VALUE)); +} else { + if (1 / (-0 % Number.MAX_VALUE) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#7.2: -0 % Number.MAX_VALUE === - 0. Actual: +0'); + } +} + +//CHECK#8 +if (-0 % Number.MIN_VALUE !== -0) { + throw new Test262Error('#8.1: -0 % Number.MIN_VALUE === 0. Actual: ' + (-0 % Number.MIN_VALUE)); +} else { + if (1 / (-0 % Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#8.2: 0 % Number.MIN_VALUE === - 0. Actual: +0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T7.js b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T7.js new file mode 100644 index 0000000000..6d9baaf151 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/S11.5.3_A4_T7.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a ECMAScript floating-point remainder operation is + determined by the rules of IEEE arithmetics +es5id: 11.5.3_A4_T7 +description: > + If operands neither an infinity, nor a zero, nor NaN, return x - + truncate(x / y) * y +---*/ + +function truncate(x) { + if (x > 0) { + return Math.floor(x); + } else { + return Math.ceil(x); + } +} + +var x, y; + +//CHECK#1 +x = 1.3; +y = 1.1; +if (x % y !== 0.19999999999999996) { + throw new Test262Error('#1: x = 1.3; y = 1.1; x % y === 0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#2 +x = -1.3; +y = 1.1; +if (x % y !== -0.19999999999999996) { + throw new Test262Error('#2: x = -1.3; y = 1.1; x % y === -0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#3 +x = 1.3; +y = -1.1; +if (x % y !== 0.19999999999999996) { + throw new Test262Error('#3: x = 1.3; y = -1.1; x % y === 0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#4 +x = -1.3; +y = -1.1; +if (x % y !== -0.19999999999999996) { + throw new Test262Error('#4: x = -1.3; y = -1.1; x % y === -0.19999999999999996. Actual: ' + (x % y)); +} + +//CHECK#5 +x = 1.3; +y = 1.1; +if (x % y !== x - truncate(x / y) * y) { + throw new Test262Error('#5: x = 1.3; y = 1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + +//CHECK#6 +x = -1.3; +y = 1.1; +if (x % y !== x - truncate(x / y) * y) { + throw new Test262Error('#6: x = -1.3; y = 1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + +//CHECK#7 +x = 1.3; +y = -1.1; +if (x % y !== x - truncate(x / y) * y) { + throw new Test262Error('#7: x = 1.3; y = -1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + +//CHECK#8 +x = -1.3; +y = -1.1; +if (x % y !== x - truncate(x / y) * y) { + throw new Test262Error('#8: x = -1.3; y = -1.1; x % y === x - truncate(x / y) * y. Actual: ' + (x % y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/bigint-and-number.js b/js/src/tests/test262/language/expressions/modulus/bigint-and-number.js new file mode 100644 index 0000000000..6f4b3acb64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for modulus operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n % 1; +}, '1n % 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 % 1n; +}, '1 % 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) % 1; +}, 'Object(1n) % 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 % Object(1n); +}, '1 % Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n % Object(1); +}, '1n % Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) % 1n; +}, 'Object(1) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) % Object(1); +}, 'Object(1n) % Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) % Object(1n); +}, 'Object(1) % Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n % NaN; +}, '1n % NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN % 1n; +}, 'NaN % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % Infinity; +}, '1n % Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity % 1n; +}, 'Infinity % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % true; +}, '1n % true throws TypeError'); + +assert.throws(TypeError, function() { + true % 1n; +}, 'true % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % '1'; +}, '1n % "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' % 1n; +}, '"1" % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % null; +}, '1n % null throws TypeError'); + +assert.throws(TypeError, function() { + null % 1n; +}, 'null % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n % undefined; +}, '1n % undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined % 1n; +}, 'undefined % 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/bigint-arithmetic.js b/js/src/tests/test262/language/expressions/modulus/bigint-arithmetic.js new file mode 100644 index 0000000000..1960b2036d --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/bigint-arithmetic.js @@ -0,0 +1,986 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: BigInt remainder arithmetic +features: [BigInt] +---*/ +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA98n, + 0x76543210n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA98n) is 0x76543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0xFEDCBA97n, + 0x77777779n, + 'The result of (0xFEDCBA9876543210n % 0xFEDCBA97n) is 0x77777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x1234n, + 0x960n, + 'The result of (0xFEDCBA9876543210n % 0x1234n) is 0x960n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x3n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0x3n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x2n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0x2n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % 0x1n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % 0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x1n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x2n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0x2n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x3n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0x3n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0x1234n, + 0x960n, + 'The result of (0xFEDCBA9876543210n % -0x1234n) is 0x960n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA97n, + 0x77777779n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA97n) is 0x77777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA98n, + 0x76543210n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA98n) is 0x76543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n % -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n % -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA9876543210n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA9876543210n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA98n, + 0x7654320Fn, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA98n) is 0x7654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0xFEDCBA97n, + 0x77777778n, + 'The result of (0xFEDCBA987654320Fn % 0xFEDCBA97n) is 0x77777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x1234n, + 0x95Fn, + 'The result of (0xFEDCBA987654320Fn % 0x1234n) is 0x95Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x3n, + 0x2n, + 'The result of (0xFEDCBA987654320Fn % 0x3n) is 0x2n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x2n, + 0x1n, + 'The result of (0xFEDCBA987654320Fn % 0x2n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % 0x1n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % 0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x1n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % -0x1n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x2n, + 0x1n, + 'The result of (0xFEDCBA987654320Fn % -0x2n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x3n, + 0x2n, + 'The result of (0xFEDCBA987654320Fn % -0x3n) is 0x2n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0x1234n, + 0x95Fn, + 'The result of (0xFEDCBA987654320Fn % -0x1234n) is 0x95Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA97n, + 0x77777778n, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA97n) is 0x77777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA98n, + 0x7654320Fn, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA98n) is 0x7654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn % -0xFEDCBA9876543210n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn % -0xFEDCBA9876543210n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA9876543210n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % 0xFEDCBA9876543210n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA987654320Fn, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % 0xFEDCBA987654320Fn) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n % 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n % 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n % 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue(0xFEDCBA98n % 0x1234n, 0x930n, 'The result of (0xFEDCBA98n % 0x1234n) is 0x930n'); +assert.sameValue(0xFEDCBA98n % 0x3n, 0x2n, 'The result of (0xFEDCBA98n % 0x3n) is 0x2n'); +assert.sameValue(0xFEDCBA98n % 0x2n, 0x0n, 'The result of (0xFEDCBA98n % 0x2n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % 0x1n, 0x0n, 'The result of (0xFEDCBA98n % 0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % -0x1n, 0x0n, 'The result of (0xFEDCBA98n % -0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % -0x2n, 0x0n, 'The result of (0xFEDCBA98n % -0x2n) is 0x0n'); +assert.sameValue(0xFEDCBA98n % -0x3n, 0x2n, 'The result of (0xFEDCBA98n % -0x3n) is 0x2n'); + +assert.sameValue( + 0xFEDCBA98n % -0x1234n, + 0x930n, + 'The result of (0xFEDCBA98n % -0x1234n) is 0x930n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n % -0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n % -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA987654320Fn, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % -0xFEDCBA987654320Fn) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n % -0xFEDCBA9876543210n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n % -0xFEDCBA9876543210n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA9876543210n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % 0xFEDCBA9876543210n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA987654320Fn, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % 0xFEDCBA987654320Fn) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA98n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % 0xFEDCBA98n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % 0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n % 0xFEDCBA97n) is 0x0n' +); + +assert.sameValue(0xFEDCBA97n % 0x1234n, 0x92Fn, 'The result of (0xFEDCBA97n % 0x1234n) is 0x92Fn'); +assert.sameValue(0xFEDCBA97n % 0x3n, 0x1n, 'The result of (0xFEDCBA97n % 0x3n) is 0x1n'); +assert.sameValue(0xFEDCBA97n % 0x2n, 0x1n, 'The result of (0xFEDCBA97n % 0x2n) is 0x1n'); +assert.sameValue(0xFEDCBA97n % 0x1n, 0x0n, 'The result of (0xFEDCBA97n % 0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA97n % -0x1n, 0x0n, 'The result of (0xFEDCBA97n % -0x1n) is 0x0n'); +assert.sameValue(0xFEDCBA97n % -0x2n, 0x1n, 'The result of (0xFEDCBA97n % -0x2n) is 0x1n'); +assert.sameValue(0xFEDCBA97n % -0x3n, 0x1n, 'The result of (0xFEDCBA97n % -0x3n) is 0x1n'); + +assert.sameValue( + 0xFEDCBA97n % -0x1234n, + 0x92Fn, + 'The result of (0xFEDCBA97n % -0x1234n) is 0x92Fn' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n % -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA98n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % -0xFEDCBA98n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA987654320Fn, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % -0xFEDCBA987654320Fn) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n % -0xFEDCBA9876543210n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n % -0xFEDCBA9876543210n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA9876543210n, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA9876543210n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA987654320Fn, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA987654320Fn) is 0x1234n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA98n, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA98n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % 0xFEDCBA97n, + 0x1234n, + 'The result of (0x1234n % 0xFEDCBA97n) is 0x1234n' +); + +assert.sameValue(0x1234n % 0x1234n, 0x0n, 'The result of (0x1234n % 0x1234n) is 0x0n'); +assert.sameValue(0x1234n % 0x3n, 0x1n, 'The result of (0x1234n % 0x3n) is 0x1n'); +assert.sameValue(0x1234n % 0x2n, 0x0n, 'The result of (0x1234n % 0x2n) is 0x0n'); +assert.sameValue(0x1234n % 0x1n, 0x0n, 'The result of (0x1234n % 0x1n) is 0x0n'); +assert.sameValue(0x1234n % -0x1n, 0x0n, 'The result of (0x1234n % -0x1n) is 0x0n'); +assert.sameValue(0x1234n % -0x2n, 0x0n, 'The result of (0x1234n % -0x2n) is 0x0n'); +assert.sameValue(0x1234n % -0x3n, 0x1n, 'The result of (0x1234n % -0x3n) is 0x1n'); +assert.sameValue(0x1234n % -0x1234n, 0x0n, 'The result of (0x1234n % -0x1234n) is 0x0n'); + +assert.sameValue( + 0x1234n % -0xFEDCBA97n, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA97n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % -0xFEDCBA98n, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA98n) is 0x1234n' +); + +assert.sameValue( + 0x1234n % -0xFEDCBA987654320Fn, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA987654320Fn) is 0x1234n' +); + +assert.sameValue( + 0x1234n % -0xFEDCBA9876543210n, + 0x1234n, + 'The result of (0x1234n % -0xFEDCBA9876543210n) is 0x1234n' +); + +assert.sameValue( + 0x3n % 0xFEDCBA9876543210n, + 0x3n, + 'The result of (0x3n % 0xFEDCBA9876543210n) is 0x3n' +); + +assert.sameValue( + 0x3n % 0xFEDCBA987654320Fn, + 0x3n, + 'The result of (0x3n % 0xFEDCBA987654320Fn) is 0x3n' +); + +assert.sameValue(0x3n % 0xFEDCBA98n, 0x3n, 'The result of (0x3n % 0xFEDCBA98n) is 0x3n'); +assert.sameValue(0x3n % 0xFEDCBA97n, 0x3n, 'The result of (0x3n % 0xFEDCBA97n) is 0x3n'); +assert.sameValue(0x3n % 0x1234n, 0x3n, 'The result of (0x3n % 0x1234n) is 0x3n'); +assert.sameValue(0x3n % 0x3n, 0x0n, 'The result of (0x3n % 0x3n) is 0x0n'); +assert.sameValue(0x3n % 0x2n, 0x1n, 'The result of (0x3n % 0x2n) is 0x1n'); +assert.sameValue(0x3n % 0x1n, 0x0n, 'The result of (0x3n % 0x1n) is 0x0n'); +assert.sameValue(0x3n % -0x1n, 0x0n, 'The result of (0x3n % -0x1n) is 0x0n'); +assert.sameValue(0x3n % -0x2n, 0x1n, 'The result of (0x3n % -0x2n) is 0x1n'); +assert.sameValue(0x3n % -0x3n, 0x0n, 'The result of (0x3n % -0x3n) is 0x0n'); +assert.sameValue(0x3n % -0x1234n, 0x3n, 'The result of (0x3n % -0x1234n) is 0x3n'); +assert.sameValue(0x3n % -0xFEDCBA97n, 0x3n, 'The result of (0x3n % -0xFEDCBA97n) is 0x3n'); +assert.sameValue(0x3n % -0xFEDCBA98n, 0x3n, 'The result of (0x3n % -0xFEDCBA98n) is 0x3n'); + +assert.sameValue( + 0x3n % -0xFEDCBA987654320Fn, + 0x3n, + 'The result of (0x3n % -0xFEDCBA987654320Fn) is 0x3n' +); + +assert.sameValue( + 0x3n % -0xFEDCBA9876543210n, + 0x3n, + 'The result of (0x3n % -0xFEDCBA9876543210n) is 0x3n' +); + +assert.sameValue( + 0x2n % 0xFEDCBA9876543210n, + 0x2n, + 'The result of (0x2n % 0xFEDCBA9876543210n) is 0x2n' +); + +assert.sameValue( + 0x2n % 0xFEDCBA987654320Fn, + 0x2n, + 'The result of (0x2n % 0xFEDCBA987654320Fn) is 0x2n' +); + +assert.sameValue(0x2n % 0xFEDCBA98n, 0x2n, 'The result of (0x2n % 0xFEDCBA98n) is 0x2n'); +assert.sameValue(0x2n % 0xFEDCBA97n, 0x2n, 'The result of (0x2n % 0xFEDCBA97n) is 0x2n'); +assert.sameValue(0x2n % 0x1234n, 0x2n, 'The result of (0x2n % 0x1234n) is 0x2n'); +assert.sameValue(0x2n % 0x3n, 0x2n, 'The result of (0x2n % 0x3n) is 0x2n'); +assert.sameValue(0x2n % 0x2n, 0x0n, 'The result of (0x2n % 0x2n) is 0x0n'); +assert.sameValue(0x2n % 0x1n, 0x0n, 'The result of (0x2n % 0x1n) is 0x0n'); +assert.sameValue(0x2n % -0x1n, 0x0n, 'The result of (0x2n % -0x1n) is 0x0n'); +assert.sameValue(0x2n % -0x2n, 0x0n, 'The result of (0x2n % -0x2n) is 0x0n'); +assert.sameValue(0x2n % -0x3n, 0x2n, 'The result of (0x2n % -0x3n) is 0x2n'); +assert.sameValue(0x2n % -0x1234n, 0x2n, 'The result of (0x2n % -0x1234n) is 0x2n'); +assert.sameValue(0x2n % -0xFEDCBA97n, 0x2n, 'The result of (0x2n % -0xFEDCBA97n) is 0x2n'); +assert.sameValue(0x2n % -0xFEDCBA98n, 0x2n, 'The result of (0x2n % -0xFEDCBA98n) is 0x2n'); + +assert.sameValue( + 0x2n % -0xFEDCBA987654320Fn, + 0x2n, + 'The result of (0x2n % -0xFEDCBA987654320Fn) is 0x2n' +); + +assert.sameValue( + 0x2n % -0xFEDCBA9876543210n, + 0x2n, + 'The result of (0x2n % -0xFEDCBA9876543210n) is 0x2n' +); + +assert.sameValue( + 0x1n % 0xFEDCBA9876543210n, + 0x1n, + 'The result of (0x1n % 0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + 0x1n % 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0x1n % 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue(0x1n % 0xFEDCBA98n, 0x1n, 'The result of (0x1n % 0xFEDCBA98n) is 0x1n'); +assert.sameValue(0x1n % 0xFEDCBA97n, 0x1n, 'The result of (0x1n % 0xFEDCBA97n) is 0x1n'); +assert.sameValue(0x1n % 0x1234n, 0x1n, 'The result of (0x1n % 0x1234n) is 0x1n'); +assert.sameValue(0x1n % 0x3n, 0x1n, 'The result of (0x1n % 0x3n) is 0x1n'); +assert.sameValue(0x1n % 0x2n, 0x1n, 'The result of (0x1n % 0x2n) is 0x1n'); +assert.sameValue(0x1n % 0x1n, 0x0n, 'The result of (0x1n % 0x1n) is 0x0n'); +assert.sameValue(0x1n % -0x1n, 0x0n, 'The result of (0x1n % -0x1n) is 0x0n'); +assert.sameValue(0x1n % -0x2n, 0x1n, 'The result of (0x1n % -0x2n) is 0x1n'); +assert.sameValue(0x1n % -0x3n, 0x1n, 'The result of (0x1n % -0x3n) is 0x1n'); +assert.sameValue(0x1n % -0x1234n, 0x1n, 'The result of (0x1n % -0x1234n) is 0x1n'); +assert.sameValue(0x1n % -0xFEDCBA97n, 0x1n, 'The result of (0x1n % -0xFEDCBA97n) is 0x1n'); +assert.sameValue(0x1n % -0xFEDCBA98n, 0x1n, 'The result of (0x1n % -0xFEDCBA98n) is 0x1n'); + +assert.sameValue( + 0x1n % -0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0x1n % -0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0x1n % -0xFEDCBA9876543210n, + 0x1n, + 'The result of (0x1n % -0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + -0x1n % 0xFEDCBA9876543210n, + -0x1n, + 'The result of (-0x1n % 0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + -0x1n % 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0x1n % 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue(-0x1n % 0xFEDCBA98n, -0x1n, 'The result of (-0x1n % 0xFEDCBA98n) is -0x1n'); +assert.sameValue(-0x1n % 0xFEDCBA97n, -0x1n, 'The result of (-0x1n % 0xFEDCBA97n) is -0x1n'); +assert.sameValue(-0x1n % 0x1234n, -0x1n, 'The result of (-0x1n % 0x1234n) is -0x1n'); +assert.sameValue(-0x1n % 0x3n, -0x1n, 'The result of (-0x1n % 0x3n) is -0x1n'); +assert.sameValue(-0x1n % 0x2n, -0x1n, 'The result of (-0x1n % 0x2n) is -0x1n'); +assert.sameValue(-0x1n % 0x1n, 0x0n, 'The result of (-0x1n % 0x1n) is 0x0n'); +assert.sameValue(-0x1n % -0x1n, 0x0n, 'The result of (-0x1n % -0x1n) is 0x0n'); +assert.sameValue(-0x1n % -0x2n, -0x1n, 'The result of (-0x1n % -0x2n) is -0x1n'); +assert.sameValue(-0x1n % -0x3n, -0x1n, 'The result of (-0x1n % -0x3n) is -0x1n'); +assert.sameValue(-0x1n % -0x1234n, -0x1n, 'The result of (-0x1n % -0x1234n) is -0x1n'); +assert.sameValue(-0x1n % -0xFEDCBA97n, -0x1n, 'The result of (-0x1n % -0xFEDCBA97n) is -0x1n'); +assert.sameValue(-0x1n % -0xFEDCBA98n, -0x1n, 'The result of (-0x1n % -0xFEDCBA98n) is -0x1n'); + +assert.sameValue( + -0x1n % -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0x1n % -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0x1n % -0xFEDCBA9876543210n, + -0x1n, + 'The result of (-0x1n % -0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + -0x2n % 0xFEDCBA9876543210n, + -0x2n, + 'The result of (-0x2n % 0xFEDCBA9876543210n) is -0x2n' +); + +assert.sameValue( + -0x2n % 0xFEDCBA987654320Fn, + -0x2n, + 'The result of (-0x2n % 0xFEDCBA987654320Fn) is -0x2n' +); + +assert.sameValue(-0x2n % 0xFEDCBA98n, -0x2n, 'The result of (-0x2n % 0xFEDCBA98n) is -0x2n'); +assert.sameValue(-0x2n % 0xFEDCBA97n, -0x2n, 'The result of (-0x2n % 0xFEDCBA97n) is -0x2n'); +assert.sameValue(-0x2n % 0x1234n, -0x2n, 'The result of (-0x2n % 0x1234n) is -0x2n'); +assert.sameValue(-0x2n % 0x3n, -0x2n, 'The result of (-0x2n % 0x3n) is -0x2n'); +assert.sameValue(-0x2n % 0x2n, 0x0n, 'The result of (-0x2n % 0x2n) is 0x0n'); +assert.sameValue(-0x2n % 0x1n, 0x0n, 'The result of (-0x2n % 0x1n) is 0x0n'); +assert.sameValue(-0x2n % -0x1n, 0x0n, 'The result of (-0x2n % -0x1n) is 0x0n'); +assert.sameValue(-0x2n % -0x2n, 0x0n, 'The result of (-0x2n % -0x2n) is 0x0n'); +assert.sameValue(-0x2n % -0x3n, -0x2n, 'The result of (-0x2n % -0x3n) is -0x2n'); +assert.sameValue(-0x2n % -0x1234n, -0x2n, 'The result of (-0x2n % -0x1234n) is -0x2n'); +assert.sameValue(-0x2n % -0xFEDCBA97n, -0x2n, 'The result of (-0x2n % -0xFEDCBA97n) is -0x2n'); +assert.sameValue(-0x2n % -0xFEDCBA98n, -0x2n, 'The result of (-0x2n % -0xFEDCBA98n) is -0x2n'); + +assert.sameValue( + -0x2n % -0xFEDCBA987654320Fn, + -0x2n, + 'The result of (-0x2n % -0xFEDCBA987654320Fn) is -0x2n' +); + +assert.sameValue( + -0x2n % -0xFEDCBA9876543210n, + -0x2n, + 'The result of (-0x2n % -0xFEDCBA9876543210n) is -0x2n' +); + +assert.sameValue( + -0x3n % 0xFEDCBA9876543210n, + -0x3n, + 'The result of (-0x3n % 0xFEDCBA9876543210n) is -0x3n' +); + +assert.sameValue( + -0x3n % 0xFEDCBA987654320Fn, + -0x3n, + 'The result of (-0x3n % 0xFEDCBA987654320Fn) is -0x3n' +); + +assert.sameValue(-0x3n % 0xFEDCBA98n, -0x3n, 'The result of (-0x3n % 0xFEDCBA98n) is -0x3n'); +assert.sameValue(-0x3n % 0xFEDCBA97n, -0x3n, 'The result of (-0x3n % 0xFEDCBA97n) is -0x3n'); +assert.sameValue(-0x3n % 0x1234n, -0x3n, 'The result of (-0x3n % 0x1234n) is -0x3n'); +assert.sameValue(-0x3n % 0x3n, 0x0n, 'The result of (-0x3n % 0x3n) is 0x0n'); +assert.sameValue(-0x3n % 0x2n, -0x1n, 'The result of (-0x3n % 0x2n) is -0x1n'); +assert.sameValue(-0x3n % 0x1n, 0x0n, 'The result of (-0x3n % 0x1n) is 0x0n'); +assert.sameValue(-0x3n % -0x1n, 0x0n, 'The result of (-0x3n % -0x1n) is 0x0n'); +assert.sameValue(-0x3n % -0x2n, -0x1n, 'The result of (-0x3n % -0x2n) is -0x1n'); +assert.sameValue(-0x3n % -0x3n, 0x0n, 'The result of (-0x3n % -0x3n) is 0x0n'); +assert.sameValue(-0x3n % -0x1234n, -0x3n, 'The result of (-0x3n % -0x1234n) is -0x3n'); +assert.sameValue(-0x3n % -0xFEDCBA97n, -0x3n, 'The result of (-0x3n % -0xFEDCBA97n) is -0x3n'); +assert.sameValue(-0x3n % -0xFEDCBA98n, -0x3n, 'The result of (-0x3n % -0xFEDCBA98n) is -0x3n'); + +assert.sameValue( + -0x3n % -0xFEDCBA987654320Fn, + -0x3n, + 'The result of (-0x3n % -0xFEDCBA987654320Fn) is -0x3n' +); + +assert.sameValue( + -0x3n % -0xFEDCBA9876543210n, + -0x3n, + 'The result of (-0x3n % -0xFEDCBA9876543210n) is -0x3n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA9876543210n, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA9876543210n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA987654320Fn, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA987654320Fn) is -0x1234n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA98n, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA98n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % 0xFEDCBA97n, + -0x1234n, + 'The result of (-0x1234n % 0xFEDCBA97n) is -0x1234n' +); + +assert.sameValue(-0x1234n % 0x1234n, 0x0n, 'The result of (-0x1234n % 0x1234n) is 0x0n'); +assert.sameValue(-0x1234n % 0x3n, -0x1n, 'The result of (-0x1234n % 0x3n) is -0x1n'); +assert.sameValue(-0x1234n % 0x2n, 0x0n, 'The result of (-0x1234n % 0x2n) is 0x0n'); +assert.sameValue(-0x1234n % 0x1n, 0x0n, 'The result of (-0x1234n % 0x1n) is 0x0n'); +assert.sameValue(-0x1234n % -0x1n, 0x0n, 'The result of (-0x1234n % -0x1n) is 0x0n'); +assert.sameValue(-0x1234n % -0x2n, 0x0n, 'The result of (-0x1234n % -0x2n) is 0x0n'); +assert.sameValue(-0x1234n % -0x3n, -0x1n, 'The result of (-0x1234n % -0x3n) is -0x1n'); +assert.sameValue(-0x1234n % -0x1234n, 0x0n, 'The result of (-0x1234n % -0x1234n) is 0x0n'); + +assert.sameValue( + -0x1234n % -0xFEDCBA97n, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA97n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % -0xFEDCBA98n, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA98n) is -0x1234n' +); + +assert.sameValue( + -0x1234n % -0xFEDCBA987654320Fn, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA987654320Fn) is -0x1234n' +); + +assert.sameValue( + -0x1234n % -0xFEDCBA9876543210n, + -0x1234n, + 'The result of (-0x1234n % -0xFEDCBA9876543210n) is -0x1234n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA9876543210n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA9876543210n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA987654320Fn, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA987654320Fn) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % 0xFEDCBA97n, + 0x0n, + 'The result of (-0xFEDCBA97n % 0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n % 0x1234n, + -0x92Fn, + 'The result of (-0xFEDCBA97n % 0x1234n) is -0x92Fn' +); + +assert.sameValue(-0xFEDCBA97n % 0x3n, -0x1n, 'The result of (-0xFEDCBA97n % 0x3n) is -0x1n'); +assert.sameValue(-0xFEDCBA97n % 0x2n, -0x1n, 'The result of (-0xFEDCBA97n % 0x2n) is -0x1n'); +assert.sameValue(-0xFEDCBA97n % 0x1n, 0x0n, 'The result of (-0xFEDCBA97n % 0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA97n % -0x1n, 0x0n, 'The result of (-0xFEDCBA97n % -0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA97n % -0x2n, -0x1n, 'The result of (-0xFEDCBA97n % -0x2n) is -0x1n'); +assert.sameValue(-0xFEDCBA97n % -0x3n, -0x1n, 'The result of (-0xFEDCBA97n % -0x3n) is -0x1n'); + +assert.sameValue( + -0xFEDCBA97n % -0x1234n, + -0x92Fn, + 'The result of (-0xFEDCBA97n % -0x1234n) is -0x92Fn' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA97n, + 0x0n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA987654320Fn, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA987654320Fn) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n % -0xFEDCBA9876543210n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n % -0xFEDCBA9876543210n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA9876543210n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA9876543210n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA987654320Fn, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA987654320Fn) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n % 0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n % 0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n % 0x1234n, + -0x930n, + 'The result of (-0xFEDCBA98n % 0x1234n) is -0x930n' +); + +assert.sameValue(-0xFEDCBA98n % 0x3n, -0x2n, 'The result of (-0xFEDCBA98n % 0x3n) is -0x2n'); +assert.sameValue(-0xFEDCBA98n % 0x2n, 0x0n, 'The result of (-0xFEDCBA98n % 0x2n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % 0x1n, 0x0n, 'The result of (-0xFEDCBA98n % 0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % -0x1n, 0x0n, 'The result of (-0xFEDCBA98n % -0x1n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % -0x2n, 0x0n, 'The result of (-0xFEDCBA98n % -0x2n) is 0x0n'); +assert.sameValue(-0xFEDCBA98n % -0x3n, -0x2n, 'The result of (-0xFEDCBA98n % -0x3n) is -0x2n'); + +assert.sameValue( + -0xFEDCBA98n % -0x1234n, + -0x930n, + 'The result of (-0xFEDCBA98n % -0x1234n) is -0x930n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA987654320Fn, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA987654320Fn) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n % -0xFEDCBA9876543210n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n % -0xFEDCBA9876543210n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA98n, + -0x7654320Fn, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA98n) is -0x7654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0xFEDCBA97n, + -0x77777778n, + 'The result of (-0xFEDCBA987654320Fn % 0xFEDCBA97n) is -0x77777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x1234n, + -0x95Fn, + 'The result of (-0xFEDCBA987654320Fn % 0x1234n) is -0x95Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x3n, + -0x2n, + 'The result of (-0xFEDCBA987654320Fn % 0x3n) is -0x2n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x2n, + -0x1n, + 'The result of (-0xFEDCBA987654320Fn % 0x2n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % 0x1n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % 0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x1n, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % -0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x2n, + -0x1n, + 'The result of (-0xFEDCBA987654320Fn % -0x2n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x3n, + -0x2n, + 'The result of (-0xFEDCBA987654320Fn % -0x3n) is -0x2n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0x1234n, + -0x95Fn, + 'The result of (-0xFEDCBA987654320Fn % -0x1234n) is -0x95Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA97n, + -0x77777778n, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA97n) is -0x77777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA98n, + -0x7654320Fn, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA98n) is -0x7654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn % -0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn % -0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA98n, + -0x76543210n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA98n) is -0x76543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0xFEDCBA97n, + -0x77777779n, + 'The result of (-0xFEDCBA9876543210n % 0xFEDCBA97n) is -0x77777779n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x1234n, + -0x960n, + 'The result of (-0xFEDCBA9876543210n % 0x1234n) is -0x960n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x3n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0x3n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x2n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0x2n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % 0x1n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % 0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x1n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0x1n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x2n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0x2n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x3n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0x3n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0x1234n, + -0x960n, + 'The result of (-0xFEDCBA9876543210n % -0x1234n) is -0x960n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA97n, + -0x77777779n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA97n) is -0x77777779n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA98n, + -0x76543210n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA98n) is -0x76543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n % -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n % -0xFEDCBA9876543210n) is 0x0n' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/bigint-errors.js b/js/src/tests/test262/language/expressions/modulus/bigint-errors.js new file mode 100644 index 0000000000..87936c2436 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: modulus operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') % 1n; +}, 'Symbol("1") % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % Symbol('1'); +}, '0n % Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) % 1n; +}, 'Object(Symbol("1")) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % Object(Symbol('1')); +}, '0n % Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) % 1n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n % {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) % 1n; +}, '({valueOf: function() {return Symbol("1");}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n % {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) % 1n; +}, '({toString: function() {return Symbol("1");}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + toString: function() { + return Symbol('1'); + } + }; +}, '0n % {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/bigint-modulo-zero.js b/js/src/tests/test262/language/expressions/modulus/bigint-modulo-zero.js new file mode 100644 index 0000000000..bb72bd692e --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/bigint-modulo-zero.js @@ -0,0 +1,37 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: BigInt modulo 0 throws a range error +esid: sec-multiplicative-operators-runtime-semantics-evaluation +info: | + Runtime Semantics: Evaluation + + MultiplicativeExpression: MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + ... + 12. Otherwise, MultiplicativeOperator is %; return T::remainder(lnum, rnum). + ... + + BigInt::remainder (x, y) + + 1. If y is 0n, throw a RangeError exception. + 2. Return the BigInt representing x modulo y. +features: [BigInt] +---*/ +assert.throws(RangeError, function() { + 1n % 0n; +}, '1n % 0n throws RangeError'); + +assert.throws(RangeError, function() { + 10n % 0n; +}, '10n % 0n throws RangeError'); + +assert.throws(RangeError, function() { + 0n % 0n; +}, '0n % 0n throws RangeError'); + +assert.throws(RangeError, function() { + 1000000000000000000n % 0n; +}, '1000000000000000000n % 0n throws RangeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/modulus/bigint-toprimitive.js new file mode 100644 index 0000000000..0ad86f9959 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: modulus operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) % 2n) is 0n'); + +assert.sameValue(2n % { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 0n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} % 2n, 0n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) % 2n) is 0n'); + +assert.sameValue(2n % { + valueOf: function() { + return 2n; + }, + + toString: err +}, 0n, 'The result of (2n % {valueOf: function() {return 2n;}, toString: err}) is 0n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({toString: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + toString: function() { + return 2n; + } +}, 0n, 'The result of (2n % {toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + valueOf: null, + + toString: function() { + return 2n; + } +}, 0n, 'The result of (2n % {valueOf: null, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 0n, 'The result of (2n % {valueOf: 1, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 0n, 'The result of (2n % {valueOf: {}, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 0n, 'The result of (2n % {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 0n, 'The result of (2n % {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 0n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) % 1n; +}, '({[Symbol.toPrimitive]: 1}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + [Symbol.toPrimitive]: 1 + }; +}, '0n % {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) % 1n; +}, '({[Symbol.toPrimitive]: {}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + [Symbol.toPrimitive]: {} + }; +}, '0n % {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) % 1n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n % {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) % 1n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n % {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) % 1n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) % 1n throws MyError'); + +assert.throws(MyError, function() { + 0n % { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n % {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) % 1n; +}, '({valueOf: function() {throw new MyError();}}) % 1n throws MyError'); + +assert.throws(MyError, function() { + 0n % { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n % {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) % 1n; +}, '({toString: function() {throw new MyError();}}) % 1n throws MyError'); + +assert.throws(MyError, function() { + 0n % { + toString: function() { + throw new MyError(); + } + }; +}, '0n % {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) % 1n; +}, '({valueOf: null, toString: null}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + valueOf: null, + toString: null + }; +}, '0n % {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) % 1n; +}, '({valueOf: 1, toString: 1}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + valueOf: 1, + toString: 1 + }; +}, '0n % {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) % 1n; +}, '({valueOf: {}, toString: {}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + valueOf: {}, + toString: {} + }; +}, '0n % {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) % 1n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n % {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) % 1n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) % 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0n % { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n % {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/modulus/bigint-wrapped-values.js new file mode 100644 index 0000000000..a80b14d9f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: modulus operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) % 2n, 0n, 'The result of (Object(2n) % 2n) is 0n'); +assert.sameValue(2n % Object(2n), 0n, 'The result of (2n % Object(2n)) is 0n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 0n, 'The result of (2n % {[Symbol.toPrimitive]: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({valueOf: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + valueOf: function() { + return 2n; + } +}, 0n, 'The result of (2n % {valueOf: function() {return 2n;}}) is 0n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} % 2n, 0n, 'The result of (({toString: function() {return 2n;}}) % 2n) is 0n'); + +assert.sameValue(2n % { + toString: function() { + return 2n; + } +}, 0n, 'The result of (2n % {toString: function() {return 2n;}}) is 0n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/browser.js b/js/src/tests/test262/language/expressions/modulus/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/modulus/line-terminator.js b/js/src/tests/test262/language/expressions/modulus/line-terminator.js new file mode 100644 index 0000000000..8976067330 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/line-terminator.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Line terminator between the operands of a modulus operator +info: | + MultiplicativeExpression[Yield, Await]: + ExponentiationExpression + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + MultiplicativeOperator : one of + * / % +---*/ + +var x = 18 + +% + +7 + +% + +3 +; + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/order-of-evaluation.js b/js/src/tests/test262/language/expressions/modulus/order-of-evaluation.js new file mode 100644 index 0000000000..6de970d731 --- /dev/null +++ b/js/src/tests/test262/language/expressions/modulus/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Type coercion order of operations for modulus operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() % (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() % (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() % (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() % (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() % (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() % (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/modulus/shell.js b/js/src/tests/test262/language/expressions/modulus/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A1.js new file mode 100644 index 0000000000..f90213d4df --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between MultiplicativeExpression and "*" + or between "*" and UnaryExpression are allowed +es5id: 11.5.1_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009*\u00091") !== 1) { + throw new Test262Error('#1: 1\\u0009*\\u00091 === 1'); +} + +//CHECK#2 +if (eval("1\u000B*\u000B1") !== 1) { + throw new Test262Error('#2: 1\\u000B*\\u000B1 === 1'); +} + +//CHECK#3 +if (eval("1\u000C*\u000C1") !== 1) { + throw new Test262Error('#3: 1\\u000C*\\u000C1 === 1'); +} + +//CHECK#4 +if (eval("1\u0020*\u00201") !== 1) { + throw new Test262Error('#4: 1\\u0020*\\u00201 === 1'); +} + +//CHECK#5 +if (eval("1\u00A0*\u00A01") !== 1) { + throw new Test262Error('#5: 1\\u00A0*\\u00A01 === 1'); +} + +//CHECK#6 +if (eval("1\u000A*\u000A1") !== 1) { + throw new Test262Error('#6: 1\\u000A*\\u000A1 === 1'); +} + +//CHECK#7 +if (eval("1\u000D*\u000D1") !== 1) { + throw new Test262Error('#7: 1\\u000D*\\u000D1 === 1'); +} + +//CHECK#8 +if (eval("1\u2028*\u20281") !== 1) { + throw new Test262Error('#8: 1\\u2028*\\u20281 === 1'); +} + +//CHECK#9 +if (eval("1\u2029*\u20291") !== 1) { + throw new Test262Error('#9: 1\\u2029*\\u20291 === 1'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029*\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029*\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T1.js new file mode 100644 index 0000000000..6d2ac31249 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y uses GetValue +es5id: 11.5.1_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 * 1 !== 1) { + throw new Test262Error('#1: 1 * 1 === 1. Actual: ' + (1 * 1)); +} + +//CHECK#2 +var x = 1; +if (x * 1 !== 1) { + throw new Test262Error('#2: var x = 1; x * 1 === 1. Actual: ' + (x * 1)); +} + +//CHECK#3 +var y = 1; +if (1 * y !== 1) { + throw new Test262Error('#3: var y = 1; 1 * y === 1. Actual: ' + (1 * y)); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x * y !== 1) { + throw new Test262Error('#4: var x = 1; var y = 1; x * y === 1. Actual: ' + (x * y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop * objecty.prop !== 1) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop * objecty.prop === 1. Actual: ' + (objectx.prop * objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T2.js new file mode 100644 index 0000000000..cc4ad0d96c --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y uses GetValue +es5id: 11.5.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x * 1; + throw new Test262Error('#1.1: x * 1 throw ReferenceError. Actual: ' + (x * 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x * 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T3.js new file mode 100644 index 0000000000..0b5dcc0edb --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y uses GetValue +es5id: 11.5.1_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 * y; + throw new Test262Error('#1.1: 1 * y throw ReferenceError. Actual: ' + (1 * y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 * y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.2_T1.js new file mode 100644 index 0000000000..65f1a7705f --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y uses [[Default Value]] +es5id: 11.5.1_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 1}} * 1 !== 1) { + throw new Test262Error('#1: {valueOf: function() {return 1}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}} * 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} * 1 !== 1) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} * 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} * 1 !== 1) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} * 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 !== 1) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 === 1. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} * 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} * 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 * {toString: function() {return 1}} !== 1) { + throw new Test262Error('#5: 1 * {toString: function() {return 1}} === 1. Actual: ' + (1 * {toString: function() {return 1}})); +} + +//CHECK#6 +if (1 * {valueOf: function() {return {}}, toString: function() {return 1}} !== 1) { + throw new Test262Error('#6: 1 * {valueOf: function() {return {}}, toString: function() {return 1}} === 1. Actual: ' + (1 * {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + 1 * {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 1 * {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 * {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 * {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 * {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 * {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 * {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 * {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.3_T1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.3_T1.js new file mode 100644 index 0000000000..e6734b1284 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.5.1_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x * y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x * y throw "x". Actual: ' + (x * y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x * y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T1.js new file mode 100644 index 0000000000..bd7c7720fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.1_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) * x !== 1) { + throw new Test262Error('#1: var x = 0; (x = 1) * x === 1. Actual: ' + ((x = 1) * x)); +} + +//CHECK#2 +var x = 0; +if (x * (x = 1) !== 0) { + throw new Test262Error('#2: var x = 0; x * (x = 1) === 0. Actual: ' + (x * (x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T2.js new file mode 100644 index 0000000000..ffa7d04327 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.1_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() * y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() * y() throw "x". Actual: ' + (x() * y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() * y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T3.js new file mode 100644 index 0000000000..6fd8e0a20c --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.1_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x * (x = 1); + throw new Test262Error('#1.1: x * (x = 1) throw ReferenceError. Actual: ' + (x * (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x * (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T4.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T4.js new file mode 100644 index 0000000000..fb7794afef --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.5.1_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) * y !== 1) { + throw new Test262Error('#1: (y = 1) * y === 1. Actual: ' + ((y = 1) * y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.1.js new file mode 100644 index 0000000000..3a46663e07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (true * true !== 1) { + throw new Test262Error('#1: true * true === 1. Actual: ' + (true * true)); +} + +//CHECK#2 +if (new Boolean(true) * true !== 1) { + throw new Test262Error('#2: new Boolean(true) * true === 1. Actual: ' + (new Boolean(true) * true)); +} + +//CHECK#3 +if (true * new Boolean(true) !== 1) { + throw new Test262Error('#3: true * new Boolean(true) === 1. Actual: ' + (true * new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) * new Boolean(true) !== 1) { + throw new Test262Error('#4: new Boolean(true) * new Boolean(true) === 1. Actual: ' + (new Boolean(true) * new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.2.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.2.js new file mode 100644 index 0000000000..1035ca7e8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if (1 * 1 !== 1) { + throw new Test262Error('#1: 1 * 1 === 1. Actual: ' + (1 * 1)); +} + +//CHECK#2 +if (new Number(1) * 1 !== 1) { + throw new Test262Error('#2: new Number(1) * 1 === 1. Actual: ' + (new Number(1) * 1)); +} + +//CHECK#3 +if (1 * new Number(1) !== 1) { + throw new Test262Error('#3: 1 * new Number(1) === 1. Actual: ' + (1 * new Number(1))); +} + +//CHECK#4 +if (new Number(1) * new Number(1) !== 1) { + throw new Test262Error('#4: new Number(1) * new Number(1) === 1. Actual: ' + (new Number(1) * new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.3.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.3.js new file mode 100644 index 0000000000..881c8228f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if ("1" * "1" !== 1) { + throw new Test262Error('#1: "1" * "1" === 1. Actual: ' + ("1" * "1")); +} + +//CHECK#2 +if (new String("1") * "1" !== 1) { + throw new Test262Error('#2: new String("1") * "1" === 1. Actual: ' + (new String("1") * "1")); +} + +//CHECK#3 +if ("1" * new String("1") !== 1) { + throw new Test262Error('#3: "1" * new String("1") === 1. Actual: ' + ("1" * new String("1"))); +} + +//CHECK#4 +if (new String("1") * new String("1") !== 1) { + throw new Test262Error('#4: new String("1") * new String("1") === 1. Actual: ' + (new String("1") * new String("1"))); +} + +//CHECK#5 +if (isNaN("x" * "1") !== true) { + throw new Test262Error('#5: "x" * "1" === Not-a-Number. Actual: ' + ("x" * "1")); +} + +//CHECK#6 +if (isNaN("1" * "x") !== true) { + throw new Test262Error('#6: "1" * "x" === Not-a-Number. Actual: ' + ("1" * "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.4.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.4.js new file mode 100644 index 0000000000..1ddfa0a1b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if (isNaN(null * undefined) !== true) { + throw new Test262Error('#1: null * undefined === Not-a-Number. Actual: ' + (null * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * null) !== true) { + throw new Test262Error('#2: undefined * null === Not-a-Number. Actual: ' + (undefined * null)); +} + +//CHECK#3 +if (isNaN(undefined * undefined) !== true) { + throw new Test262Error('#3: undefined * undefined === Not-a-Number. Actual: ' + (undefined * undefined)); +} + +//CHECK#4 +if (null * null !== 0) { + throw new Test262Error('#4: null * null === 0. Actual: ' + (null * null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.5.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.5.js new file mode 100644 index 0000000000..3002100893 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (isNaN({} * function(){return 1}) !== true) { + throw new Test262Error('#1: {} * function(){return 1} === Not-a-Number. Actual: ' + ({} * function(){return 1})); +} + +//CHECK#2 +if (isNaN(function(){return 1} * {}) !== true) { + throw new Test262Error('#2: function(){return 1} * {} === Not-a-Number. Actual: ' + (function(){return 1} * {})); +} + +//CHECK#3 +if (isNaN(function(){return 1} * function(){return 1}) !== true) { + throw new Test262Error('#3: function(){return 1} * function(){return 1} === Not-a-Number. Actual: ' + (function(){return 1} * function(){return 1})); +} + +//CHECK#4 +if (isNaN({} * {}) !== true) { + throw new Test262Error('#4: {} * {} === Not-a-Number. Actual: ' + ({} * {})); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.1.js new file mode 100644 index 0000000000..798ae45fc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Number (primitive and object) +---*/ + +//CHECK#1 +if (true * 1 !== 1) { + throw new Test262Error('#1: true * 1 === 1. Actual: ' + (true * 1)); +} + +//CHECK#2 +if (1 * true !== 1) { + throw new Test262Error('#2: 1 * true === 1. Actual: ' + (1 * true)); +} + +//CHECK#3 +if (new Boolean(true) * 1 !== 1) { + throw new Test262Error('#3: new Boolean(true) * 1 === 1. Actual: ' + (new Boolean(true) * 1)); +} + +//CHECK#4 +if (1 * new Boolean(true) !== 1) { + throw new Test262Error('#4: 1 * new Boolean(true) === 1. Actual: ' + (1 * new Boolean(true))); +} + +//CHECK#5 +if (true * new Number(1) !== 1) { + throw new Test262Error('#5: true * new Number(1) === 1. Actual: ' + (true * new Number(1))); +} + +//CHECK#6 +if (new Number(1) * true !== 1) { + throw new Test262Error('#6: new Number(1) * true === 1. Actual: ' + (new Number(1) * true)); +} + +//CHECK#7 +if (new Boolean(true) * new Number(1) !== 1) { + throw new Test262Error('#7: new Boolean(true) * new Number(1) === 1. Actual: ' + (new Boolean(true) * new Number(1))); +} + +//CHECK#8 +if (new Number(1) * new Boolean(true) !== 1) { + throw new Test262Error('#8: new Number(1) * new Boolean(true) === 1. Actual: ' + (new Number(1) * new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.2.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.2.js new file mode 100644 index 0000000000..b9f7081fa3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if ("1" * 1 !== 1) { + throw new Test262Error('#1: "1" * 1 === 1. Actual: ' + ("1" * 1)); +} + +//CHECK#2 +if (1 * "1" !== 1) { + throw new Test262Error('#2: 1 * "1" === 1. Actual: ' + (1 * "1")); +} + +//CHECK#3 +if (new String("1") * 1 !== 1) { + throw new Test262Error('#3: new String("1") * 1 === 1. Actual: ' + (new String("1") * 1)); +} + +//CHECK#4 +if (1 * new String("1") !== 1) { + throw new Test262Error('#4: 1 * new String("1") === 1. Actual: ' + (1 * new String("1"))); +} + +//CHECK#5 +if ("1" * new Number(1) !== 1) { + throw new Test262Error('#5: "1" * new Number(1) === 1. Actual: ' + ("1" * new Number(1))); +} + +//CHECK#6 +if (new Number(1) * "1" !== 1) { + throw new Test262Error('#6: new Number(1) * "1" === 1. Actual: ' + (new Number(1) * "1")); +} + +//CHECK#7 +if (new String("1") * new Number(1) !== 1) { + throw new Test262Error('#7: new String("1") * new Number(1) === 1. Actual: ' + (new String("1") * new Number(1))); +} + +//CHECK#8 +if (new Number(1) * new String("1") !== 1) { + throw new Test262Error('#8: new Number(1) * new String("1") === 1. Actual: ' + (new Number(1) * new String("1"))); +} + +//CHECK#9 +if (isNaN("x" * 1) !== true) { + throw new Test262Error('#9: "x" * 1 === Not-a-Number. Actual: ' + ("x" * 1)); +} + +//CHECK#10 +if (isNaN(1 * "x") !== true) { + throw new Test262Error('#10: 1 * "x" === Not-a-Number. Actual: ' + (1 * "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.3.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.3.js new file mode 100644 index 0000000000..1655cf9341 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 * null !== 0) { + throw new Test262Error('#1: 1 * null === 0. Actual: ' + (1 * null)); +} + +//CHECK#2 +if (null * 1 !== 0) { + throw new Test262Error('#2: null * 1 === 0. Actual: ' + (null * 1)); +} + +//CHECK#3 +if (new Number(1) * null !== 0) { + throw new Test262Error('#3: new Number(1) * null === 0. Actual: ' + (new Number(1) * null)); +} + +//CHECK#4 +if (null * new Number(1) !== 0) { + throw new Test262Error('#4: null * new Number(1) === 0. Actual: ' + (null * new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.4.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.4.js new file mode 100644 index 0000000000..2f33db75d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(1 * undefined) !== true) { + throw new Test262Error('#1: 1 * undefined === Not-a-Number. Actual: ' + (1 * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * 1) !== true) { + throw new Test262Error('#2: undefined * 1 === Not-a-Number. Actual: ' + (undefined * 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) * undefined) !== true) { + throw new Test262Error('#3: new Number(1) * undefined === Not-a-Number. Actual: ' + (new Number(1) * undefined)); +} + +//CHECK#4 +if (isNaN(undefined * new Number(1)) !== true) { + throw new Test262Error('#4: undefined * new Number(1) === Not-a-Number. Actual: ' + (undefined * new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.5.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.5.js new file mode 100644 index 0000000000..ad4cc0cd12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true * "1" !== 1) { + throw new Test262Error('#1: true * "1" === 1. Actual: ' + (true * "1")); +} + +//CHECK#2 +if ("1" * true !== 1) { + throw new Test262Error('#2: "1" * true === 1. Actual: ' + ("1" * true)); +} + +//CHECK#3 +if (new Boolean(true) * "1" !== 1) { + throw new Test262Error('#3: new Boolean(true) * "1" === 1. Actual: ' + (new Boolean(true) * "1")); +} + +//CHECK#4 +if ("1" * new Boolean(true) !== 1) { + throw new Test262Error('#4: "1" * new Boolean(true) === 1. Actual: ' + ("1" * new Boolean(true))); +} + +//CHECK#5 +if (true * new String("1") !== 1) { + throw new Test262Error('#5: true * new String("1") === 1. Actual: ' + (true * new String("1"))); +} + +//CHECK#6 +if (new String("1") * true !== 1) { + throw new Test262Error('#6: new String("1") * true === 1. Actual: ' + (new String("1") * true)); +} + +//CHECK#7 +if (new Boolean(true) * new String("1") !== 1) { + throw new Test262Error('#7: new Boolean(true) * new String("1") === 1. Actual: ' + (new Boolean(true) * new String("1"))); +} + +//CHECK#8 +if (new String("1") * new Boolean(true) !== 1) { + throw new Test262Error('#8: new String("1") * new Boolean(true) === 1. Actual: ' + (new String("1") * new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.6.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.6.js new file mode 100644 index 0000000000..fc5c638788 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + primitive String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN("1" * undefined) !== true) { + throw new Test262Error('#1: "1" * undefined === Not-a-Number. Actual: ' + ("1" * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * "1") !== true) { + throw new Test262Error('#2: undefined * "1" === Not-a-Number. Actual: ' + (undefined * "1")); +} + +//CHECK#3 +if (isNaN(new String("1") * undefined) !== true) { + throw new Test262Error('#3: new String("1") * undefined === Not-a-Number. Actual: ' + (new String("1") * undefined)); +} + +//CHECK#4 +if (isNaN(undefined * new String("1")) !== true) { + throw new Test262Error('#4: undefined * new String("1") === Not-a-Number. Actual: ' + (undefined * new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.7.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.7.js new file mode 100644 index 0000000000..c45f794070 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" * null !== 0) { + throw new Test262Error('#1: "1" * null === 0. Actual: ' + ("1" * null)); +} + +//CHECK#2 +if (null * "1" !== 0) { + throw new Test262Error('#2: null * "1" === 0. Actual: ' + (null * "1")); +} + +//CHECK#3 +if (new String("1") * null !== 0) { + throw new Test262Error('#3: new String("1") * null === 0. Actual: ' + (new String("1") * null)); +} + +//CHECK#4 +if (null * new String("1") !== 0) { + throw new Test262Error('#4: null * new String("1") === 0. Actual: ' + (null * new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.8.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.8.js new file mode 100644 index 0000000000..659e86b1e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(true * undefined) !== true) { + throw new Test262Error('#1: true * undefined === Not-a-Number. Actual: ' + (true * undefined)); +} + +//CHECK#2 +if (isNaN(undefined * true) !== true) { + throw new Test262Error('#2: undefined * true === Not-a-Number. Actual: ' + (undefined * true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) * undefined) !== true) { + throw new Test262Error('#3: new Boolean(true) * undefined === Not-a-Number. Actual: ' + (new Boolean(true) * undefined)); +} + +//CHECK#4 +if (isNaN(undefined * new Boolean(true)) !== true) { + throw new Test262Error('#4: undefined * new Boolean(true) === Not-a-Number. Actual: ' + (undefined * new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.9.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.9.js new file mode 100644 index 0000000000..5cc6fe26b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x * y returns ToNumber(x) * ToNumber(y) +es5id: 11.5.1_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true * null !== 0) { + throw new Test262Error('#1: true * null === 0. Actual: ' + (true * null)); +} + +//CHECK#2 +if (null * true !== 0) { + throw new Test262Error('#2: null * true === 0. Actual: ' + (null * true)); +} + +//CHECK#3 +if (new Boolean(true) * null !== 0) { + throw new Test262Error('#3: new Boolean(true) * null === 0. Actual: ' + (new Boolean(true) * null)); +} + +//CHECK#4 +if (null * new Boolean(true) !== 0) { + throw new Test262Error('#4: null * new Boolean(true) === 0. Actual: ' + (null * new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.1.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.1.js new file mode 100644 index 0000000000..02c8108345 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T1.1 +description: If left operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN * Number.NaN) !== true) { + throw new Test262Error('#1: NaN * NaN === Not-a-Number. Actual: ' + (NaN * NaN)); +} + +//CHECK#2 +if (isNaN(Number.NaN * +0) !== true) { + throw new Test262Error('#2: NaN * +0 === Not-a-Number. Actual: ' + (NaN * +0)); +} + +//CHECK#3 +if (isNaN(Number.NaN * -0) !== true) { + throw new Test262Error('#3: NaN * -0 === Not-a-Number. Actual: ' + (NaN * -0)); +} + +//CHECK#4 +if (isNaN(Number.NaN * Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: NaN * Infinity === Not-a-Number. Actual: ' + (NaN * Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NaN * Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#5: NaN * -Infinity === Not-a-Number. Actual: ' + (NaN * -Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NaN * Number.MAX_VALUE) !== true) { + throw new Test262Error('#6: NaN * Number.MAX_VALUE === Not-a-Number. Actual: ' + (NaN * Number.MAX_VALUE)); +} + +//CHECK#7 +if (isNaN(Number.NaN * Number.MIN_VALUE) !== true) { + throw new Test262Error('#7: NaN * Number.MIN_VALUE === Not-a-Number. Actual: ' + (NaN * Number.MIN_VALUE)); +} + +//CHECK#8 +if (isNaN(Number.NaN * 1) !== true) { + throw new Test262Error('#8: NaN * 1 === Not-a-Number. Actual: ' + (NaN * 1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.2.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.2.js new file mode 100644 index 0000000000..74e58ae05e --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T1.2.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T1.2 +description: If right operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN * Number.NaN) !== true) { + throw new Test262Error('#1: NaN * NaN === Not-a-Number. Actual: ' + (NaN * NaN)); +} + +//CHECK#2 +if (isNaN(+0 * Number.NaN) !== true) { + throw new Test262Error('#2: +0 * NaN === Not-a-Number. Actual: ' + (+0 * NaN)); +} + +//CHECK#3 +if (isNaN(-0 * Number.NaN) !== true) { + throw new Test262Error('#3: -0 * NaN === Not-a-Number. Actual: ' + (-0 * NaN)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY * Number.NaN) !== true) { + throw new Test262Error('#4: Infinity * NaN === Not-a-Number. Actual: ' + (Infinity * NaN)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY * Number.NaN) !== true) { + throw new Test262Error('#5: -Infinity * NaN === Not-a-Number. Actual: ' + ( -Infinity * NaN)); +} + +//CHECK#6 +if (isNaN(Number.MAX_VALUE * Number.NaN) !== true) { + throw new Test262Error('#6: Number.MAX_VALUE * NaN === Not-a-Number. Actual: ' + (Number.MAX_VALUE * NaN)); +} + +//CHECK#7 +if (isNaN(Number.MIN_VALUE * Number.NaN) !== true) { + throw new Test262Error('#7: Number.MIN_VALUE * NaN === Not-a-Number. Actual: ' + (Number.MIN_VALUE * NaN)); +} + +//CHECK#8 +if (isNaN(1 * Number.NaN) !== true) { + throw new Test262Error('#8: 1 * NaN === Not-a-Number. Actual: ' + (1 * NaN)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T2.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T2.js new file mode 100644 index 0000000000..34b4b68f61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T2.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T2 +description: > + The sign of the result is positive if both operands have the same + sign, negative if the operands have different signs +---*/ + +//CHECK#1 +if (1 * 1 !== 1) { + throw new Test262Error('#1: 1 * 1 === 1. Actual: ' + (1 * 1)); +} + +//CHECK#2 +if (1 * -1 !== -1) { + throw new Test262Error('#2: 1 * -1 === -1. Actual: ' + (1 * -1)); +} + +//CHECK#3 +if (-1 * 1 !== -1) { + throw new Test262Error('#3: -1 * 1 === -1. Actual: ' + (-1 * 1)); +} + +//CHECK#4 +if (-1 * -1 !== 1) { + throw new Test262Error('#4: -1 * -1 === 1. Actual: ' + (-1 * -1)); +} + +//CHECK#5 +if (0 * 0 !== 0) { + throw new Test262Error('#5.1: 0 * 0 === 0. Actual: ' + (0 * 0)); +} else { + if (1 / (0 * 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5.2: 0 * 0 === + 0. Actual: -0'); + } +} + +//CHECK#6 +if (0 * -0 !== -0) { + throw new Test262Error('#6.1: 0 * -0 === 0. Actual: ' + (0 * -0)); +} else { + if (1 / (0 * -0) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#6.2: 0 * -0 === - 0. Actual: +0'); + } +} + +//CHECK#7 +if (-0 * 0 !== -0) { + throw new Test262Error('#7.1: -0 * 0 === 0. Actual: ' + (-0 * 0)); +} else { + if (1 / (-0 * 0) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#7.2: -0 * 0 === - 0. Actual: +0'); + } +} + +//CHECK#8 +if (-0 * -0 !== 0) { + throw new Test262Error('#8.1: -0 * -0 === 0. Actual: ' + (-0 * -0)); +} else { + if (1 / (-0 * -0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#8.2: 0 * -0 === - 0. Actual: +0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T3.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T3.js new file mode 100644 index 0000000000..222e3b213e --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T3.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T3 +description: Multiplication of an infinity by a zero results in NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NEGATIVE_INFINITY * 0) !== true) { + throw new Test262Error('#1: Infinity * 0 === Not-a-Number. Actual: ' + (Infinity * 0)); +} + +//CHECK#2 +if (isNaN(-0 * Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#2: -0 * -Infinity === Not-a-Number. Actual: ' + (-0 * -Infinity)); +} + +//CHECK#3 +if (isNaN(Number.POSITIVE_INFINITY * -0) !== true) { + throw new Test262Error('#3: Infinity * -0 === Not-a-Number. Actual: ' + (Infinity * -0)); +} + +//CHECK#4 +if (isNaN(0 * Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#4: 0 * Infinity === Not-a-Number. Actual: ' + (0 * Infinity)); +} + +//CHECK#5 +if (isNaN(Number.NEGATIVE_INFINITY * -0) !== true) { + throw new Test262Error('#5: Infinity * -0 === Not-a-Number. Actual: ' + (Infinity * -0)); +} + +//CHECK#6 +if (isNaN(0 * Number.NEGATIVE_INFINITY) !== true) { + throw new Test262Error('#6: 0 * -Infinity === Not-a-Number. Actual: ' + (0 * -Infinity)); +} + +//CHECK#7 +if (isNaN(Number.POSITIVE_INFINITY * 0) !== true) { + throw new Test262Error('#7: Infinity * 0 === Not-a-Number. Actual: ' + (Infinity * 0)); +} + +//CHECK#8 +if (isNaN(-0 * Number.POSITIVE_INFINITY) !== true) { + throw new Test262Error('#8: -0 * Infinity === Not-a-Number. Actual: ' + (-0 * Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T4.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T4.js new file mode 100644 index 0000000000..71045e1a55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T4 +description: > + Multiplication of an infinity by an infinity results in an + infinity of appropriate sign +---*/ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: -Infinity * -Infinity === Infinity. Actual: ' + (-Infinity * -Infinity)); +} + +//CHECK#2 +if (Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: Infinity * Infinity === Infinity. Actual: ' + (Infinity * Infinity)); +} + +//CHECK#3 +if (Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#3: -Infinity * Infinity === -Infinity. Actual: ' + (-Infinity * Infinity)); +} + +//CHECK#4 +if (Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4: Infinity * -Infinity === -Infinity. Actual: ' + (Infinity * -Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T5.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T5.js new file mode 100644 index 0000000000..5b38d1e60f --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T5.js @@ -0,0 +1,54 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T5 +description: > + Multiplication of an infinity by a finite non-zero value results + in a signed infinity +---*/ + +//CHECK#1 +if (Number.NEGATIVE_INFINITY * -1 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: -Infinity * -1 === Infinity. Actual: ' + (-Infinity * -1)); +} + +//CHECK#2 +if (-1 * Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: -1 * -Infinity === Infinity. Actual: ' + (-1 * -Infinity)); +} + +//CHECK#3 +if (Number.POSITIVE_INFINITY * -1 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#3: Infinity * -1 === -Infinity. Actual: ' + (Infinity * -1)); +} + +//CHECK#4 +if (-1 * Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4: -1 * Infinity === -Infinity. Actual: ' + (-1 * Infinity)); +} + +//CHECK#5 +if (Number.POSITIVE_INFINITY * Number.MAX_VALUE !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5: Infinity * Number.MAX_VALUE === Infinity. Actual: ' + (Infinity * Number.MAX_VALUE)); +} + +//CHECK#6 +if (Number.POSITIVE_INFINITY * Number.MAX_VALUE !== Number.MAX_VALUE * Number.POSITIVE_INFINITY) { + throw new Test262Error('#6: Infinity * Number.MAX_VALUE === Number.MAX_VALUE * Infinity. Actual: ' + (Infinity * Number.MAX_VALUE)); +} + +//CHECK#7 +if (Number.NEGATIVE_INFINITY * Number.MIN_VALUE !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#7: -Infinity * Number.MIN_VALUE === -Infinity. Actual: ' + (-Infinity * Number.MIN_VALUE)); +} + +//CHECK#8 +if (Number.NEGATIVE_INFINITY * Number.MIN_VALUE !== Number.MIN_VALUE * Number.NEGATIVE_INFINITY) { + throw new Test262Error('#8: -Infinity * Number.MIN_VALUE === Number.MIN_VALUE * -Infinity. Actual: ' + (-Infinity * Number.MIN_VALUE)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T6.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T6.js new file mode 100644 index 0000000000..b113c85ad0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T6.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T6 +description: > + If the magnitude is too large to represent, the result is then an + infinity of appropriate sign +---*/ + +//CHECK#1 +if (Number.MAX_VALUE * 1.1 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: Number.MAX_VALUE * 1.1 === Number.POSITIVE_INFINITY. Actual: ' + (Number.MAX_VALUE * 1.1)); +} + +//CHECK#2 +if (-1.1 * Number.MAX_VALUE !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2: -1.1 * Number.MAX_VALUE === Number.NEGATIVE_INFINITY. Actual: ' + (-1.1 * Number.MAX_VALUE)); +} + +//CHECK#3 +if (Number.MAX_VALUE * 1 !== Number.MAX_VALUE) { + throw new Test262Error('#3: Number.MAX_VALUE * 1 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE * 1)); +} + +//CHECK#4 +if (-1 * Number.MAX_VALUE !== -Number.MAX_VALUE) { + throw new Test262Error('#4: -1 * Number.MAX_VALUE === -Number.MAX_VALUE. Actual: ' + (-1 * Number.MAX_VALUE)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T7.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T7.js new file mode 100644 index 0000000000..e7e62fdca2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T7.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T7 +description: > + If the magnitude is too small to represent, the result is then a + zero of appropriate sign +---*/ + +//CHECK#1 +if (Number.MIN_VALUE * 0.1 !== 0) { + throw new Test262Error('#1: Number.MIN_VALUE * 0.1 === 0. Actual: ' + (Number.MIN_VALUE * 0.1)); +} + +//CHECK#2 +if (-0.1 * Number.MIN_VALUE !== -0) { + throw new Test262Error('#2.1: -0.1 * Number.MIN_VALUE === -0. Actual: ' + (-0.1 * Number.MIN_VALUE)); +} else { + if (1 / (-0.1 * Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2.2: -0.1 * Number.MIN_VALUE === -0. Actual: +0'); + } +} + +//CHECK#3 +if (Number.MIN_VALUE * 0.5 !== 0) { + throw new Test262Error('#3: Number.MIN_VALUE * 0.5 === 0. Actual: ' + (Number.MIN_VALUE * 0.5)); +} + +//CHECK#4 +if (-0.5 * Number.MIN_VALUE !== -0) { + throw new Test262Error('#4.1: -0.5 * Number.MIN_VALUE === -0. Actual: ' + (-0.5 * Number.MIN_VALUE)); +} else { + if (1 / (-0.5 * Number.MIN_VALUE) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4.2: -0.5 * Number.MIN_VALUE === -0. Actual: +0'); + } +} + +//CHECK#5 +if (Number.MIN_VALUE * 0.51 !== Number.MIN_VALUE) { + throw new Test262Error('#5: Number.MIN_VALUE * 0.51 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE * 0.51)); +} + +//CHECK#6 +if (-0.51 * Number.MIN_VALUE !== -Number.MIN_VALUE) { + throw new Test262Error('#6: -0.51 * Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (-0.51 * Number.MIN_VALUE)); +} + +//CHECK#7 +if (Number.MIN_VALUE * 0.9 !== Number.MIN_VALUE) { + throw new Test262Error('#7: Number.MIN_VALUE * 0.9 === Number.MIN_VALUE. Actual: ' + (Number.MIN_VALUE * 0.9)); +} + +//CHECK#8 +if (-0.9 * Number.MIN_VALUE !== -Number.MIN_VALUE) { + throw new Test262Error('#8: -0.9 * Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (-0.9 * Number.MIN_VALUE)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T8.js b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T8.js new file mode 100644 index 0000000000..ea7e603886 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/S11.5.1_A4_T8.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The result of a floating-point multiplication is governed by the rules of + IEEE 754 double-precision arithmetics +es5id: 11.5.1_A4_T8 +description: > + Multiplication is not always associative (x * y * z is the same as + (x * y) * z, not x * (y * z)) +---*/ + +//CHECK#1 +if (Number.MAX_VALUE * 1.1 * 0.9 !== (Number.MAX_VALUE * 1.1) * 0.9) { + throw new Test262Error('#1: Number.MAX_VALUE * 1.1 * 0.9 === (Number.MAX_VALUE * 1.1) * 0.9. Actual: ' + (Number.MAX_VALUE * 1.1 * 0.9)); +} + +//CHECK#2 +if ((Number.MAX_VALUE * 1.1) * 0.9 === Number.MAX_VALUE * (1.1 * 0.9)) { + throw new Test262Error('#2: (Number.MAX_VALUE * 1.1) * 0.9 !== Number.MAX_VALUE * (1.1 * 0.9)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/bigint-and-number.js b/js/src/tests/test262/language/expressions/multiplication/bigint-and-number.js new file mode 100644 index 0000000000..14677fae07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for multiplication operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n * 1; +}, '1n * 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 * 1n; +}, '1 * 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) * 1; +}, 'Object(1n) * 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 * Object(1n); +}, '1 * Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n * Object(1); +}, '1n * Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) * 1n; +}, 'Object(1) * 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) * Object(1); +}, 'Object(1n) * Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) * Object(1n); +}, 'Object(1) * Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n * NaN; +}, '1n * NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN * 1n; +}, 'NaN * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * Infinity; +}, '1n * Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity * 1n; +}, 'Infinity * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * true; +}, '1n * true throws TypeError'); + +assert.throws(TypeError, function() { + true * 1n; +}, 'true * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * '1'; +}, '1n * "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' * 1n; +}, '"1" * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * null; +}, '1n * null throws TypeError'); + +assert.throws(TypeError, function() { + null * 1n; +}, 'null * 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n * undefined; +}, '1n * undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined * 1n; +}, 'undefined * 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/bigint-arithmetic.js b/js/src/tests/test262/language/expressions/multiplication/bigint-arithmetic.js new file mode 100644 index 0000000000..bb36e78c43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/bigint-arithmetic.js @@ -0,0 +1,701 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: BigInt multiplication arithmetic +features: [BigInt] +---*/ +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA9876543210n, + 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA9876543210n) is 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA987654320Fn, + 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA987654320Fn) is 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA98n, + 0xFDBAC097530ECA86541D5980n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA98n) is 0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0xFEDCBA97n, + 0xFDBAC09654320FEDDDC92770n, + 'The result of (0xFEDCBA9876543210n * 0xFEDCBA97n) is 0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x1234n, + 0x121F49F49F49F49F4B40n, + 'The result of (0xFEDCBA9876543210n * 0x1234n) is 0x121F49F49F49F49F4B40n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x3n, + 0x2FC962FC962FC9630n, + 'The result of (0xFEDCBA9876543210n * 0x3n) is 0x2FC962FC962FC9630n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x2n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n * 0x2n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n * 0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * 0x0n, + 0x0n, + 'The result of (0xFEDCBA9876543210n * 0x0n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x1n, + -0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n * -0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x2n, + -0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n * -0x2n) is -0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x3n, + -0x2FC962FC962FC9630n, + 'The result of (0xFEDCBA9876543210n * -0x3n) is -0x2FC962FC962FC9630n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0x1234n, + -0x121F49F49F49F49F4B40n, + 'The result of (0xFEDCBA9876543210n * -0x1234n) is -0x121F49F49F49F49F4B40n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA97n, + -0xFDBAC09654320FEDDDC92770n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA97n) is -0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA98n, + -0xFDBAC097530ECA86541D5980n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA98n) is -0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA987654320Fn, + -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA987654320Fn) is -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n * -0xFEDCBA9876543210n, + -0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n, + 'The result of (0xFEDCBA9876543210n * -0xFEDCBA9876543210n) is -0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0xFEDCBA987654320Fn, + 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n, + 'The result of (0xFEDCBA987654320Fn * 0xFEDCBA987654320Fn) is 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0xFEDCBA98n, + 0xFDBAC097530ECA8555409EE8n, + 'The result of (0xFEDCBA987654320Fn * 0xFEDCBA98n) is 0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0xFEDCBA97n, + 0xFDBAC09654320FECDEEC6CD9n, + 'The result of (0xFEDCBA987654320Fn * 0xFEDCBA97n) is 0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x1234n, + 0x121F49F49F49F49F390Cn, + 'The result of (0xFEDCBA987654320Fn * 0x1234n) is 0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x3n, + 0x2FC962FC962FC962Dn, + 'The result of (0xFEDCBA987654320Fn * 0x3n) is 0x2FC962FC962FC962Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x2n, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn * 0x2n) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn * 0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * 0x0n, + 0x0n, + 'The result of (0xFEDCBA987654320Fn * 0x0n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x1n, + -0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn * -0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x2n, + -0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn * -0x2n) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x3n, + -0x2FC962FC962FC962Dn, + 'The result of (0xFEDCBA987654320Fn * -0x3n) is -0x2FC962FC962FC962Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0x1234n, + -0x121F49F49F49F49F390Cn, + 'The result of (0xFEDCBA987654320Fn * -0x1234n) is -0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA97n, + -0xFDBAC09654320FECDEEC6CD9n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA97n) is -0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA98n, + -0xFDBAC097530ECA8555409EE8n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA98n) is -0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn, + -0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn) is -0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn * -0xFEDCBA9876543210n, + -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (0xFEDCBA987654320Fn * -0xFEDCBA9876543210n) is -0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); + +assert.sameValue( + 0xFEDCBA98n * 0xFEDCBA98n, + 0xFDBAC096DD413A40n, + 'The result of (0xFEDCBA98n * 0xFEDCBA98n) is 0xFDBAC096DD413A40n' +); + +assert.sameValue( + 0xFEDCBA98n * 0xFEDCBA97n, + 0xFDBAC095DE647FA8n, + 'The result of (0xFEDCBA98n * 0xFEDCBA97n) is 0xFDBAC095DE647FA8n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x1234n, + 0x121F49F496E0n, + 'The result of (0xFEDCBA98n * 0x1234n) is 0x121F49F496E0n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x3n, + 0x2FC962FC8n, + 'The result of (0xFEDCBA98n * 0x3n) is 0x2FC962FC8n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x2n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n * 0x2n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n * 0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n * 0x1n) is 0xFEDCBA98n' +); + +assert.sameValue(0xFEDCBA98n * 0x0n, 0x0n, 'The result of (0xFEDCBA98n * 0x0n) is 0x0n'); + +assert.sameValue( + 0xFEDCBA98n * -0x1n, + -0xFEDCBA98n, + 'The result of (0xFEDCBA98n * -0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n * -0x2n, + -0x1FDB97530n, + 'The result of (0xFEDCBA98n * -0x2n) is -0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n * -0x3n, + -0x2FC962FC8n, + 'The result of (0xFEDCBA98n * -0x3n) is -0x2FC962FC8n' +); + +assert.sameValue( + 0xFEDCBA98n * -0x1234n, + -0x121F49F496E0n, + 'The result of (0xFEDCBA98n * -0x1234n) is -0x121F49F496E0n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA97n, + -0xFDBAC095DE647FA8n, + 'The result of (0xFEDCBA98n * -0xFEDCBA97n) is -0xFDBAC095DE647FA8n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA98n, + -0xFDBAC096DD413A40n, + 'The result of (0xFEDCBA98n * -0xFEDCBA98n) is -0xFDBAC096DD413A40n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA987654320Fn, + -0xFDBAC097530ECA8555409EE8n, + 'The result of (0xFEDCBA98n * -0xFEDCBA987654320Fn) is -0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + 0xFEDCBA98n * -0xFEDCBA9876543210n, + -0xFDBAC097530ECA86541D5980n, + 'The result of (0xFEDCBA98n * -0xFEDCBA9876543210n) is -0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + 0xFEDCBA97n * 0xFEDCBA97n, + 0xFDBAC094DF87C511n, + 'The result of (0xFEDCBA97n * 0xFEDCBA97n) is 0xFDBAC094DF87C511n' +); + +assert.sameValue( + 0xFEDCBA97n * 0x1234n, + 0x121F49F484ACn, + 'The result of (0xFEDCBA97n * 0x1234n) is 0x121F49F484ACn' +); + +assert.sameValue( + 0xFEDCBA97n * 0x3n, + 0x2FC962FC5n, + 'The result of (0xFEDCBA97n * 0x3n) is 0x2FC962FC5n' +); + +assert.sameValue( + 0xFEDCBA97n * 0x2n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n * 0x2n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n * 0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n * 0x1n) is 0xFEDCBA97n' +); + +assert.sameValue(0xFEDCBA97n * 0x0n, 0x0n, 'The result of (0xFEDCBA97n * 0x0n) is 0x0n'); + +assert.sameValue( + 0xFEDCBA97n * -0x1n, + -0xFEDCBA97n, + 'The result of (0xFEDCBA97n * -0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n * -0x2n, + -0x1FDB9752En, + 'The result of (0xFEDCBA97n * -0x2n) is -0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n * -0x3n, + -0x2FC962FC5n, + 'The result of (0xFEDCBA97n * -0x3n) is -0x2FC962FC5n' +); + +assert.sameValue( + 0xFEDCBA97n * -0x1234n, + -0x121F49F484ACn, + 'The result of (0xFEDCBA97n * -0x1234n) is -0x121F49F484ACn' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA97n, + -0xFDBAC094DF87C511n, + 'The result of (0xFEDCBA97n * -0xFEDCBA97n) is -0xFDBAC094DF87C511n' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA98n, + -0xFDBAC095DE647FA8n, + 'The result of (0xFEDCBA97n * -0xFEDCBA98n) is -0xFDBAC095DE647FA8n' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA987654320Fn, + -0xFDBAC09654320FECDEEC6CD9n, + 'The result of (0xFEDCBA97n * -0xFEDCBA987654320Fn) is -0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + 0xFEDCBA97n * -0xFEDCBA9876543210n, + -0xFDBAC09654320FEDDDC92770n, + 'The result of (0xFEDCBA97n * -0xFEDCBA9876543210n) is -0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue(0x1234n * 0x1234n, 0x14B5A90n, 'The result of (0x1234n * 0x1234n) is 0x14B5A90n'); +assert.sameValue(0x1234n * 0x3n, 0x369Cn, 'The result of (0x1234n * 0x3n) is 0x369Cn'); +assert.sameValue(0x1234n * 0x2n, 0x2468n, 'The result of (0x1234n * 0x2n) is 0x2468n'); +assert.sameValue(0x1234n * 0x1n, 0x1234n, 'The result of (0x1234n * 0x1n) is 0x1234n'); +assert.sameValue(0x1234n * 0x0n, 0x0n, 'The result of (0x1234n * 0x0n) is 0x0n'); +assert.sameValue(0x1234n * -0x1n, -0x1234n, 'The result of (0x1234n * -0x1n) is -0x1234n'); +assert.sameValue(0x1234n * -0x2n, -0x2468n, 'The result of (0x1234n * -0x2n) is -0x2468n'); +assert.sameValue(0x1234n * -0x3n, -0x369Cn, 'The result of (0x1234n * -0x3n) is -0x369Cn'); + +assert.sameValue( + 0x1234n * -0x1234n, + -0x14B5A90n, + 'The result of (0x1234n * -0x1234n) is -0x14B5A90n' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA97n, + -0x121F49F484ACn, + 'The result of (0x1234n * -0xFEDCBA97n) is -0x121F49F484ACn' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA98n, + -0x121F49F496E0n, + 'The result of (0x1234n * -0xFEDCBA98n) is -0x121F49F496E0n' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA987654320Fn, + -0x121F49F49F49F49F390Cn, + 'The result of (0x1234n * -0xFEDCBA987654320Fn) is -0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + 0x1234n * -0xFEDCBA9876543210n, + -0x121F49F49F49F49F4B40n, + 'The result of (0x1234n * -0xFEDCBA9876543210n) is -0x121F49F49F49F49F4B40n' +); + +assert.sameValue(0x3n * 0x3n, 0x9n, 'The result of (0x3n * 0x3n) is 0x9n'); +assert.sameValue(0x3n * 0x2n, 0x6n, 'The result of (0x3n * 0x2n) is 0x6n'); +assert.sameValue(0x3n * 0x1n, 0x3n, 'The result of (0x3n * 0x1n) is 0x3n'); +assert.sameValue(0x3n * 0x0n, 0x0n, 'The result of (0x3n * 0x0n) is 0x0n'); +assert.sameValue(0x3n * -0x1n, -0x3n, 'The result of (0x3n * -0x1n) is -0x3n'); +assert.sameValue(0x3n * -0x2n, -0x6n, 'The result of (0x3n * -0x2n) is -0x6n'); +assert.sameValue(0x3n * -0x3n, -0x9n, 'The result of (0x3n * -0x3n) is -0x9n'); +assert.sameValue(0x3n * -0x1234n, -0x369Cn, 'The result of (0x3n * -0x1234n) is -0x369Cn'); + +assert.sameValue( + 0x3n * -0xFEDCBA97n, + -0x2FC962FC5n, + 'The result of (0x3n * -0xFEDCBA97n) is -0x2FC962FC5n' +); + +assert.sameValue( + 0x3n * -0xFEDCBA98n, + -0x2FC962FC8n, + 'The result of (0x3n * -0xFEDCBA98n) is -0x2FC962FC8n' +); + +assert.sameValue( + 0x3n * -0xFEDCBA987654320Fn, + -0x2FC962FC962FC962Dn, + 'The result of (0x3n * -0xFEDCBA987654320Fn) is -0x2FC962FC962FC962Dn' +); + +assert.sameValue( + 0x3n * -0xFEDCBA9876543210n, + -0x2FC962FC962FC9630n, + 'The result of (0x3n * -0xFEDCBA9876543210n) is -0x2FC962FC962FC9630n' +); + +assert.sameValue(0x2n * 0x2n, 0x4n, 'The result of (0x2n * 0x2n) is 0x4n'); +assert.sameValue(0x2n * 0x1n, 0x2n, 'The result of (0x2n * 0x1n) is 0x2n'); +assert.sameValue(0x2n * 0x0n, 0x0n, 'The result of (0x2n * 0x0n) is 0x0n'); +assert.sameValue(0x2n * -0x1n, -0x2n, 'The result of (0x2n * -0x1n) is -0x2n'); +assert.sameValue(0x2n * -0x2n, -0x4n, 'The result of (0x2n * -0x2n) is -0x4n'); +assert.sameValue(0x2n * -0x3n, -0x6n, 'The result of (0x2n * -0x3n) is -0x6n'); +assert.sameValue(0x2n * -0x1234n, -0x2468n, 'The result of (0x2n * -0x1234n) is -0x2468n'); + +assert.sameValue( + 0x2n * -0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (0x2n * -0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + 0x2n * -0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (0x2n * -0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + 0x2n * -0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (0x2n * -0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0x2n * -0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (0x2n * -0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); + +assert.sameValue(0x1n * 0x1n, 0x1n, 'The result of (0x1n * 0x1n) is 0x1n'); +assert.sameValue(0x1n * 0x0n, 0x0n, 'The result of (0x1n * 0x0n) is 0x0n'); +assert.sameValue(0x1n * -0x1n, -0x1n, 'The result of (0x1n * -0x1n) is -0x1n'); +assert.sameValue(0x1n * -0x2n, -0x2n, 'The result of (0x1n * -0x2n) is -0x2n'); +assert.sameValue(0x1n * -0x3n, -0x3n, 'The result of (0x1n * -0x3n) is -0x3n'); +assert.sameValue(0x1n * -0x1234n, -0x1234n, 'The result of (0x1n * -0x1234n) is -0x1234n'); + +assert.sameValue( + 0x1n * -0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x1n * -0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n * -0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x1n * -0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x1n * -0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x1n * -0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x1n * -0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x1n * -0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue(0x0n * 0x0n, 0x0n, 'The result of (0x0n * 0x0n) is 0x0n'); +assert.sameValue(0x0n * -0x1n, 0x0n, 'The result of (0x0n * -0x1n) is 0x0n'); +assert.sameValue(0x0n * -0x2n, 0x0n, 'The result of (0x0n * -0x2n) is 0x0n'); +assert.sameValue(0x0n * -0x3n, 0x0n, 'The result of (0x0n * -0x3n) is 0x0n'); +assert.sameValue(0x0n * -0x1234n, 0x0n, 'The result of (0x0n * -0x1234n) is 0x0n'); +assert.sameValue(0x0n * -0xFEDCBA97n, 0x0n, 'The result of (0x0n * -0xFEDCBA97n) is 0x0n'); +assert.sameValue(0x0n * -0xFEDCBA98n, 0x0n, 'The result of (0x0n * -0xFEDCBA98n) is 0x0n'); + +assert.sameValue( + 0x0n * -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0x0n * -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0x0n * -0xFEDCBA9876543210n, + 0x0n, + 'The result of (0x0n * -0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue(-0x1n * -0x1n, 0x1n, 'The result of (-0x1n * -0x1n) is 0x1n'); +assert.sameValue(-0x1n * -0x2n, 0x2n, 'The result of (-0x1n * -0x2n) is 0x2n'); +assert.sameValue(-0x1n * -0x3n, 0x3n, 'The result of (-0x1n * -0x3n) is 0x3n'); +assert.sameValue(-0x1n * -0x1234n, 0x1234n, 'The result of (-0x1n * -0x1234n) is 0x1234n'); + +assert.sameValue( + -0x1n * -0xFEDCBA97n, + 0xFEDCBA97n, + 'The result of (-0x1n * -0xFEDCBA97n) is 0xFEDCBA97n' +); + +assert.sameValue( + -0x1n * -0xFEDCBA98n, + 0xFEDCBA98n, + 'The result of (-0x1n * -0xFEDCBA98n) is 0xFEDCBA98n' +); + +assert.sameValue( + -0x1n * -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Fn, + 'The result of (-0x1n * -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0x1n * -0xFEDCBA9876543210n, + 0xFEDCBA9876543210n, + 'The result of (-0x1n * -0xFEDCBA9876543210n) is 0xFEDCBA9876543210n' +); + +assert.sameValue(-0x2n * -0x2n, 0x4n, 'The result of (-0x2n * -0x2n) is 0x4n'); +assert.sameValue(-0x2n * -0x3n, 0x6n, 'The result of (-0x2n * -0x3n) is 0x6n'); +assert.sameValue(-0x2n * -0x1234n, 0x2468n, 'The result of (-0x2n * -0x1234n) is 0x2468n'); + +assert.sameValue( + -0x2n * -0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (-0x2n * -0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + -0x2n * -0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (-0x2n * -0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + -0x2n * -0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (-0x2n * -0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0x2n * -0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (-0x2n * -0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue(-0x3n * -0x3n, 0x9n, 'The result of (-0x3n * -0x3n) is 0x9n'); +assert.sameValue(-0x3n * -0x1234n, 0x369Cn, 'The result of (-0x3n * -0x1234n) is 0x369Cn'); + +assert.sameValue( + -0x3n * -0xFEDCBA97n, + 0x2FC962FC5n, + 'The result of (-0x3n * -0xFEDCBA97n) is 0x2FC962FC5n' +); + +assert.sameValue( + -0x3n * -0xFEDCBA98n, + 0x2FC962FC8n, + 'The result of (-0x3n * -0xFEDCBA98n) is 0x2FC962FC8n' +); + +assert.sameValue( + -0x3n * -0xFEDCBA987654320Fn, + 0x2FC962FC962FC962Dn, + 'The result of (-0x3n * -0xFEDCBA987654320Fn) is 0x2FC962FC962FC962Dn' +); + +assert.sameValue( + -0x3n * -0xFEDCBA9876543210n, + 0x2FC962FC962FC9630n, + 'The result of (-0x3n * -0xFEDCBA9876543210n) is 0x2FC962FC962FC9630n' +); + +assert.sameValue( + -0x1234n * -0x1234n, + 0x14B5A90n, + 'The result of (-0x1234n * -0x1234n) is 0x14B5A90n' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA97n, + 0x121F49F484ACn, + 'The result of (-0x1234n * -0xFEDCBA97n) is 0x121F49F484ACn' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA98n, + 0x121F49F496E0n, + 'The result of (-0x1234n * -0xFEDCBA98n) is 0x121F49F496E0n' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA987654320Fn, + 0x121F49F49F49F49F390Cn, + 'The result of (-0x1234n * -0xFEDCBA987654320Fn) is 0x121F49F49F49F49F390Cn' +); + +assert.sameValue( + -0x1234n * -0xFEDCBA9876543210n, + 0x121F49F49F49F49F4B40n, + 'The result of (-0x1234n * -0xFEDCBA9876543210n) is 0x121F49F49F49F49F4B40n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA97n, + 0xFDBAC094DF87C511n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA97n) is 0xFDBAC094DF87C511n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA98n, + 0xFDBAC095DE647FA8n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA98n) is 0xFDBAC095DE647FA8n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA987654320Fn, + 0xFDBAC09654320FECDEEC6CD9n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA987654320Fn) is 0xFDBAC09654320FECDEEC6CD9n' +); + +assert.sameValue( + -0xFEDCBA97n * -0xFEDCBA9876543210n, + 0xFDBAC09654320FEDDDC92770n, + 'The result of (-0xFEDCBA97n * -0xFEDCBA9876543210n) is 0xFDBAC09654320FEDDDC92770n' +); + +assert.sameValue( + -0xFEDCBA98n * -0xFEDCBA98n, + 0xFDBAC096DD413A40n, + 'The result of (-0xFEDCBA98n * -0xFEDCBA98n) is 0xFDBAC096DD413A40n' +); + +assert.sameValue( + -0xFEDCBA98n * -0xFEDCBA987654320Fn, + 0xFDBAC097530ECA8555409EE8n, + 'The result of (-0xFEDCBA98n * -0xFEDCBA987654320Fn) is 0xFDBAC097530ECA8555409EE8n' +); + +assert.sameValue( + -0xFEDCBA98n * -0xFEDCBA9876543210n, + 0xFDBAC097530ECA86541D5980n, + 'The result of (-0xFEDCBA98n * -0xFEDCBA9876543210n) is 0xFDBAC097530ECA86541D5980n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn, + 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n, + 'The result of (-0xFEDCBA987654320Fn * -0xFEDCBA987654320Fn) is 0xFDBAC097C8DC5ACAE132F7A6B7A1DCE1n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn * -0xFEDCBA9876543210n, + 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n, + 'The result of (-0xFEDCBA987654320Fn * -0xFEDCBA9876543210n) is 0xFDBAC097C8DC5ACBE00FB23F2DF60EF0n' +); + +assert.sameValue( + -0xFEDCBA9876543210n * -0xFEDCBA9876543210n, + 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n, + 'The result of (-0xFEDCBA9876543210n * -0xFEDCBA9876543210n) is 0xFDBAC097C8DC5ACCDEEC6CD7A44A4100n' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/bigint-errors.js b/js/src/tests/test262/language/expressions/multiplication/bigint-errors.js new file mode 100644 index 0000000000..7df157c82b --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: multiplication operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') * 0n; +}, 'Symbol("1") * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * Symbol('1'); +}, '0n * Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) * 0n; +}, 'Object(Symbol("1")) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * Object(Symbol('1')); +}, '0n * Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) * 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n * {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) * 0n; +}, '({valueOf: function() {return Symbol("1");}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n * {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) * 0n; +}, '({toString: function() {return Symbol("1");}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + toString: function() { + return Symbol('1'); + } + }; +}, '0n * {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/multiplication/bigint-toprimitive.js new file mode 100644 index 0000000000..18541e1cde --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: multiplication operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) * 2n) is 4n'); + +assert.sameValue(2n * { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} * 2n, 4n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) * 2n) is 4n'); + +assert.sameValue(2n * { + valueOf: function() { + return 2n; + }, + + toString: err +}, 4n, 'The result of (2n * {valueOf: function() {return 2n;}, toString: err}) is 4n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({toString: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + toString: function() { + return 2n; + } +}, 4n, 'The result of (2n * {toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + valueOf: null, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (2n * {valueOf: null, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (2n * {valueOf: 1, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (2n * {valueOf: {}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (2n * {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 4n, 'The result of (2n * {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 4n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) * 0n; +}, '({[Symbol.toPrimitive]: 1}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + [Symbol.toPrimitive]: 1 + }; +}, '0n * {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) * 0n; +}, '({[Symbol.toPrimitive]: {}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + [Symbol.toPrimitive]: {} + }; +}, '0n * {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) * 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n * {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) * 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n * {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) * 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) * 0n throws MyError'); + +assert.throws(MyError, function() { + 0n * { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n * {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) * 0n; +}, '({valueOf: function() {throw new MyError();}}) * 0n throws MyError'); + +assert.throws(MyError, function() { + 0n * { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n * {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) * 0n; +}, '({toString: function() {throw new MyError();}}) * 0n throws MyError'); + +assert.throws(MyError, function() { + 0n * { + toString: function() { + throw new MyError(); + } + }; +}, '0n * {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) * 0n; +}, '({valueOf: null, toString: null}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + valueOf: null, + toString: null + }; +}, '0n * {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) * 0n; +}, '({valueOf: 1, toString: 1}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + valueOf: 1, + toString: 1 + }; +}, '0n * {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) * 0n; +}, '({valueOf: {}, toString: {}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + valueOf: {}, + toString: {} + }; +}, '0n * {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) * 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n * {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) * 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) * 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n * { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n * {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/multiplication/bigint-wrapped-values.js new file mode 100644 index 0000000000..3013f9af70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: multiplication operator ToNumeric with BigInt operands +esid: sec-multiplicative-operators-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) * 2n, 4n, 'The result of (Object(2n) * 2n) is 4n'); +assert.sameValue(2n * Object(2n), 4n, 'The result of (2n * Object(2n)) is 4n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 4n, 'The result of (2n * {[Symbol.toPrimitive]: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({valueOf: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + valueOf: function() { + return 2n; + } +}, 4n, 'The result of (2n * {valueOf: function() {return 2n;}}) is 4n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} * 2n, 4n, 'The result of (({toString: function() {return 2n;}}) * 2n) is 4n'); + +assert.sameValue(2n * { + toString: function() { + return 2n; + } +}, 4n, 'The result of (2n * {toString: function() {return 2n;}}) is 4n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/browser.js b/js/src/tests/test262/language/expressions/multiplication/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/multiplication/line-terminator.js b/js/src/tests/test262/language/expressions/multiplication/line-terminator.js new file mode 100644 index 0000000000..18db8b8350 --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/line-terminator.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Line terminator between the operands of a multiplication operator +info: | + MultiplicativeExpression[Yield, Await]: + ExponentiationExpression + MultiplicativeExpression MultiplicativeOperator ExponentiationExpression + + MultiplicativeOperator : one of + * / % +---*/ + +var x = 18 + +* + +2 + +* + +9 +; + +assert.sameValue(x, 324); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/order-of-evaluation.js b/js/src/tests/test262/language/expressions/multiplication/order-of-evaluation.js new file mode 100644 index 0000000000..5b5cd6692d --- /dev/null +++ b/js/src/tests/test262/language/expressions/multiplication/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-multiplicative-operators-runtime-semantics-evaluation +description: Type coercion order of operations for multiplication operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() * (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() * (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() * (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() * (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() * (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() * (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/multiplication/shell.js b/js/src/tests/test262/language/expressions/multiplication/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/new.target/asi.js b/js/src/tests/test262/language/expressions/new.target/asi.js new file mode 100644 index 0000000000..e0244833a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/asi.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-meta-properties-runtime-semantics-evaluation +es6id: 12.3.8.1 +description: NewTarget is composed of three distinct tokens +features: [new.target] +---*/ + +var newTarget = null; + +var withSpaces = function() { + newTarget = new . target; +}; + +withSpaces(); +assert.sameValue(newTarget, undefined, 'tokens seperated by whitespace'); + +new withSpaces(); +assert.sameValue(newTarget, withSpaces, 'tokens separateed by whitespace'); + +newTarget = null; + +var withLineBreaks = function() { + newTarget = new + +. + +target; +}; + +withLineBreaks(); +assert.sameValue(newTarget, undefined, 'tokens seperated by line breaks'); + +new withLineBreaks(); +assert.sameValue(newTarget, withLineBreaks, 'tokens seperated by line breaks'); + +var withSLDC = function() { + newTarget = new/* */./* */target; +}; + +withSLDC(); +assert.sameValue( + newTarget, undefined, 'tokens separated by SingleLineDelimitedComments' +); + +new withSLDC(); +assert.sameValue( + newTarget, withSLDC, 'tokens separated by SingleLineDelimitedComments' +); + + +var withMLC = function() { + newTarget = new/* + */./* + */target; +}; + +withMLC(); +assert.sameValue( + newTarget, undefined, 'tokens separated by MultiLineComments' +); + +new withMLC(); +assert.sameValue( + newTarget, withMLC, 'tokens separated by MultiLineComments' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/browser.js b/js/src/tests/test262/language/expressions/new.target/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/new.target/escaped-new.js b/js/src/tests/test262/language/expressions/new.target/escaped-new.js new file mode 100644 index 0000000000..18410c8955 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/escaped-new.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `new` keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function f() { + n\u0065w.target; +} diff --git a/js/src/tests/test262/language/expressions/new.target/escaped-target.js b/js/src/tests/test262/language/expressions/new.target/escaped-target.js new file mode 100644 index 0000000000..7a7d996ee9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/escaped-target.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `target` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function f() { + new.t\u0061rget; +} diff --git a/js/src/tests/test262/language/expressions/new.target/shell.js b/js/src/tests/test262/language/expressions/new.target/shell.js new file mode 100644 index 0000000000..ae18ad584d --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/shell.js @@ -0,0 +1,113 @@ +// GENERATED, DO NOT EDIT +// file: asyncHelpers.js +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + A collection of assertion and wrapper functions for testing asynchronous built-ins. +defines: [asyncTest] +---*/ + +function asyncTest(testFunc) { + if (!Object.hasOwn(globalThis, "$DONE")) { + throw new Test262Error("asyncTest called without async flag"); + } + if (typeof testFunc !== "function") { + $DONE(new Test262Error("asyncTest called with non-function argument")); + return; + } + try { + testFunc().then( + function () { + $DONE(); + }, + function (error) { + $DONE(error); + } + ); + } catch (syncError) { + $DONE(syncError); + } +} + +assert.throwsAsync = async function (expectedErrorConstructor, func, message) { + var innerThenable; + if (message === undefined) { + message = ""; + } else { + message += " "; + } + if (typeof func === "function") { + try { + innerThenable = func(); + if ( + innerThenable === null || + typeof innerThenable !== "object" || + typeof innerThenable.then !== "function" + ) { + message += + "Expected to obtain an inner promise that would reject with a" + + expectedErrorConstructor.name + + " but result was not a thenable"; + throw new Test262Error(message); + } + } catch (thrown) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise"; + throw new Test262Error(message); + } + } else { + message += + "assert.throwsAsync called with an argument that is not a function"; + throw new Test262Error(message); + } + + try { + return innerThenable.then( + function () { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but no exception was thrown at all"; + throw new Test262Error(message); + }, + function (thrown) { + var expectedName, actualName; + if (typeof thrown !== "object" || thrown === null) { + message += "Thrown value was not an object!"; + throw new Test262Error(message); + } else if (thrown.constructor !== expectedErrorConstructor) { + expectedName = expectedErrorConstructor.name; + actualName = thrown.constructor.name; + if (expectedName === actualName) { + message += + "Expected a " + + expectedName + + " but got a different error constructor with the same name"; + } else { + message += + "Expected a " + expectedName + " but got a " + actualName; + } + throw new Test262Error(message); + } + } + ); + } catch (thrown) { + if (typeof thrown !== "object" || thrown === null) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object "; + } else { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but a " + + thrown.constructor.name + + " was thrown synchronously"; + } + throw new Test262Error(message); + } +}; diff --git a/js/src/tests/test262/language/expressions/new.target/unary-expr.js b/js/src/tests/test262/language/expressions/new.target/unary-expr.js new file mode 100644 index 0000000000..a9302ae43e --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/unary-expr.js @@ -0,0 +1,33 @@ +// |reftest| async +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-UnaryExpression +description: > + While increments and decrements are restricted to use with NewTarget, + other unary operators should not throw SyntaxError. +info: | + UnaryExpression[Yield, Await]: + UpdateExpression[?Yield, ?Await]: + LeftHandSideExpression[?Yield, ?Await]: + NewExpression[?Yield, ?Await]: + MemberExpression[Yield, Await]: + MetaProperty: + NewTarget +features: [new.target, async-functions] +flags: [async] +includes: [asyncHelpers.js] +---*/ + +(function() { assert.sameValue(delete (new.target), true); })(); +(function() { assert.sameValue(void new.target, undefined); })(); +new function() { assert.sameValue(typeof new.target, 'function'); }; +new function() { assert.sameValue(+(new.target), NaN); }; +(function() { assert.sameValue(-(new.target), NaN); })(); +new function() { assert.sameValue(~new.target, -1); }; +(function() { assert.sameValue(!new.target, true); })(); +new function() { assert.sameValue(delete void typeof +-~!(new.target), true); }; + +asyncTest(async function() { + assert.sameValue(await new.target, undefined); +}); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-call.js b/js/src/tests/test262/language/expressions/new.target/value-via-call.js new file mode 100644 index 0000000000..29483d17a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-call.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function-calls-runtime-semantics-evaluation +es6id: 12.3.4.1 +description: Value when invoked via CallExpression +info: | + CallExpression : MemberExpressionArguments + + [...] + 8. Return ? EvaluateDirectCall(func, thisValue, Arguments, tailCall). +features: [new.target] +---*/ + +var newTarget = null; + +function f() { + newTarget = new.target; +} + +f(); + +assert.sameValue(newTarget, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-fpapply.js b/js/src/tests/test262/language/expressions/new.target/value-via-fpapply.js new file mode 100644 index 0000000000..603a1a700d --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-fpapply.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function.prototype.apply +es6id: 19.2.3.1 +description: Value when invoked via `Function.prototype.apply` +info: | + [...] + 5. Return ? Call(func, thisArg, argList). +features: [new.target] +---*/ + +var newTarget = null; + +function f() { + newTarget = new.target; +} + +f.apply({}); + +assert.sameValue(newTarget, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-fpcall.js b/js/src/tests/test262/language/expressions/new.target/value-via-fpcall.js new file mode 100644 index 0000000000..9e9c63aea6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-fpcall.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-function.prototype.call +es6id: 19.2.3.3 +description: Value when invoked via `Function.prototype.call` +info: | + [...] + 5. Return ? Call(func, thisArg, argList). +features: [new.target] +---*/ + +var newTarget = null; + +function f() { + newTarget = new.target; +} + +f.call({}); + +assert.sameValue(newTarget, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-member.js b/js/src/tests/test262/language/expressions/new.target/value-via-member.js new file mode 100644 index 0000000000..6c668a747f --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-member.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-property-accessors-runtime-semantics-evaluation +es6id: 12.3.2.1 +description: Value when invoked via MemberExpression +info: | + MemberExpression:MemberExpression.IdentifierName + + [...] + 6. Return a value of type Reference whose base value component is bv, whose + referenced name component is propertyNameString, and whose strict + reference flag is strict. + + 13.5.1 Runtime Semantics: Evaluation + + ExpressionStatement : Expression ; + + 1. Let exprRef be the result of evaluating Expression. + 2. Return ? GetValue(exprRef). +features: [new.target] +---*/ + +var newTarget = null; + +var obj = { + get m() { + newTarget = new.target; + } +}; + +obj.m; + +assert.sameValue(newTarget, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-new.js b/js/src/tests/test262/language/expressions/new.target/value-via-new.js new file mode 100644 index 0000000000..795e9dc0e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-new.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-new-operator-runtime-semantics-evaluation +es6id: 12.3.3.1 +description: Value when invoked via NewExpression +info: | + NewExpression:newNewExpression + + 1. Return ? EvaluateNew(NewExpression, empty). + + MemberExpression:newMemberExpressionArguments + + 2. Return ? EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + [...] + 8. Return ? Construct(constructor, argList). + + 7.3.13 Construct (F [ , argumentsList [ , newTarget ]]) + + 1. If newTarget was not passed, let newTarget be F. +features: [new.target] +---*/ + +var newTarget = null; +function f() { + newTarget = new.target; +} + +new f; + +assert.sameValue(newTarget, f, 'Invoked without Arguments'); + +newTarget = null; + +new f(); + +assert.sameValue(newTarget, f, 'Invoked with Arguments'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-reflect-apply.js b/js/src/tests/test262/language/expressions/new.target/value-via-reflect-apply.js new file mode 100644 index 0000000000..f811818cbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-reflect-apply.js @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-reflect.apply +es6id: 26.1.1 +description: Value when invoked via `Reflect.apply` +info: | + [...] + 5. Return ? Call(target, thisArgument, args). +features: [new.target, Reflect] +---*/ + +var newTarget = null; + +function f() { + newTarget = new.target; +} + +Reflect.apply(f, {}, []); + +assert.sameValue(newTarget, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-reflect-construct.js b/js/src/tests/test262/language/expressions/new.target/value-via-reflect-construct.js new file mode 100644 index 0000000000..6e157d465b --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-reflect-construct.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-reflect.construct +es6id: 26.1.2 +description: Value when invoked via `Reflect.construct` +info: | + [...] + 2. If newTarget is not present, let newTarget be target. + [...] + 5. Return ? Construct(target, args, newTarget). +features: [new.target, Reflect, Reflect.construct] +---*/ + +var customNewTarget = function() {}; +var newTarget = null; + +function f() { + newTarget = new.target; +} + +Reflect.construct(f, []); + +assert.sameValue(newTarget, f, 'NewTarget unspecified'); + +Reflect.construct(f, [], customNewTarget); + +assert.sameValue(newTarget, customNewTarget, 'NewTarget explicitly defined'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-super-call.js b/js/src/tests/test262/language/expressions/new.target/value-via-super-call.js new file mode 100644 index 0000000000..730f086f21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-super-call.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword-runtime-semantics-evaluation +es6id: 12.3.5.1 +description: Value when invoked via SuperCall +info: | + SuperCall : super Arguments + + 1. Let newTarget be GetNewTarget(). + [...] + 6. Let result be ? Construct(func, argList, newTarget). + [...] +features: [class, new.target] +---*/ + +var baseNewTarget, parentNewTarget; + +class Base { + constructor() { + baseNewTarget = new.target; + } +} + +class Parent extends Base { + constructor() { + parentNewTarget = new.target; + super(); + } +} + +class Child extends Parent { + constructor() { + super(); + } +} + +new Child(); + +assert.sameValue(parentNewTarget, Child, 'within "parent" constructor'); +assert.sameValue(baseNewTarget, Child, 'within "base" constructor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-super-property.js b/js/src/tests/test262/language/expressions/new.target/value-via-super-property.js new file mode 100644 index 0000000000..e19b1e2c55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-super-property.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword-runtime-semantics-evaluation +es6id: 12.3.5.1 +description: Value when invoked via SuperCall +info: | + SuperCall : super Arguments + + 1. Let newTarget be GetNewTarget(). + [...] + 6. Let result be ? Construct(func, argList, newTarget). + [...] +features: [class, new.target] +---*/ + +var newTarget = null; + +class Parent { + get attr() { + newTarget = new.target; + } +} + +class Child extends Parent { + constructor() { + super(); + super.attr; + } +} + +new Child(); + +assert.sameValue(newTarget, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new.target/value-via-tagged-template.js b/js/src/tests/test262/language/expressions/new.target/value-via-tagged-template.js new file mode 100644 index 0000000000..928af96d14 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new.target/value-via-tagged-template.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-tagged-templates-runtime-semantics-evaluation +es6id: 12.3.7.1 +description: Value when invoked via tagged template +info: | + MemberExpression : MemberExpression TemplateLiteral + + [...] + 4. Return ? EvaluateCall(tagRef, TemplateLiteral, tailCall). +features: [new.target, template] +---*/ + +var newTarget = null; + +function f() { + newTarget = new.target; +} + +f``; + +assert.sameValue(newTarget, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js new file mode 100644 index 0000000000..76a0ab179d --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "new" and NewExpression are + allowed +es5id: 11.2.2_A1.1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("new\u0009Number") != 0) { + throw new Test262Error('#1: new\\u0009Number == 0'); +} + +//CHECK#2 +if (eval("new\u000BNumber") != 0) { + throw new Test262Error('#2: new\\u000BNumber == 0'); +} + +//CHECK#3 +if (eval("new\u000CNumber") != 0) { + throw new Test262Error('#3: new\\u000CNumber == 0'); +} + +//CHECK#4 +if (eval("new\u0020Number") != 0) { + throw new Test262Error('#4: new\\u0020Number == 0'); +} + +//CHECK#5 +if (eval("new\u00A0Number") != 0) { + throw new Test262Error('#5: new\\u00A0Number == 0'); +} + +//CHECK#6 +if (eval("new\u000ANumber") != 0) { + throw new Test262Error('#6: new\\u000ANumber == 0'); +} + +//CHECK#7 +if (eval("new\u000DNumber") != 0) { + throw new Test262Error('#7: new\\u000DNumber == 0'); +} + +//CHECK#8 +if (eval("new\u2028Number") != 0) { + throw new Test262Error('#8: new\\u2028Number == 0'); +} + +//CHECK#9 +if (eval("new\u2029Number") != 0) { + throw new Test262Error('#9: new\\u2029Number == 0'); +} + +//CHECK#10 +if (eval("new\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Number") != 0) { + throw new Test262Error('#10: new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number == 0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js new file mode 100644 index 0000000000..7dc595aadb --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A1.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "new" and MemberExpression are + allowed +es5id: 11.2.2_A1.2 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("new\u0009Number()") != 0) { + throw new Test262Error('#1: new\\u0009Number == 0'); +} + +//CHECK#2 +if (eval("new\u000BNumber()") != 0) { + throw new Test262Error('#2: new\\u000BNumber == 0'); +} + +//CHECK#3 +if (eval("new\u000CNumber()") != 0) { + throw new Test262Error('#3: new\\u000CNumber == 0'); +} + +//CHECK#4 +if (eval("new\u0020Number()") != 0) { + throw new Test262Error('#4: new\\u0020Number == 0'); +} + +//CHECK#5 +if (eval("new\u00A0Number()") != 0) { + throw new Test262Error('#5: new\\u00A0Number == 0'); +} + +//CHECK#6 +if (eval("new\u000ANumber()") != 0) { + throw new Test262Error('#6: new\\u000ANumber == 0'); +} + +//CHECK#7 +if (eval("new\u000DNumber()") != 0) { + throw new Test262Error('#7: new\\u000DNumber == 0'); +} + +//CHECK#8 +if (eval("new\u2028Number()") != 0) { + throw new Test262Error('#8: new\\u2028Number == 0'); +} + +//CHECK#9 +if (eval("new\u2029Number()") != 0) { + throw new Test262Error('#9: new\\u2029Number == 0'); +} + +//CHECK#10 +if (eval("new\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Number()") != 0) { + throw new Test262Error('#10: new\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Number == 0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A2.js new file mode 100644 index 0000000000..4f1e053c7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "new" uses GetValue +es5id: 11.2.2_A2 +description: > + If GetBase(NewExpression) or GetBase(MemberExpression) is null, + throw ReferenceError +---*/ + +//CHECK#1 +try { + new x; + throw new Test262Error('#1.1: new x throw ReferenceError. Actual: ' + (new x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: new x throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + new x(); + throw new Test262Error('#2: new x() throw ReferenceError'); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#2: new x() throw ReferenceError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js new file mode 100644 index 0000000000..0707d7d0ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T1.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(NewExpression) or Type(MemberExpression) is not Object, throw + TypeError +es5id: 11.2.2_A3_T1 +description: Checking boolean primitive case +---*/ + +//CHECK#1 +try { + new true; + throw new Test262Error('#1: new true throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new true throw TypeError'); + } +} + +//CHECK#2 +try { + var x = true; + new x; + throw new Test262Error('#2: var x = true; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = true; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = true; + new x(); + throw new Test262Error('#3: var x = true; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = true; new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js new file mode 100644 index 0000000000..b111d0316e --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T2.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(NewExpression) or Type(MemberExpression) is not Object, throw + TypeError +es5id: 11.2.2_A3_T2 +description: Checking "number primitive" case +---*/ + +//CHECK#1 +try { + new 1; + throw new Test262Error('#1: new 1 throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new 1 throw TypeError'); + } +} + +//CHECK#2 +try { + var x = 1; + new x; + throw new Test262Error('#2: var x = 1; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = 1; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = 1; + new x(); + throw new Test262Error('#3: var x = 1; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = 1; new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js new file mode 100644 index 0000000000..9b4c4ffb9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T3.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(NewExpression) or Type(MemberExpression) is not Object, throw + TypeError +es5id: 11.2.2_A3_T3 +description: Checking "string primitive" case +---*/ + +//CHECK#1 +try { + new 1; + throw new Test262Error('#1: new "1" throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new "1" throw TypeError'); + } +} + +//CHECK#2 +try { + var x = "1"; + new x; + throw new Test262Error('#2: var x = "1"; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = "1"; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = "1"; + new x(); + throw new Test262Error('#3: var x = "1"; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = "1"; new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js new file mode 100644 index 0000000000..3e7229462c --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T4.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(NewExpression) or Type(MemberExpression) is not Object, throw + TypeError +es5id: 11.2.2_A3_T4 +description: Checking "undefined" case +---*/ + +//CHECK#1 +try { + new undefined; + throw new Test262Error('#1: new undefined throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new undefined throw TypeError'); + } +} + +//CHECK#2 +try { + var x = undefined; + new x; + throw new Test262Error('#2: var x = undefined; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = undefined; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = undefined; + new x(); + throw new Test262Error('#3: var x = undefined; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = undefined; new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js new file mode 100644 index 0000000000..bded1822dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A3_T5.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If Type(NewExpression) or Type(MemberExpression) is not Object, throw + TypeError +es5id: 11.2.2_A3_T5 +description: Checking "null primitive" case +---*/ + +//CHECK#1 +try { + new null; + throw new Test262Error('#1: new null throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new null throw TypeError'); + } +} + +//CHECK#2 +try { + var x = null; + new x; + throw new Test262Error('#2: var x = null; new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = null; new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = null; + new x(); + throw new Test262Error('#3: var x = null; new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = null; new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js new file mode 100644 index 0000000000..fc18a95326 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T1.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If NewExpression or MemberExpression does not implement internal + [[Construct]] method, throw TypeError +es5id: 11.2.2_A4_T1 +description: Checking Boolean object case +---*/ + +//CHECK#1 +try { + new new Boolean(true); + throw new Test262Error('#1: new new Boolean(true) throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new new Boolean(true) throw TypeError'); + } +} + +//CHECK#2 +try { + var x = new Boolean(true); + new x; + throw new Test262Error('#2: var x = new Boolean(true); new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = new Boolean(true); new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new Boolean(true); + new x(); + throw new Test262Error('#3: var x = new Boolean(true); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = new Boolean(true); new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js new file mode 100644 index 0000000000..be68afe987 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T2.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If NewExpression or MemberExpression does not implement internal + [[Construct]] method, throw TypeError +es5id: 11.2.2_A4_T2 +description: Checking Number object case +---*/ + +//CHECK#1 +try { + new new Number(1); + throw new Test262Error('#1: new new Number(1) throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new new Number(1) throw TypeError'); + } +} + +//CHECK#2 +try { + var x = new Number(1); + new x; + throw new Test262Error('#2: var x = new Number(1); new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = new Number(1); new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new Number(1); + new x(); + throw new Test262Error('#3: var x = new Number(1); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = new Number(1); new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js new file mode 100644 index 0000000000..f36fbd52d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T3.js @@ -0,0 +1,47 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If NewExpression or MemberExpression does not implement internal + [[Construct]] method, throw TypeError +es5id: 11.2.2_A4_T3 +description: Checking String object case +---*/ + +//CHECK#1 +try { + new new String("1"); + throw new Test262Error('#1: new new String("1") throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new new String("1") throw TypeError'); + } +} + +//CHECK#2 +try { + var x = new String("1"); + new x; + throw new Test262Error('#2: var x = new String("1"); new x throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: var x = new String("1"); new x throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new String("1"); + new x(); + throw new Test262Error('#3: var x = new String("1"); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = new String("1"); new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js new file mode 100644 index 0000000000..7ecf784e0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T4.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If NewExpression or MemberExpression does not implement internal + [[Construct]] method, throw TypeError +es5id: 11.2.2_A4_T4 +description: Checking Global object case +---*/ + +//CHECK#1 +try { + new this; + throw new Test262Error('#1: new this throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new this throw TypeError'); + } +} + +//CHECK#2 +try { + new this(); + throw new Test262Error('#2: new this() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: new this() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js new file mode 100644 index 0000000000..8216b05bd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/S11.2.2_A4_T5.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + If NewExpression or MemberExpression does not implement internal + [[Construct]] method, throw TypeError +es5id: 11.2.2_A4_T5 +description: Checking Math object case +---*/ + +//CHECK#1 +try { + new Math; + throw new Test262Error('#1: new Math throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1: new Math throw TypeError'); + } +} + +//CHECK#2 +try { + new new Math(); + throw new Test262Error('#2: new new Math() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2: new new Math() throw TypeError'); + } +} + +//CHECK#3 +try { + var x = new Math(); + new x(); + throw new Test262Error('#3: var x = new Math(); new x() throw TypeError'); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#3: var x = new Math(); new x() throw TypeError'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/browser.js b/js/src/tests/test262/language/expressions/new/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js new file mode 100644 index 0000000000..ebadd23a93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval-fn-wrapup.js @@ -0,0 +1,39 @@ +// Copyright (C) 2020 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-new-operator +description: > + The constructExpr is referenced before arguments in the same EvaluateNew evaluation. + Function wrap-up to use the same function level binding ref. +info: | + NewExpression : new NewExpression + 1. Return ? EvaluateNew(NewExpression, empty). + MemberExpression : new MemberExpression Arguments + 1. Return ? EvaluateNew(MemberExpression, Arguments). + + Runtime Semantics: EvaluateNew + + 3. Let ref be the result of evaluating constructExpr. + 4. Let constructor be ? GetValue(ref). + 5. If arguments is empty, let argList be a new empty List. + 6. Else, + a. Let argList be ? ArgumentListEvaluation of arguments. + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + 8. Return ? Construct(constructor, argList). +---*/ + +function fn() { + var x = function() { + this.foo = 42; + }; + + var result = new x(x = 1); + + assert.sameValue(x, 1); + assert.sameValue(result.foo, 42); +} + +fn(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js new file mode 100644 index 0000000000..cdd0254f18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/ctorExpr-fn-ref-before-args-eval.js @@ -0,0 +1,34 @@ +// Copyright (C) 2020 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-new-operator +description: > + The constructExpr is referenced before arguments in the same EvaluateNew evaluation. +info: | + NewExpression : new NewExpression + 1. Return ? EvaluateNew(NewExpression, empty). + MemberExpression : new MemberExpression Arguments + 1. Return ? EvaluateNew(MemberExpression, Arguments). + + Runtime Semantics: EvaluateNew + + 3. Let ref be the result of evaluating constructExpr. + 4. Let constructor be ? GetValue(ref). + 5. If arguments is empty, let argList be a new empty List. + 6. Else, + a. Let argList be ? ArgumentListEvaluation of arguments. + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + 8. Return ? Construct(constructor, argList). +---*/ + +var x = function() { + this.foo = 42; +}; + +var result = new x(x = 1); + +assert.sameValue(x, 1); +assert.sameValue(result.foo, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js new file mode 100644 index 0000000000..b1e980c7d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval-fn-wrapup.js @@ -0,0 +1,38 @@ +// Copyright (C) 2020 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-new-operator +description: > + The IsConstructor(ctor) happens after evaluating the arguments, use the correct ctor. + Function wrap-up to use the same function level binding ref +info: | + NewExpression : new NewExpression + 1. Return ? EvaluateNew(NewExpression, empty). + MemberExpression : new MemberExpression Arguments + 1. Return ? EvaluateNew(MemberExpression, Arguments). + + Runtime Semantics: EvaluateNew + + 3. Let ref be the result of evaluating constructExpr. + 4. Let constructor be ? GetValue(ref). + 5. If arguments is empty, let argList be a new empty List. + 6. Else, + a. Let argList be ? ArgumentListEvaluation of arguments. + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + 8. Return ? Construct(constructor, argList). +---*/ + +var ref; +var argz; + +assert.throws(TypeError, function() { + var x = 42; + ref = x; + new x(x = function() {}, argz = 39); +}); + +assert.sameValue(ref, 42); +assert.sameValue(argz, 39, 'arguments evaluated before checking valid ctor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js new file mode 100644 index 0000000000..1a8385fd41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/ctorExpr-isCtor-after-args-eval.js @@ -0,0 +1,32 @@ +// Copyright (C) 2020 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-new-operator +description: > + The IsConstructor(ctor) happens after evaluating the arguments, use the correct ctor +info: | + NewExpression : new NewExpression + 1. Return ? EvaluateNew(NewExpression, empty). + MemberExpression : new MemberExpression Arguments + 1. Return ? EvaluateNew(MemberExpression, Arguments). + + Runtime Semantics: EvaluateNew + + 3. Let ref be the result of evaluating constructExpr. + 4. Let constructor be ? GetValue(ref). + 5. If arguments is empty, let argList be a new empty List. + 6. Else, + a. Let argList be ? ArgumentListEvaluation of arguments. + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + 8. Return ? Construct(constructor, argList). +---*/ + +var x = {}; +assert.throws(TypeError, function() { + new x(x = Array); +}); + +assert.sameValue(x, Array); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js b/js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js new file mode 100644 index 0000000000..a446c720bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/non-ctor-err-realm.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-new-operator +es6id: 12.3.3 +description: Realm of error object produced when operand is not a constructor +info: | + NewExpression : new NewExpression + + 1. Return ? EvaluateNew(NewExpression, empty). + + MemberExpression : new MemberExpression Arguments + + 1. Return ? EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 7. If IsConstructor(constructor) is false, throw a TypeError exception. +features: [cross-realm] +---*/ + +var otherParseInt = $262.createRealm().global.parseInt; + +assert.sameValue(typeof otherParseInt, 'function'); + +assert.throws(TypeError, function() { + new otherParseInt(0); +}, 'production including Arguments'); + +assert.throws(TypeError, function() { + new otherParseInt; +}, 'production eliding Arguments'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/shell.js b/js/src/tests/test262/language/expressions/new/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js new file mode 100644 index 0000000000..418bba7e55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-expr-throws.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-expr-throws.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator following other arguments when evaluation throws (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + +---*/ + +assert.throws(Test262Error, function() { + new function() {}(0, ...function*() { throw new Test262Error(); }()); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js new file mode 100644 index 0000000000..4856246436 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-iter-get-value.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-iter-get-value.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + return null; + } +}); + +assert.throws(TypeError, function() { + new function() {}(0, ...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js new file mode 100644 index 0000000000..18e586403e --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-call.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-call.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + new function() {}(0, ...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js new file mode 100644 index 0000000000..0659652501 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-get-get.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-get.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + new function() {}(0, ...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js new file mode 100644 index 0000000000..124fb44312 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-step.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-step.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator following other arguments when IteratorStep fails (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + new function() {}(0, ...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js new file mode 100644 index 0000000000..849b8d1d60 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-itr-value.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-value.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator following other arguments when IteratorValue fails (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +assert.throws(Test262Error, function() { + new function() {}(0, ...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js new file mode 100644 index 0000000000..9eed42b6d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-obj-unresolvable.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-obj-unresolvable.case +// - src/spread/error/member-expr.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +assert.throws(ReferenceError, function() { + new function() {}({a: 0, ...unresolvableReference}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js new file mode 100644 index 0000000000..b393fc09dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-mult-err-unresolvable.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-unresolvable.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator following other arguments when reference is unresolvable (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +assert.throws(ReferenceError, function() { + new function() {}(0, ...unresolvableReference); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js new file mode 100644 index 0000000000..4a37f2e1dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-expr-throws.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-expr-throws.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator applied to the only argument when evaluation throws (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [generators] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). +---*/ + +assert.throws(Test262Error, function() { + new function() {}(...function*() { throw new Test262Error(); }()); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js new file mode 100644 index 0000000000..c5372145b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-call.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-call.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +assert.throws(Test262Error, function() { + new function() {}(...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js new file mode 100644 index 0000000000..2c7475c7a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-get.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-get.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + new function() {}(...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js new file mode 100644 index 0000000000..e6fa1ebd1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-get-value.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-value.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return null; +}; + +assert.throws(TypeError, function() { + new function() {}(...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js new file mode 100644 index 0000000000..3e18f9d4ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-step.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-step.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator applied to the only argument when IteratorStep fails (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +assert.throws(Test262Error, function() { + new function() {}(...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js new file mode 100644 index 0000000000..ff8141e961 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-itr-value.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-value.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator applied to the only argument when IteratorValue fails (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +assert.throws(Test262Error, function() { + new function() {}(...iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js new file mode 100644 index 0000000000..cc65d5438d --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-obj-unresolvable.js @@ -0,0 +1,37 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-obj-unresolvable.case +// - src/spread/error/member-expr.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +assert.throws(ReferenceError, function() { + new function() {}({...unresolvableReference}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js new file mode 100644 index 0000000000..e1e8415a02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-err-sngl-err-unresolvable.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-unresolvable.case +// - src/spread/error/member-expr.template +/*--- +description: Spread operator applied to the only argument when reference is unresolvable (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +assert.throws(ReferenceError, function() { + new function() {}(...unresolvableReference); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-empty.js b/js/src/tests/test262/language/expressions/new/spread-mult-empty.js new file mode 100644 index 0000000000..38020fa567 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-mult-empty.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-empty.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator following other arguments when no iteration occurs (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + callCount += 1; +}(1, 2, 3, ...[]); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-expr.js b/js/src/tests/test262/language/expressions/new/spread-mult-expr.js new file mode 100644 index 0000000000..30e6539a1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-mult-expr.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-expr.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ +var source = [3, 4, 5]; +var target; + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + assert.sameValue(target, source); + callCount += 1; +}(1, 2, ...target = source); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-iter.js b/js/src/tests/test262/language/expressions/new/spread-mult-iter.js new file mode 100644 index 0000000000..967229af2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-mult-iter.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-iter.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator following other arguments with a valid iterator (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 3; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 6, value: nextCount }; + } + }; +}; + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + callCount += 1; +}(1, 2, 3, ...iter); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-literal.js b/js/src/tests/test262/language/expressions/new/spread-mult-literal.js new file mode 100644 index 0000000000..51dc64f2f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-mult-literal.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-literal.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 5); + assert.sameValue(arguments[1], 6); + assert.sameValue(arguments[2], 7); + assert.sameValue(arguments[3], 8); + assert.sameValue(arguments[4], 9); + callCount += 1; +}(5, ...[6, 7, 8], 9); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js b/js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js new file mode 100644 index 0000000000..eb3070203a --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-mult-obj-ident.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-ident.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread operator following other properties (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(Object.keys(obj).length, 4); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; +}({a: 1, b: 2, ...o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js b/js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js new file mode 100644 index 0000000000..1a9aa9eaa7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-mult-obj-null.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-null.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread operator following other arguments with null value (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}({a: 1, b: 2, ...null}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js b/js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js new file mode 100644 index 0000000000..3e71260178 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-mult-obj-undefined.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-undefined.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread operator following other arguments with undefined (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}({a: 1, b: 2, ...undefined}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js b/js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js new file mode 100644 index 0000000000..c630fd9d9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-getter-descriptor.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-descriptor.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operation with getter results in data property descriptor (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = { + get a() { + return 42; + } +}; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 42 + }); + callCount += 1; +}({...o, c: 4, d: 5}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js b/js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js new file mode 100644 index 0000000000..95f0f6e907 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-getter-init.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-init.case +// - src/spread/default/member-expr.template +/*--- +description: Getter in object literal is not evaluated (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] +---*/ + +let o = {a: 2, b: 3}; +let executedGetter = false; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(executedGetter, false) + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...o, get c() { executedGetter = true; }}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js b/js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js new file mode 100644 index 0000000000..5cd25dd306 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-manipulate-outter-obj-in-getter.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-manipulate-outter-obj-in-getter.case +// - src/spread/default/member-expr.template +/*--- +description: Getter manipulates outter object before it's spread operation (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var o = { a: 0, b: 1 }; +var cthulhu = { get x() { + delete o.a; + o.b = 42; + o.c = "ni"; +}}; + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.hasOwnProperty("a"), false); + assert.sameValue(obj.b, 42); + assert.sameValue(obj.c, "ni"); + assert(obj.hasOwnProperty("x")); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...cthulhu, ...o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js new file mode 100644 index 0000000000..32d1226cfd --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread-getter.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread-getter.case +// - src/spread/default/member-expr.template +/*--- +description: Multiple Object Spread usage calls getter multiple times (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let getterCallCount = 0; +let o = { + get a() { + return ++getterCallCount; + } +}; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...o, c: 4, d: 5, a: 42, ...o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js new file mode 100644 index 0000000000..da3c4ac77e --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-mult-spread.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread.case +// - src/spread/default/member-expr.template +/*--- +description: Multiple Object Spread operation (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +let o = {a: 2, b: 3}; +let o2 = {c: 4, d: 5}; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 4); + callCount += 1; +}({...o, ...o2}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-null.js b/js/src/tests/test262/language/expressions/new/spread-obj-null.js new file mode 100644 index 0000000000..f67773d781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-null.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-null.case +// - src/spread/default/member-expr.template +/*--- +description: Null Object Spread is ignored (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +new function(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}({...null}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js b/js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js new file mode 100644 index 0000000000..2689c35e24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-override-immutable.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-override-immutable.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread overriding immutable properties (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] +---*/ + +let o = {b: 2}; +Object.defineProperty(o, "a", {value: 1, enumerable: true, writable: false, configurable: true}); + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 3) + assert.sameValue(obj.b, 2); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount += 1; +}({...o, a: 3}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js b/js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js new file mode 100644 index 0000000000..fbdbb8719b --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-overrides-prev-properties.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-overrides-prev-properties.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread properties overrides previous definitions (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3}; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(Object.keys(obj).length, 2); + assert.sameValue(o.a, 2); + assert.sameValue(o.b, 3); + callCount += 1; +}({a: 1, b: 7, ...o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js new file mode 100644 index 0000000000..b96f517fc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-skip-non-enumerable.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-skip-non-enumerable.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread doesn't copy non-enumerable properties (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] +---*/ + +let o = {}; +Object.defineProperty(o, "b", {value: 3, enumerable: false}); + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.hasOwnProperty("b"), false) + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}({...o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js b/js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js new file mode 100644 index 0000000000..980a894c41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-spread-order.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-spread-order.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operation follows [[OwnPropertyKeys]] order (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol, object-spread] +flags: [generated] +includes: [compareArray.js] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var calls = []; +var o = { get z() { calls.push('z') }, get a() { calls.push('a') } }; +Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true }); +Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true }); + + +var callCount = 0; + +new function(obj) { + assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; +}({...o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js b/js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js new file mode 100644 index 0000000000..e68d264fab --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-symbol-property.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-symbol-property.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operation where source object contains Symbol properties (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol, object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let symbol = Symbol('foo'); +let o = {}; +o[symbol] = 1; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj[symbol], 1); + assert(Object.prototype.hasOwnProperty.call(obj, symbol), "symbol is an own property"); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; +}({...o, c: 4, d: 5}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-undefined.js b/js/src/tests/test262/language/expressions/new/spread-obj-undefined.js new file mode 100644 index 0000000000..3a64b13ffe --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-undefined.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-undefined.case +// - src/spread/default/member-expr.template +/*--- +description: Undefined Object Spread is ignored (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +new function(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; +}({...undefined}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js b/js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js new file mode 100644 index 0000000000..46fea85d29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-obj-with-overrides.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-with-overrides.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread properties being overriden (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol, object-spread] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3, c: 4, e: undefined, f: null, g: false}; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 7); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert(obj.hasOwnProperty("e")); + assert.sameValue(obj.f, null); + assert.sameValue(obj.g, false); + assert.sameValue(obj.h, -0); + assert.sameValue(obj.i.toString(), "Symbol(foo)"); + assert(Object.is(obj.j, o)); + assert.sameValue(Object.keys(obj).length, 10); + callCount += 1; +}({...o, a: 1, b: 7, d: 5, h: -0, i: Symbol("foo"), j: o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-empty.js b/js/src/tests/test262/language/expressions/new/spread-sngl-empty.js new file mode 100644 index 0000000000..a967289690 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-sngl-empty.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-empty.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator applied to the only argument when no iteration occurs (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + [...] +---*/ + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 0); + callCount += 1; +}(...[]); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-expr.js b/js/src/tests/test262/language/expressions/new/spread-sngl-expr.js new file mode 100644 index 0000000000..0b3f28bdc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-sngl-expr.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-expr.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator applied to AssignmentExpression as only element (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var source = [2, 3, 4]; +var target; + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 2); + assert.sameValue(arguments[1], 3); + assert.sameValue(arguments[2], 4); + assert.sameValue(target, source); + callCount += 1; +}(...target = source); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-iter.js b/js/src/tests/test262/language/expressions/new/spread-sngl-iter.js new file mode 100644 index 0000000000..1b63418aac --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-sngl-iter.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-iter.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator applied to the only argument with a valid iterator (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [Symbol.iterator] +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 0; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 3, value: nextCount }; + } + }; +}; + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + callCount += 1; +}(...iter); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-literal.js b/js/src/tests/test262/language/expressions/new/spread-sngl-literal.js new file mode 100644 index 0000000000..b74182edb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-sngl-literal.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-literal.case +// - src/spread/default/member-expr.template +/*--- +description: Spread operator applied to array literal as only element (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +flags: [generated] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ + +var callCount = 0; + +new function() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 3); + assert.sameValue(arguments[1], 4); + assert.sameValue(arguments[2], 5); + callCount += 1; +}(...[3, 4, 5]); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js b/js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js new file mode 100644 index 0000000000..d1f4a56034 --- /dev/null +++ b/js/src/tests/test262/language/expressions/new/spread-sngl-obj-ident.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-obj-ident.case +// - src/spread/default/member-expr.template +/*--- +description: Object Spread operator without other arguments (`new` operator) +esid: sec-new-operator-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + MemberExpression : new MemberExpression Arguments + + 1. Return EvaluateNew(MemberExpression, Arguments). + + 12.3.3.1.1 Runtime Semantics: EvaluateNew + + 6. If arguments is empty, let argList be an empty List. + 7. Else, + a. Let argList be ArgumentListEvaluation of arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +new function(obj) { + assert.sameValue(Object.keys(obj).length, 2); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; +}({...o}); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5-0-1.js b/js/src/tests/test262/language/expressions/object/11.1.5-0-1.js new file mode 100644 index 0000000000..e0211308e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5-0-1.js @@ -0,0 +1,24 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + it isn't clear what specific requirements of the specificaiton are being tested here. This test should + probably be replaced by some more targeted tests. AllenWB +es5id: 11.1.5-0-1 +description: Object literal - get set property +---*/ + + var s1 = "In getter"; + var s2 = "In setter"; + var s3 = "Modified by setter"; + var o; + eval("o = {get foo(){ return s1;},set foo(arg){return s2 = s3}};"); + +assert.sameValue(o.foo, s1, 'o.foo'); + + o.foo=10; + +assert.sameValue(s2, s3, 's2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5-0-2.js b/js/src/tests/test262/language/expressions/object/11.1.5-0-2.js new file mode 100644 index 0000000000..7b814cea8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5-0-2.js @@ -0,0 +1,29 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + it isn't clear what specific requirements of the specificaiton are being tested here. This test should + probably be replaced by some more targeted tests. AllenWB +es5id: 11.1.5-0-2 +description: Object literal - multiple get set properties +---*/ + + var s1 = "First getter"; + var s2 = "First setter"; + var s3 = "Second getter"; + var o; + eval("o = {get foo(){ return s1;},set foo(arg){return s2 = s3}, get bar(){ return s3}, set bar(arg){ s3 = arg;}};"); + +assert.sameValue(o.foo, s1, 'o.foo'); + + o.foo = 10; + +assert.sameValue(s2, s3, 's2'); +assert.sameValue(o.bar, s3, 'o.bar'); + + o.bar = "Second setter"; + +assert.sameValue(o.bar, "Second setter", 'o.bar'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5-1gs-strict.js b/js/src/tests/test262/language/expressions/object/11.1.5-1gs-strict.js new file mode 100644 index 0000000000..9a074ade4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5-1gs-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5-1gs +description: > + Strict Mode - SyntaxError is thrown when 'eval' occurs as the + Identifier in a PropertySetParameterList of a PropertyAssignment + that is contained in strict code +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +var obj = { set _11_1_5_1_fun(eval) {}}; diff --git a/js/src/tests/test262/language/expressions/object/11.1.5-2gs.js b/js/src/tests/test262/language/expressions/object/11.1.5-2gs.js new file mode 100644 index 0000000000..93e30cd5d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5-2gs.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5-2gs +description: > + Duplicate definitions of data properties are allowed in ObjectLiterals. +---*/ + +var obj = { _11_1_5_2_gs: 10, _11_1_5_2_gs: 20 }; +assert.sameValue(obj._11_1_5_2_gs, 20); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_3-3-1.js b/js/src/tests/test262/language/expressions/object/11.1.5_3-3-1.js new file mode 100644 index 0000000000..0459867921 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_3-3-1.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyNameAndValueList : PropertyAssignment + 3.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false. +es5id: 11.1.5_3-3-1 +description: > + Object initialization using PropertyNameAndValueList + (PropertyAssignment) when property (read-only) exists in + Object.prototype (step 3) +---*/ + + Object.defineProperty(Object.prototype, "prop", { + value: 100, + writable: false, + configurable: true + }); + var obj = { prop: 12 }; + +assert(obj.hasOwnProperty("prop"), 'obj.hasOwnProperty("prop") !== true'); +assert.sameValue(obj.prop, 12, 'obj.prop'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_4-4-a-3.js b/js/src/tests/test262/language/expressions/object/11.1.5_4-4-a-3.js new file mode 100644 index 0000000000..e6b7e29509 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_4-4-a-3.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment + 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true + a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true +es5id: 11.1.5_4-4-a-3 +description: > + Object literal - Duplicate data property name allowed gets last + defined value +---*/ + + var o = eval("({foo:0,foo:1});"); + +assert.sameValue(o.foo, 1, 'o.foo'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_4-4-b-1.js b/js/src/tests/test262/language/expressions/object/11.1.5_4-4-b-1.js new file mode 100644 index 0000000000..4eb10c542a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_4-4-b-1.js @@ -0,0 +1,13 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-b-1 +description: > + Object literal - No SyntaxError if a data property definition is + followed by get accessor definition with the same name +---*/ + + eval("({foo : 1, get foo(){}});"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_4-5-1.js b/js/src/tests/test262/language/expressions/object/11.1.5_4-5-1.js new file mode 100644 index 0000000000..e4857ae9f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_4-5-1.js @@ -0,0 +1,27 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment + 5.Call the [[DefineOwnProperty]] internal method of obj with arguments propId.name, propId.descriptor, and false. +es5id: 11.1.5_4-5-1 +description: > + Object initialization using PropertyNameAndValueList + (PropertyNameAndValueList , PropertyAssignment) when property + (read-only) exists in Object.prototype (Step 5) +---*/ + + Object.defineProperty(Object.prototype, "prop2", { + value: 100, + writable: false, + configurable: true + }); + + var obj = { prop1: 101, prop2: 12 }; + +assert(obj.hasOwnProperty("prop2"), 'obj.hasOwnProperty("prop2") !== true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_5-4-1.js b/js/src/tests/test262/language/expressions/object/11.1.5_5-4-1.js new file mode 100644 index 0000000000..360509f4a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_5-4-1.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyAssignment : PropertyName : AssignmentExpression + 4.Let desc be the Property Descriptor{[[Value]]: propValue, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: true} +es5id: 11.1.5_5-4-1 +description: Object literal - property descriptor for assignment expression +---*/ + + var o = {foo : 1}; + var desc = Object.getOwnPropertyDescriptor(o,"foo"); + +assert.sameValue(desc.value, 1, 'desc.value'); +assert.sameValue(desc.writable, true, 'desc.writable'); +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_6-3-1.js b/js/src/tests/test262/language/expressions/object/11.1.5_6-3-1.js new file mode 100644 index 0000000000..17fd5462aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_6-3-1.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyAssignment : get PropertyName ( ) { FunctionBody } + 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true} +es5id: 11.1.5_6-3-1 +description: Object literal - property descriptor for get property assignment +---*/ + + var o; + eval("o = {get foo(){return 1;}};"); + var desc = Object.getOwnPropertyDescriptor(o,"foo"); + +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_6-3-2.js b/js/src/tests/test262/language/expressions/object/11.1.5_6-3-2.js new file mode 100644 index 0000000000..a5afa1e0c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_6-3-2.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyAssignment : get PropertyName ( ) { FunctionBody } + 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true} +es5id: 11.1.5_6-3-2 +description: > + Object literal - property descriptor for get property assignment + should not create a set function +---*/ + + var o; + eval("o = {get foo(){return 1;}};"); + var desc = Object.getOwnPropertyDescriptor(o,"foo"); + +assert.sameValue(desc.set, undefined, 'desc.set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_7-3-1.js b/js/src/tests/test262/language/expressions/object/11.1.5_7-3-1.js new file mode 100644 index 0000000000..ad09c800fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_7-3-1.js @@ -0,0 +1,21 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyAssignment : set PropertyName( PropertySetParameterList ) { FunctionBody } + 3.Let desc be the Property Descriptor{[[Set]]: closure, [[Enumerable]]: true, [[Configurable]]: true} +es5id: 11.1.5_7-3-1 +description: Object literal - property descriptor for set property assignment +---*/ + + var o; + eval("o = {set foo(arg){return 1;}};"); + var desc = Object.getOwnPropertyDescriptor(o,"foo"); + +assert.sameValue(desc.enumerable, true, 'desc.enumerable'); +assert.sameValue(desc.configurable, true, 'desc.configurable'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/11.1.5_7-3-2.js b/js/src/tests/test262/language/expressions/object/11.1.5_7-3-2.js new file mode 100644 index 0000000000..954f45f87e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/11.1.5_7-3-2.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyAssignment : get PropertyName ( ) { FunctionBody } + 3.Let desc be the Property Descriptor{[[Get]]: closure, [[Enumerable]]: true, [[Configurable]]: true} +es5id: 11.1.5_7-3-2 +description: > + Object literal - property descriptor for set property assignment + should not create a get function +---*/ + + var o; + eval("o = {set foo(arg){}};"); + var desc = Object.getOwnPropertyDescriptor(o,"foo"); + +assert.sameValue(desc.get, undefined, 'desc.get'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A1.1.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.1.js new file mode 100644 index 0000000000..a4c27bd345 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Evaluate the production ObjectLiteral: { }" +es5id: 11.1.5_A1.1 +description: > + Checking various properteis of the object defined with "var object + = {}" +---*/ + +var object = {}; + +//CHECK#1 +if (typeof object !== "object") { + throw new Test262Error('#1: var object = {}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + throw new Test262Error('#2: var object = {}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + throw new Test262Error('#3: var object = {}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object.toString() !== "[object Object]") { + throw new Test262Error('#4: var object = {}; object.toString === "[object Object]". Actual: ' + (object.toString)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A1.2.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.2.js new file mode 100644 index 0000000000..0156e45f19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.2.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Evaluate the production ObjectLiteral: { NumericLiteral : + AssignmentExpression} +es5id: 11.1.5_A1.2 +description: > + Checking various properteis and contents of the object defined + with "var object = {1 : true}" +---*/ + +var object = {1 : true}; + +//CHECK#1 +if (typeof object !== "object") { + throw new Test262Error('#1: var object = {1 : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + throw new Test262Error('#2: var object = {1 : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + throw new Test262Error('#3: var object = {1 : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object[1] !== true) { + throw new Test262Error('#4: var object = {1 : true}; object[1] === true'); +} + +//CHECK#5 +if (object["1"] !== true) { + throw new Test262Error('#5: var object = {1 : true}; object["1"] === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A1.3.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.3.js new file mode 100644 index 0000000000..43574f5daa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.3.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Evaluate the production ObjectLiteral: { StringLiteral : + AssignmentExpression} +es5id: 11.1.5_A1.3 +description: > + Checking various properteis and contents of the object defined + with "var object = {"x" : true}" +---*/ + +var object = {"x" : true}; + +//CHECK#1 +if (typeof object !== "object") { + throw new Test262Error('#1: var object = {"x" : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + throw new Test262Error('#2: var object = {"x" : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + throw new Test262Error('#3: var object = {"x" : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object["x"] !== true) { + throw new Test262Error('#4: var object = {"x" : true}; object["x"] === true'); +} + +//CHECK#5 +if (object.x !== true) { + throw new Test262Error('#5: var object = {"x" : true}; object.x === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A1.4.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.4.js new file mode 100644 index 0000000000..055b4597bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A1.4.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Evaluate the production ObjectLiteral: { Identifier : + AssignmentExpression} +es5id: 11.1.5_A1.4 +description: > + Checking various properteis and contents of the object defined + with "var object = {prop : true}" +---*/ + +var object = {prop : true}; + +//CHECK#1 +if (typeof object !== "object") { + throw new Test262Error('#1: var object = {prop : true}; typeof object === "object". Actual: ' + (typeof object)); +} + +//CHECK#2 +if (object instanceof Object !== true) { + throw new Test262Error('#2: var object = {prop : true}; object instanceof Object === true'); +} + +//CHECK#3 +if (object.toString !== Object.prototype.toString) { + throw new Test262Error('#3: var object = {prop : true}; object.toString === Object.prototype.toString. Actual: ' + (object.toString)); +} + +//CHECK#4 +if (object["prop"] !== true) { + throw new Test262Error('#4: var object = {prop : true}; object["prop"] === true'); +} + +//CHECK#5 +if (object.prop !== true) { + throw new Test262Error('#5: var object = {prop : true}; object.prop === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A2.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A2.js new file mode 100644 index 0000000000..543c481149 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A2.js @@ -0,0 +1,96 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Evaluate the production ObjectLiteral: { PropertyName : + AssignmentExpression } +es5id: 11.1.5_A2 +description: Creating property "prop" of various types(boolean, number and etc.) +---*/ + +//CHECK#1 +var x = true; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#1: var x = true; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#2 +var x = new Boolean(true); +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#2: var x = new Boolean(true); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#3 +var x = 1; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#3: var x = 1; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#4 +var x = new Number(1); +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#4: var x = new Number(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#5 +var x = "1"; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#5: var x = "1"; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#6 +var x = new String(1); +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#6: var x = new String(1); var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#7 +var x = undefined; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#7: var x = undefined; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#8 +var x = null; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#8: var x = null; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#9 +var x = {}; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#9: var x = {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#10 +var x = [1,2]; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#10: var x = [1,2]; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#11 +var x = function() {}; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#11: var x = function() {}; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +//CHECK#12 +var x = this; +var object = {prop : x}; +if (object.prop !== x) { + throw new Test262Error('#12: var x = this; var object = {prop : x}; object.prop === x. Actual: ' + (object.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A3.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A3.js new file mode 100644 index 0000000000..bd8a673074 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: "Evaluate the production ObjectLiteral: { PropertyNameAndValueList }" +es5id: 11.1.5_A3 +description: > + Creating the object defined with "var object = {0 : 1, "1" : "x", + o : {}}" +---*/ + +var object = {0 : 1, "1" : "x", o : {}}; + +//CHECK#1 +if (object[0] !== 1) { + throw new Test262Error('#1: var object = {0 : 1; "1" : "x"; o : {}}; object[0] === 1. Actual: ' + (object[0])); +} + +//CHECK#2 +if (object["1"] !== "x") { + throw new Test262Error('#2: var object = {0 : 1; "1" : "x"; o : {}}; object["1"] === "x". Actual: ' + (object["1"])); +} + +//CHECK#3 +if (typeof object.o !== "object") { + throw new Test262Error('#1: var object = {0 : 1; "1" : "x"; o : {}}; typeof object.o === "object". Actual: ' + (typeof object.o)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A4.1.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A4.1.js new file mode 100644 index 0000000000..c4f19a24b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A4.1.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The PropertyName is not really a BooleanLiteral +es5id: 11.1.5_A4.1 +description: "Checking if execution of \"var object = {true : 1}\" does not fail" +---*/ + +//CHECK#1 +var object = {true : 1}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A4.2.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A4.2.js new file mode 100644 index 0000000000..132c41b4c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A4.2.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The PropertyName is not really a nullLiteral +es5id: 11.1.5_A4.2 +description: "Checking if execution of \"var object = {null : true}\" does not fail" +---*/ + +//CHECK#1 +var object = {null : true}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/S11.1.5_A4.3.js b/js/src/tests/test262/language/expressions/object/S11.1.5_A4.3.js new file mode 100644 index 0000000000..dd5334f3e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/S11.1.5_A4.3.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + The PropertyName is undefined, ToString(BooleanLiteral), + ToString(nullLiteral) +es5id: 11.1.5_A4.3 +description: "Creating properties with following names: undefined, 'true', 'null'" +---*/ + +//CHECK#1 +var object = {undefined : true}; +if (object.undefined !== true) { + throw new Test262Error('#1: var object = {undefined : true}; object.undefined === true'); +} + +//CHECK#2 +var object = {undefined : true}; +if (object["undefined"] !== true) { + throw new Test262Error('#2: var object = {undefined : true}; object["undefined"] === true'); +} + +//CHECK#3 +var object = {"true" : true}; +if (object["true"] !== true) { + throw new Test262Error('#3: var object = {"true" : true}; object["true"] === true'); +} + +//CHECK#4 +var object = {"null" : true}; +if (object["null"] !== true) { + throw new Test262Error('#4: var object = {"null" : true}; object["null"] === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-duplicate-computed.js b/js/src/tests/test262/language/expressions/object/__proto__-duplicate-computed.js new file mode 100644 index 0000000000..99ac9e1374 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-duplicate-computed.js @@ -0,0 +1,56 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-__proto__-property-names-in-object-initializers +es6id: B.3.1 +description: > + The syntax error for duplicate `__proto__` property is not valid if the duplicate is a + ComputedPropertyName +info: | + B.3.1__proto__ Property Names in Object Initializers + + It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains any duplicate + entries for "__proto__" and at least two of those entries were obtained from productions of + the form + PropertyDefinition : PropertyName : AssignmentExpression . + + 12.2.6.6 Static Semantics: PropertyNameList + + ... + 3. Append PropName of PropertyDefinition to the end of list. + ... + + 12.2.6.5 Static Semantics: PropName + + ComputedPropertyName : [ AssignmentExpression ] + 1. Return empty. +---*/ + +var obj; +var proto = {}; +var ownProp = {}; + +obj = { + __proto__: proto, + ['__proto__']: {}, + ['__proto__']: ownProp +}; + +assert.sameValue( + Object.getPrototypeOf(obj), + proto, + 'prototype is defined' +); + +assert( + Object.prototype.hasOwnProperty.call(obj, '__proto__'), + 'has own property __proto__' +); + +assert.sameValue( + obj.__proto__, + ownProp, + 'own property value' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-duplicate.js b/js/src/tests/test262/language/expressions/object/__proto__-duplicate.js new file mode 100644 index 0000000000..3506c2819c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-duplicate.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-__proto__-property-names-in-object-initializers +es6id: B.3.1 +description: Duplicate `__proto__` property +info: | + It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains + any duplicate entries for "__proto__" and at least two of those entries + were obtained from productions of the form + PropertyDefinition : PropertyName : AssignmentExpression . +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + __proto__: null, + other: null, + '__proto__': null +}); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-fn-name.js b/js/src/tests/test262/language/expressions/object/__proto__-fn-name.js new file mode 100644 index 0000000000..57a654afd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-fn-name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: B.3.1 +description: Function name is not assigned based on the property name +info: | + [...] + 6. If propKey is the String value "__proto__" and if + IsComputedPropertyKey(propKey) is false, then + a. If Type(propValue) is either Object or Null, then + i. Return object.[[SetPrototypeOf]](propValue). + b. Return NormalCompletion(empty). + 7. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be HasOwnProperty(propValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(propValue, propKey). +---*/ + +var o; + +o = { + __proto__: function() {} +}; + +assert(o.__proto__.name !== '__proto__'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-permitted-dup-shorthand.js b/js/src/tests/test262/language/expressions/object/__proto__-permitted-dup-shorthand.js new file mode 100644 index 0000000000..e22f33e83e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-permitted-dup-shorthand.js @@ -0,0 +1,27 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer +description: Permitted duplicate `__proto__` property (shorthand) +info: | + Annex B defines an early error for duplicate PropertyName of `__proto__`, + but this does not apply to properties created from other productions. + + B.3.1 __proto__ Property Names in Object Initializers + + It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains + any duplicate entries for "__proto__" and at least two of those entries + were obtained from productions of the form + PropertyDefinition : PropertyName : AssignmentExpression . +---*/ + +var __proto__ = 2; +var obj = { + __proto__, + __proto__, +}; + +assert(obj.hasOwnProperty("__proto__")); +assert.sameValue(obj.__proto__, 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-permitted-dup.js b/js/src/tests/test262/language/expressions/object/__proto__-permitted-dup.js new file mode 100644 index 0000000000..778b7aef71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-permitted-dup.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer +description: Permitted duplicate `__proto__` property +info: | + Annex B defines an early error for duplicate PropertyName of `__proto__`, + but this does not apply to properties created from other productions. + + B.3.1 __proto__ Property Names in Object Initializers + + It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains + any duplicate entries for "__proto__" and at least two of those entries + were obtained from productions of the form + PropertyDefinition : PropertyName : AssignmentExpression . +features: [generators, async-functions, async-iteration, __proto__] +---*/ + +var obj = { + __proto__: null, + __proto_: null, + __proto: null, + _proto__: null, + proto__: null, + ['__proto__']: null, + __proto__() {}, + * __proto__() {}, + async __proto__() {}, + async * __proto__() {}, + get __proto__() { return 33; }, + set __proto__(_) { return 44; } +}; + +var desc = Object.getOwnPropertyDescriptor(obj, '__proto__'); + +assert.sameValue(desc.get(), 33); +assert.sameValue(desc.set(), 44); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-poisoned-object-prototype.js b/js/src/tests/test262/language/expressions/object/__proto__-poisoned-object-prototype.js new file mode 100644 index 0000000000..962353cf83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-poisoned-object-prototype.js @@ -0,0 +1,34 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-__proto__-property-names-in-object-initializers +description: > + The value of the `__proto__` property key is assigned to the [[Prototype]]. + Object.prototype.__proto__ setter should not be called. +info: | + __proto__ Property Names in Object Initializers + + PropertyDefinition : PropertyName : AssignmentExpression + + [...] + 7. If isProtoSetter is true, then + a. If Type(propValue) is either Object or Null, then + i. Return object.[[SetPrototypeOf]](propValue). +---*/ + +Object.defineProperty(Object.prototype, '__proto__', { + set: function() { + throw new Test262Error('should not be called'); + }, +}); + +var proto = {}; + +var object = { + __proto__: proto +}; + +assert(!object.hasOwnProperty('__proto__')); +assert.sameValue(Object.getPrototypeOf(object), proto); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-value-non-object.js b/js/src/tests/test262/language/expressions/object/__proto__-value-non-object.js new file mode 100644 index 0000000000..0b5733a7bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-value-non-object.js @@ -0,0 +1,92 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-__proto__-property-names-in-object-initializers +es6id: B.3.1 +description: > + The value of the `__proto__` property key is not assigned to the + [[Prototype]] internal slot, nor to a property named "__proto__" (non-Object, + non-null value) +info: | + ... + 6. If propKey is the String value "__proto__" and if + IsComputedPropertyKey(propKey) is false, then + a. If Type(propValue) is either Object or Null, then + [...] + b. Return NormalCompletion(empty). +features: [Symbol] +---*/ + +var object; + +object = { + __proto__: undefined +}; +assert.sameValue( + Object.getPrototypeOf(object), + Object.prototype, + 'prototype (undefined)' +); +assert.sameValue( + Object.getOwnPropertyDescriptor(object, '__proto__'), + undefined, + 'property (undefined)' +); + +object = { + __proto__: 1 +}; +assert.sameValue( + Object.getPrototypeOf(object), + Object.prototype, + 'prototype (numeric primitive)' +); +assert.sameValue( + Object.getOwnPropertyDescriptor(object, '__proto__'), + undefined, + 'property (numeric primitive)' +); + +object = { + __proto__: false +}; +assert.sameValue( + Object.getPrototypeOf(object), + Object.prototype, + 'prototype (boolean primitive)' +); +assert.sameValue( + Object.getOwnPropertyDescriptor(object, '__proto__'), + undefined, + 'property (boolean primitive)' +); + +object = { + __proto__: 'string literal' +}; +assert.sameValue( + Object.getPrototypeOf(object), + Object.prototype, + 'prototype (string primitive)' +); +assert.sameValue( + Object.getOwnPropertyDescriptor(object, '__proto__'), + undefined, + 'property (string primitive)' +); + +object = { + __proto__: Symbol('') +}; +assert.sameValue( + Object.getPrototypeOf(object), + Object.prototype, + 'prototype (symbol)' +); +assert.sameValue( + Object.getOwnPropertyDescriptor(object, '__proto__'), + undefined, + 'property (symbol)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-value-null.js b/js/src/tests/test262/language/expressions/object/__proto__-value-null.js new file mode 100644 index 0000000000..eb00e102d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-value-null.js @@ -0,0 +1,26 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-__proto__-property-names-in-object-initializers +es6id: B.3.1 +description: > + The value of the `__proto__` property key is assigned to the [[Prototype]] + internal slot (null value) +info: | + ... + 6. If propKey is the String value "__proto__" and if + IsComputedPropertyKey(propKey) is false, then + a. If Type(propValue) is either Object or Null, then + i. Return object.[[SetPrototypeOf]](propValue). +---*/ + +var object = { + __proto__: null +}; + +assert.sameValue(Object.getPrototypeOf(object), null); +assert.sameValue( + Object.getOwnPropertyDescriptor(object, '__proto__'), undefined +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/__proto__-value-obj.js b/js/src/tests/test262/language/expressions/object/__proto__-value-obj.js new file mode 100644 index 0000000000..45cb2dcf84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/__proto__-value-obj.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-__proto__-property-names-in-object-initializers +es6id: B.3.1 +description: > + The value of the `__proto__` property key is assigned to the [[Prototype]] + internal slot (Object value) +info: | + __proto__ Property Names in Object Initializers + + ... + 6. If propKey is the String value "__proto__" and if IsComputedPropertyKey(propKey) is false, then + a. If Type(propValue) is either Object or Null, then + i. Return object.[[SetPrototypeOf]](propValue). + b. Return NormalCompletion(empty). + ... +---*/ + +var proto = {}; + +var object = { + __proto__: proto +}; + +assert.sameValue(Object.getPrototypeOf(object), proto); +assert.sameValue( + Object.getOwnPropertyDescriptor(object, '__proto__'), undefined +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-evaluation.js b/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-evaluation.js new file mode 100644 index 0000000000..379b3926a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-evaluation.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-evaluation.case +// - src/accessor-names/error/obj.template +/*--- +description: Abrupt completion when evaluating expression (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 Runtime Semantics: Evaluation + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ +var thrower = function() { + throw new Test262Error(); +}; + + +assert.throws(Test262Error, function() { + ({ + get [thrower()]() {} + }); +}, '`get` accessor'); + +assert.throws(Test262Error, function() { + ({ + set [thrower()](_) {} + }); +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-to-prop-key.js b/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-to-prop-key.js new file mode 100644 index 0000000000..9e733e1fa0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-to-prop-key.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-to-prop-key.case +// - src/accessor-names/error/obj.template +/*--- +description: Abrupt completion when coercing to property key value (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). + + 7.1.14 ToPropertyKey + + 1. Let key be ? ToPrimitive(argument, hint String). + + 7.1.1 ToPrimitive + + [...] + 7. Return ? OrdinaryToPrimitive(input, hint). + + 7.1.1.1 OrdinaryToPrimitive + + 5. For each name in methodNames in List order, do + [...] + 6. Throw a TypeError exception. +---*/ +var badKey = Object.create(null); + + +assert.throws(TypeError, function() { + ({ + get [badKey]() {} + }); +}, '`get` accessor'); + +assert.throws(TypeError, function() { + ({ + set [badKey](_) {} + }); +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-unresolvable.js b/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-unresolvable.js new file mode 100644 index 0000000000..2100584729 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-computed-err-unresolvable.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed-err-unresolvable.case +// - src/accessor-names/error/obj.template +/*--- +description: Abrupt completion when resolving reference value (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). +---*/ + +assert.throws(ReferenceError, function() { + ({ + get [test262unresolvable]() {} + }); +}, '`get` accessor'); + +assert.throws(ReferenceError, function() { + ({ + set [test262unresolvable](_) {} + }); +}, '`set` accessor'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-computed-in.js b/js/src/tests/test262/language/expressions/object/accessor-name-computed-in.js new file mode 100644 index 0000000000..5a74e16fee --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-computed-in.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +description: > + AssignmentExpression may contain `in` keyword regardless of outer context +info: | + 12.2.6.7 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 empty = Object.create(null); +var obj, value; + +for (obj = { get ['x' in empty]() { return 'via get'; } }; ; ) { + value = obj.false; + break; +} + +assert.sameValue(value, 'via get'); + +for (obj = { set ['x' in empty](param) { value = param; } }; ; ) { + obj.false = 'via set'; + break; +} + +assert.sameValue(value, 'via set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-expr.js b/js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-expr.js new file mode 100644 index 0000000000..b1d64c522e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-expr.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +description: > + The `yield` keyword behaves as a YieldExpression within a generator function +info: | + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +features: [generators] +---*/ + +var yieldSet, obj, iter; +function* g() { + obj = { + get [yield]() { return 'get yield'; }, + set [yield](param) { yieldSet = param; } + }; +} + +iter = g(); + +iter.next(); +iter.next('first'); +iter.next('second'); + +assert.sameValue(obj.first, 'get yield'); + +obj.second = 'set yield'; + +assert.sameValue(yieldSet, 'set yield'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-id.js b/js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-id.js new file mode 100644 index 0000000000..4c3a43b6c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-computed-yield-id.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +description: > + The `yield` keyword behaves as an Identifier outside of a generator function +info: | + 12.2.6.7 Runtime Semantics: Evaluation + + [...] + + ComputedPropertyName : [ AssignmentExpression ] + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let propName be ? GetValue(exprValue). + 3. Return ? ToPropertyKey(propName). +flags: [noStrict] +---*/ + +var yield = 'y'; +var yieldSet; +var obj = { + get [yield]() { return 'get yield'; }, + set [yield](param) { yieldSet = param; } +}; + +assert.sameValue(obj.y, 'get yield'); + +obj.y = 'set yield'; + +assert.sameValue(yieldSet, 'set yield'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-computed.js b/js/src/tests/test262/language/expressions/object/accessor-name-computed.js new file mode 100644 index 0000000000..c42ff64358 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-computed.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/computed.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (AssignmentExpression) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 _; + + +var stringSet; +var obj = { + get [[_ = 'str' + 'ing']]() { return 'get string'; }, + set [[_ = 'str' + 'ing']](param) { stringSet = param; } +}; + +assert.sameValue(obj['string'], 'get string'); + +obj['string'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-binary.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-binary.js new file mode 100644 index 0000000000..1eb39223d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-binary.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-binary.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in binary notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get [0b10]() { return 'get string'; }, + set [0b10](param) { stringSet = param; } +}; + +assert.sameValue(obj['2'], 'get string'); + +obj['2'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-exponent.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-exponent.js new file mode 100644 index 0000000000..30b76fd373 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-exponent.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-exponent.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in exponent notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get [1E+9]() { return 'get string'; }, + set [1E+9](param) { stringSet = param; } +}; + +assert.sameValue(obj['1000000000'], 'get string'); + +obj['1000000000'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-hex.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-hex.js new file mode 100644 index 0000000000..852119ec08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-hex.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-hex.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in hexadecimal notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get [0x10]() { return 'get string'; }, + set [0x10](param) { stringSet = param; } +}; + +assert.sameValue(obj['16'], 'get string'); + +obj['16'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js new file mode 100644 index 0000000000..002d0b215a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-leading-decimal.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-leading-decimal.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal with leading decimal point) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get [.1]() { return 'get string'; }, + set [.1](param) { stringSet = param; } +}; + +assert.sameValue(obj['0.1'], 'get string'); + +obj['0.1'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-non-canonical.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-non-canonical.js new file mode 100644 index 0000000000..78a293c9fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-non-canonical.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-non-canonical.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal with non-canonical representation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get [0.0000001]() { return 'get string'; }, + set [0.0000001](param) { stringSet = param; } +}; + +assert.sameValue(obj['1e-7'], 'get string'); + +obj['1e-7'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-octal.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-octal.js new file mode 100644 index 0000000000..a637032860 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-octal.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-octal.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal in octal notation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get [0o10]() { return 'get string'; }, + set [0o10](param) { stringSet = param; } +}; + +assert.sameValue(obj['8'], 'get string'); + +obj['8'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-zero.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-zero.js new file mode 100644 index 0000000000..7d4b7b5981 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-numeric-zero.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-numeric-zero.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (numeric literal zero) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get [0]() { return 'get string'; }, + set [0](param) { stringSet = param; } +}; + +assert.sameValue(obj['0'], 'get string'); + +obj['0'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-char-escape.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-char-escape.js new file mode 100644 index 0000000000..e59e0c7c7e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-char-escape.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-char-escape.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal containing a character escape sequence) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['character\tescape']() { return 'get string'; }, + set ['character\tescape'](param) { stringSet = param; } +}; + +assert.sameValue(obj['character escape'], 'get string'); + +obj['character escape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped-ext.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped-ext.js new file mode 100644 index 0000000000..b064df0327 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped-ext.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped-ext.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal 'default' w/ extended escape) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['def\u{61}ult']() { return 'get string'; }, + set ['def\u{61}ult'](param) { stringSet = param; } +}; + +assert.sameValue(obj['default'], 'get string'); + +obj['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped.js new file mode 100644 index 0000000000..5d3ae79251 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default-escaped.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default-escaped.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal 'default' escaped) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['def\u0061ult']() { return 'get string'; }, + set ['def\u0061ult'](param) { stringSet = param; } +}; + +assert.sameValue(obj['default'], 'get string'); + +obj['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default.js new file mode 100644 index 0000000000..51390630f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-default.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-default.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal 'default') (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['default']() { return 'get string'; }, + set ['default'](param) { stringSet = param; } +}; + +assert.sameValue(obj['default'], 'get string'); + +obj['default'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-double-quote.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-double-quote.js new file mode 100644 index 0000000000..32e393eae3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-double-quote.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-double-quote.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal using double quotes) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ["doubleQuote"]() { return 'get string'; }, + set ["doubleQuote"](param) { stringSet = param; } +}; + +assert.sameValue(obj["doubleQuote"], 'get string'); + +obj["doubleQuote"] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-empty.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-empty.js new file mode 100644 index 0000000000..2e55ecc9cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-empty.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-empty.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal, the empty string) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['']() { return 'get string'; }, + set [''](param) { stringSet = param; } +}; + +assert.sameValue(obj[''], 'get string'); + +obj[''] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-hex-escape.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-hex-escape.js new file mode 100644 index 0000000000..60f856c981 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-hex-escape.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-hex-escape.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal containing a hexadecimal escape sequence) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['hex\x45scape']() { return 'get string'; }, + set ['hex\x45scape'](param) { stringSet = param; } +}; + +assert.sameValue(obj['hexEscape'], 'get string'); + +obj['hexEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-line-continuation.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-line-continuation.js new file mode 100644 index 0000000000..7c72aa4884 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-line-continuation.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-line-continuation.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal containing LineContinuation) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['line\ +Continuation']() { return 'get string'; }, + set ['line\ +Continuation'](param) { stringSet = param; } +}; + +assert.sameValue(obj['lineContinuation'], 'get string'); + +obj['lineContinuation'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-single-quote.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-single-quote.js new file mode 100644 index 0000000000..f71aaa300a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-single-quote.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-single-quote.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal using single quotes) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['singleQuote']() { return 'get string'; }, + set ['singleQuote'](param) { stringSet = param; } +}; + +assert.sameValue(obj['singleQuote'], 'get string'); + +obj['singleQuote'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-unicode-escape.js b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-unicode-escape.js new file mode 100644 index 0000000000..1ea68b6ddf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/accessor-name-literal-string-unicode-escape.js @@ -0,0 +1,39 @@ +// This file was procedurally generated from the following sources: +// - src/accessor-names/literal-string-unicode-escape.case +// - src/accessor-names/default/obj.template +/*--- +description: Computed values as accessor property names (string literal containing a Unicode escape sequence) (Object initializer) +esid: sec-object-initializer-runtime-semantics-evaluation +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + + 12.2.6.7 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 stringSet; +var obj = { + get ['unicod\u{000065}Escape']() { return 'get string'; }, + set ['unicod\u{000065}Escape'](param) { stringSet = param; } +}; + +assert.sameValue(obj['unicodeEscape'], 'get string'); + +obj['unicodeEscape'] = 'set string'; +assert.sameValue(stringSet, 'set string'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/browser.js b/js/src/tests/test262/language/expressions/object/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/computed-__proto__.js b/js/src/tests/test262/language/expressions/object/computed-__proto__.js new file mode 100644 index 0000000000..b50b1ec901 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/computed-__proto__.js @@ -0,0 +1,180 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-PropertyDefinition +description: > + computed __proto__ property key is assigned to an own property +info: | + 12.2.6 Object Initializer + + PropertyDefinition[Yield, Await] : + PropertyName[?Yield, ?Await] : AssignmentExpression[+In, ?Yield, ?Await] + + PropertyName[Yield, Await] : + LiteralPropertyName + ComputedPropertyName[?Yield, ?Await] + + ComputedPropertyName[Yield, Await] : + [ AssignmentExpression[+In, ?Yield, ?Await] ] + + B.3.1__proto__ Property Names in Object Initializers + + ... + 5. If propKey is the String value "__proto__" and if IsComputedPropertyKey(propKey) + is false, then + a. If Type(propValue) is either Object or Null, then + i. Return object.[[SetPrototypeOf]](propValue). + b. Return NormalCompletion(empty). +features: [Symbol] +---*/ + +var obj; +var sample = {}; + +obj = { + ['__proto__']: sample +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (ordinary object)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (ordinary object)' +); +assert.sameValue( + obj.__proto__, + sample, + 'value is properly defined (ordinary object)' +); + +obj = { + ['__proto__']: null +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (null)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (null)' +); +assert.sameValue( + obj.__proto__, + null, + 'value is properly defined (null)' +); + +obj = { + ['__proto__']: undefined +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (undefined)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (undefined)' +); +assert.sameValue( + obj.__proto__, + undefined, + 'value is properly defined (undefined)' +); + +var func = function() {}; +obj = { + ['__proto__']: func +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (func)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (func)' +); +assert.sameValue( + obj.__proto__, + func, + 'value is properly defined (func)' +); + +var symbol = Symbol('Leo'); +obj = { + ['__proto__']: symbol +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (symbol)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (symbol)' +); +assert.sameValue( + obj.__proto__, + symbol, + 'value is properly defined (symbol)' +); + +obj = { + ['__proto__']: 42 +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (number)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (number)' +); +assert.sameValue( + obj.__proto__, + 42, + 'value is properly defined (number)' +); + +obj = { + ['__proto__']: '' +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (string)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (string)' +); +assert.sameValue( + obj.__proto__, + '', + 'value is properly defined (string)' +); + +obj = { + ['__proto__']: false +}; +assert.sameValue( + Object.getPrototypeOf(obj), + Object.prototype, + 'does not change the object prototype (boolean)' +); +assert( + obj.hasOwnProperty('__proto__'), + 'computed __proto__ property is set as an own property (boolean)' +); +assert.sameValue( + obj.__proto__, + false, + 'value is properly defined (boolean)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/computed-property-evaluation-order.js b/js/src/tests/test262/language/expressions/object/computed-property-evaluation-order.js new file mode 100644 index 0000000000..0a76ced416 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/computed-property-evaluation-order.js @@ -0,0 +1,28 @@ +// Copyright (C) 2016 Michael Ficarra. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-propertydefinitionevaluation +description: > + Evaluation of PropertyDefinitionList occurs in order, and each + PropertyDefinition's PropertyName is evaluated before its + AssignmentExpression. +---*/ + +var counter = 0; +var o = { + [++counter]: ++counter, + [++counter]: ++counter, + [++counter]: ++counter, +} + +var keys = Object.getOwnPropertyNames(o); + +assert.sameValue(keys.length, 3, '3 PropertyDefinitions should result in 3 properties'); +assert.sameValue(keys[0], '1'); +assert.sameValue(o[keys[0]], 2); +assert.sameValue(keys[1], '3'); +assert.sameValue(o[keys[1]], 4); +assert.sameValue(keys[2], '5'); +assert.sameValue(o[keys[2]], 6); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/concise-generator.js b/js/src/tests/test262/language/expressions/object/concise-generator.js new file mode 100644 index 0000000000..eac0a596b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/concise-generator.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + super method calls in object literal concise generator +features: [generators] +---*/ +var proto = { + method() { + return 42; + } +}; + +var object = { + *g() { + yield super.method(); + } +}; + +Object.setPrototypeOf(object, proto); + +assert.sameValue( + object.g().next().value, + 42, + "The value of `object.g().next().value` is `42`, after executing `Object.setPrototypeOf(object, proto);`, where `object " + String(object) + "`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cover-initialized-name.js b/js/src/tests/test262/language/expressions/object/cover-initialized-name.js new file mode 100644 index 0000000000..dadf23f952 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cover-initialized-name.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-static-semantics-early-errors +es6id: 12.2.6.1 +description: Initialized name is explicitly barred from object initializers +info: | + PropertyDefinition : CoverInitializedName + + - Always throw a Syntax Error if code matches this production. + + NOTE This production exists so that ObjectLiteral can serve as a cover + grammar for ObjectAssignmentPattern. It cannot occur in an actual object + initializer. + + 12.2.6 Object Initializer + + Syntax + + [...] + + CoverInitializedName[Yield]: + + IdentifierReference[?Yield] Initializer[+In, ?Yield] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ a = 1 }); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-break-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-break-escaped.js new file mode 100644 index 0000000000..ca96dd776e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-break-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: break is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ bre\u0061k: 42 }); + +assert.sameValue(obj['break'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-case-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-case-escaped.js new file mode 100644 index 0000000000..312914aaac --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-case-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: case is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ c\u0061se: 42 }); + +assert.sameValue(obj['case'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-catch-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-catch-escaped.js new file mode 100644 index 0000000000..3b70c779e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-catch-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: catch is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ c\u0061tch: 42 }); + +assert.sameValue(obj['catch'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-class-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-class-escaped.js new file mode 100644 index 0000000000..69cb3ef4f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-class-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: class is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ cl\u0061ss: 42 }); + +assert.sameValue(obj['class'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-const-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-const-escaped.js new file mode 100644 index 0000000000..0223f5ce46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-const-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: const is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0063onst: 42 }); + +assert.sameValue(obj['const'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-continue-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-continue-escaped.js new file mode 100644 index 0000000000..b696766bc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-continue-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: continue is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0063ontinue: 42 }); + +assert.sameValue(obj['continue'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-debugger-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-debugger-escaped.js new file mode 100644 index 0000000000..9dad19cf98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-debugger-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: debugger is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0064ebugger: 42 }); + +assert.sameValue(obj['debugger'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped-ext.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped-ext.js new file mode 100644 index 0000000000..f1c7476e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped-ext.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: default is a valid identifier name, using extended escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ def\u{61}ult: 42 }); + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped.js new file mode 100644 index 0000000000..c5ab6a03f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: default is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ def\u0061ult: 42 }); + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default.js new file mode 100644 index 0000000000..f7ded1b7b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-default.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: default is a valid identifier name (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ default: 42 }); + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-delete-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-delete-escaped.js new file mode 100644 index 0000000000..3e60549d24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-delete-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: delete is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0064elete: 42 }); + +assert.sameValue(obj['delete'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-do-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-do-escaped.js new file mode 100644 index 0000000000..353eab7328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-do-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: do is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0064o: 42 }); + +assert.sameValue(obj['do'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-else-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-else-escaped.js new file mode 100644 index 0000000000..6b38f37a0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-else-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: else is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0065lse: 42 }); + +assert.sameValue(obj['else'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-enum-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-enum-escaped.js new file mode 100644 index 0000000000..d53662c4e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-enum-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: enum is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0065num: 42 }); + +assert.sameValue(obj['enum'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-export-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-export-escaped.js new file mode 100644 index 0000000000..5b85460300 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-export-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: export is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0065xport: 42 }); + +assert.sameValue(obj['export'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped-ext.js new file mode 100644 index 0000000000..0709ac416b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped-ext.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: extends is a valid identifier name, using extended escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u{65}xtends: 42 }); + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped.js new file mode 100644 index 0000000000..146047df51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: extends is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0065xtends: 42 }); + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends.js new file mode 100644 index 0000000000..d7ea054935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-extends.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: extends is a valid identifier name (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ extends: 42 }); + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-finally-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-finally-escaped.js new file mode 100644 index 0000000000..3e7e85d48a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-finally-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: finally is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0066inally: 42 }); + +assert.sameValue(obj['finally'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-for-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-for-escaped.js new file mode 100644 index 0000000000..86ec45196f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-for-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: for is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0066or: 42 }); + +assert.sameValue(obj['for'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-function-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-function-escaped.js new file mode 100644 index 0000000000..11a4f44214 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-function-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: function is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0066unction: 42 }); + +assert.sameValue(obj['function'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-if-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-if-escaped.js new file mode 100644 index 0000000000..549e97c714 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-if-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: if is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ i\u0066: 42 }); + +assert.sameValue(obj['if'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-implements-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-implements-escaped.js new file mode 100644 index 0000000000..52b4625343 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-implements-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: implements is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0069mplements: 42 }); + +assert.sameValue(obj['implements'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-import-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-import-escaped.js new file mode 100644 index 0000000000..6dbfbdd730 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-import-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: import is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0069mport: 42 }); + +assert.sameValue(obj['import'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-in-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-in-escaped.js new file mode 100644 index 0000000000..6fa00ec665 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-in-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: in is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0069n: 42 }); + +assert.sameValue(obj['in'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-instanceof-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-instanceof-escaped.js new file mode 100644 index 0000000000..472996dbec --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-instanceof-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: instanceof is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ \u0069nstanceof: 42 }); + +assert.sameValue(obj['instanceof'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-interface-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-interface-escaped.js new file mode 100644 index 0000000000..2f12ec569f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-interface-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: interface is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ interf\u0061ce: 42 }); + +assert.sameValue(obj['interface'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-let-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-let-escaped.js new file mode 100644 index 0000000000..50a1a8a8a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-let-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: let is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ l\u0065t: 42 }); + +assert.sameValue(obj['let'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-new-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-new-escaped.js new file mode 100644 index 0000000000..a924055ff5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-new-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: new is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ n\u0065w: 42 }); + +assert.sameValue(obj['new'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-package-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-package-escaped.js new file mode 100644 index 0000000000..3200b53d7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-package-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: package is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ p\u0061ckage: 42 }); + +assert.sameValue(obj['package'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-private-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-private-escaped.js new file mode 100644 index 0000000000..2285d9d5ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-private-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: private is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ privat\u0065: 42 }); + +assert.sameValue(obj['private'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-protected-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-protected-escaped.js new file mode 100644 index 0000000000..4d60c414dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-protected-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: protected is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ prot\u0065cted: 42 }); + +assert.sameValue(obj['protected'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-public-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-public-escaped.js new file mode 100644 index 0000000000..37f214579e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-public-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: public is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ pu\u0062lic: 42 }); + +assert.sameValue(obj['public'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-return-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-return-escaped.js new file mode 100644 index 0000000000..3b9d525d44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-return-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: return is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ r\u0065turn: 42 }); + +assert.sameValue(obj['return'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-static-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-static-escaped.js new file mode 100644 index 0000000000..bb334f7df5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-static-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/covered-obj-prop-name.template +/*--- +description: static is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ st\u0061tic: 42 }); + +assert.sameValue(obj['static'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-super-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-super-escaped.js new file mode 100644 index 0000000000..e8a1e00e2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-super-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: super is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ sup\u0065r: 42 }); + +assert.sameValue(obj['super'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-switch-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-switch-escaped.js new file mode 100644 index 0000000000..3a35885ad0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-switch-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: switch is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ sw\u0069tch: 42 }); + +assert.sameValue(obj['switch'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-this-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-this-escaped.js new file mode 100644 index 0000000000..673b6e0c49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-this-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: this is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ th\u0069s: 42 }); + +assert.sameValue(obj['this'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-throw-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-throw-escaped.js new file mode 100644 index 0000000000..7f70c262ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-throw-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: throw is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ t\u0068row: 42 }); + +assert.sameValue(obj['throw'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-try-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-try-escaped.js new file mode 100644 index 0000000000..dfa5596132 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-try-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: try is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ tr\u0079: 42 }); + +assert.sameValue(obj['try'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-typeof-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-typeof-escaped.js new file mode 100644 index 0000000000..63de6021a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-typeof-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: typeof is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ typ\u0065of: 42 }); + +assert.sameValue(obj['typeof'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-var-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-var-escaped.js new file mode 100644 index 0000000000..8511ef73e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-var-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: var is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ v\u0061r: 42 }); + +assert.sameValue(obj['var'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-void-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-void-escaped.js new file mode 100644 index 0000000000..48e72592d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-void-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: void is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ voi\u0064: 42 }); + +assert.sameValue(obj['void'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-while-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-while-escaped.js new file mode 100644 index 0000000000..381db509e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-while-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: while is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ whil\u0065: 42 }); + +assert.sameValue(obj['while'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-with-escaped.js b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-with-escaped.js new file mode 100644 index 0000000000..ef519e3644 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/covered-ident-name-prop-name-literal-with-escaped.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/covered-obj-prop-name.template +/*--- +description: with is a valid identifier name, using escape (PropertyName in a CoverParenthesizedExpressionAndArrowParameterList) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = ({ w\u0069th: 42 }); + +assert.sameValue(obj['with'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-add.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-add.js new file mode 100644 index 0000000000..b6be636fec --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-add.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-add.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from additive expression "add" (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1 + 1]: 2 +}; + +assert.sameValue( + o[1 + 1], + 2 +); +assert.sameValue( + o[String(1 + 1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-subtract.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-subtract.js new file mode 100644 index 0000000000..e7e8b75062 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-additive-expression-subtract.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-additive-expression-subtract.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from additive expression "subtract" (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1 - 1]: 0 +}; + +assert.sameValue( + o[1 - 1], + 0 +); +assert.sameValue( + o[String(1 - 1)], + 0 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-arrow-function-expression.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-arrow-function-expression.js new file mode 100644 index 0000000000..57d24a5626 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-arrow-function-expression.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-arrow-function-expression.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from arrow function (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [() => { }]: 1 +}; + +assert.sameValue( + o[() => { }], + 1 +); +assert.sameValue( + o[String(() => { })], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-assignment.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-assignment.js new file mode 100644 index 0000000000..a00745a3c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-assignment.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-assignment.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from assignment expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let o = { + [x = 1]: 2 +}; + +assert.sameValue( + o[x = 1], + 2 +); +assert.sameValue( + o[String(x = 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-bitwise-or.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-bitwise-or.js new file mode 100644 index 0000000000..8dd7af566a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-bitwise-or.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-bitwise-or.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from assignment expression bitwise or (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let o = { + [x |= 1]: 2 +}; + +assert.sameValue( + o[x |= 1], + 2 +); +assert.sameValue( + o[String(x |= 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-coalesce.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-coalesce.js new file mode 100644 index 0000000000..efca27d110 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-coalesce.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-coalesce.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from assignment expression coalesce (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = null; + + +let o = { + [x ??= 1]: 2 +}; + +assert.sameValue( + o[x ??= 1], + 2 +); +assert.sameValue( + o[String(x ??= 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-and.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-and.js new file mode 100644 index 0000000000..ca03a6e4cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-and.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-and.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from assignment expression logical and (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let o = { + [x &&= 1]: 2 +}; + +assert.sameValue( + o[x &&= 1], + 2 +); +assert.sameValue( + o[String(x &&= 1)], + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-or.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-or.js new file mode 100644 index 0000000000..8ee6670626 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-assignment-expression-logical-or.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-assignment-expression-logical-or.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from assignment expression logical or (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names, logical-assignment-operators] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let o = { + [x ||= 1]: 2 +}; + +assert.sameValue( + o[x ||= 1], + 2 +); +assert.sameValue( + o[String(x ||= 1)], + 2 +); + +assert.sameValue(x, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-async-arrow-function-expression.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-async-arrow-function-expression.js new file mode 100644 index 0000000000..c6effaf60e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-async-arrow-function-expression.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-async-arrow-function-expression.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [async () => {}]: 1 +}; + +assert.sameValue( + o[async () => {}], + 1 +); +assert.sameValue( + o[String(async () => {})], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js new file mode 100644 index 0000000000..2f67620acf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-await-expression.js @@ -0,0 +1,45 @@ +// |reftest| module async +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-await-expression.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names, top-level-await] +flags: [generated, async, module] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +try { + + +let o = { + [await 9]: 9 +}; + +assert.sameValue( + o[await 9], + 9 +); +assert.sameValue( + o[String(await 9)], + 9 +); + +} catch (e) { + $DONE(e); +} +$DONE(); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-false.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-false.js new file mode 100644 index 0000000000..a144480aed --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-false.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-false.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [false ? 1 : 2]: 1 +}; + +assert.sameValue( + o[false ? 1 : 2], + 1 +); +assert.sameValue( + o[String(false ? 1 : 2)], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-true.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-true.js new file mode 100644 index 0000000000..4d64b15186 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-condition-expression-true.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-condition-expression-true.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [true ? 1 : 2]: 2 +}; + +assert.sameValue( + o[true ? 1 : 2], + 2 +); +assert.sameValue( + o[String(true ? 1 : 2)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-e-notational-literal.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-e-notational-literal.js new file mode 100644 index 0000000000..0d920abec1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-e-notational-literal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-e-notational-literal.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from decimal e notational literal (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1.e1]: 2 +}; + +assert.sameValue( + o[1.e1], + 2 +); +assert.sameValue( + o[String(1.e1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-literal.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-literal.js new file mode 100644 index 0000000000..27dad519d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-decimal-literal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-decimal-literal.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from decimal literal (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1.1]: 2 +}; + +assert.sameValue( + o[1.1], + 2 +); +assert.sameValue( + o[String(1.1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-exponetiation-expression.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-exponetiation-expression.js new file mode 100644 index 0000000000..78edffafa0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-exponetiation-expression.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-exponetiation-expression.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from exponentiation expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [2 ** 2]: 4 +}; + +assert.sameValue( + o[2 ** 2], + 4 +); +assert.sameValue( + o[String(2 ** 2)], + 4 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-coalesce.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-coalesce.js new file mode 100644 index 0000000000..01d0332c73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-coalesce.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-coalesce.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from coalesce (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x; + + +let o = { + [x ?? 1]: 2 +}; + +assert.sameValue( + o[x ?? 1], + 2 +); +assert.sameValue( + o[String(x ?? 1)], + 2 +); + +assert.sameValue(x, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-and.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-and.js new file mode 100644 index 0000000000..8383211b5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-and.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-and.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from logical and (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let o = { + [x && 1]: 2 +}; + +assert.sameValue( + o[x && 1], + 2 +); +assert.sameValue( + o[String(x && 1)], + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-or.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-or.js new file mode 100644 index 0000000000..e8620cb336 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-expression-logical-or.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-expression-logical-or.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from logical or (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 0; + + +let o = { + [x || 1]: 2 +}; + +assert.sameValue( + o[x || 1], + 2 +); +assert.sameValue( + o[String(x || 1)], + 2 +); + +assert.sameValue(x, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-declaration.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-declaration.js new file mode 100644 index 0000000000..e18efd7a9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-declaration.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-declaration.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from function (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function f() {} + + +let o = { + [f()]: 1 +}; + +assert.sameValue( + o[f()], + 1 +); +assert.sameValue( + o[String(f())], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-expression.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-expression.js new file mode 100644 index 0000000000..8cdce94277 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-function-expression.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-function-expression.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from function expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [function () {}]: 1 +}; + +assert.sameValue( + o[function () {}], + 1 +); +assert.sameValue( + o[String(function () {})], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-generator-function-declaration.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-generator-function-declaration.js new file mode 100644 index 0000000000..78efff178d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-generator-function-declaration.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-generator-function-declaration.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from generator function (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { return 1; } + + +let o = { + [g()]: 1 +}; + +assert.sameValue( + o[g()], + 1 +); +assert.sameValue( + o[String(g())], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-identifier.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-identifier.js new file mode 100644 index 0000000000..51efa3483c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-identifier.js @@ -0,0 +1,42 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-identifier.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +let x = 1; + + + +let o = { + [x]: '2' +}; + +assert.sameValue( + o[x], + '2' +); +assert.sameValue( + o[String(x)], + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-e-notational-literal.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-e-notational-literal.js new file mode 100644 index 0000000000..424d40a57b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-e-notational-literal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-e-notational-literal.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1]: 2 +}; + +assert.sameValue( + o[1], + 2 +); +assert.sameValue( + o[String(1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js new file mode 100644 index 0000000000..1ea00ce76a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-integer-separators.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-integer-separators.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from integer with separators (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1_2_3_4_5_6_7_8]: 1_2_3_4_5_6_7_8 +}; + +assert.sameValue( + o[1_2_3_4_5_6_7_8], + 1_2_3_4_5_6_7_8 +); +assert.sameValue( + o[String(1_2_3_4_5_6_7_8)], + 1_2_3_4_5_6_7_8 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-math.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-math.js new file mode 100644 index 0000000000..4b270b1ed1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-math.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-math.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from math (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names, exponentiation] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1 + 2 - 3 * 4 / 5 ** 6]: 2.999232 +}; + +assert.sameValue( + o[1 + 2 - 3 * 4 / 5 ** 6], + 2.999232 +); +assert.sameValue( + o[String(1 + 2 - 3 * 4 / 5 ** 6)], + 2.999232 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-div.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-div.js new file mode 100644 index 0000000000..9d76e91b18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-div.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-div.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from multiplicative expression "divide" (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1 / 1]: 1 +}; + +assert.sameValue( + o[1 / 1], + 1 +); +assert.sameValue( + o[String(1 / 1)], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-mult.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-mult.js new file mode 100644 index 0000000000..e2ce39374a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-multiplicative-expression-mult.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-multiplicative-expression-mult.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from multiplicative expression "multiply" (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1 * 1]: 1 +}; + +assert.sameValue( + o[1 * 1], + 1 +); +assert.sameValue( + o[String(1 * 1)], + 1 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-null.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-null.js new file mode 100644 index 0000000000..38a2494046 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-null.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-null.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from condition expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [null]: null +}; + +assert.sameValue( + o[null], + null +); +assert.sameValue( + o[String(null)], + null +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-numeric-literal.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-numeric-literal.js new file mode 100644 index 0000000000..256698909e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-numeric-literal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-numeric-literal.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from numeric literal (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + [1]: 2 +}; + +assert.sameValue( + o[1], + 2 +); +assert.sameValue( + o[String(1)], + 2 +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-string-literal.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-string-literal.js new file mode 100644 index 0000000000..941baa0246 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-string-literal.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-string-literal.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from string literal (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ + + +let o = { + ['1']: '2' +}; + +assert.sameValue( + o['1'], + '2' +); +assert.sameValue( + o[String('1')], + '2' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-yield-expression.js b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-yield-expression.js new file mode 100644 index 0000000000..0051ee14d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/cpn-obj-lit-computed-property-name-from-yield-expression.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/computed-property-names/computed-property-name-from-yield-expression.case +// - src/computed-property-names/evaluation/object-literal.template +/*--- +description: Computed property name from yield expression (ComputedPropertyName in ObjectLiteral) +esid: prod-ComputedPropertyName +features: [computed-property-names] +flags: [generated] +info: | + ObjectLiteral: + { PropertyDefinitionList } + + PropertyDefinitionList: + PropertyDefinition + + PropertyDefinition: + PropertyName: AssignmentExpression + + PropertyName: + ComputedPropertyName + + ComputedPropertyName: + [ AssignmentExpression ] +---*/ +function * g() { + + +let o = { + [yield 9]: 9 +}; + +assert.sameValue( + o[yield 9], + 9 +); +assert.sameValue( + o[String(yield 9)], + 9 +); + +} +var iter = g(); +while (iter.next().done === false) ; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-close.js new file mode 100644 index 0000000000..445b32dccf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-close.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var obj = { + async *method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +obj.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..34cf9ba494 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var obj = { + async *method([x, y, z]) { + + } +}; + +assert.throws(TypeError, function() { + obj.method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err.js new file mode 100644 index 0000000000..a75fe4b06a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-get-err.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var obj = { + async *method([x]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..6b1655c6a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-init-iter-no-close.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var obj = { + async *method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-name-iter-val.js new file mode 100644 index 0000000000..37d5087822 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-name-iter-val.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding with normal value iteration (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..1571aa1cdd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..41edcb09ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +obj.method([[7, 8, 9]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..74428cd5cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var obj = { + async *method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..3fd4d8539b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var obj = { + async *method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([[]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..422cbf2bc6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var obj = { + async *method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..6728fd9233 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var obj = { + async *method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([[23]]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..49db355013 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var obj = { + async *method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..35647ccc7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var obj = { + async *method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([values]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..536d23910e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Nested array destructuring with a null value (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var obj = { + async *method([[x]]) { + + } +}; + +assert.throws(TypeError, function() { + obj.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..16621af6bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..0ce3e4a35d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..ffbd1fa1f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..e4611e257a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..a69903661d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..3ce24ed443 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var obj = { + async *method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..ae2b23ca3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Destructuring initializer with a "hole" (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +obj.method([,]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..8a92db1237 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var obj = { + async *method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([null, 0, false, '']).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..7595b0d9ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Destructuring initializer returns an abrupt completion (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var obj = { + async *method([x = (function() { throw new Test262Error(); })()]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..e7c48a0343 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Destructuring initializer with an undefined value (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method([undefined]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..0c82a896f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var obj = { + async *method([ x = unresolvableReference ]) { + + } +}; + +assert.throws(ReferenceError, function() { + obj.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..35bd1e7592 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding when value iteration completes (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..b969cba31d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..dbbf608f49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var obj = { + async *method([x]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..af5e806d81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var obj = { + async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..96eff1b382 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var obj = { + async *method([x]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..80baaf9b3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..6dfaf2b62a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..3fa1eb383a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +obj.method([{ x: 11, y: 22, z: 33 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..8e52b8a7dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..5517e53429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method([{ u: 777, w: 888, y: 999 }]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..2e9d134734 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Nested object destructuring with a null value (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var obj = { + async *method([{ x }]) { + + } +}; + +assert.throws(TypeError, function() { + obj.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..846b328819 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Nested object destructuring with a value of `undefined` (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var obj = { + async *method([{ x }]) { + + } +}; + +assert.throws(TypeError, function() { + obj.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..b8dce4eacd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Elision accepts exhausted iterator (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var obj = { + async *method([,]) { + + callCount = callCount + 1; + } +}; + +obj.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..8c7a042725 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision-step-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Elision advances iterator and forwards abrupt completions (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var obj = { + async *method([,]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..fd4a27fb89 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-elision.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Elision advances iterator (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var obj = { + async *method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..b3b34f475e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-empty.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var obj = { + async *method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +obj.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..6dedaae9cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +obj.method([3, 4, 5]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..7ece624afb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element containing an elision (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var obj = { + async *method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +obj.method(g()).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..02ad467b29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element containing an "empty" array pattern (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var obj = { + async *method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +obj.method(iter).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..854f80ec27 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,57 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element containing a rest element (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var obj = { + async *method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +obj.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..65b8896bb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Lone rest element (direct binding) (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var obj = { + async *method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +obj.method([1]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..b3c8da3fd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Rest element following elision elements (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var obj = { + async *method([, ...x]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..e846f1d6f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element following elision elements (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var obj = { + async *method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..430af6f12e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: RestElement applied to an exhausted iterator (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var obj = { + async *method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +obj.method([1, 2]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..4a1b728c83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var obj = { + async *method([...x]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..5ed5256434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var obj = { + async *method([...x]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..3a7bca8908 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-id.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Lone rest element (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var obj = { + async *method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(values).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..9ffa7bae6d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..42aabe669c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element (identifier) does not support initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...x = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..6b95782f79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..d3113cd58e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..3febcb231c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...x, y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..23add62dc7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..19264140f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var obj = { + async *method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..79eeef8c1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,57 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest element containing an object binding pattern (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var obj = { + async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +obj.method([7, 8, 9]).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..b632c5ab1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-close.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var obj = { + async *method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..ab415ea116 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + + +var obj = { + async *method([x, y, z] = [1, 2, 3]) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..c92b63a4af --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-get-err.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + + +var obj = { + async *method([x] = iter) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..488e49e226 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,60 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + + +var callCount = 0; +var obj = { + async *method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..13ae31e28e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-name-iter-val.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..dcfb499fed --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..d8c9c61c3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..63af1638cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var obj = { + async *method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..c52fbba1e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + + +var callCount = 0; +var obj = { + async *method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..2d5d26d36e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + + +var callCount = 0; +var obj = { + async *method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..1f9c272622 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + + +var callCount = 0; +var obj = { + async *method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..883f94937e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + + +var callCount = 0; +var obj = { + async *method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..87a4d0dc51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,58 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + + +var callCount = 0; +var obj = { + async *method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..4507141bf7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Nested array destructuring with a null value (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + + +var obj = { + async *method([[x]] = [null]) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..b0929c2700 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..ce5f0b8a2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..b99a2f42b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a095d5bbb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..bfed895241 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..2091d20564 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + + +var callCount = 0; +var obj = { + async *method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..d6cfd806a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Destructuring initializer with a "hole" (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..c50d67bb47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,55 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var obj = { + async *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..a05748ce09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + + +var obj = { + async *method([x = (function() { throw new Test262Error(); })()] = [undefined]) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..adfd19ec28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Destructuring initializer with an undefined value (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..d8397e38ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var obj = { + async *method([ x = unresolvableReference ] = []) { + + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..310a626877 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..7df8b15849 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..7f32c663d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + + +var obj = { + async *method([x] = g) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..8bac06c0c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,69 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + + +var callCount = 0; +var obj = { + async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..f1ad8cfb95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var obj = { + async *method([x] = g) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..a571292584 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,59 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..00faf943be --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..5f22182209 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..e232f89375 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..7609c65d02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..8f9e2fb98a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Nested object destructuring with a null value (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var obj = { + async *method([{ x }] = [null]) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..5a7d27d827 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + + +var obj = { + async *method([{ x }] = []) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..f6b1324baf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Elision accepts exhausted iterator (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + + +var callCount = 0; +var obj = { + async *method([,] = iter) { + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..8319649768 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + + +var obj = { + async *method([,] = iter) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..520d0d483a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Elision advances iterator (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var obj = { + async *method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..99dc097546 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var obj = { + async *method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..20d56cb4b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,72 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..9031d1dd9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,78 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element containing an elision (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + + +var callCount = 0; +var obj = { + async *method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..6e1d6ac640 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,61 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + + +var callCount = 0; +var obj = { + async *method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..5d81697005 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,57 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element containing a rest element (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var obj = { + async *method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..3266e120ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Lone rest element (direct binding) (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + + +var callCount = 0; +var obj = { + async *method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..44e3600713 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,47 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Rest element following elision elements (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + + +var obj = { + async *method([, ...x] = iter) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..b0288606bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element following elision elements (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + + +var callCount = 0; +var obj = { + async *method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..fdc1d70cd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + + +var callCount = 0; +var obj = { + async *method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..0fa93e0ad2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + + +var obj = { + async *method([...x] = iter) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..d2b57dbd3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [Symbol.iterator, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + + +var obj = { + async *method([...x] = iter) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..33b69e8fd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Lone rest element (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + + +var callCount = 0; +var obj = { + async *method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..2344b7e41c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..55869540a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..8064dddad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..3f5762ba19 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..c083a246db --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..b6d4f8b187 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,47 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + + +var callCount = 0; +var obj = { + async *method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..625bd12836 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element containing an object binding pattern (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + + +var callCount = 0; +var obj = { + async *method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..9947b356ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,57 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest element containing an object binding pattern (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + + +var callCount = 0; +var obj = { + async *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-null.js new file mode 100644 index 0000000000..ea117b90d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-null.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var obj = { + async *method({} = null) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..b03809d547 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-init-undefined.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var obj = { + async *method({} = undefined) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..df51c68303 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var obj = { + async *method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..22057ed6e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var obj = { + async *method({ poisoned } = poisonedProperty) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..c4672d843e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..92a932965d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..ce42c0214c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..ea800001ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..9696ee0659 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var obj = { + async *method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..6d5ea9d5cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var obj = { + async *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..ec4459bd45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error thrown when evaluating the initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ x = thrower() } = {}) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..dd71a75b4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var obj = { + async *method({ x = unresolvableReference } = {}) { + + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..2bbf0e4b78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var obj = { + async *method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..b0e58e7f36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-list-err.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ a, b = thrower(), c = ++initCount } = {}) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..8f86168e36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..42f9e396a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..30885fd1f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var obj = { + async *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..0e2d03f3e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..5dc66473ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ [thrower()]: x } = {}) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..58f010e9b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var obj = { + async *method({ poisoned: x = ++initEvalCount } = poisonedProperty) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..96e66deaf6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var obj = { + async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..bf668b1a75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Error thrown when evaluating the initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ x: y = thrower() } = {}) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..5b1163729d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var obj = { + async *method({ x: y = unresolvableReference } = {}) { + + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..ef604b362e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..d13c4d01ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..839e32578f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Binding as specified via property name and identifier (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..99001ebdd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..f07ad0ee4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var obj = { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..cb50ea279d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/async-gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var obj = { + async *method({ w: { x, y, z } = undefined } = { }) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..53c25d5d08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..0cca99bb65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var obj = { + async *method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..b505639ad1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var obj = { + async *method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..69400ddf16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/async-gen-method-dflt.template +/*--- +description: Rest object contains just unextracted data (async generator method (default parameter)) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var obj = { + async *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-null.js new file mode 100644 index 0000000000..e9178d4b38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-null.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var obj = { + async *method({}) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-undefined.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-undefined.js new file mode 100644 index 0000000000..a344862ecd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-init-undefined.js @@ -0,0 +1,41 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + + +var obj = { + async *method({}) { + + } +}; + +assert.throws(TypeError, function() { + obj.method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..81a1259775 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-empty.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + + +var callCount = 0; +var obj = { + async *method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(obj).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..69a94e745b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-get-value-err.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var obj = { + async *method({ poisoned }) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..b089f2ec26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..1e7a2fe91f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..c42bea0bea --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..dc38cacc55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + + +var callCount = 0; +var obj = { + async *method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..7a118acc48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [generators, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + + +var callCount = 0; +var obj = { + async *method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..feaebc8ea8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var obj = { + async *method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method({ w: null, x: 0, y: false, z: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..c369c9834f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-throws.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ x = thrower() }) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..1f2fd590f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var obj = { + async *method({ x = unresolvableReference }) { + + } +}; + +assert.throws(ReferenceError, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..dc9cfa3905 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var obj = { + async *method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-list-err.js new file mode 100644 index 0000000000..4a25c4d6e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-list-err.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ a, b = thrower(), c = ++initCount }) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..98279dfddf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..86fef04f36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +obj.method({ x: [45] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..def344eb1f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var obj = { + async *method({ w: [x, y, z] = [4, 5, 6] }) { + + } +}; + +assert.throws(TypeError, function() { + obj.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..e7728507ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-ary.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: [7, undefined, ] }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..8ceff22366 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-eval-err.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Evaluation of property name returns an abrupt completion (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ [thrower()]: x }) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..7da1f0ca04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + + +var obj = { + async *method({ poisoned: x = ++initEvalCount }) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..17d379c4be --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + + +var callCount = 0; +var obj = { + async *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method({ s: null, u: 0, w: false, y: '' }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..8cfbd46606 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + + +var obj = { + async *method({ x: y = thrower() }) { + + } +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..1ffc86f326 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + + +var obj = { + async *method({ x: y = unresolvableReference }) { + + } +}; + +assert.throws(ReferenceError, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..348e9a4afd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..b0999ed775 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..10eb051d8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-id.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Binding as specified via property name and identifier (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + + +var callCount = 0; +var obj = { + async *method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..550aef8f5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: undefined }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..9fc9a9fa16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var obj = { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + + } +}; + +assert.throws(TypeError, function() { + obj.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..4e8e85a6ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var obj = { + async *method({ w: { x, y, z } = undefined }) { + + } +}; + +assert.throws(TypeError, function() { + obj.method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..339c9664b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-prop-obj.js @@ -0,0 +1,51 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + + +var callCount = 0; +var obj = { + async *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: { x: undefined, z: 7 } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..3987d6d23f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-getter.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var count = 0; + + +var callCount = 0; +var obj = { + async *method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method({ get v() { count++; return 2; } }).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..3df62c76c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + + +var callCount = 0; +var obj = { + async *method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +obj.method(o).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..908ceaaa2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/async-gen-meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/async-gen-meth.template +/*--- +description: Rest object contains just unextracted data (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [object-rest, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + +---*/ + + +var callCount = 0; +var obj = { + async *method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method({x: 1, y: 2, a: 5, b: 3}).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/dstr/browser.js b/js/src/tests/test262/language/expressions/object/dstr/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-close.js new file mode 100644 index 0000000000..d4446c7f7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-close.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + *method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +obj.method(iter).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..bc8de18bfa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var obj = { + *method([x, y, z]) {} +}; + +assert.throws(TypeError, function() { + obj.method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err.js new file mode 100644 index 0000000000..a77269f3fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-get-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Abrupt completion returned by GetIterator (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var obj = { + *method([x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..1f6fd1fb11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-init-iter-no-close.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + *method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(iter).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-name-iter-val.js new file mode 100644 index 0000000000..d2d689003c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-name-iter-val.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding with normal value iteration (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..df4c1c9996 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..d3489c2d7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +obj.method([[7, 8, 9]]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..1e3c7be9a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + *method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..6a151bda23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var obj = { + *method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([[]]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..286780d95e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var obj = { + *method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..62288e2526 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var obj = { + *method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([[23]]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..6730243c63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var obj = { + *method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..afb7d58b82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var obj = { + *method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([values]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..de1f4ce8be --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Nested array destructuring with a null value (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var obj = { + *method([[x]]) {} +}; + +assert.throws(TypeError, function() { + obj.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..54222ed1c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..660b5e3979 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..db4dc7d1b8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..fe3b565901 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..11f3d14d3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..e143bc856e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var obj = { + *method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..3ff88e4501 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Destructuring initializer with a "hole" (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +obj.method([,]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..99299429f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + *method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([null, 0, false, '']).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..6d2ed7c86e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Destructuring initializer returns an abrupt completion (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var obj = { + *method([x = (function() { throw new Test262Error(); })()]) {} +}; + +assert.throws(Test262Error, function() { + obj.method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..beef9ac99a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Destructuring initializer with an undefined value (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method([undefined]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..2a5f27536e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + *method([ x = unresolvableReference ]) {} +}; + +assert.throws(ReferenceError, function() { + obj.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..54b09fb1a6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding when value iteration completes (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..255a43e17d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..60887b032c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var obj = { + *method([x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..3cffa9398a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var obj = { + *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..c412ae85e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + *method([x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..6c1066b14c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..6a4c1d1074 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..0afd65ab4b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +obj.method([{ x: 11, y: 22, z: 33 }]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..0fac6db3ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..2a4a685d00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method([{ u: 777, w: 888, y: 999 }]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..e041b401cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Nested object destructuring with a null value (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + *method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + obj.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..8b054b92f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Nested object destructuring with a value of `undefined` (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + *method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + obj.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..2aeee05583 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Elision accepts exhausted iterator (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var obj = { + *method([,]) { + + callCount = callCount + 1; + } +}; + +obj.method(iter).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..2739592f3e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision-step-err.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Elision advances iterator and forwards abrupt completions (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var obj = { + *method([,]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..ca759b79cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-elision.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Elision advances iterator (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + *method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method(g()).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..eeaed566b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-empty.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + *method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +obj.method(iter).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..7771d0ffbb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +obj.method([3, 4, 5]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..2bdce4d742 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element containing an elision (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + *method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +obj.method(g()).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..b1e725f5ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element containing an "empty" array pattern (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + *method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +obj.method(iter).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..36325d7622 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element containing a rest element (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + *method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +obj.method(values).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..9973a7bc31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Lone rest element (direct binding) (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var obj = { + *method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +obj.method([1]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..74dbc3658b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Rest element following elision elements (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var obj = { + *method([, ...x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..07419963e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element following elision elements (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var obj = { + *method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(values).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..9a4f9fef75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: RestElement applied to an exhausted iterator (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var obj = { + *method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +obj.method([1, 2]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..7c136c2854 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var obj = { + *method([...x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..7b0212d95e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + *method([...x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..f61700cc96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-id.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Lone rest element (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + *method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(values).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..fbd9bcb111 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..0892afd843 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element (identifier) does not support initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...x = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..2f18190af1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..7a2aec3f91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..58e86ede1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...x, y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..4c3daf88df --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..d4d2a7d613 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element containing an object binding pattern (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + *method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..8bcf5880d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest element containing an object binding pattern (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var obj = { + *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +obj.method([7, 8, 9]).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..41f523b846 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-close.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + *method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..9c7d758ffb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var obj = { + *method([x, y, z] = [1, 2, 3]) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..49dd5f627a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-get-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var obj = { + *method([x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..b9b4a5be02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + *method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..8c8f28b468 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-name-iter-val.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..d4c0b68f29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..2bca98495d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..0f73cbed43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + *method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..2b99b3956f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var obj = { + *method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..2c7104ce66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var obj = { + *method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..2112ac03c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var obj = { + *method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..656b0596bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var obj = { + *method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..f434cbb0f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var obj = { + *method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..87bc902370 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Nested array destructuring with a null value (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var obj = { + *method([[x]] = [null]) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..7170bc3b70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..5bc1e2edc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..d2dd773ce8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..4597b349ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..63afbc17f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..748903d9e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var obj = { + *method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..f891759cb9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Destructuring initializer with a "hole" (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..a66b57b0cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + *method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..e94d1d3a92 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var obj = { + *method([x = (function() { throw new Test262Error(); })()] = [undefined]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..0c4cb9a6cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Destructuring initializer with an undefined value (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..78f1dc13b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + *method([ x = unresolvableReference ] = []) {} +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..86f9e7ca9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..569c4b3f3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..eea2c94d71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var obj = { + *method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..c31909d97c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var obj = { + *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..896fce4ecd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + *method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..cb742d9c33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..7aeedf62f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..4d8bb96d2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..59bba12112 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..b8473e0bc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..9288406bbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Nested object destructuring with a null value (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + *method([{ x }] = [null]) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..a9594189c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + *method([{ x }] = []) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..b11d5bc033 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Elision accepts exhausted iterator (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var obj = { + *method([,] = iter) { + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..8b2bfdbdd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var obj = { + *method([,] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..8494b10c61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Elision advances iterator (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + *method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..370a417963 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + *method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..a06c36a3dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..e00f62b303 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element containing an elision (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + *method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..1568a4387e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + *method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..89cacd3e3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element containing a rest element (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + *method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..cc8a9c1452 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Lone rest element (direct binding) (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var obj = { + *method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..9608e98fdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Rest element following elision elements (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var obj = { + *method([, ...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..6b71db6ed0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element following elision elements (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var obj = { + *method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..388dc241f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var obj = { + *method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..3e8ead7911 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var obj = { + *method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..df0449f8d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + *method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..347e87b518 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Lone rest element (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + *method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..69c855f796 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..fa49afacfa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..74fb01a6f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..7de4027513 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..2214e6d4e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..9c1958cd78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + *method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..1adb4712ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element containing an object binding pattern (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + *method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..a9d5b41230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest element containing an object binding pattern (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var obj = { + *method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-null.js new file mode 100644 index 0000000000..b69f977328 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-null.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + *method({} = null) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..08da959943 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-init-undefined.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + *method({} = undefined) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..a21997f148 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var obj = { + *method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..a50eecf27b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + *method({ poisoned } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..85e089e650 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..d7e5d1eee0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..0ece48cf4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..4f196fa02b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..40177da01a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var obj = { + *method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..8432ceb139 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + *method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..aa73e48739 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ x = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..b6f7928760 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + *method({ x = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..c16bc4045b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + *method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..ba35b95cdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-list-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ a, b = thrower(), c = ++initCount } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..d70c93951e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..2edcc779d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + *method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..a5e61d4b1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + *method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..9a380b3682 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..1ff3038876 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ [thrower()]: x } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..b01c5106ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + *method({ poisoned: x = ++initEvalCount } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..3abc511622 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..059e7085a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ x: y = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..d0a8dabd58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + *method({ x: y = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..af90f89782 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..a6fe228877 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + *method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..6b1ba42cf3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Binding as specified via property name and identifier (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..705382b97f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..9269410716 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..fc6f42a8dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/gen-meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + *method({ w: { x, y, z } = undefined } = { }) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..e817b90a8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..32822764a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var obj = { + *method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..1bcebf2a67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var obj = { + *method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..c112ac8f77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/gen-method-dflt.template +/*--- +description: Rest object contains just unextracted data (generator method (default parameter)) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [object-rest, generators, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + *method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-null.js new file mode 100644 index 0000000000..228bc3fcf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-null.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + *method({}) {} +}; + +assert.throws(TypeError, function() { + obj.method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-undefined.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-undefined.js new file mode 100644 index 0000000000..7dbc82a2db --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-init-undefined.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + *method({}) {} +}; + +assert.throws(TypeError, function() { + obj.method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..6e4f19c0fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-empty.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var obj = { + *method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(obj).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..a4d7f3316a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-get-value-err.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + *method({ poisoned }) {} +}; + +assert.throws(Test262Error, function() { + obj.method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..a9ba02da76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method({}).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..3189719c9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method({}).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..a2b659cfe0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method({}).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..16f3566717 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + *method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method({}).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..bda385d965 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var obj = { + *method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method({}).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..a89cad491b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + *method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method({ w: null, x: 0, y: false, z: '' }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..b39983052d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-throws.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ x = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..dcd4dbf50e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + *method({ x = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..4e5c839799 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + *method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-list-err.js new file mode 100644 index 0000000000..00dab1ebde --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-list-err.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ a, b = thrower(), c = ++initCount }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..3e821fe3da --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({}).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..9a2b2a1edd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + *method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +obj.method({ x: [45] }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..7a2170af0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + *method({ w: [x, y, z] = [4, 5, 6] }) {} +}; + +assert.throws(TypeError, function() { + obj.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..278d0d6d6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-ary.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: [7, undefined, ] }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..f7acc44ac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-eval-err.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Evaluation of property name returns an abrupt completion (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ [thrower()]: x }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..4fa9ab78ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + *method({ poisoned: x = ++initEvalCount }) {} +}; + +assert.throws(Test262Error, function() { + obj.method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..42737b3ed8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + *method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method({ s: null, u: 0, w: false, y: '' }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..c417a288fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Error thrown when evaluating the initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + *method({ x: y = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..eb733b46ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + *method({ x: y = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..bbb8ac60ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..fa20ad7461 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + *method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..3f4b38d093 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-id.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Binding as specified via property name and identifier (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + *method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..37d743aab4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: undefined }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..ae854495d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {} +}; + +assert.throws(TypeError, function() { + obj.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..d30afb0413 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + *method({ w: { x, y, z } = undefined }) {} +}; + +assert.throws(TypeError, function() { + obj.method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..b55d6f748e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-prop-obj.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators, destructuring-binding] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + *method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: { x: undefined, z: 7 } }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..f2d085eae1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-getter.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var obj = { + *method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method({ get v() { count++; return 2; } }).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..56d8329ebb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var obj = { + *method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +obj.method(o).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..7025357c2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/gen-meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/gen-meth.template +/*--- +description: Rest object contains just unextracted data (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [object-rest, generators, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + *method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method({x: 1, y: 2, a: 5, b: 3}).next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-close.js new file mode 100644 index 0000000000..f7150d4869 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-close.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/meth.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + method([x]) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +obj.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..141d31ee65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/meth.template +/*--- +description: Abrupt completion returned by GetIterator (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var obj = { + method([x, y, z]) {} +}; + +assert.throws(TypeError, function() { + obj.method([1, 2, 3]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err.js new file mode 100644 index 0000000000..7e2fbcaa9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-get-err.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Abrupt completion returned by GetIterator (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var obj = { + method([x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-no-close.js new file mode 100644 index 0000000000..b26434e779 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-init-iter-no-close.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/meth.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + method([x]) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-name-iter-val.js new file mode 100644 index 0000000000..117c1a4123 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-name-iter-val.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding with normal value iteration (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..31a0a485f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..d36fd64d95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([[x, y, z] = [4, 5, 6]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +obj.method([[7, 8, 9]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..33d9c07fb8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + method([[,] = g()]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..a4e926c2cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var obj = { + method([[,] = g()]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([[]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..48e58942c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var obj = { + method([[] = function() { initCount += 1; return iter; }()]) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..e9180a9a4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var obj = { + method([[] = function() { initCount += 1; }()]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([[23]]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..ae883855fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var obj = { + method([[...x] = values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..6f2f4f6b99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var obj = { + method([[...x] = function() { initCount += 1; }()]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([values]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..ab0f5a2247 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/meth.template +/*--- +description: Nested array destructuring with a null value (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var obj = { + method([[x]]) {} +}; + +assert.throws(TypeError, function() { + obj.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..a7a6c63b07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/meth.template +/*--- +description: Destructuring initializer with an exhausted iterator (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..f48d25dfe8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding does assign name to arrow functions (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([arrow = () => {}]) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..e7237beceb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }]) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..d22df33c94 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([cover = (function () {}), xCover = (0, function() {})]) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..9c555e9edb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([fn = function () {}, xFn = function x() {}]) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..7bc3107067 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var obj = { + method([gen = function* () {}, xGen = function* x() {}]) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..f39019b9d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/meth.template +/*--- +description: Destructuring initializer with a "hole" (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x = 23]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +obj.method([,]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..5fe1545b13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + method([w = counter(), x = counter(), y = counter(), z = counter()]) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method([null, 0, false, '']); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..e217c7674d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/meth.template +/*--- +description: Destructuring initializer returns an abrupt completion (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var obj = { + method([x = (function() { throw new Test262Error(); })()]) {} +}; + +assert.throws(Test262Error, function() { + obj.method([undefined]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..64cbc563fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/meth.template +/*--- +description: Destructuring initializer with an undefined value (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x = 23]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method([undefined]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..bf7beaaf38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + method([ x = unresolvableReference ]) {} +}; + +assert.throws(ReferenceError, function() { + obj.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..a13c2cd57a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding when value iteration completes (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..6832665c39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([_, x]) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..2ced7cebf6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var obj = { + method([x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..66afefa92e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/meth.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var obj = { + method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..09a143e4a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + method([x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(g); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..edaf6fc897 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding when value iteration was completed previously (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x, y, z]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..4a5d388e4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..c7ff05c652 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-id.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +obj.method([{ x: 11, y: 22, z: 33 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..15b984ae02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with object binding pattern and initializer is used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..65a5355b88 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method([{ u: 777, w: 888, y: 999 }]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..f9b2316c2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/meth.template +/*--- +description: Nested object destructuring with a null value (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + obj.method([null]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..49f0fb6a64 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/meth.template +/*--- +description: Nested object destructuring with a value of `undefined` (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + method([{ x }]) {} +}; + +assert.throws(TypeError, function() { + obj.method([]); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..00e00589bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-exhausted.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/meth.template +/*--- +description: Elision accepts exhausted iterator (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var obj = { + method([,]) { + + callCount = callCount + 1; + } +}; + +obj.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..0e99944d2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision-step-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Elision advances iterator and forwards abrupt completions (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var obj = { + method([,]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision.js new file mode 100644 index 0000000000..d38bcabaac --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-elision.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/meth.template +/*--- +description: Elision advances iterator (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + method([,]) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-empty.js new file mode 100644 index 0000000000..638b60b33d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-empty.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/meth.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + method([]) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +obj.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..4df7465e63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element containing an array BindingElementList pattern (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([...[x, y, z]]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +obj.method([3, 4, 5]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..ff4d0cded1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element containing an elision (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + method([...[,]]) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +obj.method(g()); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..2f1b789631 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element containing an "empty" array pattern (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + method([...[]]) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +obj.method(iter); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..2e1aa691a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element containing a rest element (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + method([...[...x]]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +obj.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..a91f042ea5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-direct.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/meth.template +/*--- +description: Lone rest element (direct binding) (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +includes: [compareArray.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var obj = { + method([...x]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +obj.method([1]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..35b4587c12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Rest element following elision elements (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var obj = { + method([, ...x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..e6abfbf3be --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-elision.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element following elision elements (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var obj = { + method([ , , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..8a6d9e96bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/meth.template +/*--- +description: RestElement applied to an exhausted iterator (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var obj = { + method([, , ...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +obj.method([1, 2]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..dc49b042f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var obj = { + method([...x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..9e074f254a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (method) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + method([...x]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(iter); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..ceac42e7d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-id.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: Lone rest element (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + method([...x]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(values); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..89e2ce8b08 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-ary.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element (nested array pattern) does not support initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...[ x ] = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..c27e27d158 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-id.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element (identifier) does not support initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...x = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..384cc10515 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-init-obj.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element (nested object pattern) does not support initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...{ x } = []]) { + + callCount = callCount + 1; + } +}; + +obj.method([]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..822c293b75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...[x], y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..9c023ce230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element (identifier) may not be followed by any element (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...x, y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..60e715a551 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...{ x }, y]) { + + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..96ec9707fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-id.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element containing an object binding pattern (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + method([...{ length }]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +obj.method([1, 2, 3]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..598b980a95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest element containing an object binding pattern (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var obj = { + method([...{ 0: v, 1: w, 2: x, 3: y, length: z }]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +obj.method([7, 8, 9]); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-close.js new file mode 100644 index 0000000000..6ca15b4d10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-close.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-close.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Iterator is closed when not exhausted by pattern evaluation (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: false }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + method([x] = iter) { + assert.sameValue(doneCallCount, 1); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js new file mode 100644 index 0000000000..c724a6be4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err-array-prototype.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err-array-prototype.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iteratorRecord be ? GetIterator(value). + + GetIterator ( obj [ , hint [ , method ] ] ) + + [...] + 4. Let iterator be ? Call(method, obj). + + Call ( F, V [ , argumentsList ] ) + + [...] + 2. If IsCallable(F) is false, throw a TypeError exception. + +---*/ +delete Array.prototype[Symbol.iterator]; + +var obj = { + method([x, y, z] = [1, 2, 3]) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err.js new file mode 100644 index 0000000000..c5a1b662fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-get-err.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-get-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Abrupt completion returned by GetIterator (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). + +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +var obj = { + method([x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-no-close.js new file mode 100644 index 0000000000..d41957a8bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-init-iter-no-close.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-init-iter-no-close.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Iterator is not closed when exhausted by pattern evaluation (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + [...] + 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator, + result). + [...] + +---*/ +var doneCallCount = 0; +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return { value: null, done: true }; + }, + return: function() { + doneCallCount += 1; + return {}; + } + }; +}; + +var callCount = 0; +var obj = { + method([x] = iter) { + assert.sameValue(doneCallCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-name-iter-val.js new file mode 100644 index 0000000000..5d098a5a5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-name-iter-val.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-name-iter-val.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding with normal value iteration (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js new file mode 100644 index 0000000000..d916a0504c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([[x, y, z] = [4, 5, 6]] = []) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js new file mode 100644 index 0000000000..8818a7f52b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elem-iter.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([[x, y, z] = [4, 5, 6]] = [[7, 8, 9]]) { + assert.sameValue(x, 7); + assert.sameValue(y, 8); + assert.sameValue(z, 9); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js new file mode 100644 index 0000000000..5095d4455e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-init.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + method([[,] = g()] = []) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js new file mode 100644 index 0000000000..8cb2980fe6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-elision-iter.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var callCount = 0; +function* g() { + callCount += 1; +}; + +var callCount = 0; +var obj = { + method([[,] = g()] = [[]]) { + assert.sameValue(callCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js new file mode 100644 index 0000000000..cb45ff95d7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-init.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + +---*/ +var initCount = 0; +var iterCount = 0; +var iter = function*() { iterCount += 1; }(); + +var callCount = 0; +var obj = { + method([[] = function() { initCount += 1; return iter; }()] = []) { + assert.sameValue(initCount, 1); + assert.sameValue(iterCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js new file mode 100644 index 0000000000..70fec72bff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-empty-iter.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var initCount = 0; + +var callCount = 0; +var obj = { + method([[] = function() { initCount += 1; }()] = [[23]]) { + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js new file mode 100644 index 0000000000..5649ff13a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-init.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; + +var callCount = 0; +var obj = { + method([[...x] = values] = []) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js new file mode 100644 index 0000000000..96db9e2bbe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-rest-iter.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with array binding pattern and initializer is not used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + [...] + e. Else, + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ +var values = [2, 1, 3]; +var initCount = 0; + +var callCount = 0; +var obj = { + method([[...x] = function() { initCount += 1; }()] = [values]) { + assert(Array.isArray(x)); + assert.sameValue(x[0], 2); + assert.sameValue(x[1], 1); + assert.sameValue(x[2], 3); + assert.sameValue(x.length, 3); + assert.notSameValue(x, values); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js new file mode 100644 index 0000000000..d2b9227d59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-ary-val-null.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-ary-val-null.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Nested array destructuring with a null value (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ArrayBindingPattern + + 1. Let iterator be GetIterator(value). + 2. ReturnIfAbrupt(iterator). +---*/ + +var obj = { + method([[x]] = [null]) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js new file mode 100644 index 0000000000..100f1fa210 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-exhausted.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Destructuring initializer with an exhausted iterator (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x = 23] = []) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..de8ed9e82e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-arrow.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding does assign name to arrow functions (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([arrow = () => {}] = []) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js new file mode 100644 index 0000000000..dbe529dee3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-class.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([cls = class {}, xCls = class X {}, xCls2 = class { static name() {} }] = []) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js new file mode 100644 index 0000000000..bd60800496 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-cover.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([cover = (function () {}), xCover = (0, function() {})] = []) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js new file mode 100644 index 0000000000..3ada21e19d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-fn.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([fn = function () {}, xFn = function x() {}] = []) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js new file mode 100644 index 0000000000..937ecda98f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-fn-name-gen.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). + +---*/ + +var callCount = 0; +var obj = { + method([gen = function* () {}, xGen = function* x() {}] = []) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js new file mode 100644 index 0000000000..33832bd7e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-hole.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Destructuring initializer with a "hole" (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + SingleNameBinding : BindingIdentifier Initializeropt + [...] 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x = 23] = [,]) { + assert.sameValue(x, 23); + // another statement + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js new file mode 100644 index 0000000000..ef6b543c55 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-skipped.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + method([w = counter(), x = counter(), y = counter(), z = counter()] = [null, 0, false, '']) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js new file mode 100644 index 0000000000..94f24a2af9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-throws.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-throws.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Destructuring initializer returns an abrupt completion (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ + +var obj = { + method([x = (function() { throw new Test262Error(); })()] = [undefined]) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js new file mode 100644 index 0000000000..35cc01cd1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-undef.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Destructuring initializer with an undefined value (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + [...] + 7. If environment is undefined, return PutValue(lhs, v). + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x = 23] = [undefined]) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js new file mode 100644 index 0000000000..2c56439abe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-init-unresolvable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-init-unresolvable.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + method([ x = unresolvableReference ] = []) {} +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js new file mode 100644 index 0000000000..2cc42a41f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-complete.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding when value iteration completes (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js new file mode 100644 index 0000000000..2046b25432 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-done.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + [...] + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([_, x] = []) { + assert.sameValue(x, undefined); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js new file mode 100644 index 0000000000..28c2f1d35b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-step-err.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-step-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +var obj = { + method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js new file mode 100644 index 0000000000..83776c885e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-array-prototype.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-array-prototype.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializer_opt + + 1. Let bindingId be StringValue of BindingIdentifier. + 2. Let lhs be ? ResolveBinding(bindingId, environment). + 3. If iteratorRecord.[[Done]] is false, then + a. Let next be IteratorStep(iteratorRecord). + b. If next is an abrupt completion, set iteratorRecord.[[Done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[Done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[Done]] to true. + iii. ReturnIfAbrupt(v). + [...] + 7. Return InitializeReferencedBinding(lhs, v). + +---*/ +Array.prototype[Symbol.iterator] = function* () { + if (this.length > 0) { + yield this[0]; + } + if (this.length > 1) { + yield this[1]; + } + if (this.length > 2) { + yield 42; + } +}; + +var callCount = 0; +var obj = { + method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 42); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js new file mode 100644 index 0000000000..badc235ab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val-err.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(v). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var g = {}; +g[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + method([x] = g) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js new file mode 100644 index 0000000000..a7637c5fce --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-id-iter-val.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding when value iteration was completed previously (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([x, y, z] = [1, 2, 3]) { + assert.sameValue(x, 1); + assert.sameValue(y, 2); + assert.sameValue(z, 3); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js new file mode 100644 index 0000000000..7c62bc999f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id-init.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = []) { + assert.sameValue(x, 44); + assert.sameValue(y, 55); + assert.sameValue(z, 66); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id.js new file mode 100644 index 0000000000..d3ebc3d751 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-id.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ x, y, z } = { x: 44, y: 55, z: 66 }] = [{ x: 11, y: 22, z: 33 }]) { + assert.sameValue(x, 11); + assert.sameValue(y, 22); + assert.sameValue(z, 33); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js new file mode 100644 index 0000000000..99af7ffdd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id-init.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = []) { + assert.sameValue(v, 444); + assert.sameValue(x, 555); + assert.sameValue(z, 666); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js new file mode 100644 index 0000000000..cd339c6b91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-prop-id.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: BindingElement with object binding pattern and initializer is not used (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPatternInitializer opt + + [...] + 2. If iteratorRecord.[[done]] is true, let v be undefined. + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be ? GetValue(defaultValue). + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method([{ u: v, w: x, y: z } = { u: 444, w: 555, y: 666 }] = [{ u: 777, w: 888, y: 999 }]) { + assert.sameValue(v, 777); + assert.sameValue(x, 888); + assert.sameValue(z, 999); + + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js new file mode 100644 index 0000000000..e4eff071db --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-null.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-null.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Nested object destructuring with a null value (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + method([{ x }] = [null]) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js new file mode 100644 index 0000000000..b3652b96f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elem-obj-val-undef.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elem-obj-val-undef.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Nested object destructuring with a value of `undefined` (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. If iteratorRecord.[[done]] is false, then + [...] + e. Else + i. Let v be IteratorValue(next). + [...] + 4. Return the result of performing BindingInitialization of BindingPattern + with v and environment as the arguments. + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPattern : ObjectBindingPattern + + 1. Let valid be RequireObjectCoercible(value). + 2. ReturnIfAbrupt(valid). +---*/ + +var obj = { + method([{ x }] = []) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-exhausted.js new file mode 100644 index 0000000000..5478a59e2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-exhausted.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-exhausted.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Elision accepts exhausted iterator (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + [...] + 2. Return NormalCompletion(empty). + +---*/ +var iter = function*() {}(); +iter.next(); + +var callCount = 0; +var obj = { + method([,] = iter) { + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-step-err.js new file mode 100644 index 0000000000..345b6d6106 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision-step-err.js @@ -0,0 +1,77 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision-step-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Elision advances iterator and forwards abrupt completions (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + +---*/ +var following = 0; +var iter =function* () { + throw new Test262Error(); + following += 1; +}(); + +var obj = { + method([,] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +iter.next(); +assert.sameValue(following, 0, 'Iterator was properly closed.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision.js new file mode 100644 index 0000000000..5e5c3d2e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-elision.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-elision.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Elision advances iterator (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + method([,] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-empty.js new file mode 100644 index 0000000000..940d4f68d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-empty.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-empty.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: No iteration occurs for an "empty" array binding pattern (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + method([] = iter) { + assert.sameValue(iterations, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js new file mode 100644 index 0000000000..cff0fa07da --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elem.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elem.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element containing an array BindingElementList pattern (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + e. Else, + [...] + i. Let v be IteratorValue(next). + ii. If v is an abrupt completion, set + iteratorRecord.[[done]] to true. + iii. ReturnIfAbrupt(v). + 5. If iteratorRecord.[[done]] is true, let v be undefined. + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method([...[x, y, z]] = [3, 4, 5]) { + assert.sameValue(x, 3); + assert.sameValue(y, 4); + assert.sameValue(z, 5); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js new file mode 100644 index 0000000000..812967a9d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-elision.js @@ -0,0 +1,95 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-elision.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element containing an elision (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ Elision ] + + 1. Return the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord + as the argument. + + 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation + + Elision : , + + 1. If iteratorRecord.[[done]] is false, then + a. Let next be IteratorStep(iteratorRecord.[[iterator]]). + b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. + c. ReturnIfAbrupt(next). + d. If next is false, set iteratorRecord.[[done]] to true. + 2. Return NormalCompletion(empty). + +---*/ +var first = 0; +var second = 0; +function* g() { + first += 1; + yield; + second += 1; +}; + +var callCount = 0; +var obj = { + method([...[,]] = g()) { + assert.sameValue(first, 1); + assert.sameValue(second, 1); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js new file mode 100644 index 0000000000..ff91afe991 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-empty.js @@ -0,0 +1,78 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-empty.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element containing an "empty" array pattern (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + ArrayBindingPattern : [ ] + + 1. Return NormalCompletion(empty). + +---*/ +var iterations = 0; +var iter = function*() { + iterations += 1; +}(); + +var callCount = 0; +var obj = { + method([...[]] = iter) { + assert.sameValue(iterations, 1); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js new file mode 100644 index 0000000000..08108bffae --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-ary-rest.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-ary-rest.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element containing a rest element (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + method([...[...x]] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-direct.js new file mode 100644 index 0000000000..3d4ccc2a67 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-direct.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-direct.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Lone rest element (direct binding) (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +includes: [compareArray.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingIdentifier + + [...] + 2. Let A be ! ArrayCreate(0). + 3. Let n be 0. + 4. Repeat, + [...] + f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue). + g. Set n to n + 1. + +---*/ + +var callCount = 0; +var obj = { + method([...x] = [1]) { + assert(Array.isArray(x)); + assert.compareArray(x, [1]); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js new file mode 100644 index 0000000000..3ec93113e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision-next-err.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision-next-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Rest element following elision elements (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. + +---*/ +var iter = (function*() { throw new Test262Error(); })(); + +var obj = { + method([, ...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision.js new file mode 100644 index 0000000000..27fb7d17b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-elision.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-elision.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element following elision elements (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + ArrayBindingPattern : [ Elisionopt BindingRestElement ] + 1. If Elision is present, then + a. Let status be the result of performing + IteratorDestructuringAssignmentEvaluation of Elision with + iteratorRecord as the argument. + b. ReturnIfAbrupt(status). + 2. Return the result of performing IteratorBindingInitialization for + BindingRestElement with iteratorRecord and environment as arguments. +---*/ +var values = [1, 2, 3, 4, 5]; + +var callCount = 0; +var obj = { + method([ , , ...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 3); + assert.sameValue(x[1], 4); + assert.sameValue(x[2], 5); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js new file mode 100644 index 0000000000..5a88904c68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-exhausted.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: RestElement applied to an exhausted iterator (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + b. If iteratorRecord.[[done]] is true, then + i. If environment is undefined, return PutValue(lhs, A). + ii. Return InitializeReferencedBinding(lhs, A). + +---*/ + +var callCount = 0; +var obj = { + method([, , ...x] = [1, 2]) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js new file mode 100644 index 0000000000..f58a6ccba8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-step-err.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-step-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error forwarding when IteratorStep returns an abrupt completion (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + a. If iteratorRecord.[[done]] is false, + i. Let next be IteratorStep(iteratorRecord.[[iterator]]). + ii. If next is an abrupt completion, set iteratorRecord.[[done]] to + true. + iii. ReturnIfAbrupt(next). + +---*/ +var first = 0; +var second = 0; +var iter = function*() { + first += 1; + throw new Test262Error(); + second += 1; +}(); + +var obj = { + method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +iter.next(); +assert.sameValue(first, 1); +assert.sameValue(second, 0, 'Iterator is closed following abrupt completion.'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js new file mode 100644 index 0000000000..1226e30b53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id-iter-val-err.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error forwarding when IteratorValue returns an abrupt completion (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [Symbol.iterator, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, + environment). + 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, + [...] + c. Let nextValue be IteratorValue(next). + d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to + true. + e. ReturnIfAbrupt(nextValue). + +---*/ +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +var obj = { + method([...x] = iter) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id.js new file mode 100644 index 0000000000..efdc543dd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-id.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Lone rest element (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + BindingRestElement : ... BindingIdentifier + [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat + [...] + f. Let status be CreateDataProperty(A, ToString (n), nextValue). + [...] +---*/ +var values = [1, 2, 3]; + +var callCount = 0; +var obj = { + method([...x] = values) { + assert(Array.isArray(x)); + assert.sameValue(x.length, 3); + assert.sameValue(x[0], 1); + assert.sameValue(x[1], 2); + assert.sameValue(x[2], 3); + assert.notSameValue(x, values); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-ary.js new file mode 100644 index 0000000000..8d4011c374 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-ary.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-ary.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element (nested array pattern) does not support initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...[ x ] = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-id.js new file mode 100644 index 0000000000..15cd784164 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-id.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element (identifier) does not support initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...x = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-obj.js new file mode 100644 index 0000000000..450504a835 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-init-obj.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-init-obj.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element (nested object pattern) does not support initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...{ x } = []] = []) { + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js new file mode 100644 index 0000000000..6c8e701776 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-ary.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-ary.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element (array binding pattern) may not be followed by any element (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...[x], y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js new file mode 100644 index 0000000000..775197f9e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-id.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element (identifier) may not be followed by any element (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...x, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js new file mode 100644 index 0000000000..f9e91625f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-not-final-obj.js @@ -0,0 +1,63 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-not-final-obj.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element (object binding pattern) may not be followed by any element (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + ArrayBindingPattern[Yield] : + [ Elisionopt BindingRestElement[?Yield]opt ] + [ BindingElementList[?Yield] ] + [ BindingElementList[?Yield] , Elisionopt BindingRestElement[?Yield]opt ] +---*/ +$DONOTEVALUATE(); + +var callCount = 0; +var obj = { + method([...{ x }, y] = [1, 2, 3]) { + + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-id.js new file mode 100644 index 0000000000..1d1db328ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-id.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + method([...{ length }] = [1, 2, 3]) { + assert.sameValue(length, 3); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js new file mode 100644 index 0000000000..416d3e2538 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-ary-ptrn-rest-obj-prop-id.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest element containing an object binding pattern (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.6 Runtime Semantics: IteratorBindingInitialization + + BindingRestElement : ... BindingPattern + + 1. Let A be ArrayCreate(0). + [...] + 3. Repeat + [...] + b. If iteratorRecord.[[done]] is true, then + i. Return the result of performing BindingInitialization of + BindingPattern with A and environment as the arguments. + [...] +---*/ +let length = "outer"; + +var callCount = 0; +var obj = { + method([...{ 0: v, 1: w, 2: x, 3: y, length: z }] = [7, 8, 9]) { + assert.sameValue(v, 7); + assert.sameValue(w, 8); + assert.sameValue(x, 9); + assert.sameValue(y, undefined); + assert.sameValue(z, 3); + + assert.sameValue(length, "outer", "the length prop is not set as a binding name"); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-null.js new file mode 100644 index 0000000000..d54e0a4511 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-null.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + method({} = null) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-undefined.js new file mode 100644 index 0000000000..44fde05ab9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-init-undefined.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + method({} = undefined) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-empty.js new file mode 100644 index 0000000000..217e5d3ca4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-empty.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: No property access occurs for an "empty" object binding pattern (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var obj = { + method({} = obj) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..145580449b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-get-value-err.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + method({ poisoned } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..4642c55050 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ arrow = () => {} } = {}) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..2367bf4b59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } } = {}) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..3a411a697d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ cover = (function () {}), xCover = (0, function() {}) } = {}) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..b82157aa93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ fn = function () {}, xFn = function x() {} } = {}) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..9425ccf83e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var obj = { + method({ gen = function* () {}, xGen = function* x() {} } = {}) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..33f9676770 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-skipped.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + method({ w = counter(), x = counter(), y = counter(), z = counter() } = { w: null, x: 0, y: false, z: '' }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..9504d85f4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-throws.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ x = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..94635dd086 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + method({ x = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..7653d3dc9b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + method({ x, } = { x: 23 }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-list-err.js new file mode 100644 index 0000000000..4a1a12e8e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-list-err.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ a, b = thrower(), c = ++initCount } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..0653f4cc46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-init.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: [x, y, z] = [4, 5, 6] } = {}) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..28b3e703c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + method({ x: [y], } = { x: [45] }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..021cae51b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + method({ w: [x, y, z] = [4, 5, 6] } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..2ef66e8ab7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-ary.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: [x, y, z] = [4, 5, 6] } = { w: [7, undefined, ] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..38beacc2a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-eval-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Evaluation of property name returns an abrupt completion (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ [thrower()]: x } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..b780c25486 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + method({ poisoned: x = ++initEvalCount } = poisonedProperty) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..2b6b2609ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() } = { s: null, u: 0, w: false, y: '' }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..81145a03c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Error thrown when evaluating the initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ x: y = thrower() } = {}) {} +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..ad3335eda1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Destructuring initializer is an unresolvable reference (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + method({ x: y = unresolvableReference } = {}) {} +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..e149efded8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-init.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Binding as specified via property name, identifier, and initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method({ x: y = 33 } = { }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..489d474e2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + method({ x: y, } = { x: 23 }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..ee2bb3009e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Binding as specified via property name and identifier (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method({ x: y } = { x: 23 }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..c4bafc252d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-init.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: undefined }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..69cb712780 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: null }) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..19d0ae1d98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + method({ w: { x, y, z } = undefined } = { }) {} +}; + +assert.throws(TypeError, function() { + obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..0e23b496aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-prop-obj.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding, default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } } = { w: { x: undefined, z: 7 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..b0c38c21d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-getter.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var obj = { + method({...x} = { get v() { count++; return 2; } }) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..d2b5f5953c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest object doesn't contain non-enumerable properties (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var obj = { + method({...rest} = o) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..09efc88d3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-dflt-obj-ptrn-rest-val-obj.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/meth-dflt.template +/*--- +description: Rest object contains just unextracted data (method (default parameter)) +esid: sec-runtime-semantics-definemethod +features: [object-rest, destructuring-binding, default-parameters] +flags: [generated] +includes: [propertyHelper.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + method({a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-null.js new file mode 100644 index 0000000000..1d0ce524a3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-null.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-null.case +// - src/dstr-binding/error/meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (null) (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + method({}) {} +}; + +assert.throws(TypeError, function() { + obj.method(null); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-undefined.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-undefined.js new file mode 100644 index 0000000000..da29633c06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-init-undefined.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-init-undefined.case +// - src/dstr-binding/error/meth.template +/*--- +description: Value specifed for object binding pattern must be object coercible (undefined) (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ + +var obj = { + method({}) {} +}; + +assert.throws(TypeError, function() { + obj.method(undefined); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-empty.js new file mode 100644 index 0000000000..498e502768 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-empty.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-empty.case +// - src/dstr-binding/default/meth.template +/*--- +description: No property access occurs for an "empty" object binding pattern (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Runtime Semantics: BindingInitialization + + ObjectBindingPattern : { } + + 1. Return NormalCompletion(empty). +---*/ +var accessCount = 0; +var obj = Object.defineProperty({}, 'attr', { + get: function() { + accessCount += 1; + } +}); + +var callCount = 0; +var obj = { + method({}) { + assert.sameValue(accessCount, 0); + callCount = callCount + 1; + } +}; + +obj.method(obj); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-get-value-err.js new file mode 100644 index 0000000000..5b41bbedce --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-get-value-err.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-get-value-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 4. Let v be GetV(value, propertyName). + 5. ReturnIfAbrupt(v). +---*/ +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + method({ poisoned }) {} +}; + +assert.throws(Test262Error, function() { + obj.method(poisonedProperty); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js new file mode 100644 index 0000000000..92e08f1ec8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-arrow.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns `name` to arrow functions (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ arrow = () => {} }) { + assert.sameValue(arrow.name, 'arrow'); + callCount = callCount + 1; + } +}; + +obj.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-class.js new file mode 100644 index 0000000000..efbb4d77d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-class.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" classes (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ cls = class {}, xCls = class X {}, xCls2 = class { static name() {} } }) { + assert.sameValue(cls.name, 'cls'); + assert.notSameValue(xCls.name, 'xCls'); + assert.notSameValue(xCls2.name, 'xCls2'); + callCount = callCount + 1; + } +}; + +obj.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-cover.js new file mode 100644 index 0000000000..5b33aea910 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-cover.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ cover = (function () {}), xCover = (0, function() {}) }) { + assert.sameValue(cover.name, 'cover'); + assert.notSameValue(xCover.name, 'xCover'); + callCount = callCount + 1; + } +}; + +obj.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-fn.js new file mode 100644 index 0000000000..8f8f9b9c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-fn.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" functions (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). +---*/ + +var callCount = 0; +var obj = { + method({ fn = function () {}, xFn = function x() {} }) { + assert.sameValue(fn.name, 'fn'); + assert.notSameValue(xFn.name, 'xFn'); + callCount = callCount + 1; + } +}; + +obj.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-gen.js new file mode 100644 index 0000000000..e9c9fc312d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-fn-name-gen.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case +// - src/dstr-binding/default/meth.template +/*--- +description: SingleNameBinding assigns name to "anonymous" generator functions (method) +esid: sec-runtime-semantics-definemethod +features: [generators, destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + d. If IsAnonymousFunctionDefinition(Initializer) is true, then + i. Let hasNameProperty be HasOwnProperty(v, "name"). + ii. ReturnIfAbrupt(hasNameProperty). + iii. If hasNameProperty is false, perform SetFunctionName(v, + bindingId). + +---*/ + +var callCount = 0; +var obj = { + method({ gen = function* () {}, xGen = function* x() {} }) { + assert.sameValue(gen.name, 'gen'); + assert.notSameValue(xGen.name, 'xGen'); + callCount = callCount + 1; + } +}; + +obj.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-skipped.js new file mode 100644 index 0000000000..39f2ac7073 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-skipped.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-skipped.case +// - src/dstr-binding/default/meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + [...] + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + method({ w = counter(), x = counter(), y = counter(), z = counter() }) { + assert.sameValue(w, null); + assert.sameValue(x, 0); + assert.sameValue(y, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + callCount = callCount + 1; + } +}; + +obj.method({ w: null, x: 0, y: false, z: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-throws.js new file mode 100644 index 0000000000..0779e8bbc0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-throws.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-throws.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error thrown when evaluating the initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ x = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-unresolvable.js new file mode 100644 index 0000000000..7b1190e910 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-init-unresolvable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-init-unresolvable.case +// - src/dstr-binding/error/meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 6. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + method({ x = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-trailing-comma.js new file mode 100644 index 0000000000..bdc2d6f662 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-id-trailing-comma.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-id-trailing-comma.case +// - src/dstr-binding/default/meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + method({ x, }) { + assert.sameValue(x, 23); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-list-err.js new file mode 100644 index 0000000000..ceb7b0ecec --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-list-err.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-list-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Binding property list evaluation is interrupted by an abrupt completion (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingPropertyList : BindingPropertyList , BindingProperty + + 1. Let status be the result of performing BindingInitialization for + BindingPropertyList using value and environment as arguments. + 2. ReturnIfAbrupt(status). +---*/ +var initCount = 0; +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ a, b = thrower(), c = ++initCount }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +assert.sameValue(initCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-init.js new file mode 100644 index 0000000000..205b1e14a2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-init.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern using initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js new file mode 100644 index 0000000000..deb06f6f36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-trailing-comma.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case +// - src/dstr-binding/default/meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + method({ x: [y], }) { + assert.sameValue(y,45); + callCount = callCount + 1; + } +}; + +obj.method({ x: [45] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-value-null.js new file mode 100644 index 0000000000..18a5159fe3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary-value-null.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary-value-null.case +// - src/dstr-binding/error/meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern taking the `null` value (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + method({ w: [x, y, z] = [4, 5, 6] }) {} +}; + +assert.throws(TypeError, function() { + obj.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary.js new file mode 100644 index 0000000000..11ffd81d81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-ary.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-ary.case +// - src/dstr-binding/default/meth.template +/*--- +description: Object binding pattern with "nested" array binding pattern not using initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: [x, y, z] = [4, 5, 6] }) { + assert.sameValue(x, 7); + assert.sameValue(y, undefined); + assert.sameValue(z, undefined); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: [7, undefined, ] }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-eval-err.js new file mode 100644 index 0000000000..74939fd2c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-eval-err.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-eval-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Evaluation of property name returns an abrupt completion (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.5 Runtime Semantics: BindingInitialization + + BindingProperty : PropertyName : BindingElement + + 1. Let P be the result of evaluating PropertyName + 2. ReturnIfAbrupt(P). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ [thrower()]: x }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-get-value-err.js new file mode 100644 index 0000000000..c3d9972f63 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-get-value-err.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-get-value-err.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error thrown when accessing the corresponding property of the value object (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + 1. Let v be GetV(value, propertyName). + 2. ReturnIfAbrupt(v). +---*/ +var initEvalCount = 0; +var poisonedProperty = Object.defineProperty({}, 'poisoned', { + get: function() { + throw new Test262Error(); + } +}); + +var obj = { + method({ poisoned: x = ++initEvalCount }) {} +}; + +assert.throws(Test262Error, function() { + obj.method(poisonedProperty); +}); + +assert.sameValue(initEvalCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-skipped.js new file mode 100644 index 0000000000..dc97068ead --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-skipped.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case +// - src/dstr-binding/default/meth.template +/*--- +description: Destructuring initializer is not evaluated when value is not `undefined` (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + [...] +---*/ +var initCount = 0; +function counter() { + initCount += 1; +} + +var callCount = 0; +var obj = { + method({ s: t = counter(), u: v = counter(), w: x = counter(), y: z = counter() }) { + assert.sameValue(t, null); + assert.sameValue(v, 0); + assert.sameValue(x, false); + assert.sameValue(z, ''); + assert.sameValue(initCount, 0); + + assert.throws(ReferenceError, function() { + s; + }); + assert.throws(ReferenceError, function() { + u; + }); + assert.throws(ReferenceError, function() { + w; + }); + assert.throws(ReferenceError, function() { + y; + }); + callCount = callCount + 1; + } +}; + +obj.method({ s: null, u: 0, w: false, y: '' }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-throws.js new file mode 100644 index 0000000000..93c1361425 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-throws.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-throws.case +// - src/dstr-binding/error/meth.template +/*--- +description: Error thrown when evaluating the initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). +---*/ +function thrower() { + throw new Test262Error(); +} + +var obj = { + method({ x: y = thrower() }) {} +}; + +assert.throws(Test262Error, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js new file mode 100644 index 0000000000..6a9cd4a683 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init-unresolvable.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init-unresolvable.case +// - src/dstr-binding/error/meth.template +/*--- +description: Destructuring initializer is an unresolvable reference (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + BindingElement : BindingPattern Initializeropt + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +var obj = { + method({ x: y = unresolvableReference }) {} +}; + +assert.throws(ReferenceError, function() { + obj.method({}); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init.js new file mode 100644 index 0000000000..696cf4cd46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-init.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: Binding as specified via property name, identifier, and initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method({ x: y = 33 }) { + assert.sameValue(y, 33); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-trailing-comma.js new file mode 100644 index 0000000000..99d9bb6ef1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id-trailing-comma.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case +// - src/dstr-binding/default/meth.template +/*--- +description: Trailing comma is allowed following BindingPropertyList (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3 Destructuring Binding Patterns + + ObjectBindingPattern[Yield] : + { } + { BindingPropertyList[?Yield] } + { BindingPropertyList[?Yield] , } +---*/ + +var callCount = 0; +var obj = { + method({ x: y, }) { + assert.sameValue(y, 23); + + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id.js new file mode 100644 index 0000000000..6a838f2203 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-id.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-id.case +// - src/dstr-binding/default/meth.template +/*--- +description: Binding as specified via property name and identifier (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + SingleNameBinding : BindingIdentifier Initializeropt + + [...] + 8. Return InitializeReferencedBinding(lhs, v). +---*/ + +var callCount = 0; +var obj = { + method({ x: y }) { + assert.sameValue(y, 23); + assert.throws(ReferenceError, function() { + x; + }); + callCount = callCount + 1; + } +}; + +obj.method({ x: 23 }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-init.js new file mode 100644 index 0000000000..a9422f13c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-init.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-init.case +// - src/dstr-binding/default/meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern using initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + a. Let defaultValue be the result of evaluating Initializer. + b. Let v be GetValue(defaultValue). + c. ReturnIfAbrupt(v). + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, 4); + assert.sameValue(y, 5); + assert.sameValue(z, 6); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: undefined }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-null.js new file mode 100644 index 0000000000..c6c1910ac9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-null.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-null.case +// - src/dstr-binding/error/meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) {} +}; + +assert.throws(TypeError, function() { + obj.method({ w: null }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-undef.js new file mode 100644 index 0000000000..73a4484456 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj-value-undef.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj-value-undef.case +// - src/dstr-binding/error/meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern taking the `null` value (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var obj = { + method({ w: { x, y, z } = undefined }) {} +}; + +assert.throws(TypeError, function() { + obj.method({ }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj.js new file mode 100644 index 0000000000..f27a59f925 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-prop-obj.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-prop-obj.case +// - src/dstr-binding/default/meth.template +/*--- +description: Object binding pattern with "nested" object binding pattern not using initializer (method) +esid: sec-runtime-semantics-definemethod +features: [destructuring-binding] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.7 Runtime Semantics: KeyedBindingInitialization + + [...] + 3. If Initializer is present and v is undefined, then + [...] + 4. Return the result of performing BindingInitialization for BindingPattern + passing v and environment as arguments. +---*/ + +var callCount = 0; +var obj = { + method({ w: { x, y, z } = { x: 4, y: 5, z: 6 } }) { + assert.sameValue(x, undefined); + assert.sameValue(y, undefined); + assert.sameValue(z, 7); + + assert.throws(ReferenceError, function() { + w; + }); + callCount = callCount + 1; + } +}; + +obj.method({ w: { x: undefined, z: 7 } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-getter.js new file mode 100644 index 0000000000..9ef7a2cf73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-getter.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-getter.case +// - src/dstr-binding/default/meth.template +/*--- +description: Getter is called when obj is being deconstructed to a rest Object (method) +esid: sec-runtime-semantics-definemethod +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var count = 0; + +var callCount = 0; +var obj = { + method({...x}) { + assert.sameValue(count, 1); + + verifyProperty(x, "v", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method({ get v() { count++; return 2; } }); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js new file mode 100644 index 0000000000..356349aa02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-skip-non-enumerable.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest object doesn't contain non-enumerable properties (method) +esid: sec-runtime-semantics-definemethod +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ +var o = {a: 3, b: 4}; +Object.defineProperty(o, "x", { value: 4, enumerable: false }); + +var callCount = 0; +var obj = { + method({...rest}) { + assert.sameValue(rest.x, undefined); + + verifyProperty(rest, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(rest, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount = callCount + 1; + } +}; + +obj.method(o); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-val-obj.js new file mode 100644 index 0000000000..24d4ed754a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/meth-obj-ptrn-rest-val-obj.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/dstr-binding/obj-ptrn-rest-val-obj.case +// - src/dstr-binding/default/meth.template +/*--- +description: Rest object contains just unextracted data (method) +esid: sec-runtime-semantics-definemethod +features: [object-rest, destructuring-binding] +flags: [generated] +includes: [propertyHelper.js] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + method({a, b, ...rest}) { + assert.sameValue(rest.a, undefined); + assert.sameValue(rest.b, undefined); + + verifyProperty(rest, "x", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(rest, "y", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount = callCount + 1; + } +}; + +obj.method({x: 1, y: 2, a: 5, b: 3}); +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-get-not-called-on-dontenum-keys.js b/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-get-not-called-on-dontenum-keys.js new file mode 100644 index 0000000000..56494a2c1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-get-not-called-on-dontenum-keys.js @@ -0,0 +1,71 @@ +// Copyright (C) 2021 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-destructuring-binding-patterns-runtime-semantics-restbindinginitialization +description: > + Proxy's "get" trap is not invoked for non-enumerable keys. +info: | + BindingRestProperty : ... BindingIdentifier + + [...] + 3. Perform ? CopyDataProperties(restObj, value, excludedNames). + + CopyDataProperties ( target, source, excludedItems ) + + [...] + 5. Let keys be ? from.[[OwnPropertyKeys]](). + 6. For each element nextKey of keys in List order, do + [...] + c. If excluded is false, then + i. Let desc be ? from.[[GetOwnProperty]](nextKey). + ii. If desc is not undefined and desc.[[Enumerable]] is true, then + 1. Let propValue be ? Get(from, nextKey). + 2. Perform ! CreateDataPropertyOrThrow(target, nextKey, propValue). + + [[OwnPropertyKeys]] ( ) + + [...] + 7. Let trapResultArray be ? Call(trap, handler, « target »). + 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »). + [...] + 23. Return trapResult. +features: [object-rest, destructuring-binding, Proxy, Symbol] +includes: [compareArray.js, propertyHelper.js] +---*/ + +var VALUE_GOPD = "VALUE_GOPD"; +var VALUE_GET = "VALUE_GET"; + +var dontEnumSymbol = Symbol("dont_enum_symbol"); +var enumerableSymbol = Symbol("enumerable_symbol"); + +var dontEnumKeys = [dontEnumSymbol, "dontEnumString", "0"]; +var enumerableKeys = [enumerableSymbol, "enumerableString", "1"]; +var ownKeysResult = [...dontEnumKeys, ...enumerableKeys]; + +var getOwnKeys = []; +var getKeys = []; +var proxy = new Proxy({}, { + getOwnPropertyDescriptor: function(_target, key) { + getOwnKeys.push(key); + var isEnumerable = enumerableKeys.indexOf(key) !== -1; + return {value: VALUE_GOPD, writable: false, enumerable: isEnumerable, configurable: true}; + }, + get: function(_target, key) { + getKeys.push(key); + return VALUE_GET; + }, + ownKeys: function() { + return ownKeysResult; + }, +}); + +var {...rest} = proxy; +assert.compareArray(getOwnKeys, ownKeysResult); +assert.compareArray(getKeys, enumerableKeys); + +verifyProperty(rest, enumerableSymbol, {value: VALUE_GET, writable: true, enumerable: true, configurable: true}); +verifyProperty(rest, "enumerableString", {value: VALUE_GET, writable: true, enumerable: true, configurable: true}); +verifyProperty(rest, "1", {value: VALUE_GET, writable: true, enumerable: true, configurable: true}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-gopd-not-called-on-excluded-keys.js b/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-gopd-not-called-on-excluded-keys.js new file mode 100644 index 0000000000..679c3a4032 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-gopd-not-called-on-excluded-keys.js @@ -0,0 +1,55 @@ +// Copyright (C) 2021 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-destructuring-binding-patterns-runtime-semantics-restbindinginitialization +description: > + Proxy's "getOwnPropertyDescriptor" trap is not invoked for excluded keys. +info: | + BindingRestProperty : ... BindingIdentifier + + [...] + 3. Perform ? CopyDataProperties(restObj, value, excludedNames). + + CopyDataProperties ( target, source, excludedItems ) + + [...] + 5. Let keys be ? from.[[OwnPropertyKeys]](). + 6. For each element nextKey of keys in List order, do + b. For each element e of excludedItems, do + i. If SameValue(e, nextKey) is true, then + 1. Set excluded to true. + c. If excluded is false, then + i. Let desc be ? from.[[GetOwnProperty]](nextKey). + + [[OwnPropertyKeys]] ( ) + + [...] + 7. Let trapResultArray be ? Call(trap, handler, « target »). + 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »). + [...] + 23. Return trapResult. +features: [object-rest, destructuring-binding, Proxy, Symbol] +includes: [compareArray.js] +---*/ + +var excludedSymbol = Symbol("excluded_symbol"); +var includedSymbol = Symbol("included_symbol"); + +var excludedKeys = [excludedSymbol, "excludedString", "0"]; +var includedKeys = [includedSymbol, "includedString", "1"]; +var ownKeysResult = [...excludedKeys, ...includedKeys]; + +var getOwnKeys = []; +var proxy = new Proxy({}, { + getOwnPropertyDescriptor: function(_target, key) { + getOwnKeys.push(key); + }, + ownKeys: function() { + return ownKeysResult; + }, +}); + +var {[excludedSymbol]: _, excludedString, 0: excludedIndex, ...rest} = proxy; +assert.compareArray(getOwnKeys, includedKeys); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-ownkeys-returned-keys-order.js b/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-ownkeys-returned-keys-order.js new file mode 100644 index 0000000000..eed087e728 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/dstr/object-rest-proxy-ownkeys-returned-keys-order.js @@ -0,0 +1,47 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-destructuring-binding-patterns-runtime-semantics-restbindinginitialization +description: > + Proxy keys are iterated in order they were provided by "ownKeys" trap. +info: | + BindingRestProperty : ... BindingIdentifier + + [...] + 3. Perform ? CopyDataProperties(restObj, value, excludedNames). + + CopyDataProperties ( target, source, excludedItems ) + + [...] + 5. Let keys be ? from.[[OwnPropertyKeys]](). + 6. For each element nextKey of keys in List order, do + [...] + c. If excluded is false, then + i. Let desc be ? from.[[GetOwnProperty]](nextKey). + + [[OwnPropertyKeys]] ( ) + + [...] + 7. Let trapResultArray be ? Call(trap, handler, « target »). + 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »). + [...] + 23. Return trapResult. +features: [object-rest, destructuring-binding, Proxy, Symbol] +includes: [compareArray.js] +---*/ + +var getOwnKeys = []; +var ownKeysResult = [Symbol(), "foo", "0"]; +var proxy = new Proxy({}, { + getOwnPropertyDescriptor: function(_target, key) { + getOwnKeys.push(key); + }, + ownKeys: function() { + return ownKeysResult; + }, +}); + +let {...$} = proxy; +assert.compareArray(getOwnKeys, ownKeysResult); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/dstr/shell.js b/js/src/tests/test262/language/expressions/object/dstr/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/fn-name-accessor-get.js b/js/src/tests/test262/language/expressions/object/fn-name-accessor-get.js new file mode 100644 index 0000000000..83edde6750 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/fn-name-accessor-get.js @@ -0,0 +1,50 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 14.3.9 +description: Assignment of function `name` attribute ("get" accessor) +info: | + MethodDefinition : get PropertyName ( ) { FunctionBody } + + [...] + 8. Perform SetFunctionName(closure, propKey, "get"). +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o, getter; + +o = { + get id() {}, + get [anonSym]() {}, + get [namedSym]() {} +}; + +getter = Object.getOwnPropertyDescriptor(o, 'id').get; +verifyProperty(getter, 'name', { + value: 'get id', + writable: false, + enumerable: false, + configurable: true, +}); + +getter = Object.getOwnPropertyDescriptor(o, anonSym).get; +verifyProperty(getter, 'name', { + value: 'get ', + writable: false, + enumerable: false, + configurable: true, +}); + +getter = Object.getOwnPropertyDescriptor(o, namedSym).get; +verifyProperty(getter, 'name', { + value: 'get [test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/fn-name-accessor-set.js b/js/src/tests/test262/language/expressions/object/fn-name-accessor-set.js new file mode 100644 index 0000000000..e8efc8c42b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/fn-name-accessor-set.js @@ -0,0 +1,51 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 14.3.9 +description: Assignment of function `name` attribute ("set" accessor) +info: | + MethodDefinition : + set PropertyName ( PropertySetParameterList ) { FunctionBody } + + [...] + 7. Perform SetFunctionName(closure, propKey, "set"). +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o, setter; + +o = { + set id(_) {}, + set [anonSym](_) {}, + set [namedSym](_) {} +}; + +setter = Object.getOwnPropertyDescriptor(o, 'id').set; +verifyProperty(setter, 'name', { + value: 'set id', + writable: false, + enumerable: false, + configurable: true, +}); + +setter = Object.getOwnPropertyDescriptor(o, anonSym).set; +verifyProperty(setter, 'name', { + value: 'set ', + writable: false, + enumerable: false, + configurable: true, +}); + +setter = Object.getOwnPropertyDescriptor(o, namedSym).set; +verifyProperty(setter, 'name', { + value: 'set [test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/fn-name-arrow.js b/js/src/tests/test262/language/expressions/object/fn-name-arrow.js new file mode 100644 index 0000000000..18d8088346 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/fn-name-arrow.js @@ -0,0 +1,48 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.2.6.9 +description: Assignment of function `name` attribute (ArrowFunction) +info: | + 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be HasOwnProperty(propValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(propValue, + propKey). +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o; + +o = { + id: () => {}, + [anonSym]: () => {}, + [namedSym]: () => {} +}; + +verifyProperty(o.id, 'name', { + value: 'id', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[anonSym], 'name', { + value: '', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[namedSym], 'name', { + value: '[test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/fn-name-class.js b/js/src/tests/test262/language/expressions/object/fn-name-class.js new file mode 100644 index 0000000000..8933b71b5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/fn-name-class.js @@ -0,0 +1,51 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.2.6.9 +description: Assignment of function `name` attribute (ClassExpression) +info: | + 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be HasOwnProperty(propValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(propValue, + propKey). +includes: [propertyHelper.js] +features: [class, Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o; + +o = { + xId: class x {}, + id: class {}, + [anonSym]: class {}, + [namedSym]: class {} +}; + +assert(o.xId.name !== 'xId'); + +verifyProperty(o.id, 'name', { + value: 'id', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[anonSym], 'name', { + value: '', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[namedSym], 'name', { + value: '[test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/fn-name-cover.js b/js/src/tests/test262/language/expressions/object/fn-name-cover.js new file mode 100644 index 0000000000..c43012c6f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/fn-name-cover.js @@ -0,0 +1,52 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.2.6.9 +description: > + Assignment of function `name` attribute (CoverParenthesizedExpression) +info: | + 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be HasOwnProperty(propValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(propValue, + propKey). +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o; + +o = { + xId: (0, function() {}), + id: (function() {}), + [anonSym]: (function() {}), + [namedSym]: (function() {}) +}; + +assert(o.xId.name !== 'xId'); + +verifyProperty(o.id, 'name', { + value: 'id', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[anonSym], 'name', { + value: '', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[namedSym], 'name', { + value: '[test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/fn-name-fn.js b/js/src/tests/test262/language/expressions/object/fn-name-fn.js new file mode 100644 index 0000000000..6d411b1056 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/fn-name-fn.js @@ -0,0 +1,51 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.2.6.9 +description: Assignment of function `name` attribute (FunctionExpression) +info: | + 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be HasOwnProperty(propValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(propValue, + propKey). +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o; + +o = { + xId: function x() {}, + id: function() {}, + [anonSym]: function() {}, + [namedSym]: function() {} +}; + +assert(o.xId.name !== 'xId'); + +verifyProperty(o.id, 'name', { + value: 'id', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[anonSym], 'name', { + value: '', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[namedSym], 'name', { + value: '[test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/fn-name-gen.js b/js/src/tests/test262/language/expressions/object/fn-name-gen.js new file mode 100644 index 0000000000..833d743cb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/fn-name-gen.js @@ -0,0 +1,52 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.2.6.9 +description: > + Assignment of function `name` attribute (GeneratorExpression) +info: | + 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be HasOwnProperty(propValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(propValue, + propKey). +includes: [propertyHelper.js] +features: [generators, Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o; + +o = { + xId: function* x() {}, + id: function*() {}, + [anonSym]: function*() {}, + [namedSym]: function*() {} +}; + +assert(o.xId.name !== 'xId'); + +verifyProperty(o.id, 'name', { + value: 'id', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[anonSym], 'name', { + value: '', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[namedSym], 'name', { + value: '[test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/getter-body-strict-inside.js b/js/src/tests/test262/language/expressions/object/getter-body-strict-inside.js new file mode 100644 index 0000000000..3e37f09baa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/getter-body-strict-inside.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5_6-2-2-s +description: > + Strict Mode - SyntaxError is thrown when an assignment to a + reserved word or a future reserved word is made inside a strict + mode FunctionBody of a PropertyAssignment +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +void { + get x() { + "use strict"; + public = 42; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/getter-body-strict-outside-strict.js b/js/src/tests/test262/language/expressions/object/getter-body-strict-outside-strict.js new file mode 100644 index 0000000000..3af4e0b9e2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/getter-body-strict-outside-strict.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5_6-2-1-s +description: > + Strict Mode - SyntaxError is thrown when an assignment to a + reserved word or a future reserved word is contained in strict code +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +void { + get x() { + public = 42; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/getter-param-dflt.js b/js/src/tests/test262/language/expressions/object/getter-param-dflt.js new file mode 100644 index 0000000000..d58503cc33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/getter-param-dflt.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-method-definitions +es6id: 14.3 +description: > + Get accessor method may not have a formal parameter (regardless of the + presence of an initializer) +info: | + Syntax + + MethodDefinition[Yield] : + + get PropertyName[?Yield] ( ) { FunctionBody } +features: [default-parameters] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +0, { get a(param = null) {} }; diff --git a/js/src/tests/test262/language/expressions/object/getter-prop-desc.js b/js/src/tests/test262/language/expressions/object/getter-prop-desc.js new file mode 100644 index 0000000000..2728a98a9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/getter-prop-desc.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +description: Property descriptor of "set" accessor methods +info: | + ObjectLiteral: + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + 3. ReturnIfAbrupt(status). + 4. Return obj. + + 14.3.8 Runtime Semantics: PropertyDefinitionEvaluation + + MethodDefinition : get PropertyName ( ) { FunctionBody} + + [...] + 9. Let desc be the PropertyDescriptor{[[Get]]: closure, [[Enumerable]]: + enumerable, [[Configurable]]: true}. + [...] +includes: [propertyHelper.js] +---*/ + +var obj = { get m() { return 1234; } }; +var desc = Object.getOwnPropertyDescriptor(obj, 'm'); + +verifyProperty(obj, 'm', { + enumerable: true, + configurable: true, +}); + +assert.sameValue(desc.value, undefined, '`value` field'); +assert.sameValue(desc.set, undefined, '`set` field'); +assert.sameValue(typeof desc.get, 'function', 'type of `get` field'); +assert.sameValue(desc.get(), 1234, '`get` function return value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/getter-super-prop.js b/js/src/tests/test262/language/expressions/object/getter-super-prop.js new file mode 100644 index 0000000000..713d51af23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/getter-super-prop.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + super method calls in object literal getter +---*/ +var proto = { + _x: 42, + get x() { + return 'proto' + this._x; + } +}; + +var object = { + get x() { + return super.x; + } +}; + +Object.setPrototypeOf(object, proto); + +assert.sameValue(object.x, 'proto42', "The value of `object.x` is `'proto42'`, after executing `Object.setPrototypeOf(object, proto);`"); +assert.sameValue(object._x, 42, "The value of `object._x` is `42`, after executing `Object.setPrototypeOf(object, proto);`"); +assert.sameValue( + Object.getPrototypeOf(object)._x, + 42, + "The value of `Object.getPrototypeOf(object)._x` is `42`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-break-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-break-escaped.js new file mode 100644 index 0000000000..c12ecbd6b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-break-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: break is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + bre\u0061k() { return 42; } +}; + +assert.sameValue(obj['break'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-case-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-case-escaped.js new file mode 100644 index 0000000000..6733a4c3fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-case-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: case is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + c\u0061se() { return 42; } +}; + +assert.sameValue(obj['case'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-catch-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-catch-escaped.js new file mode 100644 index 0000000000..de4050fc46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-catch-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: catch is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + c\u0061tch() { return 42; } +}; + +assert.sameValue(obj['catch'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-class-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-class-escaped.js new file mode 100644 index 0000000000..7936a16e4c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-class-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: class is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + cl\u0061ss() { return 42; } +}; + +assert.sameValue(obj['class'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-const-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-const-escaped.js new file mode 100644 index 0000000000..a8dbb7110c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-const-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: const is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0063onst() { return 42; } +}; + +assert.sameValue(obj['const'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-continue-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-continue-escaped.js new file mode 100644 index 0000000000..9b3f9f24f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-continue-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: continue is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0063ontinue() { return 42; } +}; + +assert.sameValue(obj['continue'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-debugger-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-debugger-escaped.js new file mode 100644 index 0000000000..a7d84c067d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-debugger-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: debugger is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0064ebugger() { return 42; } +}; + +assert.sameValue(obj['debugger'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped-ext.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped-ext.js new file mode 100644 index 0000000000..6ea6269ede --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped-ext.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: default is a valid identifier name, using extended escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + def\u{61}ult() { return 42; } +}; + +assert.sameValue(obj['default'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped.js new file mode 100644 index 0000000000..a07947ce9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-default-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: default is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + def\u0061ult() { return 42; } +}; + +assert.sameValue(obj['default'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-default.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-default.js new file mode 100644 index 0000000000..15fbcf1594 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-default.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: default is a valid identifier name (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + default() { return 42; } +}; + +assert.sameValue(obj['default'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-delete-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-delete-escaped.js new file mode 100644 index 0000000000..3a63cf1734 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-delete-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: delete is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0064elete() { return 42; } +}; + +assert.sameValue(obj['delete'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-do-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-do-escaped.js new file mode 100644 index 0000000000..ae52e41aa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-do-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: do is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0064o() { return 42; } +}; + +assert.sameValue(obj['do'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-else-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-else-escaped.js new file mode 100644 index 0000000000..9e828a438c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-else-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: else is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0065lse() { return 42; } +}; + +assert.sameValue(obj['else'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-enum-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-enum-escaped.js new file mode 100644 index 0000000000..5044ebd8fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-enum-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: enum is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0065num() { return 42; } +}; + +assert.sameValue(obj['enum'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-export-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-export-escaped.js new file mode 100644 index 0000000000..3edb5c88e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-export-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: export is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0065xport() { return 42; } +}; + +assert.sameValue(obj['export'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped-ext.js new file mode 100644 index 0000000000..e421e6bdbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped-ext.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: extends is a valid identifier name, using extended escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u{65}xtends() { return 42; } +}; + +assert.sameValue(obj['extends'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped.js new file mode 100644 index 0000000000..f8e3797d0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: extends is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0065xtends() { return 42; } +}; + +assert.sameValue(obj['extends'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends.js new file mode 100644 index 0000000000..081541edc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-extends.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: extends is a valid identifier name (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + extends() { return 42; } +}; + +assert.sameValue(obj['extends'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-finally-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-finally-escaped.js new file mode 100644 index 0000000000..c3d5a0b9c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-finally-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: finally is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0066inally() { return 42; } +}; + +assert.sameValue(obj['finally'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-for-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-for-escaped.js new file mode 100644 index 0000000000..1f310a77e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-for-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: for is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0066or() { return 42; } +}; + +assert.sameValue(obj['for'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-function-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-function-escaped.js new file mode 100644 index 0000000000..1ec61b4465 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-function-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: function is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0066unction() { return 42; } +}; + +assert.sameValue(obj['function'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-if-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-if-escaped.js new file mode 100644 index 0000000000..ab03d1f301 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-if-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: if is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + i\u0066() { return 42; } +}; + +assert.sameValue(obj['if'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-implements-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-implements-escaped.js new file mode 100644 index 0000000000..ae82493e5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-implements-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: implements is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0069mplements() { return 42; } +}; + +assert.sameValue(obj['implements'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-import-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-import-escaped.js new file mode 100644 index 0000000000..59ac8a5120 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-import-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: import is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0069mport() { return 42; } +}; + +assert.sameValue(obj['import'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-in-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-in-escaped.js new file mode 100644 index 0000000000..4f4c2f57ab --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-in-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: in is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0069n() { return 42; } +}; + +assert.sameValue(obj['in'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-instanceof-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-instanceof-escaped.js new file mode 100644 index 0000000000..ff1855ad04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-instanceof-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: instanceof is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + \u0069nstanceof() { return 42; } +}; + +assert.sameValue(obj['instanceof'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-interface-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-interface-escaped.js new file mode 100644 index 0000000000..82a52a4c72 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-interface-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: interface is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + interf\u0061ce() { return 42; } +}; + +assert.sameValue(obj['interface'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-let-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-let-escaped.js new file mode 100644 index 0000000000..cfd9610b98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-let-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: let is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + l\u0065t() { return 42; } +}; + +assert.sameValue(obj['let'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-new-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-new-escaped.js new file mode 100644 index 0000000000..63d9968d06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-new-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: new is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + n\u0065w() { return 42; } +}; + +assert.sameValue(obj['new'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-package-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-package-escaped.js new file mode 100644 index 0000000000..ac5feaa238 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-package-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: package is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + p\u0061ckage() { return 42; } +}; + +assert.sameValue(obj['package'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-private-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-private-escaped.js new file mode 100644 index 0000000000..cf11ba5118 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-private-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: private is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + privat\u0065() { return 42; } +}; + +assert.sameValue(obj['private'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-protected-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-protected-escaped.js new file mode 100644 index 0000000000..5575cf0dd3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-protected-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: protected is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + prot\u0065cted() { return 42; } +}; + +assert.sameValue(obj['protected'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-public-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-public-escaped.js new file mode 100644 index 0000000000..813764b241 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-public-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: public is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + pu\u0062lic() { return 42; } +}; + +assert.sameValue(obj['public'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-return-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-return-escaped.js new file mode 100644 index 0000000000..833ee194f0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-return-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: return is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + r\u0065turn() { return 42; } +}; + +assert.sameValue(obj['return'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-static-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-static-escaped.js new file mode 100644 index 0000000000..b43163df38 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-static-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/obj-method-definition.template +/*--- +description: static is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + st\u0061tic() { return 42; } +}; + +assert.sameValue(obj['static'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-super-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-super-escaped.js new file mode 100644 index 0000000000..0aaf71880a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-super-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: super is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + sup\u0065r() { return 42; } +}; + +assert.sameValue(obj['super'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-switch-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-switch-escaped.js new file mode 100644 index 0000000000..a334391c78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-switch-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: switch is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + sw\u0069tch() { return 42; } +}; + +assert.sameValue(obj['switch'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-this-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-this-escaped.js new file mode 100644 index 0000000000..587bb84366 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-this-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: this is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + th\u0069s() { return 42; } +}; + +assert.sameValue(obj['this'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-throw-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-throw-escaped.js new file mode 100644 index 0000000000..18dab852b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-throw-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: throw is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + t\u0068row() { return 42; } +}; + +assert.sameValue(obj['throw'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-try-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-try-escaped.js new file mode 100644 index 0000000000..2adcb239db --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-try-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: try is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + tr\u0079() { return 42; } +}; + +assert.sameValue(obj['try'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-typeof-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-typeof-escaped.js new file mode 100644 index 0000000000..d4972feb2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-typeof-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: typeof is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + typ\u0065of() { return 42; } +}; + +assert.sameValue(obj['typeof'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-var-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-var-escaped.js new file mode 100644 index 0000000000..696151f577 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-var-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: var is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + v\u0061r() { return 42; } +}; + +assert.sameValue(obj['var'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-void-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-void-escaped.js new file mode 100644 index 0000000000..9e7985ab3f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-void-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: void is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + voi\u0064() { return 42; } +}; + +assert.sameValue(obj['void'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-while-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-while-escaped.js new file mode 100644 index 0000000000..e30b1823de --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-while-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: while is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + whil\u0065() { return 42; } +}; + +assert.sameValue(obj['while'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-method-def-with-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-method-def-with-escaped.js new file mode 100644 index 0000000000..7fa20511a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-method-def-with-escaped.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/obj-method-definition.template +/*--- +description: with is a valid identifier name, using escape (MethodDefinition) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + MethodDefinition + ... + + MethodDefinition: + PropertyName ( UniqueFormalParameters ){ FunctionBody } + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + + +var obj = { + w\u0069th() { return 42; } +}; + +assert.sameValue(obj['with'](), 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-await-static-init.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-await-static-init.js new file mode 100644 index 0000000000..4b0a4f25f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-await-static-init.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The restriction on `await` does not apply to IdentifierName +info: | + BindingIdentifier : Identifier + + [...] + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "await". +features: [class-static-block] +---*/ + +class C { + static { + ({ await: 0 }); + } +} + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-break-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-break-escaped.js new file mode 100644 index 0000000000..7f44c42ced --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-break-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/break-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: break is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + bre\u0061k: 42 +}; + +assert.sameValue(obj['break'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-case-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-case-escaped.js new file mode 100644 index 0000000000..6a5b8adb45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-case-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/case-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: case is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + c\u0061se: 42 +}; + +assert.sameValue(obj['case'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-catch-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-catch-escaped.js new file mode 100644 index 0000000000..2a291a52fd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-catch-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/catch-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: catch is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + c\u0061tch: 42 +}; + +assert.sameValue(obj['catch'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-class-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-class-escaped.js new file mode 100644 index 0000000000..43622c5191 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-class-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/class-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: class is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + cl\u0061ss: 42 +}; + +assert.sameValue(obj['class'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-const-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-const-escaped.js new file mode 100644 index 0000000000..7ee280fa99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-const-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/const-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: const is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0063onst: 42 +}; + +assert.sameValue(obj['const'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-continue-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-continue-escaped.js new file mode 100644 index 0000000000..91d2d800d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-continue-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/continue-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: continue is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0063ontinue: 42 +}; + +assert.sameValue(obj['continue'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-debugger-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-debugger-escaped.js new file mode 100644 index 0000000000..e8f7e3cb48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-debugger-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/debugger-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: debugger is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0064ebugger: 42 +}; + +assert.sameValue(obj['debugger'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped-ext.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped-ext.js new file mode 100644 index 0000000000..1bbf17b2e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped-ext.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped-ext.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: default is a valid identifier name, using extended escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + def\u{61}ult: 42 +}; + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped.js new file mode 100644 index 0000000000..66b63a8c8e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: default is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + def\u0061ult: 42 +}; + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default.js new file mode 100644 index 0000000000..ee5842a6f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-default.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/default.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: default is a valid identifier name (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + default: 42 +}; + +assert.sameValue(obj['default'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-delete-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-delete-escaped.js new file mode 100644 index 0000000000..2a24bf6689 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-delete-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/delete-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: delete is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0064elete: 42 +}; + +assert.sameValue(obj['delete'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-do-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-do-escaped.js new file mode 100644 index 0000000000..86dc6c0d9f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-do-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/do-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: do is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0064o: 42 +}; + +assert.sameValue(obj['do'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-else-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-else-escaped.js new file mode 100644 index 0000000000..a361eaab52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-else-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/else-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: else is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0065lse: 42 +}; + +assert.sameValue(obj['else'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-enum-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-enum-escaped.js new file mode 100644 index 0000000000..d328c2a00b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-enum-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/enum-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: enum is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0065num: 42 +}; + +assert.sameValue(obj['enum'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-export-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-export-escaped.js new file mode 100644 index 0000000000..91a6a832fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-export-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/export-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: export is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0065xport: 42 +}; + +assert.sameValue(obj['export'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped-ext.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped-ext.js new file mode 100644 index 0000000000..edf247f0c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped-ext.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped-ext.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: extends is a valid identifier name, using extended escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u{65}xtends: 42 +}; + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped.js new file mode 100644 index 0000000000..9ac59a11b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: extends is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0065xtends: 42 +}; + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends.js new file mode 100644 index 0000000000..f1263dea4a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-extends.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/extends.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: extends is a valid identifier name (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + extends: 42 +}; + +assert.sameValue(obj['extends'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-finally-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-finally-escaped.js new file mode 100644 index 0000000000..3942b5783a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-finally-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/finally-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: finally is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0066inally: 42 +}; + +assert.sameValue(obj['finally'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-for-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-for-escaped.js new file mode 100644 index 0000000000..e3be4e0e53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-for-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/for-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: for is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0066or: 42 +}; + +assert.sameValue(obj['for'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-function-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-function-escaped.js new file mode 100644 index 0000000000..bf53fd163e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-function-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/function-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: function is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0066unction: 42 +}; + +assert.sameValue(obj['function'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-if-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-if-escaped.js new file mode 100644 index 0000000000..81f7328597 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-if-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/if-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: if is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + i\u0066: 42 +}; + +assert.sameValue(obj['if'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-implements-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-implements-escaped.js new file mode 100644 index 0000000000..d715f14a06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-implements-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/implements-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: implements is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0069mplements: 42 +}; + +assert.sameValue(obj['implements'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-import-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-import-escaped.js new file mode 100644 index 0000000000..61e696a9f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-import-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/import-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: import is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0069mport: 42 +}; + +assert.sameValue(obj['import'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-in-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-in-escaped.js new file mode 100644 index 0000000000..334a719eaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-in-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/in-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: in is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0069n: 42 +}; + +assert.sameValue(obj['in'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-instanceof-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-instanceof-escaped.js new file mode 100644 index 0000000000..61fbe06591 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-instanceof-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/instanceof-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: instanceof is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + \u0069nstanceof: 42 +}; + +assert.sameValue(obj['instanceof'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-interface-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-interface-escaped.js new file mode 100644 index 0000000000..1d054d30c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-interface-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/interface-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: interface is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + interf\u0061ce: 42 +}; + +assert.sameValue(obj['interface'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-let-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-let-escaped.js new file mode 100644 index 0000000000..b6ce475f57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-let-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/let-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: let is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + l\u0065t: 42 +}; + +assert.sameValue(obj['let'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-new-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-new-escaped.js new file mode 100644 index 0000000000..def5e42d91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-new-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/new-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: new is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + n\u0065w: 42 +}; + +assert.sameValue(obj['new'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-package-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-package-escaped.js new file mode 100644 index 0000000000..7342a3fce5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-package-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/package-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: package is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + p\u0061ckage: 42 +}; + +assert.sameValue(obj['package'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-private-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-private-escaped.js new file mode 100644 index 0000000000..deabe2145a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-private-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/private-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: private is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + privat\u0065: 42 +}; + +assert.sameValue(obj['private'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-protected-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-protected-escaped.js new file mode 100644 index 0000000000..d9c011746e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-protected-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/protected-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: protected is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + prot\u0065cted: 42 +}; + +assert.sameValue(obj['protected'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-public-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-public-escaped.js new file mode 100644 index 0000000000..ae0372c0cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-public-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/public-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: public is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + pu\u0062lic: 42 +}; + +assert.sameValue(obj['public'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-return-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-return-escaped.js new file mode 100644 index 0000000000..51bb7f7e0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-return-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/return-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: return is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + r\u0065turn: 42 +}; + +assert.sameValue(obj['return'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-static-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-static-escaped.js new file mode 100644 index 0000000000..ac3ef28e57 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-static-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/static-escaped.case +// - src/identifier-names/future-reserved-words/obj-prop-name.template +/*--- +description: static is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + st\u0061tic: 42 +}; + +assert.sameValue(obj['static'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-super-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-super-escaped.js new file mode 100644 index 0000000000..10b5eee9bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-super-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/super-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: super is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + sup\u0065r: 42 +}; + +assert.sameValue(obj['super'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-switch-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-switch-escaped.js new file mode 100644 index 0000000000..699208b612 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-switch-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/switch-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: switch is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + sw\u0069tch: 42 +}; + +assert.sameValue(obj['switch'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-this-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-this-escaped.js new file mode 100644 index 0000000000..0b9d403d32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-this-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/this-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: this is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + th\u0069s: 42 +}; + +assert.sameValue(obj['this'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-throw-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-throw-escaped.js new file mode 100644 index 0000000000..2987f9cd41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-throw-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/throw-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: throw is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + t\u0068row: 42 +}; + +assert.sameValue(obj['throw'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-try-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-try-escaped.js new file mode 100644 index 0000000000..d85205adb3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-try-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/try-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: try is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + tr\u0079: 42 +}; + +assert.sameValue(obj['try'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-typeof-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-typeof-escaped.js new file mode 100644 index 0000000000..bbd40a432f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-typeof-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/typeof-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: typeof is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + typ\u0065of: 42 +}; + +assert.sameValue(obj['typeof'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-var-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-var-escaped.js new file mode 100644 index 0000000000..4bbfa26cf3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-var-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/var-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: var is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + v\u0061r: 42 +}; + +assert.sameValue(obj['var'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-void-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-void-escaped.js new file mode 100644 index 0000000000..9a0c99fd21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-void-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/void-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: void is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + voi\u0064: 42 +}; + +assert.sameValue(obj['void'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-while-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-while-escaped.js new file mode 100644 index 0000000000..e52ede12d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-while-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/while-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: while is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + whil\u0065: 42 +}; + +assert.sameValue(obj['while'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-with-escaped.js b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-with-escaped.js new file mode 100644 index 0000000000..8bcc439f59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/ident-name-prop-name-literal-with-escaped.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/identifier-names/with-escaped.case +// - src/identifier-names/default/obj-prop-name.template +/*--- +description: with is a valid identifier name, using escape (PropertyName) +esid: prod-PropertyDefinition +flags: [generated] +info: | + ObjectLiteral : + { PropertyDefinitionList } + { PropertyDefinitionList , } + + PropertyDefinitionList: + PropertyDefinition + PropertyDefinitionList , PropertyDefinition + + PropertyDefinition: + IdentifierReference + PropertyName : AssignmentExpression + MethodDefinition + ... AssignmentExpression + ... + + PropertyName: + LiteralPropertyName + ... + + LiteralPropertyName: + IdentifierName + ... + + Reserved Words + + A reserved word is an IdentifierName that cannot be used as an Identifier. +---*/ + +var obj = { + w\u0069th: 42 +}; + +assert.sameValue(obj['with'], 42, 'property exists'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-await-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-await-strict-mode.js new file mode 100644 index 0000000000..23dd4af93a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-await-strict-mode.js @@ -0,0 +1,27 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. await is valid in non-module strict mode code. +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + Identifier : IdentifierName but not ReservedWord + +---*/ + +var await = 1; +(function() { + "use strict"; + ({ + await + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-implements-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-implements-invalid-strict-mode.js new file mode 100644 index 0000000000..d197a4b639 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-implements-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (implements) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var implements = 1; +(function() { + "use strict"; + ({ + implements + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-interface-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-interface-invalid-strict-mode.js new file mode 100644 index 0000000000..0ed4b73162 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-interface-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (interface) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var interface = 1; +(function() { + "use strict"; + ({ + interface + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-computed-name.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-computed-name.js new file mode 100644 index 0000000000..a323ddad33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-computed-name.js @@ -0,0 +1,30 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are only valid with identifier references, + not computed property names. +esid: sec-object-initializer +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + PropertyName: + LiteralPropertyName + ComputedPropertyName +negative: + phase: parse + type: SyntaxError +---*/ + +var x = "y"; +var y = 42; + +$DONOTEVALUATE(); + +({[x]}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-zero.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-zero.js new file mode 100644 index 0000000000..77b619b624 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-invalid-zero.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 The V8 Project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are only valid with identifier references, + not property names. (0) +esid: sec-object-initializer +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({0}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-let-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-let-invalid-strict-mode.js new file mode 100644 index 0000000000..0ec29c8fe1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-let-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (let) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var let = 1; +(function() { + "use strict"; + ({ + let + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-package-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-package-invalid-strict-mode.js new file mode 100644 index 0000000000..74f37c120f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-package-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (package) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var package = 1; +(function() { + "use strict"; + ({ + package + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-private-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-private-invalid-strict-mode.js new file mode 100644 index 0000000000..3cbbb7d0d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-private-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (private) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var private = 1; +(function() { + "use strict"; + ({ + private + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-protected-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-protected-invalid-strict-mode.js new file mode 100644 index 0000000000..350d47b8e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-protected-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (protected) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var protected = 1; +(function() { + "use strict"; + ({ + protected + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-public-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-public-invalid-strict-mode.js new file mode 100644 index 0000000000..d47fcd7848 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-public-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (public) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var public = 1; +(function() { + "use strict"; + ({ + public + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-invalid.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-invalid.js new file mode 100644 index 0000000000..7cecd72f2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-invalid.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: IdentifierReference may not be `await` within class static blocks +info: | + IdentifierReference : Identifier + + - It is a Syntax Error if the code matched by this production is nested, + directly or indirectly (but not crossing function or static initialization + block boundaries), within a ClassStaticBlock and the StringValue of + Identifier is "arguments" or "await". +negative: + phase: parse + type: SyntaxError +features: [class-static-block] +---*/ + +$DONOTEVALUATE(); + +class C { + static { + ({ await }); + } +} + diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-valid.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-valid.js new file mode 100644 index 0000000000..0fca54dde8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-init-await-valid.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the body of arrow functions +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + (() => ({ await })); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-invalid-strict-mode.js new file mode 100644 index 0000000000..3084a924dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-static-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (static) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var static = 1; +(function() { + "use strict"; + ({ + static + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/identifier-shorthand-yield-invalid-strict-mode.js b/js/src/tests/test262/language/expressions/object/identifier-shorthand-yield-invalid-strict-mode.js new file mode 100644 index 0000000000..bdfe427b71 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/identifier-shorthand-yield-invalid-strict-mode.js @@ -0,0 +1,34 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Object literal shorthands are limited to valid identifier references. Future Reserved Words are disallowed in Strict Mode. (yield) +esid: sec-object-initializer +flags: [noStrict] +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + Identifier : IdentifierName but not ReservedWord + It is a Syntax Error if this phrase is contained in strict mode code and + the StringValue of IdentifierName is: "implements", "interface", "let", + "package", "private", "protected", "public", "static", or "yield". +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var yield = 1; +(function() { + "use strict"; + ({ + yield + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/let-non-strict-access.js b/js/src/tests/test262/language/expressions/object/let-non-strict-access.js new file mode 100644 index 0000000000..e9c23ff8b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/let-non-strict-access.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + In non-strict mode, let is a valid Identifier. +flags: [noStrict] +---*/ +var let = 1; +var object = {let}; + +assert.sameValue(object.let, 1, "The value of `object.let` is `1`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/let-non-strict-syntax.js b/js/src/tests/test262/language/expressions/object/let-non-strict-syntax.js new file mode 100644 index 0000000000..da6d49f2aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/let-non-strict-syntax.js @@ -0,0 +1,12 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + In non-strict mode, let is a valid Identifier. +flags: [noStrict] +---*/ +var let = 1; +var object = {let}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/literal-property-name-bigint.js b/js/src/tests/test262/language/expressions/object/literal-property-name-bigint.js new file mode 100644 index 0000000000..ad502cbdb0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/literal-property-name-bigint.js @@ -0,0 +1,56 @@ +// Copyright (C) 2020 Igalia S.L, Toru Nagashima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + BigInt in LiteralPropertyName must be valid and the property name must be + the string representation of the numeric value. +esid: prod-PropertyName +info: | + PropertyName[Yield, Await]: + LiteralPropertyName + ComputedPropertyName[?Yield, ?Await] + + LiteralPropertyName: + IdentifierName + StringLiteral + NumericLiteral + + NumericLiteral: + DecimalLiteral + DecimalBigIntegerLiteral + + LiteralPropertyName: NumericLiteral + 1. Let _nbr_ be the NumericValue of |NumericLiteral|. + 1. Return ! ToString(_nbr_). +features: [BigInt, class, destructuring-binding, let] +---*/ + +// Property + +let o = { 999999999999999999n: true }; // greater than max safe integer + +assert.sameValue(o["999999999999999999"], true, + "the property name must be the string representation of the numeric value."); + +// MethodDeclaration + +o = { 1n() { return "bar"; } }; +assert.sameValue(o["1"](), "bar", + "the property name must be the string representation of the numeric value."); + +class C { + 1n() { return "baz"; } +} + +let c = new C(); +assert.sameValue(c["1"](), "baz", + "the property name must be the string representation of the numeric value."); + +// Destructuring + +let { 1n: a } = { "1": "foo" }; +assert.sameValue(a, "foo", + "the property name must be the string representation of the numeric value."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..c141013d17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier-escaped.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier-escaped.case +// - src/async-functions/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async method() { + var \u0061wait; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier.js new file mode 100644 index 0000000000..c747d0aaef --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-binding-identifier.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-binding-identifier.case +// - src/async-functions/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async method() { + var await; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..b1dcb105e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference-escaped.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference-escaped.case +// - src/async-functions/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async method() { + void \u0061wait; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference.js new file mode 100644 index 0000000000..3c7a6ef6cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-identifier-reference.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-identifier-reference.case +// - src/async-functions/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async method() { + void await; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..043ec046a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier-escaped.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier-escaped.case +// - src/async-functions/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async method() { + \u0061wait: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier.js new file mode 100644 index 0000000000..eda037cc56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-await-as-label-identifier.js @@ -0,0 +1,33 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-functions/await-as-label-identifier.case +// - src/async-functions/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async method() { + await: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..aadcbb8e76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + var \u0061wait; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier.js new file mode 100644 index 0000000000..65a8faee06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-binding-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-binding-identifier.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + var await; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..74d04cb2e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + void \u0061wait; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference.js new file mode 100644 index 0000000000..a34ef5a980 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-identifier-reference.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-identifier-reference.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + void await; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier-escaped.js new file mode 100644 index 0000000000..8e3645db40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + \u0061wait: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier.js new file mode 100644 index 0000000000..1f28dc3581 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-await-as-label-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/await-as-label-identifier.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + await: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..a5b1aacd0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-array-destructuring-param-strict-body.js @@ -0,0 +1,119 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-gen-meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + async *method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-abrupt.js new file mode 100644 index 0000000000..71ee18569a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-abrupt.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/async-gen-meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var obj = { + async *method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..d82f55230c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-not-undefined.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/async-gen-meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var obj = { + async *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(false, '', NaN, 0, null, obj).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..10eb13b33d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-arg-val-undefined.js @@ -0,0 +1,56 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/async-gen-meth.template +/*--- +description: Use of initializer when argument value is `undefined` (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var obj = { + async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(undefined, void 0).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-duplicates.js new file mode 100644 index 0000000000..bcfe752728 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-duplicates.js @@ -0,0 +1,48 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/async-gen-meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, { + async *method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-later.js new file mode 100644 index 0000000000..4b9feeafd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-later.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/async-gen-meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + async *method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-prior.js new file mode 100644 index 0000000000..cbf1d7b093 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-prior.js @@ -0,0 +1,53 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/async-gen-meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + async *method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(3).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-self.js new file mode 100644 index 0000000000..cc64c81ffb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-ref-self.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/async-gen-meth.template +/*--- +description: Referencing a parameter from within its own initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + async *method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-rest.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-rest.js new file mode 100644 index 0000000000..c0fb63602f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-rest.js @@ -0,0 +1,52 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/async-gen-meth.template +/*--- +description: RestParameter does not support an initializer (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, { + async *method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-trailing-comma.js new file mode 100644 index 0000000000..d3410ff852 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-dflt-params-trailing-comma.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/async-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + async *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42, undefined, 1).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-escaped-async.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-escaped-async.js new file mode 100644 index 0000000000..93ee4852ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-escaped-async.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `async` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +features: [async-iteration] +---*/ + +$DONOTEVALUATE(); + +({ + \u0061sync* m(){} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..60fcc0e75e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-eval-var-scope-syntax-err.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/async-gen-meth.template +/*--- +description: sloppy direct eval in params introduces var (async generator method in sloppy code) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [default-parameters, async-iteration] +flags: [generated, noStrict] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + +var callCount = 0; +var obj = { + async *method(a = eval("var a = 42")) { + + callCount = callCount + 1; + } +}; + +assert.throws(SyntaxError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..056bbc4bda --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-object-destructuring-param-strict-body.js @@ -0,0 +1,119 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-gen-meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + async *method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-multiple.js new file mode 100644 index 0000000000..587d350e52 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-multiple.js @@ -0,0 +1,48 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/async-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + async *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42, 39, 1).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-single.js new file mode 100644 index 0000000000..270581a6f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-params-trailing-comma-single.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/async-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + async *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +ref(42, 39).next().then(() => { + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-param-strict-body.js new file mode 100644 index 0000000000..1352903427 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-param-strict-body.js @@ -0,0 +1,119 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/async-gen-meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + async *method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..60cbef5707 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-meth-rest-params-trailing-comma-early-error.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/async-gen-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, { + async *method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..181fa2e7a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier-escaped.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + var yi\u0065ld; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier.js new file mode 100644 index 0000000000..4b78e8b854 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-binding-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-binding-identifier.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + var yield; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..b0f36a3161 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference-escaped.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + void yi\u0065ld; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference.js new file mode 100644 index 0000000000..fbe97d4c7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-identifier-reference.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-identifier-reference.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + void yield; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..37f8f3f724 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier-escaped.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + yi\u0065ld: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier.js new file mode 100644 index 0000000000..5e5a8093c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-as-label-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-as-label-identifier.case +// - src/async-generators/syntax/async-obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 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 obj = { + async *method() { + yield: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-non-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-non-strict.js new file mode 100644 index 0000000000..168caf2778 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-non-strict.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-non-strict.case +// - src/async-generators/non-strict/async-obj-method.template +/*--- +description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator method - valid for non-strict only cases) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, noStrict, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ + + +var callCount = 0; + +var gen = { + async *method() { + callCount += 1; + return (function(arg) { + var yield = arg + 1; + return yield; + }(yield)) + } +}.method; + +var iter = gen(); + +var item = iter.next(); + +item.then(({ done, value }) => { + assert.sameValue(done, false); + assert.sameValue(value, undefined); +}); + +item = iter.next(42); + +item.then(({ done, value }) => { + assert.sameValue(done, true); + assert.sameValue(value, 43); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-non-strict.js new file mode 100644 index 0000000000..c8818c3423 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-non-strict.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-non-strict.case +// - src/async-generators/non-strict/async-obj-method.template +/*--- +description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator method - valid for non-strict only cases) +esid: prod-AsyncGeneratorMethod +features: [object-spread, Symbol, async-iteration] +flags: [generated, noStrict, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +var s = Symbol('s'); + + +var callCount = 0; + +var gen = { + async *method() { + callCount += 1; + yield { + ...yield yield, + ...(function(arg) { + var yield = arg; + return {...yield}; + }(yield)), + ...yield, + } + } +}.method; + +var iter = gen(); + +var iter = gen(); + +iter.next(); +iter.next(); +iter.next({ x: 10, a: 0, b: 0, [s]: 1 }); +iter.next({ y: 20, a: 1, b: 1, [s]: 42 }); +var item = iter.next({ z: 30, b: 2 }); + +item.then(({ done, value }) => { + assert.sameValue(done, false); + assert.sameValue(value.x, 10); + assert.sameValue(value.y, 20); + assert.sameValue(value.z, 30); + assert.sameValue(value.a, 1); + assert.sameValue(value.b, 2); + assert.sameValue(value[s], 42); + assert.sameValue(Object.keys(value).length, 5); + assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property"); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..6c9a911b62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-spread-strict-strict.js @@ -0,0 +1,48 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-spread-strict.case +// - src/async-generators/default/async-obj-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) +esid: prod-AsyncGeneratorMethod +features: [object-spread, async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = { + async *method() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } + } +}.method; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-strict-strict.js new file mode 100644 index 0000000000..20f631cbd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-identifier-strict-strict.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-identifier-strict.case +// - src/async-generators/default/async-obj-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) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = { + async *method() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) + } +}.method; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-catch.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-catch.js new file mode 100644 index 0000000000..2420ffc691 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-catch.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next-catch.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); + +var callCount = 0; + +var gen = { + async *method() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-async-iterator.js new file mode 100644 index 0000000000..b1fd5591b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-async-iterator.js @@ -0,0 +1,50 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: yield * [Promise.reject(value)] is treated as throw value (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + for await (let line of readFile()) { + yield line; + } + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-sync-iterator.js new file mode 100644 index 0000000000..3e439e389d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-for-await-of-sync-iterator.js @@ -0,0 +1,49 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: yield Promise.reject(value) in for-await-of is treated as throw value (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + for await (let value of iterable) { + yield value; + } + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-async-iterator.js new file mode 100644 index 0000000000..b2b4d23311 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-async-iterator.js @@ -0,0 +1,48 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield * readFile(); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-sync-iterator.js new file mode 100644 index 0000000000..155cb88be9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next-yield-star-sync-iterator.js @@ -0,0 +1,47 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: yield * (async iterator) is treated as throw value (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield * iterable; + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next.js new file mode 100644 index 0000000000..aabbef284e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-promise-reject-next.js @@ -0,0 +1,44 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-promise-reject-next.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: yield Promise.reject(value) is treated as throw value (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + +---*/ +let error = new Error(); + +var callCount = 0; + +var gen = { + async *method() { + callCount += 1; + yield Promise.reject(error); + yield "unreachable"; + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js new file mode 100644 index 0000000000..557a65fcf6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-multiple.js @@ -0,0 +1,50 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-multiple.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Use yield value in a array spread position (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +includes: [compareArray.js] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield [...yield yield]; + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-single.js new file mode 100644 index 0000000000..7c6a3c9756 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-arr-single.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-arr-single.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Use yield value in a array spread position (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield [...yield]; + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-obj.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-obj.js new file mode 100644 index 0000000000..1b97523c2a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-spread-obj.js @@ -0,0 +1,52 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-spread-obj.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Use yield value in a object spread position (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [object-spread, async-iteration] +flags: [generated, async] +info: | + Async Generator Function Definitions + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + +var callCount = 0; + +var gen = { + async *method() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-next.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-next.js new file mode 100644 index 0000000000..7f42750757 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-next.js @@ -0,0 +1,219 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-next.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Execution order for yield* with async iterator and next() (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-return.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-return.js new file mode 100644 index 0000000000..7b973e6c99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-return.js @@ -0,0 +1,235 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-return.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: execution order for yield* with async iterator and return() (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-throw.js new file mode 100644 index 0000000000..5a4b987537 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-async-throw.js @@ -0,0 +1,243 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-async-throw.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: execution order for yield* with async iterator and throw() (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-expr-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-expr-abrupt.js new file mode 100644 index 0000000000..a27c3dcfdd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-expr-abrupt.js @@ -0,0 +1,54 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-expr-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Abrupt completion while getting yield* operand (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* abrupt(); + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-get-abrupt.js new file mode 100644 index 0000000000..d5fe0a2a6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-get-abrupt.js @@ -0,0 +1,74 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-get-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Abrupt completion while getting [Symbol.asyncIterator] (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-boolean-throw.js new file mode 100644 index 0000000000..2b204d708d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-boolean-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-number-throw.js new file mode 100644 index 0000000000..636dbf8c65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-number-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-object-throw.js new file mode 100644 index 0000000000..e6ffbbc2e4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-object-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-string-throw.js new file mode 100644 index 0000000000..eb55185fcb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-string-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-symbol-throw.js new file mode 100644 index 0000000000..dd8467be8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-not-callable-symbol-throw.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-null-sync-get-abrupt.js new file mode 100644 index 0000000000..87ec41d1c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-null-sync-get-abrupt.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-abrupt.js new file mode 100644 index 0000000000..e5d8933e26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-abrupt.js @@ -0,0 +1,70 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-async-returns-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Abrupt completion while calling [Symbol.asyncIterator] (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-boolean-throw.js new file mode 100644 index 0000000000..87adae9fc1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-boolean-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - boolean (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-null-throw.js new file mode 100644 index 0000000000..fd736a66cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-null-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - null (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-number-throw.js new file mode 100644 index 0000000000..98426837ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-number-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - number (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-string-throw.js new file mode 100644 index 0000000000..d6dc2fa960 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-string-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - string (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-symbol-throw.js new file mode 100644 index 0000000000..c574cd81b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-symbol-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - symbol (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-undefined-throw.js new file mode 100644 index 0000000000..4da3ce8c99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-returns-undefined-throw.js @@ -0,0 +1,70 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.asyncIterator]() - undefined (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-undefined-sync-get-abrupt.js new file mode 100644 index 0000000000..c8e41e3e02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-async-undefined-sync-get-abrupt.js @@ -0,0 +1,79 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-get-abrupt.js new file mode 100644 index 0000000000..250c246c9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-get-abrupt.js @@ -0,0 +1,73 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-get-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Abrupt completion while getting [Symbol.iterator] (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-boolean-throw.js new file mode 100644 index 0000000000..fa1211cc87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-boolean-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-number-throw.js new file mode 100644 index 0000000000..c8cc4833d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-number-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-object-throw.js new file mode 100644 index 0000000000..a84b10fbd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-object-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-string-throw.js new file mode 100644 index 0000000000..53d7f15758 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-string-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-symbol-throw.js new file mode 100644 index 0000000000..8a9fba7b53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-not-callable-symbol-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-abrupt.js new file mode 100644 index 0000000000..417ff749f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-abrupt.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Abrupt completion while calling [Symbol.iterator] (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-boolean-throw.js new file mode 100644 index 0000000000..aaf00787b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-boolean-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - boolean (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-null-throw.js new file mode 100644 index 0000000000..9603b31462 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-null-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - null (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-number-throw.js new file mode 100644 index 0000000000..2dc6af0faa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-number-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - number (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-string-throw.js new file mode 100644 index 0000000000..2decf2215d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-string-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - string (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-symbol-throw.js new file mode 100644 index 0000000000..5105a46f85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-symbol-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - symbol (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-undefined-throw.js new file mode 100644 index 0000000000..d813a40142 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-getiter-sync-returns-undefined-throw.js @@ -0,0 +1,72 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Non object returned by [Symbol.iterator]() - undefined (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-done-get-abrupt.js new file mode 100644 index 0000000000..fcd886cadd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-done-get-abrupt.js @@ -0,0 +1,73 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Abrupt completion while getting done (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-returns-abrupt.js new file mode 100644 index 0000000000..ba89de4d9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-returns-abrupt.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-call-returns-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Abrupt completion while calling next (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-value-get-abrupt.js new file mode 100644 index 0000000000..95e03c5299 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-call-value-get-abrupt.js @@ -0,0 +1,75 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Abrupt completion while getting value (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-get-abrupt.js new file mode 100644 index 0000000000..b069bce40a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-get-abrupt.js @@ -0,0 +1,65 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-get-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Abrupt completion while getting next (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-non-object-ignores-then.js new file mode 100644 index 0000000000..a85cb45bb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-non-object-ignores-then.js @@ -0,0 +1,85 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: If next() value is not-object, do not access respective then property (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-boolean-throw.js new file mode 100644 index 0000000000..184a6d2035 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-boolean-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Not-callable next value in a yield star position - boolean (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-null-throw.js new file mode 100644 index 0000000000..b73b0cff40 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-null-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Not-callable next value in a yield star position - null (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-number-throw.js new file mode 100644 index 0000000000..3c4cba5654 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-number-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Not-callable next value in a yield star position - number (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-object-throw.js new file mode 100644 index 0000000000..70435b939f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-object-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Not-callable next value in a yield star position - object (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-string-throw.js new file mode 100644 index 0000000000..e7811e6852 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-string-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Not-callable next value in a yield star position - string (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-symbol-throw.js new file mode 100644 index 0000000000..ca2851b102 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-symbol-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Not-callable next value in a yield star position - symbol (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-undefined-throw.js new file mode 100644 index 0000000000..c96f1dd536 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-not-callable-undefined-throw.js @@ -0,0 +1,62 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Not-callable next value in a yield star position - undefined (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-get-abrupt.js new file mode 100644 index 0000000000..769d12ab18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-get-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-get-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Return abrupt after getting next().then (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-boolean-fulfillpromise.js new file mode 100644 index 0000000000..8f23847cc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-boolean-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: FulfillPromise if next().then is not-callable (boolean) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } +}.method; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-null-fulfillpromise.js new file mode 100644 index 0000000000..d06d699c91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-null-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: FulfillPromise if next().then is not-callable (null) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } +}.method; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-number-fulfillpromise.js new file mode 100644 index 0000000000..018c8e579f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-number-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: FulfillPromise if next().then is not-callable (number) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } +}.method; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-object-fulfillpromise.js new file mode 100644 index 0000000000..33872eca33 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-object-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: FulfillPromise if next().then is not-callable (object) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } +}.method; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-string-fulfillpromise.js new file mode 100644 index 0000000000..088e7a754c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-string-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: FulfillPromise if next().then is not-callable (string) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } +}.method; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-symbol-fulfillpromise.js new file mode 100644 index 0000000000..e968750365 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-symbol-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: FulfillPromise if next().then is not-callable (symbol) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } +}.method; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-undefined-fulfillpromise.js new file mode 100644 index 0000000000..6c6908110c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-non-callable-undefined-fulfillpromise.js @@ -0,0 +1,83 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: FulfillPromise if next().then is not-callable (undefined) (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('completion closes iter'); + + } +}.method; + +var iter = gen(); + +iter.next().then(({ value, done }) => { + assert.sameValue(value, 42); + assert.sameValue(done, false); +}).then($DONE, $DONE); + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-returns-abrupt.js new file mode 100644 index 0000000000..f95d2b7a8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-next-then-returns-abrupt.js @@ -0,0 +1,89 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-next-then-returns-abrupt.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: Return abrupt after calling next().then (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, Symbol.asyncIterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + yield* obj; + throw new Test262Error('abrupt completion closes iter'); + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-next.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-next.js new file mode 100644 index 0000000000..890159024e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-next.js @@ -0,0 +1,222 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-next.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: execution order for yield* with sync iterator and next() (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-return.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-return.js new file mode 100644 index 0000000000..4916e13b02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-return.js @@ -0,0 +1,197 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-return.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: execution order for yield* with sync iterator and return() (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration, Symbol.asyncIterator] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + log.push({ name: "before yield*" }); + yield* obj; + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-throw.js b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-throw.js new file mode 100644 index 0000000000..27647e55db --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-gen-yield-star-sync-throw.js @@ -0,0 +1,203 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-generators/yield-star-sync-throw.case +// - src/async-generators/default/async-obj-method.template +/*--- +description: execution order for yield* with sync iterator and throw() (Async generator method) +esid: prod-AsyncGeneratorMethod +features: [Symbol.iterator, async-iteration] +flags: [generated, async] +info: | + 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 gen = { + async *method() { + callCount += 1; + log.push({ name: "before yield*" }); + var v = yield* obj; + log.push({ + name: "after yield*", + value: v + }); + return "return-value"; + + } +}.method; + +var iter = 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); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..bda831cfe2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-array-destructuring-param-strict-body.js @@ -0,0 +1,112 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async method) +esid: sec-async-function-definitions +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +({ + async *method([element]) { + "use strict"; + } +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js new file mode 100644 index 0000000000..960f9d70a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-abrupt.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/async-meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + + +var callCount = 0; + +var obj = { + async method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +obj.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, Test262Error)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..9c3a1c280a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-not-undefined.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/async-meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + + +var callCount = 0; +var __obj = { + async method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = __obj.method; + +ref(false, '', NaN, 0, null, obj).then(() => { + assert.sameValue(callCount, 1, 'async method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..882b1ef52e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-arg-val-undefined.js @@ -0,0 +1,49 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/async-meth.template +/*--- +description: Use of initializer when argument value is `undefined` (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + + +var callCount = 0; +var __obj = { + async method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = __obj.method; + +ref(undefined, void 0).then(() => { + assert.sameValue(callCount, 1, 'async method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-duplicates.js new file mode 100644 index 0000000000..7f19edbca6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-duplicates.js @@ -0,0 +1,41 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/async-meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + + +({ + async *method(x = 0, x) { + + } +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js new file mode 100644 index 0000000000..df76b9caf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-later.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/async-meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; + +var obj = { + async method(x = y, y) { + + callCount = callCount + 1; + } +}; + +obj.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js new file mode 100644 index 0000000000..37a264d40b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-prior.js @@ -0,0 +1,46 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/async-meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; +var __obj = { + async method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = __obj.method; + +ref(3).then(() => { + assert.sameValue(callCount, 1, 'async method invoked exactly once'); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js new file mode 100644 index 0000000000..c8ad2e5e8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-ref-self.js @@ -0,0 +1,47 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/async-meth.template +/*--- +description: Referencing a parameter from within its own initializer (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + + +var callCount = 0; + +var obj = { + async method(x = x) { + + callCount = callCount + 1; + } +}; + +obj.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, ReferenceError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-rest.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-rest.js new file mode 100644 index 0000000000..241c48840c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-rest.js @@ -0,0 +1,45 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/async-meth.template +/*--- +description: RestParameter does not support an initializer (async method) +esid: sec-async-function-definitions +features: [default-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + + +({ + async *method(...x = []) { + + } +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js new file mode 100644 index 0000000000..779f5c7db0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-dflt-params-trailing-comma.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/async-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (async method) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +var __obj = { + async method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = __obj.method; + +ref(42, undefined, 1).then(() => { + assert.sameValue(callCount, 1, 'async method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-escaped-async.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-escaped-async.js new file mode 100644 index 0000000000..c5f5fe31c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-escaped-async.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `async` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +({ + \u0061sync m(){} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..002a1a643d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-eval-var-scope-syntax-err.js @@ -0,0 +1,42 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/async-meth.template +/*--- +description: sloppy direct eval in params introduces var (async method in sloppy code) +esid: sec-async-function-definitions +features: [default-parameters, async-functions] +flags: [generated, async, noStrict] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + + +var callCount = 0; + +var obj = { + async method(a = eval("var a = 42")) { + + callCount = callCount + 1; + } +}; + +obj.method() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, SyntaxError)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..db358683bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-object-destructuring-param-strict-body.js @@ -0,0 +1,112 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/async-meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (async method) +esid: sec-async-function-definitions +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +({ + async *method({property}) { + "use strict"; + } +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js new file mode 100644 index 0000000000..8a740f78d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-multiple.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/async-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (async method) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +var __obj = { + async method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = __obj.method; + +ref(42, 39, 1).then(() => { + assert.sameValue(callCount, 1, 'async method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js new file mode 100644 index 0000000000..701eaf4a09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-params-trailing-comma-single.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/async-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (async method) +esid: sec-async-function-definitions +features: [async-functions] +flags: [generated, async] +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + + +var callCount = 0; +var __obj = { + async method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +// Stores a reference `ref` for case evaluation +var ref = __obj.method; + +ref(42, 39).then(() => { + assert.sameValue(callCount, 1, 'async method invoked exactly once'); +}).then($DONE, $DONE); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-param-strict-body.js new file mode 100644 index 0000000000..ea1142fa98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-param-strict-body.js @@ -0,0 +1,112 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/async-meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (async method) +esid: sec-async-function-definitions +features: [rest-parameters, async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + + +({ + async *method(a,...rest) { + "use strict"; + } +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..5ae9534599 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-meth-rest-params-trailing-comma-early-error.js @@ -0,0 +1,38 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/async-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (async method) +esid: sec-async-function-definitions +features: [async-iteration] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.6 Async Function Definitions + + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + + +({ + async *method(...a,) { + + } +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow-returns-arguments-from-parent-function.js b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow-returns-arguments-from-parent-function.js new file mode 100644 index 0000000000..0aee873d77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow-returns-arguments-from-parent-function.js @@ -0,0 +1,35 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Async function returns an async function. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var obj = { + async method(x) { + let a = arguments; + return async () => a === arguments; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = obj.method; + +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/object/method-definition/async-returns-async-arrow-returns-newtarget.js b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow-returns-newtarget.js new file mode 100644 index 0000000000..c3c594c8b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow-returns-newtarget.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow-returns-newtarget.case +// - src/async-functions/evaluation/async-obj-method.template +/*--- +description: Async function returns an async function. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var obj = { + async method(x) { + return async () => new.target; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = obj.method; + +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/object/method-definition/async-returns-async-arrow.js b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow.js new file mode 100644 index 0000000000..039441ad8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-arrow.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-arrow.case +// - src/async-functions/evaluation/async-obj-method.template +/*--- +description: Async function returns an async function. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var obj = { + async method(x) { + return async () => x; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = obj.method; + +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/object/method-definition/async-returns-async-function-returns-arguments-from-own-function.js b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function-returns-arguments-from-own-function.js new file mode 100644 index 0000000000..9426a566ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function-returns-arguments-from-own-function.js @@ -0,0 +1,35 @@ +// |reftest| async +// 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-obj-method.template +/*--- +description: Async function returns an async function. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var obj = { + async method(x) { + let a = arguments; + return async function() { return a === arguments; }; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = obj.method; + +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/object/method-definition/async-returns-async-function-returns-newtarget.js b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function-returns-newtarget.js new file mode 100644 index 0000000000..564b648dd6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function-returns-newtarget.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function-returns-newtarget.case +// - src/async-functions/evaluation/async-obj-method.template +/*--- +description: Async function returns an async function. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var obj = { + async method(x) { + return async function() { return new.target; }; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = obj.method; + +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/object/method-definition/async-returns-async-function.js b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function.js new file mode 100644 index 0000000000..7d1e6eba11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-returns-async-function.js @@ -0,0 +1,34 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/async-functions/returns-async-function.case +// - src/async-functions/evaluation/async-obj-method.template +/*--- +description: Async function returns an async function. (Async method) +esid: prod-AsyncMethod +features: [async-functions] +flags: [generated, async] +info: | + Async Function Definitions + + AsyncMethod : + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + +---*/ +let count = 0; + + +var obj = { + async method(x) { + return async function() { return x; }; + } +}; +// Stores a reference `asyncFn` for case evaluation +let asyncFn = obj.method; + +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/object/method-definition/async-super-call-body.js b/js/src/tests/test262/language/expressions/object/method-definition/async-super-call-body.js new file mode 100644 index 0000000000..4ed22c55b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-super-call-body.js @@ -0,0 +1,28 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Super calls work in body of async methods +flags: [async] +---*/ + +var sup = { + method() { + return 'sup'; + } +} + +var child = { + async method() { + var x = await super.method(); + assert.sameValue(x, 'sup'); + } +} + +Object.setPrototypeOf(child, sup); + +child.method().then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/async-super-call-param.js b/js/src/tests/test262/language/expressions/object/method-definition/async-super-call-param.js new file mode 100644 index 0000000000..86fe1307bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/async-super-call-param.js @@ -0,0 +1,29 @@ +// |reftest| async +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Super calls work in parameter list of async methods +flags: [async] +---*/ + +var sup = { + method() { + return 'sup'; + } +} + +var child = { + async method(x = super.method()) { + var y = await x; + assert.sameValue(y, 'sup'); + } +} + +Object.setPrototypeOf(child, sup); + +child.method().then($DONE, $DONE); + diff --git a/js/src/tests/test262/language/expressions/object/method-definition/browser.js b/js/src/tests/test262/language/expressions/object/method-definition/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/computed-property-name-yield-expression.js b/js/src/tests/test262/language/expressions/object/method-definition/computed-property-name-yield-expression.js new file mode 100644 index 0000000000..77ea65c1da --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/computed-property-name-yield-expression.js @@ -0,0 +1,40 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + When the `yield` keyword occurs within the PropertyName of a + non-generator MethodDefinition within a generator function, it behaves as a + YieldExpression. +info: | + ComputedPropertyName: + [ AssignmentExpression ] + + AssignmentExpression[In, Yield, Await]: + [+Yield]YieldExpression[?In, ?Await] + +features: [computed-property-names, generators] +flags: [noStrict] +---*/ + +function * g() { + let o = { + [yield 10]: 1, + a: 'a' + }; + + yield 20; + return o; +} + +let iter = g(); +assert.sameValue(iter.next().value, 10); +assert.sameValue(iter.next().value, 20); + +let outcome = iter.next().value; + +assert.sameValue(outcome[undefined], 1); +assert.sameValue(outcome.a, 'a'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-async-method-duplicate-parameters.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-async-method-duplicate-parameters.js new file mode 100644 index 0000000000..62eec9d285 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-async-method-duplicate-parameters.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: sec-async-function-definitions +description: Formal parameters may not contain duplicates +info: | + # 14.7 Async Function Definitions + + AsyncMethod[Yield, Await]: + async[no LineTerminator here]PropertyName[?Yield, ?Await](UniqueFormalParameters[~Yield, +Await]){AsyncFunctionBody} + + # 14.1.2 Static Semantics: Early Errors + + UniqueFormalParameters:FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +({ + async foo(a, a) { } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-NSPL-with-USD.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-NSPL-with-USD.js new file mode 100644 index 0000000000..7bc49b870c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-NSPL-with-USD.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is *true* and IsSimpleParameterList of ArrowParameters is *false*. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +({ + foo(x = 1) {"use strict"} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-arguments-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-arguments-in-formal-parameters-strict.js new file mode 100644 index 0000000000..0ffffe32dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-arguments-in-formal-parameters-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters contains arguments +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +features: [async-functions] +---*/ + +$DONOTEVALUATE(); +({ + async foo (arguments) { } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-async-lineterminator.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-async-lineterminator.js new file mode 100644 index 0000000000..11aec56407 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-async-lineterminator.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-AsyncMethod +description: async methods cannot have a line terminator between "async" and the property name +info: | + 14.6 Async Function Definitions + + AsyncMethod: + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + async + foo() { } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals-default.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals-default.js new file mode 100644 index 0000000000..7c7cdcf4c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals-default.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters' default expressions contains await +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); +({ + async foo (x = await) { } +}) + diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals.js new file mode 100644 index 0000000000..d6b03faa9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-await-in-formals.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters contains await +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); +({ + async foo (await) { } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-body-contains-super-call.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-body-contains-super-call.js new file mode 100644 index 0000000000..cb2fe94af5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-body-contains-super-call.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if AsyncFunctionBody contains SuperCall is true +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); +({ + async foo () { super() } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js new file mode 100644 index 0000000000..b815f86088 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-duplicate-parameters.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright 2019 Mike Pennisi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions +description: Formal parameters may not contain duplicates +info: | + # 14.3 Method Definitions + + MethodDefinition[Yield, Await]: + PropertyName[?Yield, ?Await](UniqueFormalParameters[~Yield, ~Await]){FunctionBody[~Yield, ~Await]} + + # 14.1.2 Static Semantics: Early Errors + + UniqueFormalParameters:FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +({ + foo(a, a) { } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-eval-in-formal-parameters-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-eval-in-formal-parameters-strict.js new file mode 100644 index 0000000000..818a542b6c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-eval-in-formal-parameters-strict.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if FormalParameters contains eval in strict mode +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +features: [async-functions] +---*/ + +$DONOTEVALUATE(); +({ + async foo(eval) { } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-body-duplicate.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-body-duplicate.js new file mode 100644 index 0000000000..7b0b092ea0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-body-duplicate.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a SyntaxError if BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of AsyncFunctionBody +negative: + phase: parse + type: SyntaxError +features: [async-functions] +---*/ + +$DONOTEVALUATE(); + +({ + async function foo(bar) { let bar; } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-contains-super-call.js b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-contains-super-call.js new file mode 100644 index 0000000000..c332a4e846 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/early-errors-object-method-formals-contains-super-call.js @@ -0,0 +1,17 @@ +// |reftest| error:SyntaxError +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: It is a syntax error if FormalParameters contains SuperCall is true +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); +({ + async foo(foo = super()) { } +}) diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-e.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-e.js new file mode 100644 index 0000000000..b3d81fdb95 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-e.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `get` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols of the lexical, RegExp, and numeric string grammars are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + g\u0065t m() {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-g.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-g.js new file mode 100644 index 0000000000..75736d5796 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-g.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `get` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols of the lexical, RegExp, and numeric string grammars are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + \u0067et m() {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-t.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-t.js new file mode 100644 index 0000000000..8ffa507dcc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get-t.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `get` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols of the lexical, RegExp, and numeric string grammars are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + ge\u0074 m() {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-get.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get.js new file mode 100644 index 0000000000..f1c64a4533 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-get.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `get` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + \u0067\u0065\u0074 m() {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-e.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-e.js new file mode 100644 index 0000000000..a8050d16d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-e.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `set` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols of the lexical, RegExp, and numeric string grammars are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + s\u0065t m(v) {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-s.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-s.js new file mode 100644 index 0000000000..2aa423b4f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-s.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `set` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols of the lexical, RegExp, and numeric string grammars are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + \u0073et m(v) {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-t.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-t.js new file mode 100644 index 0000000000..c7af0b976b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set-t.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `set` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols of the lexical, RegExp, and numeric string grammars are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + se\u0074 m(v) {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/escaped-set.js b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set.js new file mode 100644 index 0000000000..c9b80ebbe7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/escaped-set.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-grammar-notation +description: > + The `set` contextual keyword must not contain Unicode escape sequences. +info: | + Terminal symbols are shown + in fixed width font, both in the productions of the grammars and throughout this + specification whenever the text directly refers to such a terminal symbol. These + are to appear in a script exactly as written. All terminal symbol code points + specified in this way are to be understood as the appropriate Unicode code points + from the Basic Latin range, as opposed to any similar-looking code points from + other Unicode ranges. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + \u0073\u0065\u0074 m(v) {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/fn-name-fn.js b/js/src/tests/test262/language/expressions/object/method-definition/fn-name-fn.js new file mode 100644 index 0000000000..0fcf7177eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/fn-name-fn.js @@ -0,0 +1,48 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 12.2.6.9 +description: Assignment of function `name` attribute (MethodDefinition) +info: | + 6. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then + a. Let hasNameProperty be HasOwnProperty(propValue, "name"). + b. ReturnIfAbrupt(hasNameProperty). + c. If hasNameProperty is false, perform SetFunctionName(propValue, + propKey). +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o; + +o = { + id() {}, + [anonSym]() {}, + [namedSym]() {} +}; + +verifyProperty(o.id, 'name', { + value: 'id', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[anonSym], 'name', { + value: '', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[namedSym], 'name', { + value: '[test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/fn-name-gen.js b/js/src/tests/test262/language/expressions/object/method-definition/fn-name-gen.js new file mode 100644 index 0000000000..648a6cd5d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/fn-name-gen.js @@ -0,0 +1,49 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es6id: 14.4.13 +description: > + Assignment of function `name` attribute (GeneratorMethod) +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + [...] + 9. Perform SetFunctionName(closure, propKey). +includes: [propertyHelper.js] +features: [generators, Symbol] +---*/ + +var namedSym = Symbol('test262'); +var anonSym = Symbol(); +var o; + +o = { + *id() {}, + *[anonSym]() {}, + *[namedSym]() {} +}; + +verifyProperty(o.id, 'name', { + value: 'id', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[anonSym], 'name', { + value: '', + writable: false, + enumerable: false, + configurable: true, +}); + +verifyProperty(o[namedSym], 'name', { + value: '[test262]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..3482e62678 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template +/*--- +description: Forbidden extension, f.arguments (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [arrow-function, async-iteration, generators] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var obj = { + async *method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +obj.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..7be74395e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-gen-meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,40 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [arrow-function, async-iteration, generators] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var obj = { + async *method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +obj.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..04968aeb0d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/async-meth.template +/*--- +description: Forbidden extension, f.arguments (async method) +esid: sec-async-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; + +var obj = { + async method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +obj.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..2f1b6d96dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/async-meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,41 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/async-meth.template +/*--- +description: Forbidden extension, o.caller (async method) +esid: sec-async-function-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + + +var callCount = 0; + +var obj = { + async method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +obj.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..90481c7c99 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/gen-meth.template +/*--- +description: Forbidden extension, f.arguments (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var obj = { + *method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..a6535ae934 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/gen-meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/gen-meth.template +/*--- +description: Forbidden extension, o.caller (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var obj = { + *method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-arguments.js new file mode 100644 index 0000000000..5c739e5c00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-arguments.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case +// - src/function-forms/forbidden-extensions/bullet-one/meth.template +/*--- +description: Forbidden extension, f.arguments (method) +esid: sec-runtime-semantics-definemethod +flags: [generated, noStrict] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var obj = { + method() { + assert.sameValue(this.method.hasOwnProperty("arguments"), false); + callCount++; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-caller.js new file mode 100644 index 0000000000..445d706dbc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/meth-forbidden-ext-direct-access-prop-caller.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-direct-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-one/meth.template +/*--- +description: Forbidden extension, o.caller (method) +esid: sec-runtime-semantics-definemethod +flags: [generated, noStrict] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. + +---*/ + +var callCount = 0; +var obj = { + method() { + assert.sameValue(this.method.hasOwnProperty("caller"), false); + callCount++; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b1/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..7be88f006a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [arrow-function, async-iteration, generators] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + async *method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..7b4ad46cc5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [arrow-function, async-iteration, generators] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + async *method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..4e7383d47f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-gen-meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,66 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template +/*--- +description: Forbidden extension, o.caller (async generator method) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [arrow-function, async-iteration, generators] +flags: [generated, noStrict, async] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + async *method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method().next() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..8c4587393c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/async-meth.template +/*--- +description: Forbidden extension, o.caller (async method) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; + +var obj = { + async method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..0825fc002d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/async-meth.template +/*--- +description: Forbidden extension, o.caller (async method) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; + +var obj = { + async method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..339ea9ef5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/async-meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,67 @@ +// |reftest| async +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/async-meth.template +/*--- +description: Forbidden extension, o.caller (async method) +esid: sec-async-definitions +features: [arrow-function, async-functions] +flags: [generated, noStrict, async] +info: | + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + + +var callCount = 0; + +var obj = { + async method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method() + .then(() => { + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..de57ed3f17 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/gen-meth.template +/*--- +description: Forbidden extension, o.caller (generator method) +esid: sec-generator-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + *method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method().next().value; +assert.sameValue(callCount, 1, 'generator method body was evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..86eb411a42 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/gen-meth.template +/*--- +description: Forbidden extension, o.caller (generator method) +esid: sec-generator-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + *method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method().next().value; +assert.sameValue(callCount, 1, 'generator method body was evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..c6d5da32bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/gen-meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,64 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/gen-meth.template +/*--- +description: Forbidden extension, o.caller (generator method) +esid: sec-generator-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated, noStrict] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + *method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + callCount++; + } +}; + +obj.method().next().value; +assert.sameValue(callCount, 1, 'generator method body was evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-get.js new file mode 100644 index 0000000000..755cced7f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-get.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case +// - src/function-forms/forbidden-extensions/bullet-two/meth.template +/*--- +description: Forbidden extension, o.caller (method) +esid: sec-runtime-semantics-definemethod +flags: [generated, noStrict] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {get(){return 1}}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-value.js new file mode 100644 index 0000000000..f34e303a0e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-own-prop-caller-value.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case +// - src/function-forms/forbidden-extensions/bullet-two/meth.template +/*--- +description: Forbidden extension, o.caller (method) +esid: sec-runtime-semantics-definemethod +flags: [generated, noStrict] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && true) { + Object.defineProperty(inner, "caller", {value: 1}); + } + var result = inner(); + if (descriptor && descriptor.configurable && true) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-prop-caller.js new file mode 100644 index 0000000000..3ebf9fe182 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/meth-forbidden-ext-indirect-access-prop-caller.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case +// - src/function-forms/forbidden-extensions/bullet-two/meth.template +/*--- +description: Forbidden extension, o.caller (method) +esid: sec-runtime-semantics-definemethod +flags: [generated, noStrict] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +---*/ +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} + +var callCount = 0; +var obj = { + method() { + "use strict"; + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && false) { + Object.defineProperty(inner, "caller", {}); + } + var result = inner(); + if (descriptor && descriptor.configurable && false) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, this.method); + } + + callCount++; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method body evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/b2/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/browser.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/shell.js b/js/src/tests/test262/language/expressions/object/method-definition/forbidden-ext/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..b05d92c975 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-array-destructuring-param-strict-body.js @@ -0,0 +1,141 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/gen-meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + *method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-abrupt.js new file mode 100644 index 0000000000..66050c3bd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-abrupt.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/gen-meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var obj = { + *method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..62d8f68b98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-not-undefined.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/gen-meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var obj = { + *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +obj.method(false, '', NaN, 0, null, obj).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..ed813ed055 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-arg-val-undefined.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/gen-meth.template +/*--- +description: Use of initializer when argument value is `undefined` (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var obj = { + *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +obj.method(undefined, void 0).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-duplicates.js new file mode 100644 index 0000000000..0a420f3c65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-duplicates.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/gen-meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, { + *method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-later.js new file mode 100644 index 0000000000..4896ed4fb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-later.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/gen-meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + *method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-prior.js new file mode 100644 index 0000000000..31cf8c202a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-prior.js @@ -0,0 +1,76 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/gen-meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + *method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +obj.method(3).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-self.js new file mode 100644 index 0000000000..e9c760f74b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-ref-self.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/gen-meth.template +/*--- +description: Referencing a parameter from within its own initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + *method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-rest.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-rest.js new file mode 100644 index 0000000000..db09934efb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-rest.js @@ -0,0 +1,74 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/gen-meth.template +/*--- +description: RestParameter does not support an initializer (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, { + *method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-trailing-comma.js new file mode 100644 index 0000000000..9475c8d9b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-dflt-params-trailing-comma.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..d04259c457 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-eval-var-scope-syntax-err.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/gen-meth.template +/*--- +description: sloppy direct eval in params introduces var (generator method in sloppy code) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [default-parameters, generators] +flags: [generated, noStrict] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + +var callCount = 0; +var obj = { + *method(a = eval("var a = 42")) { + + callCount = callCount + 1; + } +}; + +assert.throws(SyntaxError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..b10d612aca --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-object-destructuring-param-strict-body.js @@ -0,0 +1,141 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/gen-meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + *method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-multiple.js new file mode 100644 index 0000000000..1c2aa808a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-multiple.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-single.js new file mode 100644 index 0000000000..32bd3c08e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-params-trailing-comma-single.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +obj.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-param-strict-body.js new file mode 100644 index 0000000000..a60d7dfc90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-param-strict-body.js @@ -0,0 +1,141 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/gen-meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [rest-parameters, generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + *method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..7238cc6dde --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-meth-rest-params-trailing-comma-early-error.js @@ -0,0 +1,67 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/gen-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, { + *method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier-escaped.js new file mode 100644 index 0000000000..1082896597 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier-escaped.case +// - src/generators/syntax/obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var obj = { + *method() { + var yi\u0065ld; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier.js new file mode 100644 index 0000000000..9eadc20db7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-binding-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-binding-identifier.case +// - src/generators/syntax/obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + BindingIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var obj = { + *method() { + var yield; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference-escaped.js new file mode 100644 index 0000000000..44972293de --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference-escaped.case +// - src/generators/syntax/obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var obj = { + *method() { + void yi\u0065ld; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference.js new file mode 100644 index 0000000000..ac3bb6d022 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-identifier-reference.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-identifier-reference.case +// - src/generators/syntax/obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + IdentifierReference : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var obj = { + *method() { + void yield; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier-escaped.js new file mode 100644 index 0000000000..c6beb85f3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier-escaped.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier-escaped.case +// - src/generators/syntax/obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var obj = { + *method() { + yi\u0065ld: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier.js new file mode 100644 index 0000000000..ed4e11a171 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-as-label-identifier.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/generators/yield-as-label-identifier.case +// - src/generators/syntax/obj-method.template +/*--- +description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + LabelIdentifier : Identifier + + It is a Syntax Error if this production has a [Yield] parameter and + StringValue of Identifier is "yield". + +---*/ +$DONOTEVALUATE(); + +var obj = { + *method() { + yield: ; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-non-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-non-strict.js new file mode 100644 index 0000000000..4be93d4a8a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-non-strict.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-non-strict.case +// - src/generators/non-strict/obj-method.template +/*--- +description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Generator method - valid for non-strict only cases) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated, noStrict] +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + +---*/ + +var callCount = 0; + +var gen = { + *method() { + callCount += 1; + return (function(arg) { + var yield = arg + 1; + return yield; + }(yield)) + } +}.method; + +var iter = gen(); + +var item = iter.next(); + +assert.sameValue(item.done, false); +assert.sameValue(item.value, undefined); + +item = iter.next(42); + +assert.sameValue(item.done, true); +assert.sameValue(item.value, 43); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-non-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-non-strict.js new file mode 100644 index 0000000000..6718d4ffa7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-non-strict.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-non-strict.case +// - src/generators/non-strict/obj-method.template +/*--- +description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Generator method - valid for non-strict only cases) +esid: prod-GeneratorMethod +features: [Symbol, object-spread, generators] +flags: [generated, noStrict] +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +var s = Symbol('s'); + +var callCount = 0; + +var gen = { + *method() { + callCount += 1; + yield { + ...yield yield, + ...(function(arg) { + var yield = arg; + return {...yield}; + }(yield)), + ...yield, + } + } +}.method; + +var iter = gen(); + +var iter = gen(); + +iter.next(); +iter.next(); +iter.next({ x: 10, a: 0, b: 0, [s]: 1 }); +iter.next({ y: 20, a: 1, b: 1, [s]: 42 }); +var item = iter.next({ z: 30, b: 2 }); + +var value = item.value; + +assert.sameValue(item.done, false); +assert.sameValue(value.x, 10); +assert.sameValue(value.y, 20); +assert.sameValue(value.z, 30); +assert.sameValue(value.a, 1); +assert.sameValue(value.b, 2); +assert.sameValue(value[s], 42); +assert(Object.prototype.hasOwnProperty.call(value, s), "s is an own property"); +assert.sameValue(Object.keys(value).length, 5); + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-strict-strict.js new file mode 100644 index 0000000000..968afe2fe3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-spread-strict-strict.js @@ -0,0 +1,48 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-spread-strict.case +// - src/generators/default/obj-method.template +/*--- +description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Generator method) +esid: prod-GeneratorMethod +features: [object-spread, generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = { + *method() { + callCount += 1; + return { + ...(function() { + var yield; + throw new Test262Error(); + }()), + } + } +}.method; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-strict-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-strict-strict.js new file mode 100644 index 0000000000..6e36a3e99f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-identifier-strict-strict.js @@ -0,0 +1,39 @@ +// |reftest| error:SyntaxError +'use strict'; +// This file was procedurally generated from the following sources: +// - src/generators/yield-identifier-strict.case +// - src/generators/default/obj-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 method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated, onlyStrict] +negative: + phase: parse + type: SyntaxError +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + +---*/ +$DONOTEVALUATE(); + +var callCount = 0; + +var gen = { + *method() { + callCount += 1; + (function() { + var yield; + throw new Test262Error(); + }()) + } +}.method; + +var iter = gen(); + + + +assert.sameValue(callCount, 1); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js new file mode 100644 index 0000000000..1352d0507b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-multiple.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-multiple.case +// - src/generators/default/obj-method.template +/*--- +description: Use yield value in a array spread position (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +includes: [compareArray.js] +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] + +---*/ +var arr = ['a', 'b', 'c']; +var item; + +var callCount = 0; + +var gen = { + *method() { + callCount += 1; + yield [...yield yield]; + } +}.method; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-single.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-single.js new file mode 100644 index 0000000000..964cbdf9f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-arr-single.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-arr-single.case +// - src/generators/default/obj-method.template +/*--- +description: Use yield value in a array spread position (Generator method) +esid: prod-GeneratorMethod +features: [generators] +flags: [generated] +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + Array Initializer + + SpreadElement[Yield, Await]: + ...AssignmentExpression[+In, ?Yield, ?Await] +---*/ +var arr = ['a', 'b', 'c']; + +var callCount = 0; + +var gen = { + *method() { + callCount += 1; + yield [...yield]; + } +}.method; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-obj.js b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-obj.js new file mode 100644 index 0000000000..b6664311a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/gen-yield-spread-obj.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/generators/yield-spread-obj.case +// - src/generators/default/obj-method.template +/*--- +description: Use yield value in a object spread position (Generator method) +esid: prod-GeneratorMethod +features: [object-spread, generators] +flags: [generated] +info: | + 14.4 Generator Function Definitions + + GeneratorMethod[Yield, Await]: + * PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody } + + + Spread Properties + + PropertyDefinition[Yield]: + (...) + ...AssignmentExpression[In, ?Yield] + +---*/ + +var callCount = 0; + +var gen = { + *method() { + callCount += 1; + yield { + ...yield, + y: 1, + ...yield yield, + }; + } +}.method; + +var iter = 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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-ctor.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-ctor.js new file mode 100644 index 0000000000..727b8337c3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-ctor.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator functions declared as methods cannot be used as constructors. +es6id: 14.4.13 +features: [generators] +---*/ + +var method = { *method() {} }.method; + +assert.throws(TypeError, function() { + var instance = new method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-no-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-no-strict.js new file mode 100644 index 0000000000..6406a25a6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-no-strict.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + In the absence of the "use strict" directive, generator functions declared + as methods obey "global" ThisMode semantics. +es6id: 14.4.13 +flags: [noStrict] +features: [generators] +---*/ + +var global = (function() { return this; }()); +var thisValue = null; +var method = { + *method() { + thisValue = this; + } +}.method; + +method().next(); + +assert.sameValue(thisValue, global); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-strict.js new file mode 100644 index 0000000000..a9b0e3cb3d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-invoke-fn-strict.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + In the presence of the "use strict" directive, generator functions declared + as methods obey "strict" ThisMode semantics. +es6id: 14.4.13 +flags: [noStrict] +features: [generators] +---*/ + +var thisValue = null; +var method = { + *method() { + 'use strict'; + thisValue = this; + } +}.method; + +method().next(); + +assert.sameValue(thisValue, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-length-dflt.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-length-dflt.js new file mode 100644 index 0000000000..b425bd1002 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-length-dflt.js @@ -0,0 +1,70 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [generators, default-parameters] +includes: [propertyHelper.js] +---*/ + + +var f1 = { *m(x = 42) {} }.m; + +verifyProperty(f1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f2 = { *m(x = 42, y) {} }.m; + +verifyProperty(f2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f3 = { *m(x, y = 42) {} }.m; + +verifyProperty(f3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var f4 = { *m(x, y = 42, z) {} }.m; + +verifyProperty(f4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-length.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-length.js new file mode 100644 index 0000000000..a8b31eacca --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-length.js @@ -0,0 +1,22 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator functions declared as methods have a `length` property that + describes the number of formal parameters. +es6id: 14.4.13 +includes: [propertyHelper.js] +features: [generators] +---*/ + +var method = { *method(a, b, c) {} }.method; + +verifyProperty(method, "length", { + value: 3, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-string.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-string.js new file mode 100644 index 0000000000..a7fe2ad6a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-string.js @@ -0,0 +1,22 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator functions declared as methods are assigned a `name` property + according to the string value of their property name. +es6id: 14.4.13 +includes: [propertyHelper.js] +features: [generators] +---*/ + +var method = { *method() {} }.method; + +verifyProperty(method, 'name', { + value: 'method', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-symbol.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-symbol.js new file mode 100644 index 0000000000..2df13b0323 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-name-prop-symbol.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator functions declared as methods are assigned a `name` property + according to the string value of their property name. +es6id: 14.4.13 +includes: [propertyHelper.js] +features: [Symbol, generators] +---*/ + +var m = Symbol('method'); +var method = { *[m]() {} }[m]; + +verifyProperty(method, 'name', { + value: '[method]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-no-yield.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-no-yield.js new file mode 100644 index 0000000000..c217b75f90 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-no-yield.js @@ -0,0 +1,22 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + Generators declared with GeneratorMethod syntax do not require a + `yield` expression. + features: [generators] + es6id: 14.4 +---*/ + +var result; +var obj = { + *foo(a) {} +}; + +result = obj.foo(3).next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-param-id-yield.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-id-yield.js new file mode 100644 index 0000000000..65a443daa8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-id-yield.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The BindingIdentifier of a SingleNameBinding witihn the FormalParameters of + a GeneratorMethod may not be the `yield` keyword. +es6id: 14.4 +features: [generators] +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + *method(yield) {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-param-init-yield.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-init-yield.js new file mode 100644 index 0000000000..3f07f6316d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-init-yield.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The Initializer of a SingleNameBinding witihn the FormalParameters of a + GeneratorMethod may not contain the `yield` keyword. +es6id: 14.4 +features: [generators] +flags: [noStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +(function*() { + ({ + *method(x = yield) {} + }); +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-const.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-const.js new file mode 100644 index 0000000000..13db6a8e28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-const.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + GeneratorMethod early SyntaxError when lexical declaration + inside generator shadows parameter name +features: [generators] +es6id: 14.4.1 +author: Sam Mikes +description: GeneratorMethod error with lexical shadowing +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *foo(a) { + const a = 3; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-let.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-let.js new file mode 100644 index 0000000000..38c74a2fc9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-param-redecl-let.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + GeneratorMethod early SyntaxError when lexical declaration + inside generator shadows parameter name +features: [generators] +es6id: 14.4.1 +author: Sam Mikes +description: GeneratorMethod error with lexical shadowing +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *foo(a) { + let a = 3; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-params.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-params.js new file mode 100644 index 0000000000..605419c8fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-params.js @@ -0,0 +1,30 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator functions declared as methods honor their declared formal + parameters. +es6id: 14.4.13 +features: [generators] +---*/ + +var value1 = {}; +var value2 = {}; +var value3 = {}; +var arg1, arg2, arg3; +var obj = { + *method(a, b, c) { + arg1 = a; + arg2 = b; + arg3 = c; + } +}; + +obj.method(value1, value2, value3).next(); + +assert.sameValue(arg1, value1); +assert.sameValue(arg2, value2); +assert.sameValue(arg3, value3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-eval-error.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-eval-error.js new file mode 100644 index 0000000000..62a7bed5c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-eval-error.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Errors thrown during method definition are forwarded to the runtime. +es6id: 14.4.13 +features: [generators] +---*/ + +assert.throws(Test262Error, function() { + ({ + *[(function() { throw new Test262Error(); }())]() {} + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-expr.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-expr.js new file mode 100644 index 0000000000..4f68db8aa1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-expr.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + When the `yield` keyword occurs within the PropertyName of a + GeneratorMethod within a generator function, it behaves as a + YieldExpression. +es6id: 14.4 +features: [generators] +flags: [noStrict] +---*/ + +var obj = null; +var yield = 'propNameViaIdentifier'; +var iter = (function*() { + obj = { + *[yield]() {} + }; +})(); + +iter.next(); + +assert.sameValue(obj, null); + +iter.next('propNameViaExpression'); + +assert( + !Object.prototype.hasOwnProperty.call(obj, 'propNameViaIdentifier'), + "The property name is not taken from the 'yield' variable" +); +assert( + Object.prototype.hasOwnProperty.call(obj, 'propNameViaExpression'), + "The property name is taken from the yield expression" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-id.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-id.js new file mode 100644 index 0000000000..b12f993f2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-prop-name-yield-id.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + When the `yield` keyword occurs within the PropertyName of a + GeneratorMethod outside of a generator function, it behaves as an + Identifier. +es6id: 14.4 +features: [generators] +flags: [noStrict] +---*/ + +var yield = 'propName'; +var obj = { + *[yield]() {} +}; + +assert( + Object.prototype.hasOwnProperty.call(obj, 'propName'), + "The property name is taken from the 'yield' variable" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-property-desc.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-property-desc.js new file mode 100644 index 0000000000..3f60bc14c6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-property-desc.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator functions declared as methods are defined as enumerable, + writable, configurable properties on the initialized object. +es6id: 14.4.13 +includes: [propertyHelper.js] +features: [generators] +---*/ + +var obj = { *method() {} }; + +verifyProperty(obj, "method", { + writable: true, + enumerable: true, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-prototype-prop.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-prototype-prop.js new file mode 100644 index 0000000000..26c939cc7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-prototype-prop.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Generator functions declared as methods define a `prototype` property. +es6id: 14.4.13 +includes: [propertyHelper.js] +features: [generators] +---*/ + +var GeneratorPrototype = Object.getPrototypeOf(function* () {}).prototype; +var method = { *method() {} }.method; + +assert.sameValue( + Object.getPrototypeOf(method.prototype), + GeneratorPrototype +); + +verifyProperty(method, "prototype", { + writable: true, + enumerable: false, + configurable: false, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-prototype.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-prototype.js new file mode 100644 index 0000000000..e1cbbe141f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-prototype.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The prototype of generator functions declared as methods is the + Generator Prototype. +es6id: 14.4.13 +features: [generators] +---*/ + +var obj = { *method() {} }; +assert.sameValue( + Object.getPrototypeOf(obj.method), + Object.getPrototypeOf(function*() {}) +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-return.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-return.js new file mode 100644 index 0000000000..ee4b6a20cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-return.js @@ -0,0 +1,25 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `return` is a valid statement within generator function bodies. + features: [generators] + es6id: 14.4 +---*/ + +var result; +var obj = { + *g1() { return; }, + *g2() { return 1; } +}; + +result = obj.g1().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +result = obj.g2().next(); +assert.sameValue(result.value, 1); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-body.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-body.js new file mode 100644 index 0000000000..cc619c9c5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-body.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + GeneratorMethod early SyntaxError when super is called + directly inside generator body +features: [generators] +es6id: 14.4.1 +author: Sam Mikes +description: GeneratorMethod error if HasDirectSuper in body +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *foo(a) { + super(); + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-param.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-param.js new file mode 100644 index 0000000000..ff1cbb4347 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-call-param.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + GeneratorMethod early SyntaxError when super is called + directly inside generator args +features: [generators] +es6id: 14.4.1 +author: Sam Mikes +description: GeneratorMethod error if HasDirectSuper in args +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *foo(a = super()) { + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-body.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-body.js new file mode 100644 index 0000000000..15dde63dab --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-body.js @@ -0,0 +1,25 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + GeneratorMethod can reference SuperProperty in body +features: [generators] +es6id: 14.4.1 +author: Sam Mikes +description: GeneratorMethod body uses SuperProperty (allowed) +---*/ + +var obj; + +var obj = { + *foo() { + return super.toString; + } +}; + +obj.toString = null; + +assert.sameValue(obj.foo().next().value, Object.prototype.toString); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-param.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-param.js new file mode 100644 index 0000000000..f2d1f2d3af --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-super-prop-param.js @@ -0,0 +1,23 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + GeneratorMethod can reference SuperProperty in default parameters +es6id: 14.4.1 +author: Sam Mikes +description: GeneratorMethod uses SuperProperty (allowed) +features: [default-parameters, generators, super] +---*/ + +var obj = { + *foo(a = super.toString) { + return a; + } +}; + +obj.toString = null; + +assert.sameValue(obj.foo().next().value, Object.prototype.toString); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js b/js/src/tests/test262/language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js new file mode 100644 index 0000000000..aa390737b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/generator-use-strict-with-non-simple-param.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-generator-function-definitions-static-semantics-early-errors +description: > + A SyntaxError is thrown if a generator method contains a non-simple parameter list and a UseStrict directive. +info: | + Static Semantics: Early Errors + + It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and IsSimpleParameterList of StrictFormalParameters is false. +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +var o = { + *m(a = 0) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-array-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-array-destructuring-param-strict-body.js new file mode 100644 index 0000000000..9e3b782d2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-array-destructuring-param-strict-body.js @@ -0,0 +1,137 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/array-destructuring-param-strict-body.case +// - src/function-forms/syntax/meth.template +/*--- +description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (method) +esid: sec-runtime-semantics-definemethod +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + method([element]) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-abrupt.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-abrupt.js new file mode 100644 index 0000000000..d0b95458d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-abrupt.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-abrupt.case +// - src/function-forms/error/meth.template +/*--- +description: Abrupt completion returned by evaluation of initializer (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ + +var callCount = 0; +var obj = { + method(_ = (function() { throw new Test262Error(); }())) { + + callCount = callCount + 1; + } +}; + +assert.throws(Test262Error, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-not-undefined.js new file mode 100644 index 0000000000..e650ffe0ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-not-undefined.js @@ -0,0 +1,92 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-not-undefined.case +// - src/function-forms/default/meth.template +/*--- +description: Use of initializer when argument value is not `undefined` (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; + +var callCount = 0; +var obj = { + method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { + assert.sameValue(aFalse, false); + assert.sameValue(aString, ''); + assert.sameValue(aNaN, NaN); + assert.sameValue(a0, 0); + assert.sameValue(aNull, null); + assert.sameValue(aObj, obj); + callCount = callCount + 1; + } +}; + +obj.method(false, '', NaN, 0, null, obj); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-undefined.js new file mode 100644 index 0000000000..ea061dbadd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-arg-val-undefined.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-arg-val-undefined.case +// - src/function-forms/default/meth.template +/*--- +description: Use of initializer when argument value is `undefined` (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + +---*/ + +var callCount = 0; +var obj = { + method(fromLiteral = 23, fromExpr = 45, fromHole = 99) { + assert.sameValue(fromLiteral, 23); + assert.sameValue(fromExpr, 45); + assert.sameValue(fromHole, 99); + callCount = callCount + 1; + } +}; + +obj.method(undefined, void 0); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-duplicates.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-duplicates.js new file mode 100644 index 0000000000..04dbd6f3da --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-duplicates.js @@ -0,0 +1,66 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-duplicates.case +// - src/function-forms/syntax/meth.template +/*--- +description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. + +---*/ +$DONOTEVALUATE(); + +0, { + method(x = 0, x) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-later.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-later.js new file mode 100644 index 0000000000..6bc6514fea --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-later.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-later.case +// - src/function-forms/error/meth.template +/*--- +description: Referencing a parameter that occurs later in the ParameterList (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + method(x = y, y) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-prior.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-prior.js new file mode 100644 index 0000000000..dd1edc1264 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-prior.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-prior.case +// - src/function-forms/default/meth.template +/*--- +description: Referencing a parameter that occurs earlier in the ParameterList (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + method(x, y = x, z = y) { + assert.sameValue(x, 3, 'first argument value'); + assert.sameValue(y, 3, 'second argument value'); + assert.sameValue(z, 3, 'third argument value'); + callCount = callCount + 1; + } +}; + +obj.method(3); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-self.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-self.js new file mode 100644 index 0000000000..5990e01af2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-ref-self.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-ref-self.case +// - src/function-forms/error/meth.template +/*--- +description: Referencing a parameter from within its own initializer (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. + +---*/ +var x = 0; + +var callCount = 0; +var obj = { + method(x = x) { + + callCount = callCount + 1; + } +}; + +assert.throws(ReferenceError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-rest.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-rest.js new file mode 100644 index 0000000000..05e0365c8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-rest.js @@ -0,0 +1,70 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-rest.case +// - src/function-forms/syntax/meth.template +/*--- +description: RestParameter does not support an initializer (method) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] + +---*/ +$DONOTEVALUATE(); + +0, { + method(...x = []) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-trailing-comma.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-trailing-comma.js new file mode 100644 index 0000000000..27275b4cd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-dflt-params-trailing-comma.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/dflt-params-trailing-comma.case +// - src/function-forms/default/meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (method) +esid: sec-runtime-semantics-definemethod +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-eval-var-scope-syntax-err.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-eval-var-scope-syntax-err.js new file mode 100644 index 0000000000..61ba250a7d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-eval-var-scope-syntax-err.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/eval-var-scope-syntax-err.case +// - src/function-forms/error-no-strict/meth.template +/*--- +description: sloppy direct eval in params introduces var (method in sloppy code) +esid: sec-runtime-semantics-definemethod +features: [default-parameters] +flags: [generated, noStrict] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + + Runtime Semantics: IteratorBindingInitialization + FormalParameter : BindingElement + + 1. Return the result of performing IteratorBindingInitialization for BindingElement with arguments iteratorRecord and environment. + +---*/ + +var callCount = 0; +var obj = { + method(a = eval("var a = 42")) { + + callCount = callCount + 1; + } +}; + +assert.throws(SyntaxError, function() { + obj.method(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-object-destructuring-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-object-destructuring-param-strict-body.js new file mode 100644 index 0000000000..e1bc9900b4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-object-destructuring-param-strict-body.js @@ -0,0 +1,137 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/object-destructuring-param-strict-body.case +// - src/function-forms/syntax/meth.template +/*--- +description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (method) +esid: sec-runtime-semantics-definemethod +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 13.3.3.4 Static Semantics: IsSimpleParameterList + + BindingElement : BindingPattern + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + method({property}) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-multiple.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-multiple.js new file mode 100644 index 0000000000..6dd75d99f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-multiple.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-multiple.case +// - src/function-forms/default/meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (method) +esid: sec-runtime-semantics-definemethod +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-single.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-single.js new file mode 100644 index 0000000000..43d6c80f91 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-params-trailing-comma-single.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/function-forms/params-trailing-comma-single.case +// - src/function-forms/default/meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (method) +esid: sec-runtime-semantics-definemethod +flags: [generated] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +obj.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-rest-param-strict-body.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-rest-param-strict-body.js new file mode 100644 index 0000000000..d2b7c23fee --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-rest-param-strict-body.js @@ -0,0 +1,137 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-param-strict-body.case +// - src/function-forms/syntax/meth.template +/*--- +description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (method) +esid: sec-runtime-semantics-definemethod +features: [rest-parameters] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.13 Static Semantics: IsSimpleParameterList + + FormalParameters : FormalParameterList , FunctionRestParameter + + 1. Return false. + + 14.1.2 Static Semantics: Early Errors + + FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody } + FunctionDeclaration : function ( FormalParameters ) { FunctionBody } + FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.2.1 Static Semantics: Early Errors + + ArrowFunction : ArrowParameters => ConciseBody + + - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and + IsSimpleParameterList of ArrowParameters is false. + + 14.3.1 Static Semantics: Early Errors + + MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and + IsSimpleParameterList of PropertySetParameterList is false. + + 14.4.1 Static Semantics: Early Errors + + GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + 14.5.1 Static Semantics: Early Errors + + AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody } + AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.7.1 Static Semantics: Early Errors + + AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of UniqueFormalParameters is false. + + AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } + AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } + + - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and + IsSimpleParameterList of FormalParameters is false. + + 14.8.1 Static Semantics: Early Errors + + AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and + IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false. + +---*/ +$DONOTEVALUATE(); + +0, { + method(a,...rest) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/meth-rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/expressions/object/method-definition/meth-rest-params-trailing-comma-early-error.js new file mode 100644 index 0000000000..6c1e0435d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/meth-rest-params-trailing-comma-early-error.js @@ -0,0 +1,62 @@ +// |reftest| error:SyntaxError +// This file was procedurally generated from the following sources: +// - src/function-forms/rest-params-trailing-comma-early-error.case +// - src/function-forms/syntax/meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (method) +esid: sec-runtime-semantics-definemethod +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ +$DONOTEVALUATE(); + +0, { + method(...a,) { + + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-ctor.js b/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-ctor.js new file mode 100644 index 0000000000..f1c3450e44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-ctor.js @@ -0,0 +1,15 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions declared as methods may not be used as constructors. +es6id: 14.3.8 +---*/ + +var obj = { method() {} }; +assert.throws(TypeError, function() { + new obj.method(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-no-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-no-strict.js new file mode 100644 index 0000000000..ef606afbd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-no-strict.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + In the absence of the "use strict" directive, functions declared as methods + obey "global" ThisMode semantics. +es6id: 14.3.8 +flags: [noStrict] +---*/ + +var global = (function() { return this; }()); +var thisValue = null; +var method = { + method() { + thisValue = this; + } +}.method; + +method(); + +assert.sameValue(thisValue, global); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-strict.js b/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-strict.js new file mode 100644 index 0000000000..aab879473e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-invoke-fn-strict.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + In the presence of the "use strict" directive, functions declared as + methods obey "strict" ThisMode semantics. +es6id: 14.3.8 +flags: [noStrict] +---*/ + +var thisValue = null; +var method = { + method() { + 'use strict'; + thisValue = this; + } +}.method; + +method(); + +assert.sameValue(thisValue, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-length-dflt.js b/js/src/tests/test262/language/expressions/object/method-definition/name-length-dflt.js new file mode 100644 index 0000000000..2655e2a6bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-length-dflt.js @@ -0,0 +1,70 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [default-parameters] +includes: [propertyHelper.js] +---*/ + + +var f1 = { m(x = 42) {} }.m; + +verifyProperty(f1, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f2 = { m(x = 42, y) {} }.m; + +verifyProperty(f2, "length", { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +var f3 = { m(x, y = 42) {} }.m; + +verifyProperty(f3, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +var f4 = { m(x, y = 42, z) {} }.m; + +verifyProperty(f4, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-length.js b/js/src/tests/test262/language/expressions/object/method-definition/name-length.js new file mode 100644 index 0000000000..9957dd7410 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-length.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions declared as methods have a `length` property that describes the + number of formal parameters. +es6id: 14.3.8 +includes: [propertyHelper.js] +---*/ + +var method = { method(a, b, c) {} }.method; + +verifyProperty(method, "length", { + value: 3, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-string.js b/js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-string.js new file mode 100644 index 0000000000..c252000d77 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-string.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions declared as methods are assigned a `name` property according to + the string value of their property name. +es6id: 14.3.8 +includes: [propertyHelper.js] +---*/ + +var method = { method() {} }.method; + +verifyProperty(method, 'name', { + value: 'method', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-symbol.js b/js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-symbol.js new file mode 100644 index 0000000000..712b134277 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-name-prop-symbol.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions declared as methods are assigned a `name` property according to + the string value of their property name. +es6id: 14.3.8 +includes: [propertyHelper.js] +features: [Symbol] +---*/ + +var m = Symbol('method'); +var method = { [m]() {} }[m]; + +verifyProperty(method, 'name', { + value: '[method]', + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-param-id-yield.js b/js/src/tests/test262/language/expressions/object/method-definition/name-param-id-yield.js new file mode 100644 index 0000000000..6d1304939b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-param-id-yield.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The BindingIdentifier of a SingleNameBinding witihn the FormalParameters of + a non-generator MethodDefinition may be the `yield` keyword. +es6id: 14.3 +flags: [noStrict] +---*/ + +var obj = { + method(yield) { + return yield; + } +}; + + +assert.sameValue(obj.method('arg'), 'arg'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-param-init-yield.js b/js/src/tests/test262/language/expressions/object/method-definition/name-param-init-yield.js new file mode 100644 index 0000000000..bb20602dc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-param-init-yield.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + When the `yield` keyword occurs within the Initializer of a + SingleNameBinding within the FormalParameters of a non-generator + MethodDefinition, it behaves as an Identifier. +es6id: 14.3 +flags: [noStrict] +---*/ + +var yield = 'default'; +var obj = { + method(x = yield) { + return x; + } +}; + + +assert.sameValue(obj.method(), 'default'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-param-redecl.js b/js/src/tests/test262/language/expressions/object/method-definition/name-param-redecl.js new file mode 100644 index 0000000000..682d63d80b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-param-redecl.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + It is a Syntax Error if any element of the BoundNames of + StrictFormalParameters also occurs in the LexicallyDeclaredNames of + FunctionBody. +es6id: 14.3.1 +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + method(param) { + let param; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-params.js b/js/src/tests/test262/language/expressions/object/method-definition/name-params.js new file mode 100644 index 0000000000..ed2ae90225 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-params.js @@ -0,0 +1,28 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions declared as methods honor their declared formal parameters. +es6id: 14.3.8 +---*/ + +var value1 = {}; +var value2 = {}; +var value3 = {}; +var arg1, arg2, arg3; +var obj = { + method(a, b, c) { + arg1 = a; + arg2 = b; + arg3 = c; + } +}; + +obj.method(value1, value2, value3); + +assert.sameValue(arg1, value1); +assert.sameValue(arg2, value2); +assert.sameValue(arg3, value3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-eval-error.js b/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-eval-error.js new file mode 100644 index 0000000000..4db4f964cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-eval-error.js @@ -0,0 +1,16 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Errors thrown during method definition are forwarded to the runtime. +es6id: 14.3.8 +---*/ + +assert.throws(Test262Error, function() { + ({ + [(function() { throw new Test262Error(); }())]() {} + }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-expr.js b/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-expr.js new file mode 100644 index 0000000000..2ed775db5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-expr.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + When the `yield` keyword occurs within the PropertyName of a + non-generator MethodDefinition within a generator function, it behaves as a + YieldExpression. +es6id: 14.3 +features: [generators] +flags: [noStrict] +---*/ + +var obj = null; +var yield = 'propNameViaIdentifier'; +var iter = (function*() { + obj = { + [yield]() {} + }; +})(); + +iter.next(); + +assert.sameValue(obj, null); + +iter.next('propNameViaExpression'); + +assert( + !Object.prototype.hasOwnProperty.call(obj, 'propNameViaIdentifier'), + "The property name is not taken from the 'yield' variable" +); +assert( + Object.prototype.hasOwnProperty.call(obj, 'propNameViaExpression'), + "The property name is taken from the yield expression" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-id.js b/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-id.js new file mode 100644 index 0000000000..91c6f2a265 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-prop-name-yield-id.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + When the `yield` keyword occurs within the PropertyName of a + non-generator MethodDefinition outside of a generator function, it behaves + as an Identifier. +es6id: 14.3 +flags: [noStrict] +---*/ + +var yield = 'propName'; +var obj = { + [yield]() {} +}; + +assert( + Object.prototype.hasOwnProperty.call(obj, 'propName'), + "The property name is taken from the 'yield' variable" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-property-desc.js b/js/src/tests/test262/language/expressions/object/method-definition/name-property-desc.js new file mode 100644 index 0000000000..eea6795929 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-property-desc.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions declared as methods are defined as enumerable, writable, + configurable properties on the initialized object. +es6id: 14.3.8 +includes: [propertyHelper.js] +---*/ + +var obj = { method() {} }; + +verifyProperty(obj, "method", { + writable: true, + enumerable: true, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-prototype-prop.js b/js/src/tests/test262/language/expressions/object/method-definition/name-prototype-prop.js new file mode 100644 index 0000000000..2720007c12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-prototype-prop.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + Functions declared as methods do not define a `prototype` property. +es6id: 14.3.9 +---*/ + +var method = { method() {} }.method; + +assert( + !Object.prototype.hasOwnProperty.call(method, 'prototype'), + "Functions declared as methods do not define a 'prototype' property" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-prototype.js b/js/src/tests/test262/language/expressions/object/method-definition/name-prototype.js new file mode 100644 index 0000000000..1c3b99ca6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-prototype.js @@ -0,0 +1,13 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The prototype of functions declared as methods is the Function prototype. +es6id: 14.3.8 +---*/ + +var obj = { method() {} }; +assert.sameValue(Object.getPrototypeOf(obj.method), Function.prototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-super-call-body.js b/js/src/tests/test262/language/expressions/object/method-definition/name-super-call-body.js new file mode 100644 index 0000000000..0755d80330 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-super-call-body.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. +esid: sec-object-initializer-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + method() { + super(); + } +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-super-call-param.js b/js/src/tests/test262/language/expressions/object/method-definition/name-super-call-param.js new file mode 100644 index 0000000000..6607a16dfb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-super-call-param.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + It is a Syntax Error if HasDirectSuper of MethodDefinition is true. +esid: sec-object-initializer-static-semantics-early-errors +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({ + method(param = super()) {} +}); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-body.js b/js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-body.js new file mode 100644 index 0000000000..1f8f302c2e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-body.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The HomeObject of Functions declared as methods is the Object prototype. +es6id: 14.3.8 +features: [super] +---*/ + +var obj = { + method() { + return super.toString; + } +}; + +obj.toString = null; + +assert.sameValue(obj.method(), Object.prototype.toString); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-param.js b/js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-param.js new file mode 100644 index 0000000000..d46612b028 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/name-super-prop-param.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + The HomeObject of Functions declared as methods is the Object prototype. +es6id: 14.3.8 +features: [super] +---*/ + +var obj = { + method(x = super.toString) { + return x; + } +}; + +obj.toString = null; + +assert.sameValue(obj.method(), Object.prototype.toString); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/object-method-returns-promise.js b/js/src/tests/test262/language/expressions/object/method-definition/object-method-returns-promise.js new file mode 100644 index 0000000000..9a57e2ddf0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/object-method-returns-promise.js @@ -0,0 +1,18 @@ +// Copyright 2016 Microsoft, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +author: Brian Terlson +esid: pending +description: > + Async function method definitions return promises +features: [async-functions] +---*/ +var obj = { + async method() {} +} +var p = obj.method(); +assert(p instanceof Promise, "async functions return promise instances"); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-args-unmapped.js b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-args-unmapped.js new file mode 100644 index 0000000000..4147026935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-args-unmapped.js @@ -0,0 +1,90 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [generators, default-parameters] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; + } +}; + +obj.method().next(); + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-ref-arguments.js b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-ref-arguments.js new file mode 100644 index 0000000000..1c3b6d6732 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-gen-meth-ref-arguments.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [generators, default-parameters] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod is strict mode code, + let strict be true. Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + *method(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; + } +}; + +obj.method(undefined, undefined, 'third', 'fourth').next(); + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-args-unmapped.js b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-args-unmapped.js new file mode 100644 index 0000000000..8299b33331 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-args-unmapped.js @@ -0,0 +1,87 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (method) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [default-parameters] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method(x, _ = 0) { + assert.sameValue(x, undefined, 'parameter binding value (initial)'); + assert.sameValue( + arguments[0], undefined, 'arguments property value (initial)' + ); + + arguments[0] = 1; + + assert.sameValue( + x, undefined, 'parameter binding value (after arguments modification)' + ); + assert.sameValue( + arguments[0], 1, 'arguments property value (after arguments modification)' + ); + + x = 2; + + assert.sameValue( + x, 2, 'parameter binding value (after parameter binding modification)' + ); + assert.sameValue( + arguments[0], + 1, + 'arguments property value (after parameter binding modification)' + ); + callCount = callCount + 1; + } +}; + +obj.method(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-ref-arguments.js b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-ref-arguments.js new file mode 100644 index 0000000000..cb1d1490ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/params-dflt-meth-ref-arguments.js @@ -0,0 +1,66 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Referencing the arguments object from a default parameter (method) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [default-parameters] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] + + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +var callCount = 0; +var obj = { + method(x = arguments[2], y = arguments[3], z) { + assert.sameValue(x, 'third', 'first parameter'); + assert.sameValue(y, 'fourth', 'second parameter'); + assert.sameValue(z, 'third', 'third parameter'); + callCount = callCount + 1; + } +}; + +obj.method(undefined, undefined, 'third', 'fourth'); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn-inside-class.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn-inside-class.js new file mode 100644 index 0000000000..d0cba3fac1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn-inside-class.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name even + inside a class body (async method). +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, async-functions, class, class-fields-public] +---*/ + +$DONOTEVALUATE(); + +class C { + field = { + async #m() {} + } +} diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn.js new file mode 100644 index 0000000000..d49334f37f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-fn.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name + (async method). +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, async-functions] +---*/ + +$DONOTEVALUATE(); + +var o = { + async #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js new file mode 100644 index 0000000000..041c4be37a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen-inside-class.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name even + inside a class body. (async generator) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, async-iteration, class, class-fields-public] +---*/ + +$DONOTEVALUATE(); + +class C { + field = { + async * #m() {} + } +} diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen.js new file mode 100644 index 0000000000..ff4c600266 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-async-gen.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name. + (async generator) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, async-iteration] +---*/ + +$DONOTEVALUATE(); + +var o = { + async * #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js new file mode 100644 index 0000000000..55f9506956 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen-inside-class.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name even + inside a class body. (generator) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, generators, class, class-fields-public] +---*/ + +$DONOTEVALUATE(); + +class C { + field = { + * #m() {} + } +} diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen.js new file mode 100644 index 0000000000..e16fd6b282 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-gen.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name. + (generator) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, generators] +---*/ + +$DONOTEVALUATE(); + +var o = { + * #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method-inside-class.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method-inside-class.js new file mode 100644 index 0000000000..e3cc1c6d78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method-inside-class.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name even + inside a class body. (getter method) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, class, class-fields-public] +---*/ + +$DONOTEVALUATE(); + +class C { + field = { + get #m() {} + } +} diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method.js new file mode 100644 index 0000000000..afe43213b7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-get-method.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name. + (getter method) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private] +---*/ + +$DONOTEVALUATE(); + +var o = { + get #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method-inside-class.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method-inside-class.js new file mode 100644 index 0000000000..ec3ee177bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method-inside-class.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name even + inside a class body. (ordinary method) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, class, class-fields-public] +---*/ + +$DONOTEVALUATE(); + +class C { + field = { + #m() {} + } +} diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method.js new file mode 100644 index 0000000000..093f1996d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-method.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name. + (ordinary method) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private] +---*/ + +$DONOTEVALUATE(); + +var o = { + #m() {} +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method-inside-class.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method-inside-class.js new file mode 100644 index 0000000000..73fac9e29f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method-inside-class.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name even + inside a class body. (getter method) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private, class, class-fields-public] +---*/ + +$DONOTEVALUATE(); + +class C { + field = { + set #m(x) {} + } +} diff --git a/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method.js b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method.js new file mode 100644 index 0000000000..a60cb19552 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/private-name-early-error-set-method.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2018 Leo Balter. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + Throws an early SyntaxError if a method definition has a private name. + (getter method) +info: | + Static Semantics: Early Errors + + PropertyDefinition : MethodDefinition + It is a Syntax Error if PrivateBoundNames of MethodDefinition is non-empty. +negative: + phase: parse + type: SyntaxError +features: [class-methods-private] +---*/ + +$DONOTEVALUATE(); + +var o = { + set #m(x) {} +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/setter-use-strict-with-non-simple-param.js b/js/src/tests/test262/language/expressions/object/method-definition/setter-use-strict-with-non-simple-param.js new file mode 100644 index 0000000000..ccabe8543c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/setter-use-strict-with-non-simple-param.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + A SyntaxError is thrown if a setter method contains a non-simple parameter list and a UseStrict directive. +info: | + Static Semantics: Early Errors + + It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of PropertySetParameterList is false. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var o = { + set m(a = 0) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/shell.js b/js/src/tests/test262/language/expressions/object/method-definition/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-accessor.js b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-accessor.js new file mode 100644 index 0000000000..3d8d09771f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-accessor.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the body of accessor methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + ({set accessor(await) {}}); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-generator.js b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-generator.js new file mode 100644 index 0000000000..2287ef2441 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-generator.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the parameter list of generator methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + ({*method(await) {}}); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-normal.js b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-normal.js new file mode 100644 index 0000000000..ca0d1894b1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-binding-normal.js @@ -0,0 +1,20 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within the parameter list of methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +class C { + static { + ({method(await) {}}); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-accessor.js b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-accessor.js new file mode 100644 index 0000000000..d050188cfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-accessor.js @@ -0,0 +1,30 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within accessor methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + ({ + set accessor(x = fromParam = await) { + fromBody = await; + } + }).accessor = undefined; + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-generator.js b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-generator.js new file mode 100644 index 0000000000..0732cd0648 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-generator.js @@ -0,0 +1,30 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within generator methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + ({ + *method(x = fromParam = await) { + fromBody = await; + } + }).method().next(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-normal.js b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-normal.js new file mode 100644 index 0000000000..0a96a248cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/static-init-await-reference-normal.js @@ -0,0 +1,30 @@ +// Copyright (C) 2021 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-class-definitions-static-semantics-early-errors +description: The `await` keyword is interpreted as an identifier within methods +info: | + ClassStaticBlockBody : ClassStaticBlockStatementList + + [...] + - It is a Syntax Error if ContainsAwait of ClassStaticBlockStatementList is true. +features: [class-static-block] +---*/ + +var await = 0; +var fromParam, fromBody; + +class C { + static { + ({ + method(x = fromParam = await) { + fromBody = await; + } + }).method(); + } +} + +assert.sameValue(fromParam, 0, 'from parameter'); +assert.sameValue(fromBody, 0, 'from body'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/use-strict-with-non-simple-param.js b/js/src/tests/test262/language/expressions/object/method-definition/use-strict-with-non-simple-param.js new file mode 100644 index 0000000000..c97c9c7d01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/use-strict-with-non-simple-param.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-method-definitions-static-semantics-early-errors +description: > + A SyntaxError is thrown if a method contains a non-simple parameter list and a UseStrict directive. +info: | + Static Semantics: Early Errors + + It is a Syntax Error if ContainsUseStrict of FunctionBody is true and IsSimpleParameterList of StrictFormalParameters is false. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var o = { + m(a = 0) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-with-rhs.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-with-rhs.js new file mode 100644 index 0000000000..0e962e5931 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-with-rhs.js @@ -0,0 +1,120 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` is a valid expression within generator function bodies. + features: [generators] + es6id: 14.4 +---*/ + +var iter, result; +var obj = { + *g1() { (yield 1) }, + *g2() { [yield 1] }, + *g3() { {yield 1} }, + *g4() { yield 1, yield 2; }, + *g5() { (yield 1) ? yield 2 : yield 3; } +}; + +iter = obj.g1(); +result = iter.next(); +assert.sameValue(result.value, 1, 'Within grouping operator: result `value`'); +assert.sameValue( + result.done, false, 'Within grouping operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following grouping operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following grouping operator: result `done` flag' +); + +iter = obj.g2(); +result = iter.next(); +assert.sameValue(result.value, 1, 'Within array literal: result `value`'); +assert.sameValue( + result.done, false, 'Within array literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following array literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following array literal: result `done` flag' +); + +iter = obj.g3(); +result = iter.next(); +assert.sameValue(result.value, 1, 'Within object literal: result `value`'); +assert.sameValue( + result.done, false, 'Within object literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following object literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following object literal: result `done` flag' +); + +iter = obj.g4(); +result = iter.next(); +assert.sameValue( + result.value, 1, 'First expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'First expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, 2, 'Second expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'Second expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following comma expression: result `value`' +); +assert.sameValue( + result.done, true, 'Following comma expression: result `done` flag' +); + +iter = obj.g5(); +result = iter.next(); +assert.sameValue( + result.value, + 1, + 'Conditional expression in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Conditional expression in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, + 3, + 'Branch in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Branch in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following conditional operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following conditional operator: result `done` flag' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-without-rhs.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-without-rhs.js new file mode 100644 index 0000000000..21fe83f4e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-expression-without-rhs.js @@ -0,0 +1,130 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` is a valid expression within generator function bodies. + features: [generators] + es6id: 14.4 +---*/ + +var iter, result; +var obj = { + *g1() { (yield) }, + *g2() { [yield] }, + *g3() { {yield} }, + *g4() { yield, yield; }, + *g5() { (yield) ? yield : yield; } +}; + +iter = obj.g1(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Within grouping operator: result `value`' +); +assert.sameValue( + result.done, false, 'Within grouping operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following grouping operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following grouping operator: result `done` flag' +); + +iter = obj.g2(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Within array literal: result `value`' +); +assert.sameValue( + result.done, false, 'Within array literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following array literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following array literal: result `done` flag' +); + +iter = obj.g3(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Within object literal: result `value`' +); +assert.sameValue( + result.done, false, 'Within object literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following object literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following object literal: result `done` flag' +); + +iter = obj.g4(); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'First expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'First expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'Second expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'Second expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following comma expression: result `value`' +); +assert.sameValue( + result.done, true, 'Following comma expression: result `done` flag' +); + +iter = obj.g5(); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'Conditional expression in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Conditional expression in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'Branch in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Branch in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following conditional operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following conditional operator: result `done` flag' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js new file mode 100644 index 0000000000..e82150bb98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-function-expression-binding-identifier.js @@ -0,0 +1,25 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` may be used as the binding identifier of a function expression + within generator bodies. + features: [generators] + es6id: 14.1 + flags: [noStrict] +---*/ + +var result; +var obj = { + *g() { + (function yield() {}); + } +}; + +result = obj.g().next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js new file mode 100644 index 0000000000..f28e85f989 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-generator-method-binding-identifier.js @@ -0,0 +1,30 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` is a valid BindingIdentifier for GeneratorMethods + features: [generators] + es6id: 12.1.1 +---*/ + +var iter, result; +var obj = { + *yield() { (yield 3) + (yield 4); } +} + +iter = obj.yield(); + +result = iter.next(); +assert.sameValue(result.value, 3, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 4, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Third result `value`'); +assert.sameValue(result.done, true, 'Third result `done` flag');; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-identifier-in-nested-function.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-identifier-in-nested-function.js new file mode 100644 index 0000000000..909d2d0a85 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-identifier-in-nested-function.js @@ -0,0 +1,26 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` is not a reserved keyword within normal function bodies declared + within generator function bodies. + features: [generators] + es6id: 12.1.1 + flags: [noStrict] +---*/ + +var result; +var obj = { + *g() { + function h() { + yield = 1; + } + } +}; + +result = obj.g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-literal-property-name.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-literal-property-name.js new file mode 100644 index 0000000000..8b1adeb65e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-literal-property-name.js @@ -0,0 +1,23 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` may be used as a literal property name in an object literal + within generator function bodies. + features: [generators] + es6id: 12.1.1 +---*/ + +var result; +var obj = { + *g() { + ({ get yield() { return 1 } }); + } +}; + +result = obj.g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-logical-or-expression.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-logical-or-expression.js new file mode 100644 index 0000000000..258bbc1d04 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-logical-or-expression.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` expressions are not LogicalOrExpressions. + features: [generators] + es6id: 12.1.1 + negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *g() { + yield ? yield : yield; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-parameter.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-parameter.js new file mode 100644 index 0000000000..46bcb0620f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-parameter.js @@ -0,0 +1,20 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` is a reserved keyword within generator function bodies and may + not be used as the binding identifier of a parameter. + features: [generators] + es6id: 12.1.1 + negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *g(yield) {} +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-property-name.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-property-name.js new file mode 100644 index 0000000000..0fa724954b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-property-name.js @@ -0,0 +1,23 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` may be used as a literal property name in an object literal + within generator function bodies. + features: [generators] + es6id: 12.1.1 +---*/ + +var result; +var obj = { + *g() { + ({ yield: 1 }); + } +}; + +result = obj.g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-statement.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-statement.js new file mode 100644 index 0000000000..88f327147f --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-statement.js @@ -0,0 +1,49 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` is a valid statement within generator function bodies. + features: [generators] + es6id: 14.4 +---*/ + +var iter, result; +var obj = { + *g1() { yield; }, + *g2() { yield 1; } +}; + +iter = obj.g1(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Without right-hand-side: first result `value`' +); +assert.sameValue( + result.done, false, 'Without right-hand-side: first result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Without right-hand-side: second result `value`' +); +assert.sameValue( + result.done, true, 'Without right-hand-eside: second result `done` flag' +); + +iter = obj.g2(); +result = iter.next(); +assert.sameValue( + result.value, 1, 'With right-hand-side: first result `value`' +); +assert.sameValue( + result.done, false, 'With right-hand-side: first result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'With right-hand-side: second result `value`' +); +assert.sameValue( + result.done, true, 'With right-hand-eside: second result `done` flag' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-as-yield-operand.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-yield-operand.js new file mode 100644 index 0000000000..0beb76f49b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-as-yield-operand.js @@ -0,0 +1,33 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` expressions may be used as the right-hand-side of other `yield` + expressions. + features: [generators] + es6id: 14.4 +---*/ + +var iter, result; +var obj = { + *g() { + yield yield 1; + } +}; + +iter = obj.g(); + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Third result `value`'); +assert.sameValue(result.done, true, 'Thid result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-newline.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-newline.js new file mode 100644 index 0000000000..69d234cfec --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-newline.js @@ -0,0 +1,29 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + Newlines terminate `yield` expressions. + features: [generators] + es6id: 14.4 +---*/ + +var iter, result; +var obj = { + *g() { + yield + 1 + } +}; + +iter = obj.g(); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Second result `value`'); +assert.sameValue(result.done, true, 'Second result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-return.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-return.js new file mode 100644 index 0000000000..bea909f6e0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-return.js @@ -0,0 +1,22 @@ +// Copyright 2015 Cubane Canada, Inc. All rights reserved. +// See LICENSE for details. + +/*--- +info: | + Generator can be declared with GeneratorMethod syntax +features: [generators] +es6id: 14.4 +author: Sam Mikes +description: can declare generator methods +---*/ + +var obj = { + *foo(a) { yield a+1; return; } +}; + +var g = obj.foo(3); + +assert.sameValue(g.next().value, 4); +assert.sameValue(g.next().done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-star-after-newline.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-star-after-newline.js new file mode 100644 index 0000000000..133314c379 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-star-after-newline.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + A newline may not precede the `*` token in a `yield` expression. + features: [generators] + es6id: 14.4 + negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *g() { + yield + * 1 + } +}; diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-star-before-newline.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-star-before-newline.js new file mode 100644 index 0000000000..5b281bb95d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-star-before-newline.js @@ -0,0 +1,24 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + The right-hand side of a `yield *` expression may appear on a new line. + features: [generators] + es6id: 14.4 +---*/ + +var result; +var obj = { + *g() { + yield * + g2() + } +}; +var g2 = function*() {}; + +result = obj.g().next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/method-definition/yield-weak-binding.js b/js/src/tests/test262/language/expressions/object/method-definition/yield-weak-binding.js new file mode 100644 index 0000000000..4566975196 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method-definition/yield-weak-binding.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` expressions bind weakly + features: [generators] + es6id: 14.4 + negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +var obj = { + *g() { yield 3 + yield 4; } +}; diff --git a/js/src/tests/test262/language/expressions/object/method.js b/js/src/tests/test262/language/expressions/object/method.js new file mode 100644 index 0000000000..6d3e51a9d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/method.js @@ -0,0 +1,30 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + super method calls in object literal method +---*/ +var proto = { + method(x) { + return 'proto' + x; + } +}; + +var object = { + method(x) { + return super.method(x); + } +}; + +Object.setPrototypeOf(object, proto); + +assert.sameValue(object.method(42), 'proto42', "`object.method(42)` returns `'proto42'`, after executing `Object.setPrototypeOf(object, proto);`"); +assert.sameValue(proto.method(42), 'proto42', "`proto.method(42)` returns `'proto42'`, after executing `Object.setPrototypeOf(object, proto);`"); +assert.sameValue( + Object.getPrototypeOf(object).method(42), + 'proto42', + "`Object.getPrototypeOf(object).method(42)` returns `'proto42'`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/not-defined.js b/js/src/tests/test262/language/expressions/object/not-defined.js new file mode 100644 index 0000000000..b8a7d4d33c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/not-defined.js @@ -0,0 +1,13 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + Throws when IdentifierReference is undefined +---*/ + +assert.throws(ReferenceError, function() { + var o = {notDefined}; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/object-spread-proxy-get-not-called-on-dontenum-keys.js b/js/src/tests/test262/language/expressions/object/object-spread-proxy-get-not-called-on-dontenum-keys.js new file mode 100644 index 0000000000..411723dde5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/object-spread-proxy-get-not-called-on-dontenum-keys.js @@ -0,0 +1,73 @@ +// Copyright (C) 2021 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-propertydefinitionevaluation +description: > + Proxy's "get" trap is not invoked for non-enumerable keys. +info: | + PropertyDefinition : ... AssignmentExpression + + [...] + 3. Let excludedNames be a new empty List. + 4. Return ? CopyDataProperties(object, fromValue, excludedNames). + + CopyDataProperties ( target, source, excludedItems ) + + [...] + 5. Let keys be ? from.[[OwnPropertyKeys]](). + 6. For each element nextKey of keys in List order, do + [...] + c. If excluded is false, then + i. Let desc be ? from.[[GetOwnProperty]](nextKey). + ii. If desc is not undefined and desc.[[Enumerable]] is true, then + 1. Let propValue be ? Get(from, nextKey). + 2. Perform ! CreateDataPropertyOrThrow(target, nextKey, propValue). + + [[OwnPropertyKeys]] ( ) + + [...] + 7. Let trapResultArray be ? Call(trap, handler, « target »). + 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »). + [...] + 23. Return trapResult. +features: [object-spread, Proxy, Symbol] +includes: [compareArray.js, propertyHelper.js] +---*/ + +var VALUE_LITERAL = "VALUE_LITERAL"; +var VALUE_GOPD = "VALUE_GOPD"; +var VALUE_GET = "VALUE_GET"; + +var dontEnumSymbol = Symbol("dont_enum_symbol"); +var enumerableSymbol = Symbol("enumerable_symbol"); + +var dontEnumKeys = [dontEnumSymbol, "dontEnumString", "0"]; +var enumerableKeys = [enumerableSymbol, "enumerableString", "1"]; +var ownKeysResult = [...dontEnumKeys, ...enumerableKeys]; + +var getOwnKeys = []; +var getKeys = []; +var proxy = new Proxy({}, { + getOwnPropertyDescriptor: function(_target, key) { + getOwnKeys.push(key); + var isEnumerable = enumerableKeys.indexOf(key) !== -1; + return {value: VALUE_GOPD, writable: false, enumerable: isEnumerable, configurable: true}; + }, + get: function(_target, key) { + getKeys.push(key); + return VALUE_GET; + }, + ownKeys: function() { + return ownKeysResult; + }, +}); + +var result = {[enumerableSymbol]: VALUE_LITERAL, enumerableString: VALUE_LITERAL, [1]: VALUE_LITERAL, ...proxy}; +assert.compareArray(getOwnKeys, ownKeysResult); +assert.compareArray(getKeys, enumerableKeys); + +verifyProperty(result, enumerableSymbol, {value: VALUE_GET, writable: true, enumerable: true, configurable: true}); +verifyProperty(result, "enumerableString", {value: VALUE_GET, writable: true, enumerable: true, configurable: true}); +verifyProperty(result, "1", {value: VALUE_GET, writable: true, enumerable: true, configurable: true}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/object-spread-proxy-no-excluded-keys.js b/js/src/tests/test262/language/expressions/object/object-spread-proxy-no-excluded-keys.js new file mode 100644 index 0000000000..2f65a9996b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/object-spread-proxy-no-excluded-keys.js @@ -0,0 +1,49 @@ +// Copyright (C) 2021 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-propertydefinitionevaluation +description: > + Proxy's "getOwnPropertyDescriptor" trap is invoked for all keys. +info: | + PropertyDefinition : ... AssignmentExpression + + [...] + 3. Let excludedNames be a new empty List. + 4. Return ? CopyDataProperties(object, fromValue, excludedNames). + + CopyDataProperties ( target, source, excludedItems ) + + [...] + 5. Let keys be ? from.[[OwnPropertyKeys]](). + 6. For each element nextKey of keys in List order, do + [...] + c. If excluded is false, then + i. Let desc be ? from.[[GetOwnProperty]](nextKey). + + [[OwnPropertyKeys]] ( ) + + [...] + 7. Let trapResultArray be ? Call(trap, handler, « target »). + 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »). + [...] + 23. Return trapResult. +features: [object-spread, Proxy, Symbol] +includes: [compareArray.js] +---*/ + +var sym = Symbol(); +var getOwnKeys = []; +var ownKeysResult = [sym, "foo", "0"]; +var proxy = new Proxy({}, { + getOwnPropertyDescriptor: function(_target, key) { + getOwnKeys.push(key); + }, + ownKeys: function() { + return ownKeysResult; + }, +}); + +({[sym]: 0, foo: 0, [0]: 0, ...proxy}); +assert.compareArray(getOwnKeys, ownKeysResult); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/object-spread-proxy-ownkeys-returned-keys-order.js b/js/src/tests/test262/language/expressions/object/object-spread-proxy-ownkeys-returned-keys-order.js new file mode 100644 index 0000000000..5e70ce39b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/object-spread-proxy-ownkeys-returned-keys-order.js @@ -0,0 +1,48 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-propertydefinitionevaluation +description: > + Proxy keys are iterated in order they were provided by "ownKeys" trap. +info: | + PropertyDefinition : ... AssignmentExpression + + [...] + 3. Let excludedNames be a new empty List. + 4. Return ? CopyDataProperties(object, fromValue, excludedNames). + + CopyDataProperties ( target, source, excludedItems ) + + [...] + 5. Let keys be ? from.[[OwnPropertyKeys]](). + 6. For each element nextKey of keys in List order, do + [...] + c. If excluded is false, then + i. Let desc be ? from.[[GetOwnProperty]](nextKey). + + [[OwnPropertyKeys]] ( ) + + [...] + 7. Let trapResultArray be ? Call(trap, handler, « target »). + 8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »). + [...] + 23. Return trapResult. +features: [object-spread, Proxy, Symbol] +includes: [compareArray.js] +---*/ + +var getOwnKeys = []; +var ownKeysResult = [Symbol(), "foo", "0"]; +var proxy = new Proxy({}, { + getOwnPropertyDescriptor: function(_target, key) { + getOwnKeys.push(key); + }, + ownKeys: function() { + return ownKeysResult; + }, +}); + +({...proxy}); +assert.compareArray(getOwnKeys, ownKeysResult); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-def-id-eval-error-2.js b/js/src/tests/test262/language/expressions/object/prop-def-id-eval-error-2.js new file mode 100644 index 0000000000..5cc7cb73e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-def-id-eval-error-2.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5.9 +description: > + Errors thrown during IdentifierReference evaluation are forwarded to the + runtime. +flags: [noStrict] +features: [Proxy] +---*/ + +var p = new Proxy({}, { + has: function () { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + with (p) { + ({attr}); + } +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-def-id-eval-error.js b/js/src/tests/test262/language/expressions/object/prop-def-id-eval-error.js new file mode 100644 index 0000000000..33763ffce5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-def-id-eval-error.js @@ -0,0 +1,23 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5.9 +description: > + Errors thrown during IdentifierReference evaluation are forwarded to the + runtime. +flags: [noStrict] +features: [Symbol, Symbol.unscopables] +---*/ + +var obj = { + attr: null, + get [Symbol.unscopables]() { throw new Test262Error(); } +}; + +assert.throws(Test262Error, function() { + with (obj) { + ({ attr }); + } +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-def-id-get-error.js b/js/src/tests/test262/language/expressions/object/prop-def-id-get-error.js new file mode 100644 index 0000000000..0424ba0ee2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-def-id-get-error.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5.9 +description: > + Errors thrown during IdentifierReference value retrieval are forwarded to + the runtime. +---*/ + +assert.throws(ReferenceError, function() { + ({ unresolvable }); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-def-id-valid.js b/js/src/tests/test262/language/expressions/object/prop-def-id-valid.js new file mode 100644 index 0000000000..60125786bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-def-id-valid.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5.9 +description: > + When a valid IdentifierReference appears in an object initializer, a new + data property is created. The property name is the string value of the + identifier, the property value is the value of the identifier, and the + property is enumerable, writable, and configurable. +includes: [propertyHelper.js] +---*/ + +var attr = 23; +var obj; + +obj = { attr }; + +verifyProperty(obj, "attr", { + value: 23, + writable: true, + enumerable: true, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-def-invalid-async-prefix.js b/js/src/tests/test262/language/expressions/object/prop-def-invalid-async-prefix.js new file mode 100644 index 0000000000..b5c846b643 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-def-invalid-async-prefix.js @@ -0,0 +1,36 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Mozilla Corporation. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + async is not a valid prefix of an identifier reference +esid: sec-object-initializer +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition + + MethodDefinition: + PropertyName ( UniqueFormalParameters ) { FunctionBody } + AsyncMethod + + AsyncMethod: + async [no LineTerminator here] PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } + VariableDeclaration : BindingPattern Initializer + + 1. Let rhs be the result of evaluating Initializer. + 2. Let rval be GetValue(rhs). + 3. ReturnIfAbrupt(rval). + 4. Return the result of performing BindingInitialization for + BindingPattern passing rval and undefined as arguments. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({async async}); diff --git a/js/src/tests/test262/language/expressions/object/prop-def-invalid-star-prefix.js b/js/src/tests/test262/language/expressions/object/prop-def-invalid-star-prefix.js new file mode 100644 index 0000000000..cacc6b1ec4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-def-invalid-star-prefix.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2019 Tiancheng "Timothy" Gu. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + * is not a valid prefix of an identifier reference +esid: sec-object-initializer +info: | + PropertyDefinition: + IdentifierReference + CoverInitializedName + PropertyName : AssignmentExpression + MethodDefinition +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +({* foo}); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-data-data.js b/js/src/tests/test262/language/expressions/object/prop-dup-data-data.js new file mode 100644 index 0000000000..ae346f3b65 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-data-data.js @@ -0,0 +1,22 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Refer 11.1.5; + The production + PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment + 4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true + a. This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true +es5id: 11.1.5_4-4-a-2 +description: > + Object literal - Duplicate data property name allowed if not in + strict mode +---*/ + +void { + foo: 0, + foo: 1 +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-data-set.js b/js/src/tests/test262/language/expressions/object/prop-dup-data-set.js new file mode 100644 index 0000000000..a22a4f5b51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-data-set.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-b-2 +description: > + Object literal - No SyntaxError if a data property definition is + followed by set accessor definition with the same name +---*/ + +void { + foo: 1, + set foo(x) {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-get-data.js b/js/src/tests/test262/language/expressions/object/prop-dup-get-data.js new file mode 100644 index 0000000000..4ce5ca25f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-get-data.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-c-1 +description: > + Object literal - No SyntaxError if a get accessor property definition + is followed by a data property definition with the same name +---*/ + +void { + get foo() {}, + foo: 1 +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-get-get.js b/js/src/tests/test262/language/expressions/object/prop-dup-get-get.js new file mode 100644 index 0000000000..a456efec26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-get-get.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-d-1 +description: Object literal - No SyntaxError for duplicate property name (get,get) +---*/ + +void { + get foo() {}, + get foo() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-get-set-get.js b/js/src/tests/test262/language/expressions/object/prop-dup-get-set-get.js new file mode 100644 index 0000000000..a9227db162 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-get-set-get.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-d-3 +description: > + Object literal - No SyntaxError for duplicate property name + (get,set,get) +---*/ + +void { + get foo() {}, + set foo(arg) {}, + get foo() {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-set-data.js b/js/src/tests/test262/language/expressions/object/prop-dup-set-data.js new file mode 100644 index 0000000000..9c07baa686 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-set-data.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-c-2 +description: > + Object literal - No SyntaxError if a set accessor property definition + is followed by a data property definition with the same name +---*/ + +void { + set foo(x) {}, + foo: 1 +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-set-get-set.js b/js/src/tests/test262/language/expressions/object/prop-dup-set-get-set.js new file mode 100644 index 0000000000..56fa5e867b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-set-get-set.js @@ -0,0 +1,17 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-d-4 +description: > + Object literal - No SyntaxError for duplicate property name + (set,get,set) +---*/ + +void { + set foo(arg) {}, + get foo() {}, + set foo(arg1) {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/prop-dup-set-set.js b/js/src/tests/test262/language/expressions/object/prop-dup-set-set.js new file mode 100644 index 0000000000..c8e482f4dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/prop-dup-set-set.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.5_4-4-d-2 +description: Object literal - No SyntaxError for duplicate property name (set,set) +---*/ + +void { + set foo(arg) {}, + set foo(arg1) {} +}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/properties-names-eval-arguments.js b/js/src/tests/test262/language/expressions/object/properties-names-eval-arguments.js new file mode 100644 index 0000000000..8f9ed68921 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/properties-names-eval-arguments.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + property names `eval` and `arguments` +---*/ +var o = { + eval() { + return 1; + }, + arguments() { + return 2; + }, +}; + +assert.sameValue(o.eval(), 1, "`o.eval()` returns `1`"); +assert.sameValue(o.arguments(), 2, "`o.arguments()` returns `2`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/property-name-yield.js b/js/src/tests/test262/language/expressions/object/property-name-yield.js new file mode 100644 index 0000000000..f8ab2ced3a --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/property-name-yield.js @@ -0,0 +1,12 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- + description: > + `yield` may be used as a literal property name in an object literal. + es6id: 12.1.1 +---*/ + +({ yield: 1 }); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-gen-meth-body-lex-distinct.js b/js/src/tests/test262/language/expressions/object/scope-gen-meth-body-lex-distinct.js new file mode 100644 index 0000000000..df8d77f575 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-gen-meth-body-lex-distinct.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new lexical environment (distinct from the variable + environment) for the function body outside of strict mode +info: | + [...] + 29. If strict is false, then + a. Let lexEnv be NewDeclarativeEnvironment(varEnv). + b. NOTE: Non-strict functions use a separate lexical Environment Record + for top-level lexical declarations so that a direct eval can + determine whether any var scoped declarations introduced by the eval + code conflict with pre-existing top-level lexically scoped + declarations. This is not needed for strict functions because a + strict direct eval always places all declarations into a new + Environment Record. + [...] + + 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation + + [...] + 5. If strict is false, then + [...] + b. Let thisLex be lexEnv. + c. Assert: The following loop will terminate. + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + ii. NOTE: Annex B.3.5 defines alternate semantics for the + above step. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. +flags: [noStrict] +features: [generators, let] +---*/ + +var o = { + *m() { + let x; + eval('var x;'); + } +}; +var iter = o.m(); + +assert.throws(SyntaxError, function() { + iter.next(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-close.js b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-close.js new file mode 100644 index 0000000000..afb0b98f30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-close.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probe1, probe2, probeBody; + +({ + *m( + _ = (eval('var x = "inside";'), probe1 = function() { return x; }), + __ = probe2 = function() { return x; } + ) { + probeBody = function() { return x; }; + } +}.m().next()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-open.js b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-open.js new file mode 100644 index 0000000000..7157eaf78b --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-elem-var-open.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probe1, probe2; + +({ + *m( + _ = probe1 = function() { return x; }, + __ = (eval('var x = "inside";'), probe2 = function() { return x; }) + ) {} +}.m().next()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-close.js b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-close.js new file mode 100644 index 0000000000..c357b326af --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-close.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probeParam, probeBody; + +({ + *m( + ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })] + ) { + probeBody = function() { return x; } + } +}.m().next()); + +assert.sameValue(probeParam(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-open.js b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-open.js new file mode 100644 index 0000000000..b686c1b753 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-gen-meth-param-rest-elem-var-open.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +features: [generators] +---*/ + +var x = 'outside'; +var probe1, probe2; + +({ + *m( + _ = probe1 = function() { return x; }, + ...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })] + ) {} +}.m().next()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-close.js new file mode 100644 index 0000000000..9536c96b11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-close.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var probe; + +({ + // A parameter expression is necessary to trigger the creation of the scope + // under test. + *m(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}.m().next()); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-open.js new file mode 100644 index 0000000000..7bc1851085 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-gen-meth-paramsbody-var-open.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +features: [generators] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +({ + *m(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}.m().next()); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-getter-body-lex-distinc.js b/js/src/tests/test262/language/expressions/object/scope-getter-body-lex-distinc.js new file mode 100644 index 0000000000..8b5874b158 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-getter-body-lex-distinc.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new lexical environment (distinct from the variable + environment) for the function body outside of strict mode +info: | + [...] + 29. If strict is false, then + a. Let lexEnv be NewDeclarativeEnvironment(varEnv). + b. NOTE: Non-strict functions use a separate lexical Environment Record + for top-level lexical declarations so that a direct eval can + determine whether any var scoped declarations introduced by the eval + code conflict with pre-existing top-level lexically scoped + declarations. This is not needed for strict functions because a + strict direct eval always places all declarations into a new + Environment Record. + [...] + + 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation + + [...] + 5. If strict is false, then + [...] + b. Let thisLex be lexEnv. + c. Assert: The following loop will terminate. + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + ii. NOTE: Annex B.3.5 defines alternate semantics for the + above step. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. +flags: [noStrict] +features: [let] +---*/ + +var o = { + get a() { + let x; + eval('var x;'); + } +}; + +assert.throws(SyntaxError, function() { + o.a; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-meth-body-lex-distinct.js b/js/src/tests/test262/language/expressions/object/scope-meth-body-lex-distinct.js new file mode 100644 index 0000000000..5cc48775d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-meth-body-lex-distinct.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new lexical environment (distinct from the variable + environment) for the function body outside of strict mode +info: | + [...] + 29. If strict is false, then + a. Let lexEnv be NewDeclarativeEnvironment(varEnv). + b. NOTE: Non-strict functions use a separate lexical Environment Record + for top-level lexical declarations so that a direct eval can + determine whether any var scoped declarations introduced by the eval + code conflict with pre-existing top-level lexically scoped + declarations. This is not needed for strict functions because a + strict direct eval always places all declarations into a new + Environment Record. + [...] + + 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation + + [...] + 5. If strict is false, then + [...] + b. Let thisLex be lexEnv. + c. Assert: The following loop will terminate. + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + ii. NOTE: Annex B.3.5 defines alternate semantics for the + above step. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. +flags: [noStrict] +features: [let] +---*/ + +var m = { + m() { + let x; + eval('var x;'); + } +}.m; + +assert.throws(SyntaxError, m); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-close.js b/js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-close.js new file mode 100644 index 0000000000..6d8c2e60ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-close.js @@ -0,0 +1,34 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2, probeBody; + +({ + m( + _ = (eval('var x = "inside";'), probe1 = function() { return x; }), + __ = probe2 = function() { return x; } + ) { + probeBody = function() { return x; }; + } +}.m()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-open.js b/js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-open.js new file mode 100644 index 0000000000..d51f1bfd16 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-meth-param-elem-var-open.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2; + +({ + m( + _ = probe1 = function() { return x; }, + __ = (eval('var x = "inside";'), probe2 = function() { return x; }) + ) {} +}.m()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-close.js b/js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-close.js new file mode 100644 index 0000000000..62aeae3b3c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-close.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probeParam, probeBody; + +({ + m( + ...[_ = (eval('var x = "inside";'), probeParam = function() { return x; })] + ) { + probeBody = function() { return x; } + } +}.m()); + +assert.sameValue(probeParam(), 'inside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-open.js b/js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-open.js new file mode 100644 index 0000000000..3e4d9c3fe8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-meth-param-rest-elem-var-open.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + sloppy direct evals in params introduce vars +info: | + [...] + 20. Else, + a. NOTE: A separate Environment Record is needed to ensure that bindings created by direct eval calls in the formal parameter list are outside the environment where parameters are declared. + b. Let calleeEnv be the LexicalEnvironment of calleeContext. + c. Let env be NewDeclarativeEnvironment(calleeEnv). + d. Let envRec be env's EnvironmentRecord. + [...] +flags: [noStrict] +---*/ + +var x = 'outside'; +var probe1, probe2; + +({ + m( + _ = probe1 = function() { return x; }, + ...[__ = (eval('var x = "inside";'), probe2 = function() { return x; })] + ) {} +}.m()); + +assert.sameValue(probe1(), 'inside'); +assert.sameValue(probe2(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-close.js new file mode 100644 index 0000000000..1a2a47ef46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-close.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +({ + // A parameter expression is necessary to trigger the creation of the scope + // under test. + m(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}.m()); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-open.js new file mode 100644 index 0000000000..1cc395b18e --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-meth-paramsbody-var-open.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +({ + m(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}.m()); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-setter-body-lex-distinc.js b/js/src/tests/test262/language/expressions/object/scope-setter-body-lex-distinc.js new file mode 100644 index 0000000000..3318fac03d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-setter-body-lex-distinc.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new lexical environment (distinct from the variable + environment) for the function body outside of strict mode +info: | + [...] + 29. If strict is false, then + a. Let lexEnv be NewDeclarativeEnvironment(varEnv). + b. NOTE: Non-strict functions use a separate lexical Environment Record + for top-level lexical declarations so that a direct eval can + determine whether any var scoped declarations introduced by the eval + code conflict with pre-existing top-level lexically scoped + declarations. This is not needed for strict functions because a + strict direct eval always places all declarations into a new + Environment Record. + [...] + + 18.2.1.3 Runtime Semantics: EvalDeclarationInstantiation + + [...] + 5. If strict is false, then + [...] + b. Let thisLex be lexEnv. + c. Assert: The following loop will terminate. + d. Repeat while thisLex is not the same as varEnv, + i. Let thisEnvRec be thisLex's EnvironmentRecord. + ii. If thisEnvRec is not an object Environment Record, then + 1. NOTE: The environment of with statements cannot contain any + lexical declaration so it doesn't need to be checked for + var/let hoisting conflicts. + 2. For each name in varNames, do + a. If thisEnvRec.HasBinding(name) is true, then + i. Throw a SyntaxError exception. + ii. NOTE: Annex B.3.5 defines alternate semantics for the + above step. + b. NOTE: A direct eval will not hoist var declaration over a + like-named lexical declaration. + iii. Let thisLex be thisLex's outer environment reference. +flags: [noStrict] +features: [let] +---*/ + +var o = { + set a(_) { + let x; + eval('var x;'); + } +}; + +assert.throws(SyntaxError, function() { + o.a = null; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-close.js b/js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-close.js new file mode 100644 index 0000000000..3f18937429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-close.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Disposal of variable environment for the function body +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var probe; + +({ + // A parameter expression is necessary to trigger the creation of the scope + // under test. + set a(_ = null) { + var x = 'inside'; + probe = function() { return x; }; + } +}.a = null); + +var x = 'outside'; + +assert.sameValue(probe(), 'inside'); +assert.sameValue(x, 'outside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-open.js b/js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-open.js new file mode 100644 index 0000000000..6919f07aea --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/scope-setter-paramsbody-var-open.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-functiondeclarationinstantiation +description: > + Creation of new variable environment for the function body (as distinct from + that for the function's parameters) +info: | + [...] + 26. If hasParameterExpressions is false, then + [...] + 27. Else, + a. NOTE A separate Environment Record is needed to ensure that closures + created by expressions in the formal parameter list do not have + visibility of declarations in the function body. + b. Let varEnv be NewDeclarativeEnvironment(env). + c. Let varEnvRec be varEnv's EnvironmentRecord. + d. Set the VariableEnvironment of calleeContext to varEnv. + e. Let instantiatedVarNames be a new empty List. + [...] +---*/ + +var x = 'outside'; +var probeParams, probeBody; + +({ + set a(_ = probeParams = function() { return x; }) { + var x = 'inside'; + probeBody = function() { return x; }; + } +}.a = undefined); + +assert.sameValue(probeParams(), 'outside'); +assert.sameValue(probeBody(), 'inside'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/setter-body-strict-inside.js b/js/src/tests/test262/language/expressions/object/setter-body-strict-inside.js new file mode 100644 index 0000000000..ad0341354d --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-body-strict-inside.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5_7-2-2-s +description: > + Strict Mode - SyntaxError is thrown when an assignment to a + reserved word is made in a strict FunctionBody of a + PropertyAssignment +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +void { + set x(value) { + "use strict"; + public = 42; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/setter-body-strict-outside-strict.js b/js/src/tests/test262/language/expressions/object/setter-body-strict-outside-strict.js new file mode 100644 index 0000000000..a3b0ac3989 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-body-strict-outside-strict.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5_7-2-1-s +description: > + Strict Mode - SyntaxError is thrown when an assignment to a + reserved word is contained in strict code +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +void { + set x(value) { + public = 42; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/setter-length-dflt.js b/js/src/tests/test262/language/expressions/object/setter-length-dflt.js new file mode 100644 index 0000000000..47a4d9419c --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-length-dflt.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 14.1.6 +description: > + Default parameters' effect on function length +info: | + Function length is counted by the non initialized parameters in the left. + + 9.2.4 FunctionInitialize (F, kind, ParameterList, Body, Scope) + + [...] + 2. Let len be the ExpectedArgumentCount of ParameterList. + 3. Perform ! DefinePropertyOrThrow(F, "length", PropertyDescriptor{[[Value]]: + len, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true}). + [...] + + FormalsList : FormalParameter + + 1. If HasInitializer of FormalParameter is true return 0 + 2. Return 1. + + FormalsList : FormalsList , FormalParameter + + 1. Let count be the ExpectedArgumentCount of FormalsList. + 2. If HasInitializer of FormalsList is true or HasInitializer of + FormalParameter is true, return count. + 3. Return count+1. +features: [default-parameters] +includes: [propertyHelper.js] +---*/ + + +var set = Object.getOwnPropertyDescriptor({ set m(x = 42) {} }, 'm').set; + +verifyProperty(set, 'length', { + value: 0, + writable: false, + enumerable: false, + configurable: true, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-inside.js b/js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-inside.js new file mode 100644 index 0000000000..2c6e159ab6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-inside.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5-4-s +description: > + Strict Mode - SyntaxError is thrown when 'arguments' occurs as + the Identifier in a PropertySetParameterList of a + PropertyAssignment if its FunctionBody is strict code +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +void { + set x(arguments) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-outside-strict.js b/js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-outside-strict.js new file mode 100644 index 0000000000..b1bfb8c519 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-param-arguments-strict-outside-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5-2-s +description: > + Strict Mode - SyntaxError is thrown when 'arguments' occurs as the + Identifier in a PropertySetParameterList of a PropertyAssignment + that is contained in strict code +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +void { + set x(arguments) {} +}; diff --git a/js/src/tests/test262/language/expressions/object/setter-param-eval-strict-inside.js b/js/src/tests/test262/language/expressions/object/setter-param-eval-strict-inside.js new file mode 100644 index 0000000000..b3c3db1caa --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-param-eval-strict-inside.js @@ -0,0 +1,22 @@ +// |reftest| error:SyntaxError +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5-3-s +description: > + Strict Mode - SyntaxError is thrown when 'evals' occurs as the + Identifier in a PropertySetParameterList of a PropertyAssignment + if its FunctionBody is strict code +negative: + phase: parse + type: SyntaxError +flags: [noStrict] +---*/ + +$DONOTEVALUATE(); + +void { + set x(eval) { + "use strict"; + } +}; diff --git a/js/src/tests/test262/language/expressions/object/setter-param-eval-strict-outside-strict.js b/js/src/tests/test262/language/expressions/object/setter-param-eval-strict-outside-strict.js new file mode 100644 index 0000000000..c92405d8b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-param-eval-strict-outside-strict.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es5id: 11.1.5-1-s +description: > + Strict Mode - SyntaxError is thrown when 'eval' occurs as the + Identifier in a PropertySetParameterList of a PropertyAssignment + that is contained in strict code +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +void { + set x(eval) {} +}; diff --git a/js/src/tests/test262/language/expressions/object/setter-prop-desc.js b/js/src/tests/test262/language/expressions/object/setter-prop-desc.js new file mode 100644 index 0000000000..7ace84e8ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-prop-desc.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object-initializer-runtime-semantics-evaluation +es6id: 12.2.6.8 +description: Property descriptor of "set" accessor methods +info: | + ObjectLiteral: + { PropertyDefinitionList } + { PropertyDefinitionList , } + + 1. Let obj be ObjectCreate(%ObjectPrototype%). + 2. Let status be the result of performing PropertyDefinitionEvaluation of + PropertyDefinitionList with arguments obj and true. + 3. ReturnIfAbrupt(status). + 4. Return obj. + + 14.3.8 Runtime Semantics: PropertyDefinitionEvaluation + + MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody } + + [...] + 8. Let desc be the PropertyDescriptor{[[Set]]: closure, [[Enumerable]]: + enumerable, [[Configurable]]: true}. + [...] +includes: [propertyHelper.js] +---*/ + +var obj = { set m(x) { return x; } }; +var desc = Object.getOwnPropertyDescriptor(obj, 'm'); + +verifyProperty(obj, 'm', { + enumerable: true, + configurable: true, +}); + +assert.sameValue(desc.value, undefined, '`value` field'); +assert.sameValue(desc.get, undefined, '`get` field'); +assert.sameValue(typeof desc.set, 'function', 'type of `set` field'); +assert.sameValue(desc.set(436), 436, '`set` function return value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/setter-super-prop.js b/js/src/tests/test262/language/expressions/object/setter-super-prop.js new file mode 100644 index 0000000000..5568a66c62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/setter-super-prop.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + super method calls in object literal setters +---*/ +var proto = { + _x: 0, + set x(v) { + return this._x = v; + } +}; + +var object = { + set x(v) { + super.x = v; + } +}; + +Object.setPrototypeOf(object, proto); + +assert.sameValue(object.x = 1, 1, "`object.x = 1` is `1`, after executing `Object.setPrototypeOf(object, proto);`"); +assert.sameValue(object._x, 1, "The value of `object._x` is `1`, after executing `Object.setPrototypeOf(object, proto);`"); +assert.sameValue( + Object.getPrototypeOf(object)._x, + 0, + "The value of `Object.getPrototypeOf(object)._x` is `0`" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/shell.js b/js/src/tests/test262/language/expressions/object/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/object/yield-non-strict-access.js b/js/src/tests/test262/language/expressions/object/yield-non-strict-access.js new file mode 100644 index 0000000000..1ce5eb7c75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/yield-non-strict-access.js @@ -0,0 +1,14 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + In non-strict mode, yield is a valid Identifier. +flags: [noStrict] +---*/ +var yield = 1; +var object = {yield}; + +assert.sameValue(object.yield, 1, "The value of `object.yield` is `1`"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/object/yield-non-strict-syntax.js b/js/src/tests/test262/language/expressions/object/yield-non-strict-syntax.js new file mode 100644 index 0000000000..6b21dc2f45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/object/yield-non-strict-syntax.js @@ -0,0 +1,12 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.5 +description: > + In non-strict mode, yield is a valid Identifier. +flags: [noStrict] +---*/ +var yield = 1; +var object = {yield}; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/browser.js b/js/src/tests/test262/language/expressions/optional-chaining/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/optional-chaining/call-expression-super-no-base.js b/js/src/tests/test262/language/expressions/optional-chaining/call-expression-super-no-base.js new file mode 100644 index 0000000000..da3a634bdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/call-expression-super-no-base.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + should not suppress error if super called on class with no base +info: | + Left-Hand-Side Expressions + OptionalExpression: + SuperCall OptionalChain +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +class C { + constructor () { + super()?.a; + } +} diff --git a/js/src/tests/test262/language/expressions/optional-chaining/call-expression.js b/js/src/tests/test262/language/expressions/optional-chaining/call-expression.js new file mode 100644 index 0000000000..aa3f4abeb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/call-expression.js @@ -0,0 +1,77 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain on call expression +info: | + Left-Hand-Side Expressions + OptionalExpression: + CallExpression OptionalChain +features: [optional-chaining] +---*/ + +// CallExpression CoverCallExpressionAndAsyncArrowHead +function fn () { + return {a: 33}; +}; +const obj = { + fn () { + return 44; + } +} +assert.sameValue(33, fn()?.a); +assert.sameValue(undefined, fn()?.b); +assert.sameValue(44, obj?.fn()); + +// CallExpression SuperCall +class A {} +class B extends A { + constructor () { + assert.sameValue(undefined, super()?.a); + } +} +new B(); + +// CallExpression Arguments +function fn2 () { + return () => { + return {a: 66}; + }; +} +function fn3 () { + return () => { + return null; + }; +} +assert.sameValue(66, fn2()()?.a); +assert.sameValue(undefined, fn3()()?.a); + +// CallExpression [Expression] +function fn4 () { + return [{a: 77}]; +} +function fn5 () { + return []; +} +assert.sameValue(77, fn4()[0]?.a); +assert.sameValue(undefined, fn5()[0]?.a); + +// CallExpression .IdentifierName +function fn6 () { + return { + a: { + b: 88 + } + }; +} +assert.sameValue(88, fn6().a?.b); +assert.sameValue(undefined, fn6().b?.c); + +// CallExpression TemplateLiteral +function fn7 () { + return () => {}; +} +assert.sameValue(undefined, fn7()`hello`?.a); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string-esi.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string-esi.js new file mode 100644 index 0000000000..ae830b1300 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string-esi.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +// This production exists in order to prevent automatic semicolon +// insertion rules. +null?. + `hello` diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string.js new file mode 100644 index 0000000000..cb8361cd0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-op-template-string.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +null?.`hello`; diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string-esi.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string-esi.js new file mode 100644 index 0000000000..9c992b00d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string-esi.js @@ -0,0 +1,26 @@ +// |reftest| error:SyntaxError +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +// This production exists in order to prevent automatic semicolon +// insertion rules. +null?.fn + `hello` diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string.js new file mode 100644 index 0000000000..a74ca1cf32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-null-optchain-template-string.js @@ -0,0 +1,23 @@ +// |reftest| error:SyntaxError +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +null?.fn`hello`; diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string-esi.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string-esi.js new file mode 100644 index 0000000000..c1ec6d707d --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string-esi.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +const a = function() {}; + +// This production exists in order to prevent automatic semicolon +// insertion rules. +a?. + `hello` diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string.js new file mode 100644 index 0000000000..043bfb3da3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-op-template-string.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +const a = function() {}; + +a?.`hello`; diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string-esi.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string-esi.js new file mode 100644 index 0000000000..1aefaaec22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string-esi.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +const a = {fn() {}}; + +// This production exists in order to prevent automatic semicolon +// insertion rules. +a?.fn + `hello` diff --git a/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string.js b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string.js new file mode 100644 index 0000000000..277048e1aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/early-errors-tail-position-optchain-template-string.js @@ -0,0 +1,25 @@ +// |reftest| error:SyntaxError +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + template string passed to tail position of optional chain +info: | + Static Semantics: Early Errors + OptionalChain: + ?.TemplateLiteral + OptionalChain TemplateLiteral + + It is a Syntax Error if any code matches this production. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +const a = {fn() {}}; + +a?.fn`hello`; diff --git a/js/src/tests/test262/language/expressions/optional-chaining/eval-optional-call.js b/js/src/tests/test262/language/expressions/optional-chaining/eval-optional-call.js new file mode 100644 index 0000000000..8ff4800560 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/eval-optional-call.js @@ -0,0 +1,41 @@ +// Copyright 2020 Toru Nagashima. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-optional-chaining-chain-evaluation +description: optional call invoked on eval function should be indirect eval. +info: | + Runtime Semantics: ChainEvaluation + OptionalChain: ?. Arguments + 1. Let thisChain be this OptionalChain. + 2. Let tailCall be IsInTailPosition(thisChain). + 3. Return ? EvaluateCall(baseValue, baseReference, Arguments, tailCall). + + Runtime Semantics: EvaluateCall ( func, ref, arguments, tailPosition ) + + ... + 7. Let result be Call(func, thisValue, argList). + ... + + eval ( x ) + + ... + 4. Return ? PerformEval(x, callerRealm, false, false). + + Runtime Semantics: PerformEval ( x, callerRealm, strictCaller, direct ) +features: [optional-chaining] +---*/ + +const a = 'global'; + +function fn() { + const a = 'local'; + return eval?.('a'); +} + +assert.sameValue(fn(), 'global', 'fn() returns "global" value from indirect eval'); + +const b = (a => eval?.('a'))('local'); + +assert.sameValue(b, 'global', 'b is "global", from indirect eval not observing parameter'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-do.js b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-do.js new file mode 100644 index 0000000000..470f067b20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-do.js @@ -0,0 +1,20 @@ +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain in test portion of do while statement +info: | + IterationStatement + do Statement while (OptionalExpression) +features: [optional-chaining] +---*/ +let count = 0; +const obj = {a: true}; +do { + count++; + break; +} while (obj?.a); +assert.sameValue(1, count); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-await-of.js b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-await-of.js new file mode 100644 index 0000000000..ec799bf2d3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-await-of.js @@ -0,0 +1,37 @@ +// |reftest| async +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain RHS of for await statement +info: | + IterationStatement + for await (LeftHandSideExpression of AssignmentExpression) Statement +features: [optional-chaining] +flags: [async] +includes: [asyncHelpers.js] +---*/ +const obj = { + iterable: { + [Symbol.asyncIterator]() { + return { + i: 0, + next() { + if (this.i < 3) { + return Promise.resolve({ value: this.i++, done: false }); + } + return Promise.resolve({ done: true }); + } + }; + } + } +}; +async function checkAssertions() { + let count = 0; + for await (const num of obj?.iterable) { + count += num; + } + assert.sameValue(3, count); +} +asyncTest(checkAssertions); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-in.js b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-in.js new file mode 100644 index 0000000000..6774675f1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-in.js @@ -0,0 +1,24 @@ +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain in test portion of do while statement +info: | + IterationStatement + for (LeftHandSideExpression in Expression) Statement +features: [optional-chaining] +---*/ +const obj = { + inner: { + a: 1, + b: 2 + } +}; +let str = ''; +for (const key in obj?.inner) { + str += key; +} +assert.sameValue('ab', str); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-of-type-error.js b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-of-type-error.js new file mode 100644 index 0000000000..938e10d8d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for-of-type-error.js @@ -0,0 +1,30 @@ +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain returning undefined in RHS of for of statement +info: | + IterationStatement + for (LeftHandSideExpression of Expression) Statement +features: [optional-chaining] +---*/ + +assert.throws(TypeError, function() { + for (const key of {}?.a) ; +}); + +assert.throws(TypeError, function() { + for (const key of {}?.a) {} +}); + +const obj = undefined; +assert.throws(TypeError, function() { + for (const key of obj?.a) {} +}); + +assert.throws(TypeError, function() { + for (const key of obj?.a); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for.js b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for.js new file mode 100644 index 0000000000..cb884d486e --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-for.js @@ -0,0 +1,45 @@ +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain in init/test/update of for statement +info: | + IterationStatement + for (Expression; Expression; Expression) Statement +features: [optional-chaining] +---*/ + +// OptionalExpression in test. +let count; +const obj = {a: true}; +for (count = 0; obj?.a; count++) { + if (count > 0) break; +} +assert.sameValue(count, 1); + +// OptionalExpression in init/test/update. +let count2 = 0; +const obj2 = undefined; + +for (obj?.a; obj2?.a; obj?.a) { count2++; } +assert.sameValue(count2, 0); + +for (obj?.a; undefined?.a; obj?.a) { count2++; } +assert.sameValue(count2, 0); + +// Short-circuiting +let touched = 0; +const obj3 = { + get a() { + count++; + return undefined; // explicit for clarity + } +}; +for (count = 0; true; obj3?.a?.[touched++]) { + if (count > 0) { break; } +} +assert.sameValue(count, 1); +assert.sameValue(touched, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-while.js b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-while.js new file mode 100644 index 0000000000..1390315896 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/iteration-statement-while.js @@ -0,0 +1,20 @@ +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain in test portion of while statement +info: | + IterationStatement + while (Expression) Statement +features: [optional-chaining] +---*/ +let count = 0; +const obj = {a: true}; +while (obj?.a) { + count++; + break; +} +assert.sameValue(1, count); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-identifier.js b/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-identifier.js new file mode 100644 index 0000000000..deffd0b9ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-identifier.js @@ -0,0 +1,34 @@ +// |reftest| async +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain on member expression in async context +info: | + Left-Hand-Side Expressions + OptionalExpression + MemberExpression [PrimaryExpression identifier] OptionalChain +features: [optional-chaining] +flags: [async] +includes: [asyncHelpers.js] +---*/ + +const a = undefined; +const c = {d: Promise.resolve(11)}; +async function checkAssertions() { + assert.sameValue(await a?.b, undefined); + assert.sameValue(await c?.d, 11); + + Promise.prototype.x = 42; + var res = await Promise.resolve(undefined)?.x; + assert.sameValue(res, 42, 'await unwraps the evaluation of the whole optional chaining expression #1'); + + Promise.prototype.y = 43; + var res = await Promise.reject(undefined)?.y; + assert.sameValue(res, 43, 'await unwraps the evaluation of the whole optional chaining expression #2'); + + c.e = Promise.resolve(39); + assert.sameValue(await c?.e, 39, 'await unwraps the promise given after the evaluation of the OCE'); +} +asyncTest(checkAssertions); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-literal.js b/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-literal.js new file mode 100644 index 0000000000..00e791f916 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-literal.js @@ -0,0 +1,21 @@ +// |reftest| async +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain on member expression in async context +info: | + Left-Hand-Side Expressions + OptionalExpression: + MemberExpression [PrimaryExpression literal] OptionalChain +features: [optional-chaining] +flags: [async] +includes: [asyncHelpers.js] +---*/ + +async function checkAssertions() { + assert.sameValue(await "hello"?.[0], 'h'); + assert.sameValue(await null?.a, undefined); +} +asyncTest(checkAssertions); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-this.js b/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-this.js new file mode 100644 index 0000000000..5de87fa9bb --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/member-expression-async-this.js @@ -0,0 +1,21 @@ +// |reftest| async +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain on member expression in async context +info: | + Left-Hand-Side Expressions + OptionalExpression: + MemberExpression [PrimaryExpression this] OptionalChain +features: [optional-chaining] +flags: [async] +---*/ + +async function thisFn() { + return await this?.a +} +thisFn.call({a: Promise.resolve(33)}).then(function(arg) { + assert.sameValue(33, arg); +}).then($DONE, $DONE); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/member-expression.js b/js/src/tests/test262/language/expressions/optional-chaining/member-expression.js new file mode 100644 index 0000000000..4854182c75 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/member-expression.js @@ -0,0 +1,106 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain on member expression +info: | + Left-Hand-Side Expressions + OptionalExpression: + MemberExpression OptionalChain +features: [optional-chaining] +---*/ + +// PrimaryExpression +// IdentifierReference +const a = {b: 22}; +assert.sameValue(22, a?.b); +// this +function fn () { + return this?.a +} +assert.sameValue(33, fn.call({a: 33})); +// Literal +assert.sameValue(undefined, "hello"?.a); +assert.sameValue(undefined, null?.a); +// ArrayLiteral +assert.sameValue(2, [1, 2]?.[1]); +// ObjectLiteral +assert.sameValue(44, {a: 44}?.a); +// FunctionExpression +assert.sameValue('a', (function a () {}?.name)); +// ClassExpression +assert.sameValue('Foo', (class Foo {}?.name)); +// GeneratorFunction +assert.sameValue('a', (function * a () {}?.name)); +// AsyncFunctionExpression +assert.sameValue('a', (async function a () {}?.name)); +// AsyncGeneratorExpression +assert.sameValue('a', (async function * a () {}?.name)); +// RegularExpressionLiteral +assert.sameValue(true, /[a-z]/?.test('a')); +// TemplateLiteral +assert.sameValue('h', `hello`?.[0]); +// CoverParenthesizedExpressionAndArrowParameterList +assert.sameValue(undefined, ({a: 33}, null)?.a); +assert.sameValue(33, (undefined, {a: 33})?.a); + +// MemberExpression [ Expression ] +const arr = [{a: 33}]; +assert.sameValue(33, arr[0]?.a); +assert.sameValue(undefined, arr[1]?.a); + +// MemberExpression .IdentifierName +const obj = {a: {b: 44}}; +assert.sameValue(44, obj.a?.b); +assert.sameValue(undefined, obj.c?.b); + +// MemberExpression TemplateLiteral +function f2 () { + return {a: 33}; +} +function f3 () {} +assert.sameValue(33, f2`hello world`?.a); +assert.sameValue(undefined, f3`hello world`?.a); + +// MemberExpression SuperProperty +class A { + a () {} + undf () { + return super.a?.c; + } +} +class B extends A { + dot () { + return super.a?.name; + } + expr () { + return super['a']?.name; + } + undf2 () { + return super.b?.c; + } +} +const subcls = new B(); +assert.sameValue('a', subcls.dot()); +assert.sameValue('a', subcls.expr()); +assert.sameValue(undefined, subcls.undf2()); +assert.sameValue(undefined, (new A()).undf()); + +// MemberExpression MetaProperty +class C { + constructor () { + assert.sameValue(undefined, new.target?.a); + } +} +new C(); + +// new MemberExpression Arguments +class D { + constructor (val) { + this.a = val; + } +} +assert.sameValue(99, new D(99)?.a); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/new-target-optional-call.js b/js/src/tests/test262/language/expressions/optional-chaining/new-target-optional-call.js new file mode 100644 index 0000000000..df05a11507 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/new-target-optional-call.js @@ -0,0 +1,32 @@ +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional call invoked on new.target should be equivalent to call +info: | + OptionalExpression + MemberExpression OptionalChain + NewTarget OptionalChain +features: [optional-chaining] +---*/ + +const newTargetContext = (function() { return this; })(); + +let called = false; +// should be set to 'undefined' or global context, depending on whether +// mode is strict or sloppy. +let context = null; +function Base() { + called = true; + context = this; +} +function Foo(blerg) { + new.target?.(); +} + +Reflect.construct(Foo, [], Base); +assert(context === newTargetContext); +assert.sameValue(called, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-call-preserves-this.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-call-preserves-this.js new file mode 100644 index 0000000000..dbaf92c3b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-call-preserves-this.js @@ -0,0 +1,29 @@ +// Copyright (C) 2019 Sony Interactive Entertainment Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-optional-chaining-chain-evaluation +description: > + optional call must preserve this context, as with a non-optional call +info: | + OptionalChain : ?. Arguments + 1. Let thisChain be this OptionalChain. + 2. Let tailCall be IsInTailPosition(thisChain). + 3. Return ? EvaluateCall(baseValue, baseReference, Arguments, tailCall). +features: [optional-chaining] +---*/ + +const a = { + b() { return this._b; }, + _b: { c: 42 } +}; + +assert.sameValue(a?.b().c, 42); +assert.sameValue((a?.b)().c, 42); + +assert.sameValue(a.b?.().c, 42); +assert.sameValue((a.b)?.().c, 42); + +assert.sameValue(a?.b?.().c, 42); +assert.sameValue((a?.b)?.().c, 42); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js new file mode 100644 index 0000000000..1acd866b23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-optional-chain-square-brackets.js @@ -0,0 +1,30 @@ +// |reftest| async +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain expansions in an async context +info: | + Left-Hand-Side Expressions + OptionalExpression + MemberExpression [PrimaryExpression Identifier] OptionalChain + OptionalChain OptionalChain ?.[Expression] +features: [optional-chaining] +flags: [async] +includes: [asyncHelpers.js] +---*/ + +async function checkAssertions() { + assert.sameValue(await {a: [11]}?.a[0], 11); + const b = {c: [22, 33]}; + assert.sameValue(b?.c[await Promise.resolve(1)], 33); + function e(val) { + return val; + } + assert.sameValue({d: e}?.d(await Promise.resolve([44, 55]))[1], 55); + assert.sameValue(undefined?.arr[ + await Promise.reject(new Error('unreachable')) + ], undefined); +} +asyncTest(checkAssertions); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-square-brackets.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-square-brackets.js new file mode 100644 index 0000000000..361b324295 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-async-square-brackets.js @@ -0,0 +1,26 @@ +// |reftest| async +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain expansions in an async context +info: | + Left-Hand-Side Expressions + OptionalExpression + MemberExpression [PrimaryExpression Identifier] OptionalChain + OptionalChain ?.[Expression] +features: [optional-chaining] +flags: [async] +includes: [asyncHelpers.js] +---*/ + +async function checkAssertions() { + assert.sameValue(await [11]?.[0], 11); + assert.sameValue([22, 33]?.[await Promise.resolve(1)], 33); + assert.sameValue([44, await Promise.resolve(55)]?.[1], 55); + assert.sameValue(undefined?.[ + await Promise.reject(new Error('unreachable')) + ], undefined); +} +asyncTest(checkAssertions); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-expression-optional-expression.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-expression-optional-expression.js new file mode 100644 index 0000000000..be898b876e --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-expression-optional-expression.js @@ -0,0 +1,22 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain bracket notation containing optional expresion +info: | + OptionalChain: + ?. [OptionalExpression] +features: [optional-chaining] +---*/ +const a = undefined; +const b = {e: 0}; +const c = {}; +c[undefined] = 11; +const d = [22]; + +assert.sameValue(undefined, a?.[a?.b]); +assert.sameValue(11, c?.[a?.b]); +assert.sameValue(22, d?.[b?.e]); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-arguments.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-arguments.js new file mode 100644 index 0000000000..c9d9874078 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-arguments.js @@ -0,0 +1,21 @@ +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + Productions for ?. Arguments +info: | + OptionalChain[Yield, Await]: + ?. Arguments +features: [optional-chaining] +---*/ + +function fn(arg1, arg2, arg3 = 0) { + return arg1 + arg2 + arg3; +} + +assert.sameValue(fn?.(10, 20), 30, 'regular'); +assert.sameValue(String?.(42), '42', 'built-in'); +assert.sameValue(fn ?. (...[10, 20, 40]), 70, 'spread'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-expression.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-expression.js new file mode 100644 index 0000000000..dfde4d26c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-expression.js @@ -0,0 +1,44 @@ +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + Productions for ?. [Expression] +info: | + OptionalChain: + ?.[ Expression ] +features: [optional-chaining] +---*/ + +const $ = 'x'; +const arr = [39, 42]; + +arr.true = 'prop'; +arr[1.1] = 'other prop'; + +const obj = { + a: 'hello', + undefined: 40, + $: 0, + NaN: 41, + null: 42, + x: 43, + true: 44 +}; + +assert.sameValue(arr?.[0], 39, '[0]'); +assert.sameValue(arr?.[0, 1], 42, '[0, 1]'); +assert.sameValue(arr?.[1], 42, '[1]'); +assert.sameValue(arr?.[1, 0], 39, '[1, 0]'); +assert.sameValue(arr?.[{}, NaN, undefined, 2, 0, 10 / 10], 42, '[{}, NaN, undefined, 2, 0, 10 / 10]'); +assert.sameValue(arr?.[true], 'prop', '[true]'); +assert.sameValue(arr?.[1.1], 'other prop', '[1.1]'); + +assert.sameValue(obj?.[undefined], 40, '[undefined]'); +assert.sameValue(obj?.[NaN], 41, '[NaN]'); +assert.sameValue(obj?.[null], 42, '[null]'); +assert.sameValue(obj?.['$'], 0, '["$"]'); +assert.sameValue(obj?.[$], 43, '[$]'); +assert.sameValue(obj?.[true], 44, '[true]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-identifiername.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-identifiername.js new file mode 100644 index 0000000000..2636caf315 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain-prod-identifiername.js @@ -0,0 +1,40 @@ +// Copyright 2020 Salesforce.com, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-OptionalExpression +description: > + Productions for ?. IdentifierName +info: | + OptionalChain[Yield, Await]: + ?. IdentifierName +features: [optional-chaining] +---*/ + +const arr = [10, 11]; +const obj = { + a: 'hello' +}; + +assert.sameValue(obj?.a, 'hello'); +assert.sameValue(obj?.\u0061, 'hello'); +assert.sameValue(obj?.\u{0061}, 'hello'); + +assert.sameValue(obj?.\u0062, undefined); +assert.sameValue(obj?.\u{0062}, undefined); + +assert.sameValue(arr ?. length, 2); +assert.sameValue(arr ?. l\u0065ngth, 2); +assert.sameValue(arr ?. l\u{0065}ngth, 2); + +assert.sameValue(obj?.$, undefined); + +obj.$ = 42; +assert.sameValue(obj?.$, 42); + +assert.sameValue(obj?._, undefined); + +obj._ = 39; +assert.sameValue(obj?._, 39); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-chain.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain.js new file mode 100644 index 0000000000..b8dd183092 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-chain.js @@ -0,0 +1,52 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + various optional chain expansions +info: | + OptionalChain[Yield, Await]: + ?.[Expression] + ?.IdentifierName + ?.Arguments + ?.TemplateLiteral + OptionalChain [Expression] + OptionalChain .IdentifierName + OptionalChain Arguments[?Yield, ?Await] + OptionalChain TemplateLiteral +features: [optional-chaining] +---*/ + +const arr = [10, 11]; +const obj = { + a: 'hello', + b: {val: 13}, + c(arg1) { + return arg1 * 2; + }, + arr: [11, 12] +}; +const i = 0; + +// OptionalChain: ?.[Expression] +assert.sameValue(11, arr?.[i + 1]); + +// OptionalChain: ?.IdentifierName +assert.sameValue('hello', obj?.a); + +// OptionalChain: ?.Arguments +const fn = (arg1, arg2) => { + return arg1 + arg2; +} +assert.sameValue(30, fn?.(10, 20)); + +// OptionalChain: OptionalChain [Expression] +assert.sameValue(12, obj?.arr[i + 1]); + +// OptionalChain: OptionalChain .IdentifierName +assert.sameValue(13, obj?.b.val); + +// OptionalChain: OptionalChain Arguments +assert.sameValue(20, obj?.c(10)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/optional-expression.js b/js/src/tests/test262/language/expressions/optional-chaining/optional-expression.js new file mode 100644 index 0000000000..38cba72d21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/optional-expression.js @@ -0,0 +1,29 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chain on recursive optional expression +info: | + Left-Hand-Side Expressions + OptionalExpression: + OptionalExpression OptionalChain +features: [optional-chaining] +---*/ + +const obj = { + a: { + b: 22 + } +}; + +function fn () { + return {}; +} + +// OptionalExpression (MemberExpression OptionalChain) OptionalChain +assert.sameValue(22, obj?.a?.b); +// OptionalExpression (CallExpression OptionalChain) OptionalChain +assert.sameValue(undefined, fn()?.a?.b); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/punctuator-decimal-lookahead.js b/js/src/tests/test262/language/expressions/optional-chaining/punctuator-decimal-lookahead.js new file mode 100644 index 0000000000..ec64f9201e --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/punctuator-decimal-lookahead.js @@ -0,0 +1,17 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + ternary operation with decimal does not evaluate as optional chain +info: | + Punctuators + OptionalChainingPunctuator:: + ?.[lookahead ∉ DecimalDigit] +features: [optional-chaining] +---*/ + +const value = true ?.30 : false; +assert.sameValue(.30, value); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/runtime-semantics-evaluation.js b/js/src/tests/test262/language/expressions/optional-chaining/runtime-semantics-evaluation.js new file mode 100644 index 0000000000..a87af57856 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/runtime-semantics-evaluation.js @@ -0,0 +1,20 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + accessing optional value on undefined or null returns undefined. +info: | + If baseValue is undefined or null, then + Return undefined. +features: [optional-chaining] +---*/ + +const nul = null; +const undf = undefined; +assert.sameValue(undefined, nul?.a); +assert.sameValue(undefined, undf?.b); +assert.sameValue(undefined, null?.a); +assert.sameValue(undefined, undefined?.b); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/shell.js b/js/src/tests/test262/language/expressions/optional-chaining/shell.js new file mode 100644 index 0000000000..ae18ad584d --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/shell.js @@ -0,0 +1,113 @@ +// GENERATED, DO NOT EDIT +// file: asyncHelpers.js +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + A collection of assertion and wrapper functions for testing asynchronous built-ins. +defines: [asyncTest] +---*/ + +function asyncTest(testFunc) { + if (!Object.hasOwn(globalThis, "$DONE")) { + throw new Test262Error("asyncTest called without async flag"); + } + if (typeof testFunc !== "function") { + $DONE(new Test262Error("asyncTest called with non-function argument")); + return; + } + try { + testFunc().then( + function () { + $DONE(); + }, + function (error) { + $DONE(error); + } + ); + } catch (syncError) { + $DONE(syncError); + } +} + +assert.throwsAsync = async function (expectedErrorConstructor, func, message) { + var innerThenable; + if (message === undefined) { + message = ""; + } else { + message += " "; + } + if (typeof func === "function") { + try { + innerThenable = func(); + if ( + innerThenable === null || + typeof innerThenable !== "object" || + typeof innerThenable.then !== "function" + ) { + message += + "Expected to obtain an inner promise that would reject with a" + + expectedErrorConstructor.name + + " but result was not a thenable"; + throw new Test262Error(message); + } + } catch (thrown) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but an exception was thrown synchronously while obtaining the inner promise"; + throw new Test262Error(message); + } + } else { + message += + "assert.throwsAsync called with an argument that is not a function"; + throw new Test262Error(message); + } + + try { + return innerThenable.then( + function () { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but no exception was thrown at all"; + throw new Test262Error(message); + }, + function (thrown) { + var expectedName, actualName; + if (typeof thrown !== "object" || thrown === null) { + message += "Thrown value was not an object!"; + throw new Test262Error(message); + } else if (thrown.constructor !== expectedErrorConstructor) { + expectedName = expectedErrorConstructor.name; + actualName = thrown.constructor.name; + if (expectedName === actualName) { + message += + "Expected a " + + expectedName + + " but got a different error constructor with the same name"; + } else { + message += + "Expected a " + expectedName + " but got a " + actualName; + } + throw new Test262Error(message); + } + } + ); + } catch (thrown) { + if (typeof thrown !== "object" || thrown === null) { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but innerThenable synchronously threw a value that was not an object "; + } else { + message += + "Expected a " + + expectedErrorConstructor.name + + " to be thrown asynchronously but a " + + thrown.constructor.name + + " was thrown synchronously"; + } + throw new Test262Error(message); + } +}; diff --git a/js/src/tests/test262/language/expressions/optional-chaining/short-circuiting.js b/js/src/tests/test262/language/expressions/optional-chaining/short-circuiting.js new file mode 100644 index 0000000000..74295cb1ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/short-circuiting.js @@ -0,0 +1,24 @@ +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + demonstrate syntax-based short-circuiting. +info: | + If the expression on the LHS of ?. evaluates to null/undefined, the RHS is + not evaluated +features: [optional-chaining] +---*/ + +const a = undefined; +let x = 1; + +a?.[++x] // short-circuiting. +a?.b.c(++x).d; // long short-circuiting. + +undefined?.[++x] // short-circuiting. +undefined?.b.c(++x).d; // long short-circuiting. + +assert.sameValue(1, x); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/static-semantics-simple-assignment.js b/js/src/tests/test262/language/expressions/optional-chaining/static-semantics-simple-assignment.js new file mode 100644 index 0000000000..cbbcedba50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/static-semantics-simple-assignment.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError + +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + an optional expression cannot be target of assignment +info: | + Static Semantics: IsValidSimpleAssignmentTarget + LeftHandSideExpression: + OptionalExpression + Return false. +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +const obj = {}; + +obj?.a = 33; diff --git a/js/src/tests/test262/language/expressions/optional-chaining/super-property-optional-call.js b/js/src/tests/test262/language/expressions/optional-chaining/super-property-optional-call.js new file mode 100644 index 0000000000..21d1635ecc --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/super-property-optional-call.js @@ -0,0 +1,32 @@ +// Copyright 2019 Google, LLC. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional call invoked on super method should be equivalent to call +info: | + OptionalExpression + MemberExpression OptionalChain + SuperProperty OptionalChain +features: [optional-chaining] +---*/ + +let called = false; +let context; +class Base { + method() { + called = true; + context = this; + } +} +class Foo extends Base { + method() { + super.method?.(); + } +} +const foo = new Foo(); +foo.method(); +assert(foo === context); +assert.sameValue(called, true); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/optional-chaining/update-expression-postfix.js b/js/src/tests/test262/language/expressions/optional-chaining/update-expression-postfix.js new file mode 100644 index 0000000000..8b8fc68f9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/update-expression-postfix.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chaining is forbidden in write contexts +info: | + UpdateExpression[Yield, Await]: + LeftHandSideExpression++ + LeftHandSideExpression-- + ++UnaryExpression + --UnaryExpression +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +// LeftHandSideExpression ++ +const a = {}; +a?.b++; diff --git a/js/src/tests/test262/language/expressions/optional-chaining/update-expression-prefix.js b/js/src/tests/test262/language/expressions/optional-chaining/update-expression-prefix.js new file mode 100644 index 0000000000..ba65aadc0c --- /dev/null +++ b/js/src/tests/test262/language/expressions/optional-chaining/update-expression-prefix.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright 2019 Google, Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-OptionalExpression +description: > + optional chaining is forbidden in write contexts +info: | + UpdateExpression[Yield, Await]: + LeftHandSideExpression++ + LeftHandSideExpression-- + ++UnaryExpression + --UnaryExpression +features: [optional-chaining] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +// --UnaryExpression +const a = {}; +--a?.b; diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/11.3.2-2-3-s.js b/js/src/tests/test262/language/expressions/postfix-decrement/11.3.2-2-3-s.js new file mode 100644 index 0000000000..84624702f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/11.3.2-2-3-s.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.3.2-2-3-s +description: > + SyntaxError is not thrown if the identifier 'arguments[...]' appears as a + PostfixExpression(arguments--) +---*/ + +function testcase() { + arguments[1] = 7; + arguments[1]--; + assert.sameValue(arguments[1], 6, 'arguments[1]'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T1.js new file mode 100644 index 0000000000..331e8ebb29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T1.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- uses GetValue and PutValue +es5id: 11.3.2_A2.1_T1 +description: Type(x) is Reference and GetBase(x) is not null +---*/ + +//CHECK#1 +var x = 1; +if (x-- !== 1) { + throw new Test262Error('#1: var x = 1; x-- === 1. Actual: ' + (x--)); +} else { + if (x !== 1 - 1) { + throw new Test262Error('#1: var x = 1; x--; x === 1 - 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (this.x-- !== 1) { + throw new Test262Error('#2: this.x = 1; this.x-- === 1. Actual: ' + (this.x--)); +} else { + if (this.x !== 1 - 1) { + throw new Test262Error('#2: this.x = 1; this.x--; this.x === 1 - 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (object.prop-- !== 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; object.prop-- === 1. Actual: ' + (object.prop--)); +} else { + if (this.x !== 1 - 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; object.prop--; object.prop === 1 - 1. Actual: ' + (object.prop)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T2.js new file mode 100644 index 0000000000..aeec69a948 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- uses GetValue and PutValue +es5id: 11.3.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x--; + throw new Test262Error('#1.1: x-- throw ReferenceError. Actual: ' + (x--)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x-- throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.2_T1.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.2_T1.js new file mode 100644 index 0000000000..c67f6ff47e --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A2.2_T1.js @@ -0,0 +1,110 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- uses [[Default Value]] +es5id: 11.3.2_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +var y = object--; +if (y !== 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +var y = object--; +if (y !== 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +var y = object--; +if (y !== 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + var y = object--; + if (y !== 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object--; y === 1. Actual: ' + (y)); + } else { + if (object !== 1 - 1) { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object--; object === 1 - 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; y not throw "error"'); + } else { + throw new Test262Error('#4.4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; y not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +var y = object--; +if (y !== 1) { + throw new Test262Error('#5.1: var object = {toString: function() {return 1}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#5.2: var object = {toString: function() {return 1}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +var y = object--; +if (y !== 1) { + throw new Test262Error('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; var y = object--; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; object--; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + var y = object--; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object-- throw "error". Actual: ' + (y)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object-- throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + var y = object--; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object-- throw TypeError. Actual: ' + (y)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object-- throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T1.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T1.js new file mode 100644 index 0000000000..a6b12d78d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns x = ToNumber(x) - 1 +es5id: 11.3.2_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = true; +x--; +if (x !== 0) { + throw new Test262Error('#1: var x = true; x--; x === 0. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(false); +x--; +if (x !== 0 - 1) { + throw new Test262Error('#2: var x = new Boolean(false); x--; x === 0 - 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T2.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T2.js new file mode 100644 index 0000000000..62abd9a843 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns x = ToNumber(x) - 1 +es5id: 11.3.2_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 1.1; +x--; +if (x !== 1.1 - 1) { + throw new Test262Error('#1: var x = 1.1; x--; x === 1.1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-0.1); +x--; +if (x !== -0.1 - 1) { + throw new Test262Error('#2: var x = new Number(-0.1); x--; x === -0.1 - 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T3.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T3.js new file mode 100644 index 0000000000..be212e5d21 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns x = ToNumber(x) - 1 +es5id: 11.3.2_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +var x = "1"; +x--; +if (x !== 1 - 1) { + throw new Test262Error('#1: var x = "1"; x--; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +x--; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = "x"; x--; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +x--; +if (x !== -1 - 1) { + throw new Test262Error('#3: var x = new String("-1"); x--; x === -1 - 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T4.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T4.js new file mode 100644 index 0000000000..a63fd66f1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns x = ToNumber(x) - 1 +es5id: 11.3.2_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +x--; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x; x--; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +x--; +if (x !== -1) { + throw new Test262Error('#2: var x = null; x--; x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T5.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T5.js new file mode 100644 index 0000000000..8370b9f374 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A3_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns x = ToNumber(x) - 1 +es5id: 11.3.2_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +x--; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x = {}; x--; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +x--; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; x--; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T1.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T1.js new file mode 100644 index 0000000000..f0faa9f7c8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns ToNumber(x) +es5id: 11.3.2_A4_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = true; +var y = x--; +if (y !== 1) { + throw new Test262Error('#1: var x = true; var y = x--; y === 1. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Boolean(false); +var y = x--; +if (y !== 0) { + throw new Test262Error('#2: var x = new Boolean(false); var y = x--; y === 0. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T2.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T2.js new file mode 100644 index 0000000000..3e14354d4f --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns ToNumber(x) +es5id: 11.3.2_A4_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 1.1; +var y = x--; +if (y !== 1.1) { + throw new Test262Error('#1: var x = 1.1; var y = x--; y === 1.1. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Number(-0.1); +var y = x--; +if (y !== -0.1) { + throw new Test262Error('#2: var x = new Number(-0.1); var y = x--; y === -0.1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T3.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T3.js new file mode 100644 index 0000000000..5be273279f --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns ToNumber(x) +es5id: 11.3.2_A4_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +var x = "1"; +var y = x--; +if (y !== 1) { + throw new Test262Error('#1: var x = "1"; var y = x--; y === 1. Actual: ' + (y)); +} + +//CHECK#2 +var x = "x"; +var y = x--; +if (isNaN(y) !== true) { + throw new Test262Error('#2: var x = "x"; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#3 +var x = new String("-1"); +var y = x--; +if (y !== -1) { + throw new Test262Error('#3: var x = new String("-1"); var y = x--; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T4.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T4.js new file mode 100644 index 0000000000..930c86be46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns ToNumber(x) +es5id: 11.3.2_A4_T4 +description: If Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +var y = x--; +if (isNaN(y) !== true) { + throw new Test262Error('#1: var x; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = null; +var y = x--; +if (y !== 0) { + throw new Test262Error('#2: var x = null; var y = x--; y === 0. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T5.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T5.js new file mode 100644 index 0000000000..f2283094dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A4_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- returns ToNumber(x) +es5id: 11.3.2_A4_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +var y = x--; +if (isNaN(y) !== true) { + throw new Test262Error('#1: var x = {}; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = function(){return 1}; +var y = x--; +if (isNaN(y) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; var y = x--; y === Not-a-Number. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T1.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T1.js new file mode 100644 index 0000000000..d1ca6e0d70 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T1.js @@ -0,0 +1,38 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- calls PutValue(lhs, newValue) +es5id: S11.3.2_A5_T1 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x--; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T2.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T2.js new file mode 100644 index 0000000000..b800170f66 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T2.js @@ -0,0 +1,35 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- calls PutValue(lhs, newValue) +es5id: S11.3.2_A5_T2 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x--; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T3.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T3.js new file mode 100644 index 0000000000..044adac491 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A5_T3.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- calls PutValue(lhs, newValue) +es5id: S11.3.2_A5_T3 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x--; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T1.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T1.js new file mode 100644 index 0000000000..d90d69e910 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T1.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the null value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + + base[prop()]--; +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + base[prop]--; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T2.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T2.js new file mode 100644 index 0000000000..5e8a45d29a --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T2.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the undefined value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + + base[prop()]--; +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + base[prop]--; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T3.js b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T3.js new file mode 100644 index 0000000000..30ae7714ce --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/S11.3.2_A6_T3.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x-- evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple + times. +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return 1; + } +}; + +base[prop]--; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/arguments-nostrict.js b/js/src/tests/test262/language/expressions/postfix-decrement/arguments-nostrict.js new file mode 100644 index 0000000000..1e0b684230 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/arguments-nostrict.js @@ -0,0 +1,27 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: > + In non-strict code, "arguments--" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + 1. If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + 2. Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression : LeftHandSideExpression -- + + It is an early Reference Error if AssignmentTargetType of LeftHandSideExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [noStrict] +---*/ + +if (false) { + arguments--; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/arguments-strict.js b/js/src/tests/test262/language/expressions/postfix-decrement/arguments-strict.js new file mode 100644 index 0000000000..b80d81aa50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/arguments-strict.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. (arguments) +info: | + sec-identifiers-static-semantics-assignmenttargettype + + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: LeftHandSideExpression -- + + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments--; diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/bigint.js b/js/src/tests/test262/language/expressions/postfix-decrement/bigint.js new file mode 100644 index 0000000000..ab55111a00 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/bigint.js @@ -0,0 +1,64 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Postfix decrement for references to BigInt values +esid: sec-postfix-decrement-operator-runtime-semantics-evaluation +info: | + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ? ToNumeric(? GetValue(expr)). + 3. Let newValue be ? Type(oldvalue)::subtract(oldValue, Type(oldValue)::unit). + 4. Perform ? PutValue(expr, newValue). + 5. Return oldValue. +features: [BigInt] +---*/ + +var x = 1n; +assert.sameValue(x--, 1n, "var x = 1n; x-- === 1n"); +assert.sameValue(x, 0n, "var x = 1n; x--; x === 0n"); + +var x = 0n; +assert.sameValue(x--, 0n, "var x = 0n; x-- === 0n"); +assert.sameValue(x, -1n, "var x = 0n; x--; x === -1n"); + +var x = 123457n; +assert.sameValue(x--, 123457n, "var x = 123457n; x-- === 123457n"); +assert.sameValue(x, 123456n, "var x = 123457n; x--; x === 123456n"); + +var x = -123456n; +assert.sameValue(x--, -123456n, "var x = -123456n; x-- === -123456n"); +assert.sameValue(x, -123457n, "var x = -123456n; x--; x === -123457n"); + +var x = 0x1fffffffffffff01n; +assert.sameValue(x--, 0x1fffffffffffff01n, "var x = 0x1fffffffffffff01n; x-- === 0x1fffffffffffff01n"); +assert.sameValue(x, 0x1fffffffffffff00n, "var x = 0x1fffffffffffff01n; x--; x === 0x1fffffffffffff00n"); + +var x = -0x1fffffffffffff00n; +assert.sameValue(x--, -0x1fffffffffffff00n, "var x = -0x1fffffffffffff00n; x-- === -0x1fffffffffffff00n"); +assert.sameValue(x, -0x1fffffffffffff01n, "var x = -0x1fffffffffffff00n; x--; x === -0x1fffffffffffff01n"); + +var x = {y:1n}; +assert.sameValue(x.y--, 1n, "var x = {y:1n}; x.y-- === 1n"); +assert.sameValue(x.y, 0n, "var x = {y:1n}; x.y--; x.y === 0n"); + +var x = {y:{z:1n}}; +assert.sameValue(x.y.z--, 1n, "var x = {y:{z:1n}}; x.y.z-- === 1n"); +assert.sameValue(x.y.z, 0n, "var x = {y:{z:1n}}; x.y.z--; x.y.z === 0n"); + +var x = [1n]; +assert.sameValue(x[0]--, 1n, "var x = [1n]; x[0]-- === 1n"); +assert.sameValue(x[0], 0n, "var x = [1n]; x[0]--; x[0] === 0n"); + +var x = [null, [null, null, 1n]]; +assert.sameValue(x[1][2]--, 1n, "var x = [null, [null, null, 1n]]; x[1][2]-- === 1n"); +assert.sameValue(x[1][2], 0n, "var x = [null, [null, null, 1n]]; x[1][2]--; x[1][2] === 0n"); + +var x = {y:[1n]}; +assert.sameValue(x.y[0]--, 1n, "var x = {y:[1n]}; x.y[0]-- === 1n"); +assert.sameValue(x.y[0], 0n, "var x = {y:[1n]}; x.y[0]--; x.y[0] === 0n"); + +var x = [{z:1n}]; +assert.sameValue(x[0].z--, 1n, "var x = [{z:1n}]; x[0].z-- === 1n"); +assert.sameValue(x[0].z, 0n, "var x = [{z:1n}]; x[0].z--; x[0].z === 0n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/browser.js b/js/src/tests/test262/language/expressions/postfix-decrement/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/eval-nostrict.js b/js/src/tests/test262/language/expressions/postfix-decrement/eval-nostrict.js new file mode 100644 index 0000000000..686f5480cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/eval-nostrict.js @@ -0,0 +1,25 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + In non-strict code, "eval--" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression : LeftHandSideExpression -- + + It is an early Reference Error if AssignmentTargetType of LeftHandSideExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [noStrict] +---*/ + +eval--; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/eval-strict.js b/js/src/tests/test262/language/expressions/postfix-decrement/eval-strict.js new file mode 100644 index 0000000000..44d326c42c --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/eval-strict.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. (eval) +info: | + sec-identifiers-static-semantics-assignmenttargettype + + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: LeftHandSideExpression -- + + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval--; diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-carriage-return.js b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-carriage-return.js new file mode 100644 index 0000000000..056042b4bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-carriage-return.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator between LeftHandSideExpression and "--" is not allowed +es5id: 11.3.2_A1.1_T2 +esid: sec-postfix-decrement-operator +description: Checking Carriage Return +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x +--; +// The preceding line contains an unprintable CARRIAGE RETURN character (U+000D) diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-feed.js b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-feed.js new file mode 100644 index 0000000000..fe6be54493 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-feed.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator (LINE FEED) between LeftHandSideExpression and "--" is not allowed +es5id: 11.3.2_A1.1_T1 +esid: sec-postfix-decrement-operator +description: Checking Line Feed +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x +--; diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-separator.js b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-separator.js new file mode 100644 index 0000000000..a9ad546180 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-line-separator.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator between LeftHandSideExpression and "--" is not allowed +es5id: 11.3.2_A1.1_T3 +esid: sec-postfix-decrement-operator +description: Checking Line separator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x
--; +// The preceding line contains an unprintable LINE SEPARATOR character (U+2028) diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-paragraph-separator.js b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-paragraph-separator.js new file mode 100644 index 0000000000..cc79e3ea74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/line-terminator-paragraph-separator.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator between LeftHandSideExpression and "--" is not allowed +es5id: 11.3.2_A1.1_T4 +esid: sec-postfix-decrement-operator +description: Checking Paragraph separator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x
--; +// The preceding line contains an unprintable PARAGRAPH SEPARATOR character +// (U+2029) diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js b/js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 0000000000..3ce90c8337 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x-- calls PutValue(lhs, newValue) (formerly S11.3.2_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x--; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js b/js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 0000000000..77f3fcf223 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/operator-x-postfix-decrement-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x-- calls PutValue(lhs, newValue) (formerly S11.3.2_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x--; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/shell.js b/js/src/tests/test262/language/expressions/postfix-decrement/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-id.js b/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-id.js new file mode 100644 index 0000000000..81921cd93e --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-id.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-postfix-expressions-static-semantics-early-errors +es6id: 12.4.1 +es5id: 11.1.6_A3_T5 +description: Applied to a "covered" IdentifierReference +info: | + PostfixExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Reference Error if IsValidSimpleAssignmentTarget of + LeftHandSideExpression is false. + + Static Semantics: IsValidSimpleAssignmentTarget + + IdentifierReference : Identifier + + 1. If this IdentifierReference is contained in strict mode code and + StringValue of Identifier is "eval" or "arguments", return false. + 2. Return true. +---*/ + +var y = 2; + +(y)--; +assert.sameValue(y, 1); + +((y))--; +assert.sameValue(y, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-newtarget.js b/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-newtarget.js new file mode 100644 index 0000000000..e888c9b0db --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" new.target +info: | + UpdateExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + (new.target)--; +} diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-yieldexpr.js b/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-yieldexpr.js new file mode 100644 index 0000000000..3f75207241 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/target-cover-yieldexpr.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" YieldExpression +info: | + UpdateExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.15.3 Static Semantics: AssignmentTargetType + + AssignmentExpression: + YieldExpression + ArrowFunction + AsyncArrowFunction + LeftHandSideExpression = AssignmentExpression + LeftHandSideExpression AssignmentOperator AssignmentExpression + + 1. Return invalid. +features: [generators] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function* g() { + (yield)--; +} diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/target-newtarget.js b/js/src/tests/test262/language/expressions/postfix-decrement/target-newtarget.js new file mode 100644 index 0000000000..7912237669 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/target-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to new.target +info: | + UpdateExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + new.target--; +} diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/this.js b/js/src/tests/test262/language/expressions/postfix-decrement/this.js new file mode 100644 index 0000000000..e7bf80bce4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/this.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2023 Veera Sivarajan. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: > + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (this) +info: | + sec-static-semantics-assignmenttargettype + + PrimaryExpression: this + + Return invalid. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: LeftHandSideExpression -- + + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +this--; diff --git a/js/src/tests/test262/language/expressions/postfix-decrement/whitespace.js b/js/src/tests/test262/language/expressions/postfix-decrement/whitespace.js new file mode 100644 index 0000000000..58f50e5a6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-decrement/whitespace.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: White Space between LeftHandSideExpression and "--" are allowed +es5id: 11.3.2_A1.2_T1 +esid: sec-postfix-decrement-operator +---*/ + +var x = 0; + +assert.sameValue(x --, 0, 'U+0009 (expression)'); +assert.sameValue(x, -1, 'U+0009 (side effect)'); + +assert.sameValue(x --, -1, 'U+000B (expression)'); +assert.sameValue(x, -2, 'U+000B (side effect)'); + +assert.sameValue(x --, -2, 'U+000C (expression)'); +assert.sameValue(x, -3, 'U+000C (side effect)'); + +assert.sameValue(x --, -3, 'U+0020 (expression)'); +assert.sameValue(x, -4, 'U+0020 (side effect)'); + +assert.sameValue(x --, -4, 'U+00A0 (expression)'); +assert.sameValue(x, -5, 'U+00A0 (side effect)'); + +assert.sameValue(x  --, -5, 'U+0009U+000BU+000CU+0020U+00A0 (expression)'); +assert.sameValue(x, -6, 'U+0009U+000BU+000CU+0020U+00A0 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-1gs-strict.js b/js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-1gs-strict.js new file mode 100644 index 0000000000..775c2f6945 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-1gs-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.3.1-2-1gs +description: > + Strict Mode - SyntaxError is throw if the identifier arguments + appear as a PostfixExpression(arguments++) +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +arguments++; diff --git a/js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-3.js b/js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-3.js new file mode 100644 index 0000000000..3b50e26e51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/11.3.1-2-3.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.3.1-2-3-s +description: > + SyntaxError is not thrown if the identifier 'arguments[...]' appears as a + PostfixExpression(arguments++) +---*/ + +function testcase() { + arguments[1] = 7; + arguments[1]++; + assert.sameValue(arguments[1], 8, 'arguments[1]'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T1.js new file mode 100644 index 0000000000..73cd704ba0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T1.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ uses GetValue and PutValue +es5id: 11.3.1_A2.1_T1 +description: Type(x) is Reference and GetBase(x) is not null +---*/ + +//CHECK#1 +var x = 1; +var y = x++; +if (y !== 1) { + throw new Test262Error('#1: var x = 1; var y = x++; y === 1. Actual: ' + (y)); +} else { + if (x !== 1 + 1) { + throw new Test262Error('#1: var x = 1; var y = x++; x === 1 + 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +var y = this.x++; +if (y !== 1) { + throw new Test262Error('#2: this.x = 1; var y = this.x++; y === 1. Actual: ' + (y)); +} else { + if (this.x !== 1 + 1) { + throw new Test262Error('#2: this.x = 1; var y = this.x++; this.x === 1 + 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +var y = object.prop++; +if (y !== 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; var y = object.prop++; y === 1. Actual: ' + (y)); +} else { + if (this.x !== 1 + 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; var y = object.prop++; object.prop === 1 + 1. Actual: ' + (object.prop)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T2.js new file mode 100644 index 0000000000..42e508fb5e --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ uses GetValue and PutValue +es5id: 11.3.1_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x++; + throw new Test262Error('#1.1: x++ throw ReferenceError. Actual: ' + (x++)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x++ throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.2_T1.js new file mode 100644 index 0000000000..5b4b38c802 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A2.2_T1.js @@ -0,0 +1,110 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ uses [[Default Value]] +es5id: 11.3.1_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +var y = object++; +if (y !== 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +var y = object++; +if (y !== 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +var y = object++; +if (y !== 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + var y = object++; + if (y !== 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object++; y === 1. Actual: ' + (y)); + } else { + if (object !== 1 + 1) { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object++; object === 1 + 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object++; y not throw "error"'); + } else { + throw new Test262Error('#4.4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; var y = object++; y not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +var y = object++; +if (y !== 1) { + throw new Test262Error('#5.1: var object = {toString: function() {return 1}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#5.2: var object = {toString: function() {return 1}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +var y = object++; +if (y !== 1) { + throw new Test262Error('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; var y = object++; y === 1. Actual: ' + (y)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; object++; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + var y = object++; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object++ throw "error". Actual: ' + (y)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object++ throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + var y = object++; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object++ throw TypeError. Actual: ' + (y)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object++ throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T1.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T1.js new file mode 100644 index 0000000000..53ba4ca4ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns x = ToNumber(x) + 1 +es5id: 11.3.1_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = false; +x++; +if (x !== 0 + 1) { + throw new Test262Error('#1: var x = false; x++; x === 0 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(true); +x++; +if (x !== 1 + 1) { + throw new Test262Error('#2: var x = new Boolean(true); x++; x === 1 + 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T2.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T2.js new file mode 100644 index 0000000000..3cff471e1a --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns x = ToNumber(x) + 1 +es5id: 11.3.1_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 0.1; +x++; +if (x !== 0.1 + 1) { + throw new Test262Error('#1: var x = 0.1; x++; x === 0.1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +x++; +if (x !== -1.1 + 1) { + throw new Test262Error('#2: var x = new Number(-1.1); x++; x === -1.1 + 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T3.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T3.js new file mode 100644 index 0000000000..74b835e9fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns x = ToNumber(x) + 1 +es5id: 11.3.1_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +var x = "1"; +x++; +if (x !== 1 + 1) { + throw new Test262Error('#1: var x = "1"; x++; x === 1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +x++; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = "x"; x++; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +x++; +if (x !== -1 + 1) { + throw new Test262Error('#3: var x = new String("-1"); x++; x === -1 + 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T4.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T4.js new file mode 100644 index 0000000000..88015215b6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns x = ToNumber(x) + 1 +es5id: 11.3.1_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +x++; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x; x++; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +x++; +if (x !== 1) { + throw new Test262Error('#2: var x = null; x++; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T5.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T5.js new file mode 100644 index 0000000000..70b6c35157 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A3_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns x = ToNumber(x) + 1 +es5id: 11.3.1_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +x++; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x = {}; x++; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +x++; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; x++; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T1.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T1.js new file mode 100644 index 0000000000..055a91a9e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns ToNumber(x) +es5id: 11.3.1_A4_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = false; +var y = x++; +if (y !== 0) { + throw new Test262Error('#1: var x = false; var y = x++; y === 0. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Boolean(true); +var y = x++; +if (y !== 1) { + throw new Test262Error('#2: var x = new Boolean(true); var y = x++; y === 1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T2.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T2.js new file mode 100644 index 0000000000..c078b3d2ac --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns ToNumber(x) +es5id: 11.3.1_A4_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = -0.1; +var y = x++; +if (y !== -0.1) { + throw new Test262Error('#1: var x = -0.1; var y = x++; y === -0.1. Actual: ' + (y)); +} + +//CHECK#2 +var x = new Number(1.1); +var y = x++; +if (y !== 1.1) { + throw new Test262Error('#2: var x = new Number(1.1); var y = x++; y === 1.1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T3.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T3.js new file mode 100644 index 0000000000..10738f07f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns ToNumber(x) +es5id: 11.3.1_A4_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +var x = "1"; +var y = x++; +if (y !== 1) { + throw new Test262Error('#1: var x = "1"; var y = x++; y === 1. Actual: ' + (y)); +} + +//CHECK#2 +var x = "x"; +var y = x++; +if (isNaN(y) !== true) { + throw new Test262Error('#2: var x = "x"; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#3 +var x = new String("-1"); +var y = x++; +if (y !== -1) { + throw new Test262Error('#3: var x = new String("-1"); var y = x++; y === -1. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T4.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T4.js new file mode 100644 index 0000000000..251c7844f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns ToNumber(x) +es5id: 11.3.1_A4_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +var y = x++; +if (isNaN(y) !== true) { + throw new Test262Error('#1: var x; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = null; +var y = x++; +if (y !== 0) { + throw new Test262Error('#2: var x = null; var y = x++; y === 0. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T5.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T5.js new file mode 100644 index 0000000000..b85d9ef7ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A4_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ returns ToNumber(x) +es5id: 11.3.1_A4_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +var y = x++; +if (isNaN(y) !== true) { + throw new Test262Error('#1: var x = {}; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + +//CHECK#2 +var x = function(){return 1}; +var y = x++; +if (isNaN(y) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; var y = x++; y === Not-a-Number. Actual: ' + (y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T1.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T1.js new file mode 100644 index 0000000000..25e9610a15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T1.js @@ -0,0 +1,38 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ calls PutValue(lhs, newValue) +es5id: S11.3.1_A5_T1 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + x++; + } + + if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T2.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T2.js new file mode 100644 index 0000000000..9ec9c15596 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T2.js @@ -0,0 +1,35 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ calls PutValue(lhs, newValue) +es5id: S11.3.1_A5_T2 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + x++; +} + +if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T3.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T3.js new file mode 100644 index 0000000000..be8c8bff58 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A5_T3.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ calls PutValue(lhs, newValue) +es5id: S11.3.1_A5_T3 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + x++; + } +} + +if (innerScope.x !== 3) { + throw new Test262Error('#1: innerScope.x === 3. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T1.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T1.js new file mode 100644 index 0000000000..a0c5784b6a --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T1.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the null value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + + base[prop()]++; +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + base[prop]++; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T2.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T2.js new file mode 100644 index 0000000000..889bb0c9a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T2.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the undefined value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + + base[prop()]++; +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + base[prop]++; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T3.js b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T3.js new file mode 100644 index 0000000000..ce2fc1c204 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/S11.3.1_A6_T3.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x++ evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple + times. +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return 1; + } +}; + +base[prop]++; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/arguments-nostrict.js b/js/src/tests/test262/language/expressions/postfix-increment/arguments-nostrict.js new file mode 100644 index 0000000000..e88aa31940 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/arguments-nostrict.js @@ -0,0 +1,27 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: > + In non-strict code, "arguments++" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + 1. If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + 2. Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression : LeftHandSideExpression ++ + + It is an early Reference Error if AssignmentTargetType of LeftHandSideExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [noStrict] +---*/ + +if (false) { + arguments++; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/arguments-strict.js b/js/src/tests/test262/language/expressions/postfix-increment/arguments-strict.js new file mode 100644 index 0000000000..c76d277132 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/arguments-strict.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-identifiers-static-semantics-assignmenttargettype +description: > + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. +info: | + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: LeftHandSideExpression ++ + + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +arguments++; diff --git a/js/src/tests/test262/language/expressions/postfix-increment/bigint.js b/js/src/tests/test262/language/expressions/postfix-increment/bigint.js new file mode 100644 index 0000000000..29308b342a --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/bigint.js @@ -0,0 +1,64 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Postfix increment for references to BigInt values +esid: sec-postfix-increment-operator-runtime-semantics-evaluation +info: | + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ? ToNumeric(? GetValue(expr)). + 3. Let newValue be ? Type(oldvalue)::add(oldValue, Type(oldValue)::unit). + 4. Perform ? PutValue(expr, newValue). + 5. Return oldValue. +features: [BigInt] +---*/ + +var x = 0n; +assert.sameValue(x++, 0n, "var x = 0n; x++ === 0n"); +assert.sameValue(x, 1n, "var x = 0n; x++; x === 1n"); + +var x = -1n; +assert.sameValue(x++, -1n, "var x = -1n; x++ === -1n"); +assert.sameValue(x, 0n, "var x = -1n; x++; x === 0n"); + +var x = 123456n; +assert.sameValue(x++, 123456n, "var x = 123456n; x++ === 123456n"); +assert.sameValue(x, 123457n, "var x = 123456n; x++; x === 123457n"); + +var x = -123457n; +assert.sameValue(x++, -123457n, "var x = -123457n; x++ === -123457n"); +assert.sameValue(x, -123456n, "var x = -123457n; x++; x === -123456n"); + +var x = 0x1fffffffffffff00n; +assert.sameValue(x++, 0x1fffffffffffff00n, "var x = 0x1fffffffffffff00n; x++ === 0x1fffffffffffff00n"); +assert.sameValue(x, 0x1fffffffffffff01n, "var x = 0x1fffffffffffff00n; x++; x === 0x1fffffffffffff01n"); + +var x = -0x1fffffffffffff01n; +assert.sameValue(x++, -0x1fffffffffffff01n, "var x = -0x1fffffffffffff01n; x++ === -0x1fffffffffffff01n"); +assert.sameValue(x, -0x1fffffffffffff00n, "var x = -0x1fffffffffffff01n; x++; x === -0x1fffffffffffff00n"); + +var x = {y:0n}; +assert.sameValue(x.y++, 0n, "var x = {y:0n}; x.y++ === 0n"); +assert.sameValue(x.y, 1n, "var x = {y:0n}; x.y++; x.y === 1n"); + +var x = {y:{z:0n}}; +assert.sameValue(x.y.z++, 0n, "var x = {y:{z:0n}}; x.y.z++ === 0n"); +assert.sameValue(x.y.z, 1n, "var x = {y:{z:0n}}; x.y.z++; x.y.z === 1n"); + +var x = [0n]; +assert.sameValue(x[0]++, 0n, "var x = [0n]; x[0]++ === 0n"); +assert.sameValue(x[0], 1n, "var x = [0n]; x[0]++; x[0] === 1n"); + +var x = [null, [null, null, 0n]]; +assert.sameValue(x[1][2]++, 0n, "var x = [null, [null, null, 0n]]; x[1][2]++ === 0n"); +assert.sameValue(x[1][2], 1n, "var x = [null, [null, null, 0n]]; x[1][2]++; x[1][2] === 1n"); + +var x = {y:[0n]}; +assert.sameValue(x.y[0]++, 0n, "var x = {y:[0n]}; x.y[0]++ === 0n"); +assert.sameValue(x.y[0], 1n, "var x = {y:[0n]}; x.y[0]++; x.y[0] === 1n"); + +var x = [{z:0n}]; +assert.sameValue(x[0].z++, 0n, "var x = [{z:0n}]; x[0].z++ === 0n"); +assert.sameValue(x[0].z, 1n, "var x = [{z:0n}]; x[0].z++; x[0].z === 1n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/browser.js b/js/src/tests/test262/language/expressions/postfix-increment/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/postfix-increment/eval-nostrict.js b/js/src/tests/test262/language/expressions/postfix-increment/eval-nostrict.js new file mode 100644 index 0000000000..a85b061e48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/eval-nostrict.js @@ -0,0 +1,25 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + In non-strict code, "eval++" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + 1. If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + 2. Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression : LeftHandSideExpression ++ + + It is an early Reference Error if AssignmentTargetType of LeftHandSideExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [noStrict] +---*/ + +eval++; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/eval-strict.js b/js/src/tests/test262/language/expressions/postfix-increment/eval-strict.js new file mode 100644 index 0000000000..401e3cd59d --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/eval-strict.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-identifiers-static-semantics-assignmenttargettype +description: > + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. +info: | + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: LeftHandSideExpression ++ + + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is strict. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +eval++; diff --git a/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-carriage-return.js b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-carriage-return.js new file mode 100644 index 0000000000..2ff9e7a5ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-carriage-return.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator between LeftHandSideExpression and "++" is not allowed +es5id: 11.3.1_A1.1_T2 +esid: postfix-increment-operator +description: Carriage Return +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x +++; +// The preceding line contains an unprintable CARRIAGE RETURN character (U+000D) diff --git a/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-feed.js b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-feed.js new file mode 100644 index 0000000000..f41423cb5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-feed.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator between LeftHandSideExpression and "++" is not allowed +es5id: 11.3.1_A1.1_T1 +esid: postfix-increment-operator +description: Checking Line Feed +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x +++; diff --git a/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-separator.js b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-separator.js new file mode 100644 index 0000000000..e9e53b0c2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-line-separator.js @@ -0,0 +1,18 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator between LeftHandSideExpression and "++" is not allowed +es5id: 11.3.1_A1.1_T3 +esid: postfix-increment-operator +description: Checking Line Separator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x
++; +// The preceding line contains an unprintable LINE SEPARATOR character (U+2028) diff --git a/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-paragraph-separator.js b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-paragraph-separator.js new file mode 100644 index 0000000000..441f1328b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/line-terminator-paragraph-separator.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Line Terminator between LeftHandSideExpression and "++" is not allowed +es5id: 11.3.1_A1.1_T4 +esid: postfix-increment-operator +description: Checking Paragraph separator +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +x
++; +// The preceding line contains an unprintable PARAGRAPH SEPARATOR character +// (U+2029) diff --git a/js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js b/js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 0000000000..c38e053da1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x++ calls PutValue(lhs, newValue) (formerly S11.3.1_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x++; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js b/js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 0000000000..28684d5998 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/operator-x-postfix-increment-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator x++ calls PutValue(lhs, newValue) (formerly S11.3.1_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + x++; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/shell.js b/js/src/tests/test262/language/expressions/postfix-increment/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/postfix-increment/target-cover-id.js b/js/src/tests/test262/language/expressions/postfix-increment/target-cover-id.js new file mode 100644 index 0000000000..ad269175bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/target-cover-id.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-postfix-expressions-static-semantics-early-errors +es6id: 12.4.1 +es5id: 11.1.6_A3_T5 +description: Applied to a "covered" IdentifierReference +info: | + PostfixExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Reference Error if IsValidSimpleAssignmentTarget of + LeftHandSideExpression is false. + + Static Semantics: IsValidSimpleAssignmentTarget + + IdentifierReference : Identifier + + 1. If this IdentifierReference is contained in strict mode code and + StringValue of Identifier is "eval" or "arguments", return false. + 2. Return true. +---*/ + +var y = 1; + +(y)++; +assert.sameValue(y, 2); + +((y))++; +assert.sameValue(y, 3); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/postfix-increment/target-cover-newtarget.js b/js/src/tests/test262/language/expressions/postfix-increment/target-cover-newtarget.js new file mode 100644 index 0000000000..daca101d24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/target-cover-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" new.target +info: | + UpdateExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + (new.target)++; +} diff --git a/js/src/tests/test262/language/expressions/postfix-increment/target-cover-yieldexpr.js b/js/src/tests/test262/language/expressions/postfix-increment/target-cover-yieldexpr.js new file mode 100644 index 0000000000..c2514d23e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/target-cover-yieldexpr.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" YieldExpression +info: | + UpdateExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.15.3 Static Semantics: AssignmentTargetType + + AssignmentExpression: + YieldExpression + ArrowFunction + AsyncArrowFunction + LeftHandSideExpression = AssignmentExpression + LeftHandSideExpression AssignmentOperator AssignmentExpression + + 1. Return invalid. +features: [generators] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function* g() { + (yield)++; +} diff --git a/js/src/tests/test262/language/expressions/postfix-increment/target-newtarget.js b/js/src/tests/test262/language/expressions/postfix-increment/target-newtarget.js new file mode 100644 index 0000000000..40b67143d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/target-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to new.target +info: | + UpdateExpression : + LeftHandSideExpression ++ + LeftHandSideExpression -- + + - It is an early Syntax Error if AssignmentTargetType of + LeftHandSideExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + new.target++; +} diff --git a/js/src/tests/test262/language/expressions/postfix-increment/this.js b/js/src/tests/test262/language/expressions/postfix-increment/this.js new file mode 100644 index 0000000000..1568cf44e6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/this.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2023 Veera Sivarajan. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: > + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. (this) +info: | + sec-static-semantics-assignmenttargettype + + PrimaryExpression: this + + Return invalid. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: LeftHandSideExpression ++ + + It is an early Syntax Error if AssignmentTargetType of LeftHandSideExpression is not simple. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +this++; diff --git a/js/src/tests/test262/language/expressions/postfix-increment/whitespace.js b/js/src/tests/test262/language/expressions/postfix-increment/whitespace.js new file mode 100644 index 0000000000..1987986e73 --- /dev/null +++ b/js/src/tests/test262/language/expressions/postfix-increment/whitespace.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: White Space between LeftHandSideExpression and "++" are allowed +es5id: 11.3.1_A1.2_T1 +esid: postfix-increment-operator +---*/ + +var x = 0; + +assert.sameValue(x ++, 0, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +assert.sameValue(x ++, 1, 'U+000B (expression)'); +assert.sameValue(x, 2, 'U+000B (side effect)'); + +assert.sameValue(x ++, 2, 'U+000C (expression)'); +assert.sameValue(x, 3, 'U+000C (side effect)'); + +assert.sameValue(x ++, 3, 'U+0020 (expression)'); +assert.sameValue(x, 4, 'U+0020 (side effect)'); + +assert.sameValue(x ++, 4, 'U+00A0 (expression)'); +assert.sameValue(x, 5, 'U+00A0 (side effect)'); + +assert.sameValue(x  ++, 5, 'U+0009U+000BU+000CU+0020U+00A0 (expression)'); +assert.sameValue(x, 6, 'U+0009U+000BU+000CU+0020U+00A0 (side effect)'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-2gs-strict.js b/js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-2gs-strict.js new file mode 100644 index 0000000000..42a20db97e --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-2gs-strict.js @@ -0,0 +1,19 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.4.5-2-2gs +description: > + Strict Mode - SyntaxError is throw if the UnaryExpression operated + upon by a Prefix Decrement operator(--arguments) +negative: + phase: parse + type: SyntaxError +flags: [onlyStrict] +---*/ + +$DONOTEVALUATE(); + +--arguments; diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-3-s.js b/js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-3-s.js new file mode 100644 index 0000000000..56033f721a --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/11.4.5-2-3-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.4.5-2-3-s +description: SyntaxError is not thrown for --arguments[...] +---*/ + +function testcase() { + arguments[1] = 7; + --arguments[1]; + assert.sameValue(arguments[1], 6, 'arguments[1]'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T1.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T1.js new file mode 100644 index 0000000000..5cd97ac2e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T1.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x uses GetValue and PutValue +es5id: 11.4.5_A2.1_T1 +description: Type(x) is Reference and GetBase(x) is not null +---*/ + +//CHECK#1 +var x = 1; +if (--x !== 1 - 1) { + throw new Test262Error('#1: var x = 1; --x === 1 - 1. Actual: ' + (--x)); +} else { + if (x !== 1 - 1) { + throw new Test262Error('#1: var x = 1; --x; x === 1 - 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (--this.x !== 1 - 1) { + throw new Test262Error('#2: this.x = 1; --this.x === 1 - 1. Actual: ' + (--this.x)); +} else { + if (this.x !== 1 - 1) { + throw new Test262Error('#2: this.x = 1; --this.x; this.x === 1 - 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (--object.prop !== 1 - 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; --object.prop === 1 - 1. Actual: ' + (--object.prop)); +} else { + if (this.x !== 1 - 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; --object.prop; object.prop === 1 - 1. Actual: ' + (object.prop)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T2.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T2.js new file mode 100644 index 0000000000..e57096133c --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x uses GetValue and PutValue +es5id: 11.4.5_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + --x; + throw new Test262Error('#1.1: --x throw ReferenceError. Actual: ' + (--x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: --x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.2_T1.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.2_T1.js new file mode 100644 index 0000000000..0f9d23139b --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A2.2_T1.js @@ -0,0 +1,104 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x uses [[Default Value]] +es5id: 11.4.5_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (--object !== 1 - 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (--object !== 1 - 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (--object !== 1 - 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (--object !== 1 - 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object === 1 - 1. Actual: ' + (--object)); + } else { + if (object !== 1 - 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object; object === 1 - 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (--object !== 1 - 1) { + throw new Test262Error('#5.1: var object = {toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#5.2: var object = {toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (--object !== 1 - 1) { + throw new Test262Error('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); +} else { + if (object !== 1 - 1) { + throw new Test262Error('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + --object; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (--object)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + --object; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (--object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T1.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T1.js new file mode 100644 index 0000000000..6ff5479bd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns x = ToNumber(x) - 1 +es5id: 11.4.5_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = true; +--x; +if (x !== 1 - 1) { + throw new Test262Error('#1: var x = true; --x; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(false); +--x; +if (x !== 0 - 1) { + throw new Test262Error('#2: var x = new Boolean(false); --x; x === 0 - 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T2.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T2.js new file mode 100644 index 0000000000..a71845fef6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns x = ToNumber(x) - 1 +es5id: 11.4.5_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 0.1; +--x; +if (x !== 0.1 - 1) { + throw new Test262Error('#1: var x = 0.1; --x; x === 0.1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +--x; +if (x !== -1.1 - 1) { + throw new Test262Error('#2: var x = new Number(-1.1); --x; x === -1.1 - 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T3.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T3.js new file mode 100644 index 0000000000..d9d6a93b06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns x = ToNumber(x) - 1 +es5id: 11.4.5_A3_T3 +description: Type(x) is primitive string or String object +---*/ + +//CHECK#1 +var x = "1"; +--x; +if (x !== 1 - 1) { + throw new Test262Error('#1: var x = "1"; --x; x === 1 - 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +--x; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = "x"; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +--x; +if (x !== -1 - 1) { + throw new Test262Error('#3: var x = new String("-1"); --x; x === -1 - 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T4.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T4.js new file mode 100644 index 0000000000..f2b894736b --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns x = ToNumber(x) - 1 +es5id: 11.4.5_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +--x; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +--x; +if (x !== -1) { + throw new Test262Error('#2: var x = null; --x; x === -1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T5.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T5.js new file mode 100644 index 0000000000..0b7614444c --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A3_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns x = ToNumber(x) - 1 +es5id: 11.4.5_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +--x; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x = {}; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +--x; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; --x; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T1.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T1.js new file mode 100644 index 0000000000..7cb3216ad8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns ToNumber(x) - 1 +es5id: 11.4.5_A4_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = true; +if (--x !== 1 - 1) { + throw new Test262Error('#1: var x = true; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Boolean(false); +if (--x !== 0 - 1) { + throw new Test262Error('#2: var x = new Boolean(false); --x === 0 - 1. Actual: ' + (--x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T2.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T2.js new file mode 100644 index 0000000000..6f79668e10 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns ToNumber(x) - 1 +es5id: 11.4.5_A4_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 0.1; +if (--x !== 0.1 - 1) { + throw new Test262Error('#1: var x = 0.1; --x === 0.1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (--x !== -1.1 - 1) { + throw new Test262Error('#2: var x = new Number(-1.1); --x === -1.1- 1. Actual: ' + (--x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T3.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T3.js new file mode 100644 index 0000000000..a7add2c03b --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns ToNumber(x) - 1 +es5id: 11.4.5_A4_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +var x = "1"; +if (--x !== 1 - 1) { + throw new Test262Error('#1: var x = "1"; --x === 1 - 1. Actual: ' + (--x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(--x) !== true) { + throw new Test262Error('#2: var x = "x"; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#3 +var x = new String("-1"); +if (--x !== -1 - 1) { + throw new Test262Error('#3: var x = new String("-1"); --x === -1 - 1. Actual: ' + (--x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T4.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T4.js new file mode 100644 index 0000000000..cda8745456 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T4.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns ToNumber(x) - 1 +es5id: 11.4.5_A4_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +if (isNaN(--x) !== true) { + throw new Test262Error('#1: var x; --x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +if (--x !== -1) { + throw new Test262Error('#2: var x = null; --x === -1. Actual: ' + (--x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T5.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T5.js new file mode 100644 index 0000000000..6d631d188e --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A4_T5.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x returns ToNumber(x) - 1 +es5id: 11.4.5_A4_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +if (isNaN(--x) !== true) { + throw new Test262Error('#1: var x = {}; --x === Not-a-Number. Actual: ' + (--x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(--x) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; --x === Not-a-Number. Actual: ' + (--x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T1.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T1.js new file mode 100644 index 0000000000..3ffed09bb1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T1.js @@ -0,0 +1,38 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x calls PutValue(lhs, newValue) +es5id: S11.4.5_A5_T1 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + --x; + } + + if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T2.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T2.js new file mode 100644 index 0000000000..d8a9f39fee --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T2.js @@ -0,0 +1,35 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x calls PutValue(lhs, newValue) +es5id: S11.4.5_A5_T2 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + --x; +} + +if (scope.x !== 1) { + throw new Test262Error('#1: scope.x === 1. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T3.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T3.js new file mode 100644 index 0000000000..6c02d3a490 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A5_T3.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x calls PutValue(lhs, newValue) +es5id: S11.4.5_A5_T3 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + --x; + } +} + +if (innerScope.x !== 1) { + throw new Test262Error('#1: innerScope.x === 1. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T1.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T1.js new file mode 100644 index 0000000000..149a49a0a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T1.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the null value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + + --base[prop()]; +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + --base[prop]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T2.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T2.js new file mode 100644 index 0000000000..09495dee06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T2.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the undefined value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + + --base[prop()]; +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + --base[prop]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T3.js b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T3.js new file mode 100644 index 0000000000..b274872680 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_A6_T3.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator --x evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple + times. +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return 1; + } +}; + +--base[prop]; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/arguments-nostrict.js b/js/src/tests/test262/language/expressions/prefix-decrement/arguments-nostrict.js new file mode 100644 index 0000000000..b82439c517 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/arguments-nostrict.js @@ -0,0 +1,27 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + In non-strict code, "--arguments" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + 1. If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + 2. Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression -- UnaryExpression + + It is an early Reference Error if AssignmentTargetType of UnaryExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. +flags: [noStrict] +---*/ + +if (false) { + --arguments; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/arguments-strict.js b/js/src/tests/test262/language/expressions/prefix-decrement/arguments-strict.js new file mode 100644 index 0000000000..363377c705 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/arguments-strict.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. (arguments) +info: | + sec-identifiers-static-semantics-assignmenttargettype + + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: -- UnaryExpression + + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +--arguments; diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/bigint.js b/js/src/tests/test262/language/expressions/prefix-decrement/bigint.js new file mode 100644 index 0000000000..39897ecb13 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/bigint.js @@ -0,0 +1,64 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Prefix decrement for references to BigInt values +esid: sec-prefix-decrement-operator-runtime-semantics-evaluation +info: | + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ? ToNumeric(? GetValue(expr)). + 3. Let newValue be ? Type(oldvalue)::subtract(oldValue, Type(oldValue)::unit). + 4. Perform ? PutValue(expr, newValue). + 5. Return newValue. +features: [BigInt] +---*/ + +var x = 1n; +assert.sameValue(--x, 0n, "var x = 1n; --x === 0n"); +assert.sameValue(x, 0n, "var x = 1n; --x; x === 0n"); + +var x = 0n; +assert.sameValue(--x, -1n, "var x = 0n; --x === -1n"); +assert.sameValue(x, -1n, "var x = 0n; --x; x === -1n"); + +var x = 123457n; +assert.sameValue(--x, 123456n, "var x = 123457n; --x === 123456n"); +assert.sameValue(x, 123456n, "var x = 123457n; --x; x === 123456n"); + +var x = -123456n; +assert.sameValue(--x, -123457n, "var x = -123456n; --x === -123457n"); +assert.sameValue(x, -123457n, "var x = -123456n; --x; x === -123457n"); + +var x = 0x1fffffffffffff01n; +assert.sameValue(--x, 0x1fffffffffffff00n, "var x = 0x1fffffffffffff01n; --x === 0x1fffffffffffff00n"); +assert.sameValue(x, 0x1fffffffffffff00n, "var x = 0x1fffffffffffff01n; --x; x === 0x1fffffffffffff00n"); + +var x = -0x1fffffffffffff00n; +assert.sameValue(--x, -0x1fffffffffffff01n, "var x = -0x1fffffffffffff00n; --x === -0x1fffffffffffff01n"); +assert.sameValue(x, -0x1fffffffffffff01n, "var x = -0x1fffffffffffff00n; --x; x === -0x1fffffffffffff01n"); + +var x = {y:1n}; +assert.sameValue(--x.y, 0n, "var x = {y:1n}; --x.y === 0n"); +assert.sameValue(x.y, 0n, "var x = {y:1n}; --x.y; x.y === 0n"); + +var x = {y:{z:1n}}; +assert.sameValue(--x.y.z, 0n, "var x = {y:{z:1n}}; --x.y.z === 0n"); +assert.sameValue(x.y.z, 0n, "var x = {y:{z:1n}}; --x.y.z; x.y.z === 0n"); + +var x = [1n]; +assert.sameValue(--x[0], 0n, "var x = [1n]; --x[0] === 0n"); +assert.sameValue(x[0], 0n, "var x = [1n]; --x[0]; x[0] === 0n"); + +var x = [null, [null, null, 1n]]; +assert.sameValue(--x[1][2], 0n, "var x = [null, [null, null, 1n]]; --x[1][2] === 0n"); +assert.sameValue(x[1][2], 0n, "var x = [null, [null, null, 1n]]; --x[1][2]; x[1][2] === 0n"); + +var x = {y:[1n]}; +assert.sameValue(--x.y[0], 0n, "var x = {y:[1n]}; --x.y[0] === 0n"); +assert.sameValue(x.y[0], 0n, "var x = {y:[1n]}; --x.y[0]; x.y[0] === 0n"); + +var x = [{z:1n}]; +assert.sameValue(--x[0].z, 0n, "var x = [{z:1n}]; --x[0].z === 0n"); +assert.sameValue(x[0].z, 0n, "var x = [{z:1n}]; --x[0].z; x[0].z === 0n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/browser.js b/js/src/tests/test262/language/expressions/prefix-decrement/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/eval-nostrict.js b/js/src/tests/test262/language/expressions/prefix-decrement/eval-nostrict.js new file mode 100644 index 0000000000..3eff3119e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/eval-nostrict.js @@ -0,0 +1,25 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + In non-strict code, "--eval" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + 1. If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + 2. Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression -- UnaryExpression + + It is an early Reference Error if AssignmentTargetType of UnaryExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. +flags: [noStrict] +---*/ + +--eval; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/eval-strict.js b/js/src/tests/test262/language/expressions/prefix-decrement/eval-strict.js new file mode 100644 index 0000000000..203b5ac94a --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/eval-strict.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. (eval) +info: | + sec-identifiers-static-semantics-assignmenttargettype + + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: -- UnaryExpression + + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +--eval; diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js b/js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 0000000000..ee57f0c376 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator --x calls PutValue(lhs, newValue) (formerly S11.4.5_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + --x; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js b/js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 0000000000..4c76ae6ff6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/operator-prefix-decrement-x-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator --x calls PutValue(lhs, newValue) (formerly S11.4.5_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + --x; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/shell.js b/js/src/tests/test262/language/expressions/prefix-decrement/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-id.js b/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-id.js new file mode 100644 index 0000000000..56a929c2cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-id.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-unary-operators-static-semantics-early-errors +es6id: 12.5.1 +es5id: 11.1.6_A3_T5 +description: Applied to a "covered" IdentifierReference +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Reference Error if IsValidSimpleAssignmentTarget of + UnaryExpression is false. + + Static Semantics: IsValidSimpleAssignmentTarget + + IdentifierReference : Identifier + + 1. If this IdentifierReference is contained in strict mode code and + StringValue of Identifier is "eval" or "arguments", return false. + 2. Return true. +---*/ + +var y = 1; + +--(y); + +assert.sameValue(y, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-newtarget.js b/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-newtarget.js new file mode 100644 index 0000000000..f976891363 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" new.target +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Syntax Error if IsValidSimpleAssignmentTarget of + UnaryExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + --(new.target); +} diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-yieldexpr.js b/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-yieldexpr.js new file mode 100644 index 0000000000..92cac869d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/target-cover-yieldexpr.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" YieldExpression +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Syntax Error if IsValidSimpleAssignmentTarget of + UnaryExpression is invalid or strict. + + 12.15.3 Static Semantics: AssignmentTargetType + + AssignmentExpression: + YieldExpression + ArrowFunction + AsyncArrowFunction + LeftHandSideExpression = AssignmentExpression + LeftHandSideExpression AssignmentOperator AssignmentExpression + + 1. Return invalid. +features: [generators] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function* g() { + --(yield); +} diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/target-newtarget.js b/js/src/tests/test262/language/expressions/prefix-decrement/target-newtarget.js new file mode 100644 index 0000000000..dd97e59f8d --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/target-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to new.target +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Syntax Error if IsValidSimpleAssignmentTarget of + UnaryExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + --new.target; +} diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/this.js b/js/src/tests/test262/language/expressions/prefix-decrement/this.js new file mode 100644 index 0000000000..8a732d9028 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/this.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2023 Veera Sivarajan. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: > + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (this) +info: | + sec-static-semantics-assignmenttargettype + + PrimaryExpression: this + + Return invalid. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: -- UnaryExpression + + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +--this; diff --git a/js/src/tests/test262/language/expressions/prefix-decrement/whitespace.js b/js/src/tests/test262/language/expressions/prefix-decrement/whitespace.js new file mode 100644 index 0000000000..f7a38319c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-decrement/whitespace.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + White Space and Line Terminator between "--" and UnaryExpression are + allowed +es5id: 11.4.5_A1 +esid: sec-prefix-decrement-operator +---*/ + +var x = 0; + +assert.sameValue(-- x, -1, 'U+0009 (expression)'); +assert.sameValue(x, -1, 'U+0009 (side effect)'); + +assert.sameValue(-- x, -2, 'U+000B (expression)'); +assert.sameValue(x, -2, 'U+000B (side effect)'); + +assert.sameValue(-- x, -3, 'U+000C (expression)'); +assert.sameValue(x, -3, 'U+000C (side effect)'); + +assert.sameValue(-- x, -4, 'U+0020 (expression)'); +assert.sameValue(x, -4, 'U+0020 (side effect)'); + +assert.sameValue(-- x, -5, 'U+00A0 (expression)'); +assert.sameValue(x, -5, 'U+00A0 (side effect)'); + +assert.sameValue(-- +x, -6, 'U+000A (expression)'); +assert.sameValue(x, -6, 'U+000A (side effect)'); + +assert.sameValue(-- x, -7, 'U+000D (expression)'); +assert.sameValue(x, -7, 'U+000D (side effect)'); + +assert.sameValue(--
x, -8, 'U+2028 (expression)'); +assert.sameValue(x, -8, 'U+2028 (side effect)'); + +assert.sameValue(--
x, -9, 'U+2029 (expression)'); +assert.sameValue(x, -9, 'U+2029 (side effect)'); + +assert.sameValue( + --   + 

x, + -10, + 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)' +); +assert.sameValue( + x, -10, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/11.4.4-2-3-s.js b/js/src/tests/test262/language/expressions/prefix-increment/11.4.4-2-3-s.js new file mode 100644 index 0000000000..8c1f4075f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/11.4.4-2-3-s.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.4.4-2-3-s +description: SyntaxError is not thrown for ++arguments[...] +---*/ + +function testcase() { + arguments[1] = 7; + ++arguments[1]; + assert.sameValue(arguments[1], 8, 'arguments[1]'); + } +testcase(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T1.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T1.js new file mode 100644 index 0000000000..edf1fa6994 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T1.js @@ -0,0 +1,41 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x uses GetValue and PutValue +es5id: 11.4.4_A2.1_T1 +description: Type(x) is Reference and GetBase(x) is not null +---*/ + +//CHECK#1 +var x = 1; +if (++x !== 1 + 1) { + throw new Test262Error('#1: var x = 1; ++x === 1 + 1. Actual: ' + (++x)); +} else { + if (x !== 1 + 1) { + throw new Test262Error('#1: var x = 1; ++x; x === 1 + 1. Actual: ' + (x)); + } +} + +//CHECK#2 +this.x = 1; +if (++this.x !== 1 + 1) { + throw new Test262Error('#2: this.x = 1; ++this.x === 1 + 1. Actual: ' + (++this.x)); +} else { + if (this.x !== 1 + 1) { + throw new Test262Error('#2: this.x = 1; ++this.x; this.x === 1 + 1. Actual: ' + (this.x)); + } +} + +//CHECK#3 +var object = new Object(); +object.prop = 1; +if (++object.prop !== 1 + 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; ++object.prop === 1 + 1. Actual: ' + (++object.prop)); +} else { + if (this.x !== 1 + 1) { + throw new Test262Error('#3: var object = new Object(); object.prop = 1; ++object.prop; object.prop === 1 + 1. Actual: ' + (object.prop)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T2.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T2.js new file mode 100644 index 0000000000..98a6bc8a28 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x uses GetValue and PutValue +es5id: 11.4.4_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + ++x; + throw new Test262Error('#1.1: ++x throw ReferenceError. Actual: ' + (++x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: ++x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.2_T1.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.2_T1.js new file mode 100644 index 0000000000..496ee322e5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A2.2_T1.js @@ -0,0 +1,104 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x uses [[Default Value]] +es5id: 11.4.4_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (++object !== 1 + 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (++object !== 1 + 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (++object !== 1 + 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (++object !== 1 + 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object === 1 + 1. Actual: ' + (++object)); + } else { + if (object !== 1 + 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object; object === 1 + 1. Actual: ' + (object)); + } + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; ++object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (++object !== 1 + 1) { + throw new Test262Error('#5.1: var object = {toString: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#5.2: var object = {toString: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (++object !== 1 + 1) { + throw new Test262Error('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ++object === 1 + 1. Actual: ' + (++object)); +} else { + if (object !== 1 + 1) { + throw new Test262Error('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; ++object; object === 1 + 1. Actual: ' + (object)); + } +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + ++object; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ++object throw "error". Actual: ' + (++object)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; ++object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + ++object; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ++object throw TypeError. Actual: ' + (++object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; ++object throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T1.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T1.js new file mode 100644 index 0000000000..85774f70e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns x = ToNumber(x) + 1 +es5id: 11.4.4_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = false; +++x; +if (x !== 0 + 1) { + throw new Test262Error('#1: var x = false; ++x; x === 0 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Boolean(true); +++x; +if (x !== 1 + 1) { + throw new Test262Error('#2: var x = new Boolean(true); ++x; x === 1 + 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T2.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T2.js new file mode 100644 index 0000000000..05d1b33d2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns x = ToNumber(x) + 1 +es5id: 11.4.4_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 0.1; +++x; +if (x !== 0.1 + 1) { + throw new Test262Error('#1: var x = 0.1; ++x; x === 0.1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = new Number(-1.1); +++x; +if (x !== -1.1 + 1) { + throw new Test262Error('#2: var x = new Number(-1.1); ++x; x === -1.1 + 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T3.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T3.js new file mode 100644 index 0000000000..b7fa4147bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T3.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns x = ToNumber(x) + 1 +es5id: 11.4.4_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +var x = "1"; +++x; +if (x !== 1 + 1) { + throw new Test262Error('#1: var x = "1"; ++x; x === 1 + 1. Actual: ' + (x)); +} + +//CHECK#2 +var x = "x"; +++x; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = "x"; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#3 +var x = new Number("-1"); +++x; +if (x !== -1 + 1) { + throw new Test262Error('#3: var x = new String("-1"); ++x; x === -1 + 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T4.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T4.js new file mode 100644 index 0000000000..ce7cad87f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns x = ToNumber(x) + 1 +es5id: 11.4.4_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +++x; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = null; +++x; +if (x !== 1) { + throw new Test262Error('#2: var x = null; ++x; x === 1. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T5.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T5.js new file mode 100644 index 0000000000..671d642f0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A3_T5.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns x = ToNumber(x) + 1 +es5id: 11.4.4_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +++x; +if (isNaN(x) !== true) { + throw new Test262Error('#1: var x = {}; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +//CHECK#2 +var x = function(){return 1}; +++x; +if (isNaN(x) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; ++x; x === Not-a-Number. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T1.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T1.js new file mode 100644 index 0000000000..827bfbfaa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns ToNumber(x) + 1 +es5id: 11.4.4_A4_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = false; +if (++x !== 0 + 1) { + throw new Test262Error('#1: var x = false; ++x === 0 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = new Boolean(true); +if (++x !== 1 + 1) { + throw new Test262Error('#2: var x = new Boolean(true); ++x === 1 + 1. Actual: ' + (++x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T2.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T2.js new file mode 100644 index 0000000000..00bb0f43a9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns ToNumber(x) + 1 +es5id: 11.4.4_A4_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 0.1; +if (++x !== 0.1 + 1) { + throw new Test262Error('#1: var x = 0.1; ++x === 0.1 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (++x !== -1.1 + 1) { + throw new Test262Error('#2: var x = new Number(-1.1); ++x === -1.1 + 1. Actual: ' + (++x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T3.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T3.js new file mode 100644 index 0000000000..0850820caa --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns ToNumber(x) + 1 +es5id: 11.4.4_A4_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +var x = "1"; +if (++x !== 1 + 1) { + throw new Test262Error('#1: var x = "1"; ++x === 1 + 1. Actual: ' + (++x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(++x) !== true) { + throw new Test262Error('#2: var x = "x"; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#3 +var x = new String("-1"); +if (++x !== -1 + 1) { + throw new Test262Error('#3: var x = new String("-1"); ++x === -1 + 1. Actual: ' + (++x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T4.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T4.js new file mode 100644 index 0000000000..41b2feca22 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T4.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns ToNumber(x) + 1 +es5id: 11.4.4_A4_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +if (isNaN(++x) !== true) { + throw new Test262Error('#1: var x; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#2 +var x = null; +if (++x !== 1) { + throw new Test262Error('#2: var x = null; ++x === 1. Actual: ' + (++x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T5.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T5.js new file mode 100644 index 0000000000..39383a65cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A4_T5.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x returns ToNumber(x) + 1 +es5id: 11.4.4_A4_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +if (isNaN(++x) !== true) { + throw new Test262Error('#1: var x = {}; ++x === Not-a-Number. Actual: ' + (++x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(++x) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; ++x === Not-a-Number. Actual: ' + (++x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T1.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T1.js new file mode 100644 index 0000000000..e7eb79c63a --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T1.js @@ -0,0 +1,38 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x calls PutValue(lhs, newValue) +es5id: S11.4.4_A5_T1 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding function environment record is not changed. +flags: [noStrict] +---*/ + +function testFunction() { + var x = 0; + var scope = { + get x() { + delete this.x; + return 2; + } + }; + + with (scope) { + ++x; + } + + if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); + } + if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); + } +} +testFunction(); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T2.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T2.js new file mode 100644 index 0000000000..f25459fe31 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T2.js @@ -0,0 +1,35 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x calls PutValue(lhs, newValue) +es5id: S11.4.4_A5_T2 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding global environment record is not changed. +flags: [noStrict] +---*/ + +var x = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + ++x; +} + +if (scope.x !== 3) { + throw new Test262Error('#1: scope.x === 3. Actual: ' + (scope.x)); +} +if (x !== 0) { + throw new Test262Error('#2: x === 0. Actual: ' + (x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T3.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T3.js new file mode 100644 index 0000000000..8b63c83d61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A5_T3.js @@ -0,0 +1,39 @@ +// Copyright (C) 2014 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x calls PutValue(lhs, newValue) +es5id: S11.4.4_A5_T3 +description: > + Evaluating LeftHandSideExpression lhs returns Reference type; Reference + base value is an environment record and environment record kind is + object environment record. PutValue(lhs, newValue) uses the initially + created Reference even if the environment binding is no longer present. + Binding in surrounding object environment record is not changed. +flags: [noStrict] +---*/ + +var outerScope = { + x: 0 +}; +var innerScope = { + get x() { + delete this.x; + return 2; + } +}; + +with (outerScope) { + with (innerScope) { + ++x; + } +} + +if (innerScope.x !== 3) { + throw new Test262Error('#1: innerScope.x === 3. Actual: ' + (innerScope.x)); +} +if (outerScope.x !== 0) { + throw new Test262Error('#2: outerScope.x === 0. Actual: ' + (outerScope.x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T1.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T1.js new file mode 100644 index 0000000000..be8f4a8a47 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T1.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the null value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = null; + var prop = function() { + throw new DummyError(); + }; + + ++base[prop()]; +}); + +assert.throws(TypeError, function() { + var base = null; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + ++base[prop]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T2.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T2.js new file mode 100644 index 0000000000..ac13f6a66b --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T2.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. base is the undefined value. +---*/ + +function DummyError() { } + +assert.throws(DummyError, function() { + var base = undefined; + var prop = function() { + throw new DummyError(); + }; + + ++base[prop()]; +}); + +assert.throws(TypeError, function() { + var base = undefined; + var prop = { + toString: function() { + throw new Test262Error("property key evaluated"); + } + }; + + ++base[prop]; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T3.js b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T3.js new file mode 100644 index 0000000000..b3e9a874c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/S11.4.4_A6_T3.js @@ -0,0 +1,24 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator ++x evaluates its reference expression once. +description: > + The operand expression is evaluated exactly once. Operand expression is + MemberExpression: base[prop]. ToPropertyKey(prop) is not called multiple + times. +---*/ + +var propKeyEvaluated = false; +var base = {}; +var prop = { + toString: function() { + assert(!propKeyEvaluated); + propKeyEvaluated = true; + return 1; + } +}; + +++base[prop]; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/arguments-nostrict.js b/js/src/tests/test262/language/expressions/prefix-increment/arguments-nostrict.js new file mode 100644 index 0000000000..d9af8d7ad5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/arguments-nostrict.js @@ -0,0 +1,27 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + In non-strict code, "++arguments" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + 1. If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + 2. Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression ++ UnaryExpression + + It is an early Reference Error if AssignmentTargetType of UnaryExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. +flags: [noStrict] +---*/ + +if (false) { + ++arguments; +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/arguments-strict.js b/js/src/tests/test262/language/expressions/prefix-increment/arguments-strict.js new file mode 100644 index 0000000000..c96cdfa298 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/arguments-strict.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. (arguments) +info: | + sec-identifiers-static-semantics-assignmenttargettype + + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: ++ UnaryExpression + + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +++arguments; diff --git a/js/src/tests/test262/language/expressions/prefix-increment/bigint.js b/js/src/tests/test262/language/expressions/prefix-increment/bigint.js new file mode 100644 index 0000000000..a6cd9dcbde --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/bigint.js @@ -0,0 +1,64 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Prefix increment for references to BigInt values +esid: sec-prefix-increment-operator-runtime-semantics-evaluation +info: | + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ? ToNumeric(? GetValue(expr)). + 3. Let newValue be ? Type(oldvalue)::add(oldValue, Type(oldValue)::unit). + 4. Perform ? PutValue(expr, newValue). + 5. Return newValue. +features: [BigInt] +---*/ + +var x = 0n; +assert.sameValue(++x, 1n, "var x = 0n; ++x === 1n"); +assert.sameValue(x, 1n, "var x = 0n; ++x; x === 1n"); + +var x = -1n; +assert.sameValue(++x, 0n, "var x = -1n; ++x === 0n"); +assert.sameValue(x, 0n, "var x = -1n; ++x; x === 0n"); + +var x = 123456n; +assert.sameValue(++x, 123457n, "var x = 123456n; ++x === 123457n"); +assert.sameValue(x, 123457n, "var x = 123456n; ++x; x === 123457n"); + +var x = -123457n; +assert.sameValue(++x, -123456n, "var x = -123457n; ++x === -123456n"); +assert.sameValue(x, -123456n, "var x = -123457n; ++x; x === -123456n"); + +var x = 0x1fffffffffffff00n; +assert.sameValue(++x, 0x1fffffffffffff01n, "var x = 0x1fffffffffffff00n; ++x === 0x1fffffffffffff01n"); +assert.sameValue(x, 0x1fffffffffffff01n, "var x = 0x1fffffffffffff00n; ++x; x === 0x1fffffffffffff01n"); + +var x = -0x1fffffffffffff01n; +assert.sameValue(++x, -0x1fffffffffffff00n, "var x = -0x1fffffffffffff01n; ++x === -0x1fffffffffffff00n"); +assert.sameValue(x, -0x1fffffffffffff00n, "var x = -0x1fffffffffffff01n; ++x; x === -0x1fffffffffffff00n"); + +var x = {y:0n}; +assert.sameValue(++x.y, 1n, "var x = {y:0n}; ++x.y === 1n"); +assert.sameValue(x.y, 1n, "var x = {y:0n}; ++x.y; x.y === 1n"); + +var x = {y:{z:0n}}; +assert.sameValue(++x.y.z, 1n, "var x = {y:{z:0n}}; ++x.y.z === 1n"); +assert.sameValue(x.y.z, 1n, "var x = {y:{z:0n}}; ++x.y.z; x.y.z === 1n"); + +var x = [0n]; +assert.sameValue(++x[0], 1n, "var x = [0n]; ++x[0] === 1n"); +assert.sameValue(x[0], 1n, "var x = [0n]; ++x[0]; x[0] === 1n"); + +var x = [null, [null, null, 0n]]; +assert.sameValue(++x[1][2], 1n, "var x = [null, [null, null, 0n]]; ++x[1][2] === 1n"); +assert.sameValue(x[1][2], 1n, "var x = [null, [null, null, 0n]]; ++x[1][2]; x[1][2] === 1n"); + +var x = {y:[0n]}; +assert.sameValue(++x.y[0], 1n, "var x = {y:[0n]}; ++x.y[0] === 1n"); +assert.sameValue(x.y[0], 1n, "var x = {y:[0n]}; ++x.y[0]; x.y[0] === 1n"); + +var x = [{z:0n}]; +assert.sameValue(++x[0].z, 1n, "var x = [{z:0n}]; ++x[0].z === 1n"); +assert.sameValue(x[0].z, 1n, "var x = [{z:0n}]; ++x[0].z; x[0].z === 1n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/browser.js b/js/src/tests/test262/language/expressions/prefix-increment/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/prefix-increment/eval-nostrict.js b/js/src/tests/test262/language/expressions/prefix-increment/eval-nostrict.js new file mode 100644 index 0000000000..8bebe8850e --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/eval-nostrict.js @@ -0,0 +1,25 @@ +// Copyright (c) 2018 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + In non-strict code, "++eval" does not produce an early error. +info: | + sec-identifiers-static-semantics-assignmenttargettype + + 1. If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + 2. Return simple. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression ++ UnaryExpression + + It is an early Reference Error if AssignmentTargetType of UnaryExpression is invalid. + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. +flags: [noStrict] +---*/ + +++eval; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/eval-strict.js b/js/src/tests/test262/language/expressions/prefix-increment/eval-strict.js new file mode 100644 index 0000000000..21498be432 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/eval-strict.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +'use strict'; +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions +description: > + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. (eval) +info: | + sec-identifiers-static-semantics-assignmenttargettype + + If this IdentifierReference is contained in strict mode code and StringValue of Identifier is "eval" or "arguments", return strict. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: ++ UnaryExpression + + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is strict. + +flags: [onlyStrict] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +++eval; diff --git a/js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js b/js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js new file mode 100644 index 0000000000..96e6ebb9a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue--1.js @@ -0,0 +1,41 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator ++x calls PutValue(lhs, newValue) (formerly S11.4.4_A5_T5) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +Object.defineProperty(this, "x", { + configurable: true, + get: function() { + delete this.x; + return 2; + } +}); + +(function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + ++x; + count++; + }); + count++; +})(); + +assert.sameValue(count, 2); +assert(!('x' in this)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js b/js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js new file mode 100644 index 0000000000..8825b4563e --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/operator-prefix-increment-x-calls-putvalue-lhs-newvalue-.js @@ -0,0 +1,42 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object-environment-records-setmutablebinding-n-v-s +description: > + Operator ++x calls PutValue(lhs, newValue) (formerly S11.4.4_A5_T4) +info: | + The concrete Environment Record method SetMutableBinding for object Environment + Records attempts to set the value of the Environment Record's associated binding + object's property whose name is the value of the argument N to the value of argument V. + A property named N normally already exists but if it does not or is not currently writable, + error handling is determined by the value of the Boolean argument S. + + Let stillExists be ? HasProperty(bindings, N). + If stillExists is false and S is true, throw a ReferenceError exception. +flags: [noStrict] +---*/ +var count = 0; +var scope = { + get x() { + delete this.x; + return 2; + } +}; + +with (scope) { + (function() { + "use strict"; + assert.throws(ReferenceError, () => { + count++; + ++x; + count++; + }); + count++; + })(); +} + +assert.sameValue(count, 2); +assert(!('x' in scope)); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/shell.js b/js/src/tests/test262/language/expressions/prefix-increment/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/prefix-increment/target-cover-id.js b/js/src/tests/test262/language/expressions/prefix-increment/target-cover-id.js new file mode 100644 index 0000000000..df73600774 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/target-cover-id.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-unary-operators-static-semantics-early-errors +es6id: 12.5.1 +es5id: 11.1.6_A3_T5 +description: Applied to a "covered" IdentifierReference +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Reference Error if IsValidSimpleAssignmentTarget of + UnaryExpression is false. + + Static Semantics: IsValidSimpleAssignmentTarget + + IdentifierReference : Identifier + + 1. If this IdentifierReference is contained in strict mode code and + StringValue of Identifier is "eval" or "arguments", return false. + 2. Return true. +---*/ + +var y = 1; + +++(y); + +assert.sameValue(y, 2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/prefix-increment/target-cover-newtarget.js b/js/src/tests/test262/language/expressions/prefix-increment/target-cover-newtarget.js new file mode 100644 index 0000000000..cd99f262d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/target-cover-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" new.target +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Syntax Error if IsValidSimpleAssignmentTarget of + UnaryExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + ++(new.target); +} diff --git a/js/src/tests/test262/language/expressions/prefix-increment/target-cover-yieldexpr.js b/js/src/tests/test262/language/expressions/prefix-increment/target-cover-yieldexpr.js new file mode 100644 index 0000000000..b22a09e52c --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/target-cover-yieldexpr.js @@ -0,0 +1,35 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to a "covered" YieldExpression +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Syntax Error if IsValidSimpleAssignmentTarget of + UnaryExpression is invalid or strict. + + 12.15.3 Static Semantics: AssignmentTargetType + + AssignmentExpression: + YieldExpression + ArrowFunction + AsyncArrowFunction + LeftHandSideExpression = AssignmentExpression + LeftHandSideExpression AssignmentOperator AssignmentExpression + + 1. Return invalid. +features: [generators] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function* g() { + ++(yield); +} diff --git a/js/src/tests/test262/language/expressions/prefix-increment/target-newtarget.js b/js/src/tests/test262/language/expressions/prefix-increment/target-newtarget.js new file mode 100644 index 0000000000..eb8e4edd45 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/target-newtarget.js @@ -0,0 +1,32 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: Applied to new.target +info: | + UnaryExpression : + ++ UnaryExpression + -- UnaryExpression + + - It is an early Syntax Error if IsValidSimpleAssignmentTarget of + UnaryExpression is invalid or strict. + + 12.3.1.6 Static Semantics: AssignmentTargetType + + NewTarget: + + new.target + + 1. Return invalid. +negative: + phase: parse + type: SyntaxError +features: [new.target] +---*/ + +$DONOTEVALUATE(); + +function f() { + ++new.target; +} diff --git a/js/src/tests/test262/language/expressions/prefix-increment/this.js b/js/src/tests/test262/language/expressions/prefix-increment/this.js new file mode 100644 index 0000000000..28f34cc3f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/this.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2023 Veera Sivarajan. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-update-expressions-static-semantics-early-errors +description: > + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. (this) +info: | + sec-static-semantics-assignmenttargettype + + PrimaryExpression: this + + Return invalid. + + sec-update-expressions-static-semantics-early-errors + + UpdateExpression: ++ UnaryExpression + + It is an early Syntax Error if AssignmentTargetType of UnaryExpression is not simple. +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +++this; diff --git a/js/src/tests/test262/language/expressions/prefix-increment/whitespace.js b/js/src/tests/test262/language/expressions/prefix-increment/whitespace.js new file mode 100644 index 0000000000..04d98bd7d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/prefix-increment/whitespace.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + White Space and Line Terminator between "++" and UnaryExpression are + allowed +es5id: 11.4.4_A1 +esid: sec-prefix-increment-operator +---*/ + +var x = 0; + +assert.sameValue(++ x, 1, 'U+0009 (expression)'); +assert.sameValue(x, 1, 'U+0009 (side effect)'); + +assert.sameValue(++ x, 2, 'U+000B (expression)'); +assert.sameValue(x, 2, 'U+000B (side effect)'); + +assert.sameValue(++ x, 3, 'U+000C (expression)'); +assert.sameValue(x, 3, 'U+000C (side effect)'); + +assert.sameValue(++ x, 4, 'U+0020 (expression)'); +assert.sameValue(x, 4, 'U+0020 (side effect)'); + +assert.sameValue(++ x, 5, 'U+00A0 (expression)'); +assert.sameValue(x, 5, 'U+00A0 (side effect)'); + +assert.sameValue(++ +x, 6, 'U+000A (expression)'); +assert.sameValue(x, 6, 'U+000A (side effect)'); + +assert.sameValue(++ x, 7, 'U+000D (expression)'); +assert.sameValue(x, 7, 'U+000D (side effect)'); + +assert.sameValue(++
x, 8, 'U+2028 (expression)'); +assert.sameValue(x, 8, 'U+2028 (side effect)'); + +assert.sameValue(++
x, 9, 'U+2029 (expression)'); +assert.sameValue(x, 9, 'U+2029 (side effect)'); + +assert.sameValue( + ++   + 

x, + 10, + 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (expression)' +); +assert.sameValue( + x, 10, 'U+0009U+000BU+000CU+0020U+00A0U+000AU+000DU+2028U+2029 (side effect)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.1.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.1.js new file mode 100644 index 0000000000..5b4154c86b --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between MemberExpression or + CallExpression and "." and between "." and Identifier are allowed +es5id: 11.2.1_A1.1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("Number\u0009.\u0009POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: Number\\u0009.\\u0009POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#2 +if (eval("Number\u000B.\u000BPOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: Number\\u000B.\\u000BPOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#3 +if (eval("Number\u000C.\u000CPOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: Number\\u000C.\\u000CPOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#4 +if (eval("Number\u0020.\u0020POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#4: Number\\u0020.\\u0020POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#5 +if (eval("Number\u00A0.\u00A0POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5: Number\\u00A0.\\u00A0POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#6 +if (eval("Number\u000A.\u000APOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#6: Number\\u000A.\\u000APOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#7 +if (eval("Number\u000D.\u000DPOSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#7: Number\\u000D.\\u000DPOSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#8 +if (eval("Number\u2028.\u2028POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#8: Number\\u2028.\\u2028POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#9 +if (eval("Number\u2029.\u2029POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#9: Number\\u2029.\\u2029POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +//CHECK#10 +if (eval("Number\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029.\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029POSITIVE_INFINITY") !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#10: Number\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029.\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029POSITIVE_INFINITY === Number.POSITIVE_INFINITY'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.2.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.2.js new file mode 100644 index 0000000000..28f300a715 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A1.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "[" and MemberExpression or + CallExpression and between Identifier and "]" are allowed +es5id: 11.2.1_A1.2 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval('Number[\u0009"POSITIVE_INFINITY"\u0009]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: Number[\\u0009"POSITIVE_INFINITY"\\u0009] === Number.POSITIVE_INFINITY'); +} + +//CHECK#2 +if (eval('Number[\u000B"POSITIVE_INFINITY"\u000B]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2: Number[\\u000B"POSITIVE_INFINITY"\\u000B] === Number.POSITIVE_INFINITY'); +} + +//CHECK#3 +if (eval('Number[\u000C"POSITIVE_INFINITY"\u000C]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: Number[\\u000C"POSITIVE_INFINITY"\\u000C] === Number.POSITIVE_INFINITY'); +} + +//CHECK#4 +if (eval('Number[\u0020"POSITIVE_INFINITY"\u0020]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#4: Number[\\u0020"POSITIVE_INFINITY"\\u0020] === Number.POSITIVE_INFINITY'); +} + +//CHECK#5 +if (eval('Number[\u00A0"POSITIVE_INFINITY"\u00A0]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5: Number[\\u00A0"POSITIVE_INFINITY"\\u00A0] === Number.POSITIVE_INFINITY'); +} + +//CHECK#6 +if (eval('Number[\u000A"POSITIVE_INFINITY"\u000A]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#6: Number[\\u000A"POSITIVE_INFINITY"\\u000A] === Number.POSITIVE_INFINITY'); +} + +//CHECK#7 +if (eval('Number[\u000D"POSITIVE_INFINITY"\u000D]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#7: Number[\\u000D"POSITIVE_INFINITY"\\u000D] === Number.POSITIVE_INFINITY'); +} + +//CHECK#8 +if (eval('Number[\u2028"POSITIVE_INFINITY"\u2028]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#8: Number[\\u2028"POSITIVE_INFINITY"\\u2028] === Number.POSITIVE_INFINITY'); +} + +//CHECK#9 +if (eval('Number[\u2029"POSITIVE_INFINITY"\u2029]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#9: Number[\\u2029"POSITIVE_INFINITY"\\u2029] === Number.POSITIVE_INFINITY'); +} + +//CHECK#10 +if (eval('Number[\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029"POSITIVE_INFINITY"\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029]') !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#10: Number[\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029"POSITIVE_INFINITY"\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029] === Number.POSITIVE_INFINITY'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A2.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A2.js new file mode 100644 index 0000000000..b42517ea29 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: MemberExpression and CallExpression uses GetValue +es5id: 11.2.1_A2 +description: > + If GetBase(MemberExpression or CallExpression) is null, throw + ReferenceError +---*/ + +//CHECK#1 +try { + object[1]; + throw new Test262Error('#1.1: object[1] throw ReferenceError. Actual: ' + (object[1])); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: object[1] throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + object.prop; + throw new Test262Error('#2.1: object.prop throw ReferenceError. Actual: ' + (object.prop)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#2.2: object.prop throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T1.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T1.js new file mode 100644 index 0000000000..1f2bc6bfda --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + MemberExpression calls ToObject(MemberExpression) and + ToString(Expression). CallExpression calls ToObject(CallExpression) and + ToString(Expression) +es5id: 11.2.1_A3_T1 +description: Checking Boolean case +---*/ + +//CHECK#1 +if (true.toString() !== "true") { + throw new Test262Error('#1: true.toString() === "true". Actual: ' + (true.toString())); +} + +//CHECK#2 +if (false["toString"]() !== "false") { + throw new Test262Error('#2: false["toString"]() === "false". Actual: ' + (false["toString"]())); +} + +//CHECK#3 +if (new Boolean(true).toString() !== "true") { + throw new Test262Error('#3: new Boolean(true).toString() === "true". Actual: ' + (new Boolean(true).toString())); +} + +//CHECK#4 +if (new Boolean(false)["toString"]() !== "false") { + throw new Test262Error('#4: new Boolean(false)["toString"]() === "false". Actual: ' + (new Boolean(false)["toString"]())); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T2.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T2.js new file mode 100644 index 0000000000..3b9d643c81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T2.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + MemberExpression calls ToObject(MemberExpression) and + ToString(Expression). CallExpression calls ToObject(CallExpression) and + ToString(Expression) +es5id: 11.2.1_A3_T2 +description: Checking Number case +---*/ + +//CHECK#1 +if (1..toString() !== "1") { + throw new Test262Error('#1: 1..toString() === "1". Actual: ' + (1..toString())); +} + +//CHECK#2 +if (1.1.toFixed(5) !== "1.10000") { + throw new Test262Error('#2: 1.1.toFixed(5) === "1.10000". Actual: ' + (1.1.toFixed(5))); +} + +//CHECK#3 +if (1["toString"]() !== "1") { + throw new Test262Error('#3: 1["toString"]() === "1". Actual: ' + (1["toString"]())); +} + +//CHECK#4 +if (1.["toFixed"](5) !== "1.00000") { + throw new Test262Error('#4: 1.["toFixed"](5) === "1.00000". Actual: ' + (1.["toFixed"](5))); +} + +//CHECK#5 +if (new Number(1).toString() !== "1") { + throw new Test262Error('#5: new Number(1).toString() === "1". Actual: ' + (new Number(1).toString())); +} + +//CHECK#6 +if (new Number(1)["toFixed"](5) !== "1.00000") { + throw new Test262Error('#6: new Number(1)["toFixed"](5) === "1.00000". Actual: ' + (new Number(1)["toFixed"](5))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T3.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T3.js new file mode 100644 index 0000000000..2ddfba4935 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T3.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + MemberExpression calls ToObject(MemberExpression) and + ToString(Expression). CallExpression calls ToObject(CallExpression) and + ToString(Expression) +es5id: 11.2.1_A3_T3 +description: Checking String case; +---*/ + +//CHECK#1 +if ("abc123".charAt(5) !== "3") { + throw new Test262Error('#1: "abc123".charAt(5) === "3". Actual: ' + ("abc123".charAt(5))); +} + +//CHECK#2 +if ("abc123"["charAt"](0) !== "a") { + throw new Test262Error('#2: "abc123"["charAt"](0) === "a". Actual: ' + ("abc123"["charAt"](0))); +} + +//CHECK#3 +if ("abc123".length !== 6) { + throw new Test262Error('#3: "abc123".length === 6. Actual: ' + ("abc123".length)); +} + +//CHECK#4 +if ("abc123"["length"] !== 6) { + throw new Test262Error('#4: "abc123"["length"] === 6. Actual: ' + ("abc123"["length"])); +} + +//CHECK#5 +if (new String("abc123").length !== 6) { + throw new Test262Error('#5: new String("abc123").length === 6. Actual: ' + (new String("abc123").length)); +} + +//CHECK#6 +if (new String("abc123")["charAt"](2) !== "c") { + throw new Test262Error('#6: new String("abc123")["charAt"](2) === "c". Actual: ' + (new String("abc123")["charAt"](2))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T4.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T4.js new file mode 100644 index 0000000000..7c6ffbd587 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T4.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + MemberExpression calls ToObject(MemberExpression) and + ToString(Expression). CallExpression calls ToObject(CallExpression) and + ToString(Expression) +es5id: 11.2.1_A3_T4 +description: Checking "undefined" case +---*/ + +//CHECK#1 +try { + undefined.toString(); + throw new Test262Error('#1.1: undefined.toString() throw TypeError. Actual: ' + (undefined.toString())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: undefined.toString() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + undefined["toString"](); + throw new Test262Error('#2.1: undefined["toString"]() throw TypeError. Actual: ' + (undefined["toString"]())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: undefined["toString"]() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T5.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T5.js new file mode 100644 index 0000000000..b8d0ce6a49 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A3_T5.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + MemberExpression calls ToObject(MemberExpression) and + ToString(Expression). CallExpression calls ToObject(CallExpression) and + ToString(Expression) +es5id: 11.2.1_A3_T5 +description: Checking "null" case +---*/ + +//CHECK#1 +try { + null.toString(); + throw new Test262Error('#1.1: null.toString() throw TypeError. Actual: ' + (null.toString())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#1.2: null.toString() throw TypeError. Actual: ' + (e)); + } +} + +//CHECK#2 +try { + null["toString"](); + throw new Test262Error('#2.1: null["toString"]() throw TypeError. Actual: ' + (null["toString"]())); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#2.2: null["toString"]() throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T1.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T1.js new file mode 100644 index 0000000000..4ae02c57cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T1 +description: Checking properties of this object +---*/ + +//CHECK#1-32 +if (typeof (this.NaN) === "undefined") throw new Test262Error('#1: typeof (this.NaN) !== "undefined"'); +if (typeof this['NaN'] === "undefined") throw new Test262Error('#2: typeof this["NaN"] !== "undefined"'); +if (typeof this.Infinity === "undefined") throw new Test262Error('#3: typeof this.Infinity !== "undefined"'); +if (typeof this['Infinity'] === "undefined") throw new Test262Error('#4: typeof this["Infinity"] !== "undefined"'); +if (typeof this.parseInt === "undefined") throw new Test262Error('#5: typeof this.parseInt !== "undefined"'); +if (typeof this['parseInt'] === "undefined") throw new Test262Error('#6: typeof this["parseInt"] !== "undefined"'); +if (typeof this.parseFloat === "undefined") throw new Test262Error('#7: typeof this.parseFloat !== "undefined"'); +if (typeof this['parseFloat'] === "undefined") throw new Test262Error('#8: typeof this["parseFloat"] !== "undefined"'); +if (typeof this.isNaN === "undefined") throw new Test262Error('#13: typeof this.isNaN !== "undefined"'); +if (typeof this['isNaN'] === "undefined") throw new Test262Error('#14: typeof this["isNaN"] !== "undefined"'); +if (typeof this.isFinite === "undefined") throw new Test262Error('#15: typeof this.isFinite !== "undefined"'); +if (typeof this['isFinite'] === "undefined") throw new Test262Error('#16: typeof this["isFinite"] !== "undefined"'); +if (typeof this.Object === "undefined") throw new Test262Error('#17: typeof this.Object !== "undefined"'); +if (typeof this['Object'] === "undefined") throw new Test262Error('#18: typeof this["Object"] !== "undefined"'); +if (typeof this.Number === "undefined") throw new Test262Error('#19: typeof this.Number !== "undefined"'); +if (typeof this['Number'] === "undefined") throw new Test262Error('#20: typeof this["Number"] !== "undefined"'); +if (typeof this.Function === "undefined") throw new Test262Error('#21: typeof this.Function !== "undefined"'); +if (typeof this['Function'] === "undefined") throw new Test262Error('#22: typeof this["Function"] !== "undefined"'); +if (typeof this.Array === "undefined") throw new Test262Error('#23: typeof this.Array !== "undefined"'); +if (typeof this['Array'] === "undefined") throw new Test262Error('#24: typeof this["Array"] !== "undefined"'); +if (typeof this.String === "undefined") throw new Test262Error('#25: typeof this.String !== "undefined"'); +if (typeof this['String'] === "undefined") throw new Test262Error('#26: typeof this["String"] !== "undefined"'); +if (typeof this.Boolean === "undefined") throw new Test262Error('#27: typeof this.Boolean !== "undefined"'); +if (typeof this['Boolean'] === "undefined") throw new Test262Error('#28: typeof this["Boolean"] !== "undefined"'); +if (typeof this.Date === "undefined") throw new Test262Error('#29: typeof this.Date !== "undefined"'); +if (typeof this['Date'] === "undefined") throw new Test262Error('#30: typeof this["Date"] !== "undefined"'); +if (typeof this.Math === "undefined") throw new Test262Error('#31: typeof this.Math !== "undefined"'); +if (typeof this['Math'] === "undefined") throw new Test262Error('#32: typeof this["Math"] !== "undefined"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T2.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T2.js new file mode 100644 index 0000000000..066fbe70fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T2 +description: Checking properties and methods of Object objects +---*/ + +//CHECK#1-8 +if (typeof Object.prototype !== "object") throw new Test262Error('#1: typeof Object.prototype === "object". Actual: ' + (typeof Object.prototype )); +if (typeof Object['prototype'] !== "object") throw new Test262Error('#2: typeof Object["prototype"] === "object". Actual: ' + (typeof Object["prototype"] )); +if (typeof Object.toString !== "function") throw new Test262Error('#3: typeof Object.toString === "function". Actual: ' + (typeof Object.toString )); +if (typeof Object['toString'] !== "function") throw new Test262Error('#4: typeof Object["toString"] === "function". Actual: ' + (typeof Object["toString"] )); +if (typeof Object.valueOf !== "function") throw new Test262Error('#5: typeof Object.valueOf === "function". Actual: ' + (typeof Object.valueOf )); +if (typeof Object['valueOf'] !== "function") throw new Test262Error('#6: typeof Object["valueOf"] === "function". Actual: ' + (typeof Object["valueOf"] )); +if (typeof Object.constructor !== "function") throw new Test262Error('#7: typeof Object.constructor === "function". Actual: ' + (typeof Object.constructor )); +if (typeof Object['constructor'] !== "function") throw new Test262Error('#8: typeof Object["constructor"] === "function". Actual: ' + (typeof Object["constructor"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T3.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T3.js new file mode 100644 index 0000000000..ff86bb4469 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T3 +description: Checking properties of the Function object +---*/ + +//CHECK#1-8 +if (typeof Function.prototype !== "function") throw new Test262Error('#1: typeof Function.prototype === "function". Actual: ' + (typeof Function.prototype )); +if (typeof Function['prototype'] !== "function") throw new Test262Error('#2: typeof Function["prototype"] === "function". Actual: ' + (typeof Function["prototype"] )); +if (typeof Function.prototype.toString !== "function") throw new Test262Error('#3: typeof Function.prototype.toString === "function". Actual: ' + (typeof Function.prototype.toString )); +if (typeof Function.prototype['toString'] !== "function") throw new Test262Error('#4: typeof Function.prototype["toString"] === "function". Actual: ' + (typeof Function.prototype["toString"] )); +if (typeof Function.prototype.length !== "number") throw new Test262Error('#5: typeof Function.prototype.length === "number". Actual: ' + (typeof Function.prototype.length )); +if (typeof Function.prototype['length'] !== "number") throw new Test262Error('#6: typeof Function.prototype["length"] === "number". Actual: ' + (typeof Function.prototype["length"] )); +if (typeof Function.prototype.valueOf !== "function") throw new Test262Error('#7: typeof Function.prototype.valueOf === "function". Actual: ' + (typeof Function.prototype.valueOf )); +if (typeof Function.prototype['valueOf'] !== "function") throw new Test262Error('#8: typeof Function.prototype["valueOf"] === "function". Actual: ' + (typeof Function.prototype["valueOf"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T4.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T4.js new file mode 100644 index 0000000000..d5ee6e1046 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T4.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T4 +description: Checking properties of the Array object +---*/ + +//CHECK#1-8 +if (typeof Array.prototype !== "object") throw new Test262Error('#1: typeof Array.prototype === "object". Actual: ' + (typeof Array.prototype )); +if (typeof Array['prototype'] !== "object") throw new Test262Error('#2: typeof Array["prototype"] === "object". Actual: ' + (typeof Array["prototype"] )); +if (typeof Array.length !== "number") throw new Test262Error('#3: typeof Array.length === "number". Actual: ' + (typeof Array.length )); +if (typeof Array['length'] !== "number") throw new Test262Error('#4: typeof Array["length"] === "number". Actual: ' + (typeof Array["length"] )); +if (typeof Array.prototype.constructor !== "function") throw new Test262Error('#5: typeof Array.prototype.constructor === "function". Actual: ' + (typeof Array.prototype.constructor )); +if (typeof Array.prototype['constructor'] !== "function") throw new Test262Error('#6: typeof Array.prototype["constructor"] === "function". Actual: ' + (typeof Array.prototype["constructor"] )); +if (typeof Array.prototype.toString !== "function") throw new Test262Error('#7: typeof Array.prototype.toString === "function". Actual: ' + (typeof Array.prototype.toString )); +if (typeof Array.prototype['toString'] !== "function") throw new Test262Error('#8: typeof Array.prototype["toString"] === "function". Actual: ' + (typeof Array.prototype["toString"] )); +if (typeof Array.prototype.join !== "function") throw new Test262Error('#9: typeof Array.prototype.join === "function". Actual: ' + (typeof Array.prototype.join )); +if (typeof Array.prototype['join'] !== "function") throw new Test262Error('#10: typeof Array.prototype["join"] === "function". Actual: ' + (typeof Array.prototype["join"] )); +if (typeof Array.prototype.reverse !== "function") throw new Test262Error('#11: typeof Array.prototype.reverse === "function". Actual: ' + (typeof Array.prototype.reverse )); +if (typeof Array.prototype['reverse'] !== "function") throw new Test262Error('#12: typeof Array.prototype["reverse"] === "function". Actual: ' + (typeof Array.prototype["reverse"] )); +if (typeof Array.prototype.sort !== "function") throw new Test262Error('#13: typeof Array.prototype.sort === "function". Actual: ' + (typeof Array.prototype.sort )); +if (typeof Array.prototype['sort'] !== "function") throw new Test262Error('#14: typeof Array.prototype["sort"] === "function". Actual: ' + (typeof Array.prototype["sort"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T5.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T5.js new file mode 100644 index 0000000000..97e4664ac3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T5.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T5 +description: Checking properties of the String object +---*/ + +//CHECK#1-28 +if (typeof String.prototype !== "object") throw new Test262Error('#1: typeof String.prototype === "object". Actual: ' + (typeof String.prototype )); +if (typeof String['prototype'] !== "object") throw new Test262Error('#2: typeof String["prototype"] === "object". Actual: ' + (typeof String["prototype"] )); +if (typeof String.fromCharCode !== "function") throw new Test262Error('#3: typeof String.fromCharCode === "function". Actual: ' + (typeof String.fromCharCode )); +if (typeof String['fromCharCode'] !== "function") throw new Test262Error('#4: typeof String["fromCharCode"] === "function". Actual: ' + (typeof String["fromCharCode"] )); +if (typeof String.prototype.toString !== "function") throw new Test262Error('#5: typeof String.prototype.toString === "function". Actual: ' + (typeof String.prototype.toString )); +if (typeof String.prototype['toString'] !== "function") throw new Test262Error('#6: typeof String.prototype["toString"] === "function". Actual: ' + (typeof String.prototype["toString"] )); +if (typeof String.prototype.constructor !== "function") throw new Test262Error('#7: typeof String.prototype.constructor === "function". Actual: ' + (typeof String.prototype.constructor )); +if (typeof String.prototype['constructor'] !== "function") throw new Test262Error('#8: typeof String.prototype["constructor"] === "function". Actual: ' + (typeof String.prototype["constructor"] )); +if (typeof String.prototype.valueOf !== "function") throw new Test262Error('#9: typeof String.prototype.valueOf === "function". Actual: ' + (typeof String.prototype.valueOf )); +if (typeof String.prototype['valueOf'] !== "function") throw new Test262Error('#10: typeof String.prototype["valueOf"] === "function". Actual: ' + (typeof String.prototype["valueOf"] )); +if (typeof String.prototype.charAt !== "function") throw new Test262Error('#11: typeof String.prototype.charAt === "function". Actual: ' + (typeof String.prototype.charAt )); +if (typeof String.prototype['charAt'] !== "function") throw new Test262Error('#12: typeof String.prototype["charAt"] === "function". Actual: ' + (typeof String.prototype["charAt"] )); +if (typeof String.prototype.charCodeAt !== "function") throw new Test262Error('#13: typeof String.prototype.charCodeAt === "function". Actual: ' + (typeof String.prototype.charCodeAt )); +if (typeof String.prototype['charCodeAt'] !== "function") throw new Test262Error('#14: typeof String.prototype["charCodeAt"] === "function". Actual: ' + (typeof String.prototype["charCodeAt"] )); +if (typeof String.prototype.indexOf !== "function") throw new Test262Error('#15: typeof String.prototype.indexOf === "function". Actual: ' + (typeof String.prototype.indexOf )); +if (typeof String.prototype['indexOf'] !== "function") throw new Test262Error('#16: typeof String.prototype["indexOf"] === "function". Actual: ' + (typeof String.prototype["indexOf"] )); +if (typeof String.prototype.lastIndexOf !== "function") throw new Test262Error('#17: typeof String.prototype.lastIndexOf === "function". Actual: ' + (typeof String.prototype.lastIndexOf )); +if (typeof String.prototype['lastIndexOf'] !== "function") throw new Test262Error('#18: typeof String.prototype["lastIndexOf"] === "function". Actual: ' + (typeof String.prototype["lastIndexOf"] )); +if (typeof String.prototype.split !== "function") throw new Test262Error('#19: typeof String.prototype.split === "function". Actual: ' + (typeof String.prototype.split )); +if (typeof String.prototype['split'] !== "function") throw new Test262Error('#20: typeof String.prototype["split"] === "function". Actual: ' + (typeof String.prototype["split"] )); +if (typeof String.prototype.substring !== "function") throw new Test262Error('#21: typeof String.prototype.substring === "function". Actual: ' + (typeof String.prototype.substring )); +if (typeof String.prototype['substring'] !== "function") throw new Test262Error('#22: typeof String.prototype["substring"] === "function". Actual: ' + (typeof String.prototype["substring"] )); +if (typeof String.prototype.toLowerCase !== "function") throw new Test262Error('#23: typeof String.prototype.toLowerCase === "function". Actual: ' + (typeof String.prototype.toLowerCase )); +if (typeof String.prototype['toLowerCase'] !== "function") throw new Test262Error('#24: typeof String.prototype["toLowerCase"] === "function". Actual: ' + (typeof String.prototype["toLowerCase"] )); +if (typeof String.prototype.toUpperCase !== "function") throw new Test262Error('#25: typeof String.prototype.toUpperCase === "function". Actual: ' + (typeof String.prototype.toUpperCase )); +if (typeof String.prototype['toUpperCase'] !== "function") throw new Test262Error('#26: typeof Array.prototype === "object". Actual: ' + (typeof Array.prototype )); +if (typeof String.prototype.length !== "number") throw new Test262Error('#27: typeof String.prototype.length === "number". Actual: ' + (typeof String.prototype.length )); +if (typeof String.prototype['length'] !== "number") throw new Test262Error('#28: typeof String.prototype["length"] === "number". Actual: ' + (typeof String.prototype["length"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T6.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T6.js new file mode 100644 index 0000000000..c6b849a99b --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T6.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T6 +description: Checking properties of the Boolean object +---*/ + +//CHECK#1-8 +if (typeof Boolean.prototype !== "object") throw new Test262Error('#1: typeof Boolean.prototype === "object". Actual: ' + (typeof Boolean.prototype )); +if (typeof Boolean['prototype'] !== "object") throw new Test262Error('#2: typeof Boolean["prototype"] === "object". Actual: ' + (typeof Boolean["prototype"] )); +if (typeof Boolean.constructor !== "function") throw new Test262Error('#3: typeof Boolean.constructor === "function". Actual: ' + (typeof Boolean.constructor )); +if (typeof Boolean['constructor'] !== "function") throw new Test262Error('#4: typeof Boolean["constructor"] === "function". Actual: ' + (typeof Boolean["constructor"] )); +if (typeof Boolean.prototype.valueOf !== "function") throw new Test262Error('#5: typeof Boolean.prototype.valueOf === "function". Actual: ' + (typeof Boolean.prototype.valueOf )); +if (typeof Boolean.prototype['valueOf'] !== "function") throw new Test262Error('#6: typeof Boolean.prototype["valueOf"] === "function". Actual: ' + (typeof Boolean.prototype["valueOf"] )); +if (typeof Boolean.prototype.toString !== "function") throw new Test262Error('#7: typeof Boolean.prototype.toString === "function". Actual: ' + (typeof Boolean.prototype.toString )); +if (typeof Boolean.prototype['toString'] !== "function") throw new Test262Error('#8: typeof Boolean.prototype["toString"] === "function". Actual: ' + (typeof Boolean.prototype["toString"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T7.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T7.js new file mode 100644 index 0000000000..60892ffbaa --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T7.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T7 +description: Checking properties of the Number object +---*/ + +//CHECK#1-16 +if (typeof Number.MAX_VALUE !== "number") throw new Test262Error('#1: typeof Number.MAX_VALUE === "number". Actual: ' + (typeof Number.MAX_VALUE )); +if (typeof Number['MAX_VALUE'] !== "number") throw new Test262Error('#2: typeof Number["MAX_VALUE"] === "number". Actual: ' + (typeof Number["MAX_VALUE"] )); +if (typeof Number.MIN_VALUE !== "number") throw new Test262Error('#3: typeof Number.MIN_VALUE === "number". Actual: ' + (typeof Number.MIN_VALUE )); +if (typeof Number['MIN_VALUE'] !== "number") throw new Test262Error('#4: typeof Number["MIN_VALUE"] === "number". Actual: ' + (typeof Number["MIN_VALUE"] )); +if (typeof Number.NaN !== "number") throw new Test262Error('#5: typeof Number.NaN === "number". Actual: ' + (typeof Number.NaN )); +if (typeof Number['NaN'] !== "number") throw new Test262Error('#6: typeof Number["NaN"] === "number". Actual: ' + (typeof Number["NaN"] )); +if (typeof Number.NEGATIVE_INFINITY !== "number") throw new Test262Error('#7: typeof Number.NEGATIVE_INFINITY === "number". Actual: ' + (typeof Number.NEGATIVE_INFINITY )); +if (typeof Number['NEGATIVE_INFINITY'] !== "number") throw new Test262Error('#8: typeof Number["NEGATIVE_INFINITY"] === "number". Actual: ' + (typeof Number["NEGATIVE_INFINITY"] )); +if (typeof Number.POSITIVE_INFINITY !== "number") throw new Test262Error('#9: typeof Number.POSITIVE_INFINITY === "number". Actual: ' + (typeof Number.POSITIVE_INFINITY )); +if (typeof Number['POSITIVE_INFINITY'] !== "number") throw new Test262Error('#10: typeof Number["POSITIVE_INFINITY"] === "number". Actual: ' + (typeof Number["POSITIVE_INFINITY"] )); +if (typeof Number.prototype.toString !== "function") throw new Test262Error('#11: typeof Number.prototype.toString === "function". Actual: ' + (typeof Number.prototype.toString )); +if (typeof Number.prototype['toString'] !== "function") throw new Test262Error('#12: typeof Number.prototype["toString"] === "function". Actual: ' + (typeof Number.prototype["toString"] )); +if (typeof Number.prototype.constructor !== "function") throw new Test262Error('#13: typeof Number.prototype.constructor === "function". Actual: ' + (typeof Number.prototype.constructor )); +if (typeof Number.prototype['constructor'] !== "function") throw new Test262Error('#14: typeof Number.prototype["constructor"] === "function". Actual: ' + (typeof Number.prototype["constructor"] )); +if (typeof Number.prototype.valueOf !== "function") throw new Test262Error('#15: typeof Number.prototype.valueOf === "function". Actual: ' + (typeof Number.prototype.valueOf )); +if (typeof Number.prototype['valueOf'] !== "function") throw new Test262Error('#16: typeof Number.prototype["valueOf"] === "function". Actual: ' + (typeof Number.prototype["valueOf"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T8.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T8.js new file mode 100644 index 0000000000..0d1d882188 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T8.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T8 +description: Checking properties of the Math Object +---*/ + +//CHECK#1-52 +if (typeof Math.E !== "number") throw new Test262Error('#1: typeof Math.E === "number". Actual: ' + (typeof Math.E )); +if (typeof Math['E'] !== "number") throw new Test262Error('#2: typeof Math["E"] === "number". Actual: ' + (typeof Math["E"] )); +if (typeof Math.LN10 !== "number") throw new Test262Error('#3: typeof Math.LN10 === "number". Actual: ' + (typeof Math.LN10 )); +if (typeof Math['LN10'] !== "number") throw new Test262Error('#4: typeof Math["LN10"] === "number". Actual: ' + (typeof Math["LN10"] )); +if (typeof Math.LN2 !== "number") throw new Test262Error('#5: typeof Math.LN2 === "number". Actual: ' + (typeof Math.LN2 )); +if (typeof Math['LN2'] !== "number") throw new Test262Error('#6: typeof Math["LN2"] === "number". Actual: ' + (typeof Math["LN2"] )); +if (typeof Math.LOG2E !== "number") throw new Test262Error('#7: typeof Math.LOG2E === "number". Actual: ' + (typeof Math.LOG2E )); +if (typeof Math['LOG2E'] !== "number") throw new Test262Error('#8: typeof Math["LOG2E"] === "number". Actual: ' + (typeof Math["LOG2E"] )); +if (typeof Math.LOG10E !== "number") throw new Test262Error('#9: typeof Math.LOG10E === "number". Actual: ' + (typeof Math.LOG10E )); +if (typeof Math['LOG10E'] !== "number") throw new Test262Error('#10: typeof Math["LOG10E"] === "number". Actual: ' + (typeof Math["LOG10E"] )); +if (typeof Math.PI !== "number") throw new Test262Error('#11: typeof Math.PI === "number". Actual: ' + (typeof Math.PI )); +if (typeof Math['PI'] !== "number") throw new Test262Error('#12: typeof Math["PI"] === "number". Actual: ' + (typeof Math["PI"] )); +if (typeof Math.SQRT1_2 !== "number") throw new Test262Error('#13: typeof Math.SQRT1_2 === "number". Actual: ' + (typeof Math.SQRT1_2 )); +if (typeof Math['SQRT1_2'] !== "number") throw new Test262Error('#14: typeof Math["SQRT1_2"] === "number". Actual: ' + (typeof Math["SQRT1_2"] )); +if (typeof Math.SQRT2 !== "number") throw new Test262Error('#15: typeof Math.SQRT2 === "number". Actual: ' + (typeof Math.SQRT2 )); +if (typeof Math['SQRT2'] !== "number") throw new Test262Error('#16: typeof Math["SQRT2"] === "number". Actual: ' + (typeof Math["SQRT2"] )); +if (typeof Math.abs !== "function") throw new Test262Error('#17: typeof Math.abs === "function". Actual: ' + (typeof Math.abs )); +if (typeof Math['abs'] !== "function") throw new Test262Error('#18: typeof Math["abs"] === "function". Actual: ' + (typeof Math["abs"] )); +if (typeof Math.acos !== "function") throw new Test262Error('#19: typeof Math.acos === "function". Actual: ' + (typeof Math.acos )); +if (typeof Math['acos'] !== "function") throw new Test262Error('#20: typeof Math["acos"] === "function". Actual: ' + (typeof Math["acos"] )); +if (typeof Math.asin !== "function") throw new Test262Error('#21: typeof Math.asin === "function". Actual: ' + (typeof Math.asin )); +if (typeof Math['asin'] !== "function") throw new Test262Error('#22: typeof Math["asin"] === "function". Actual: ' + (typeof Math["asin"] )); +if (typeof Math.atan !== "function") throw new Test262Error('#23: typeof Math.atan === "function". Actual: ' + (typeof Math.atan )); +if (typeof Math['atan'] !== "function") throw new Test262Error('#24: typeof Math["atan"] === "function". Actual: ' + (typeof Math["atan"] )); +if (typeof Math.atan2 !== "function") throw new Test262Error('#25: typeof Math.atan2 === "function". Actual: ' + (typeof Math.atan2 )); +if (typeof Math['atan2'] !== "function") throw new Test262Error('#26: typeof Math["atan2"] === "function". Actual: ' + (typeof Math["atan2"] )); +if (typeof Math.ceil !== "function") throw new Test262Error('#27: typeof Math.ceil === "function". Actual: ' + (typeof Math.ceil )); +if (typeof Math['ceil'] !== "function") throw new Test262Error('#28: typeof Math["ceil"] === "function". Actual: ' + (typeof Math["ceil"] )); +if (typeof Math.cos !== "function") throw new Test262Error('#29: typeof Math.cos === "function". Actual: ' + (typeof Math.cos )); +if (typeof Math['cos'] !== "function") throw new Test262Error('#30: typeof Math["cos"] === "function". Actual: ' + (typeof Math["cos"] )); +if (typeof Math.exp !== "function") throw new Test262Error('#31: typeof Math.exp === "function". Actual: ' + (typeof Math.exp )); +if (typeof Math['exp'] !== "function") throw new Test262Error('#32: typeof Math["exp"] === "function". Actual: ' + (typeof Math["exp"] )); +if (typeof Math.floor !== "function") throw new Test262Error('#33: typeof Math.floor === "function". Actual: ' + (typeof Math.floor )); +if (typeof Math['floor'] !== "function") throw new Test262Error('#34: typeof Math["floor"] === "function". Actual: ' + (typeof Math["floor"] )); +if (typeof Math.log !== "function") throw new Test262Error('#35: typeof Math.log === "function". Actual: ' + (typeof Math.log )); +if (typeof Math['log'] !== "function") throw new Test262Error('#36: typeof Math["log"] === "function". Actual: ' + (typeof Math["log"] )); +if (typeof Math.max !== "function") throw new Test262Error('#37: typeof Math.max === "function". Actual: ' + (typeof Math.max )); +if (typeof Math['max'] !== "function") throw new Test262Error('#38: typeof Math["max"] === "function". Actual: ' + (typeof Math["max"] )); +if (typeof Math.min !== "function") throw new Test262Error('#39: typeof Math.min === "function". Actual: ' + (typeof Math.min )); +if (typeof Math['min'] !== "function") throw new Test262Error('#40: typeof Math["min"] === "function". Actual: ' + (typeof Math["min"] )); +if (typeof Math.pow !== "function") throw new Test262Error('#41: typeof Math.pow === "function". Actual: ' + (typeof Math.pow )); +if (typeof Math['pow'] !== "function") throw new Test262Error('#42: typeof Math["pow"] === "function". Actual: ' + (typeof Math["pow"] )); +if (typeof Math.random !== "function") throw new Test262Error('#43: typeof Math.random === "function". Actual: ' + (typeof Math.random )); +if (typeof Math['random'] !== "function") throw new Test262Error('#44: typeof Math["random"] === "function". Actual: ' + (typeof Math["random"] )); +if (typeof Math.round !== "function") throw new Test262Error('#45: typeof Math.round === "function". Actual: ' + (typeof Math.round )); +if (typeof Math['round'] !== "function") throw new Test262Error('#46: typeof Math["round"] === "function". Actual: ' + (typeof Math["round"] )); +if (typeof Math.sin !== "function") throw new Test262Error('#47: typeof Math.sin === "function". Actual: ' + (typeof Math.sin )); +if (typeof Math['sin'] !== "function") throw new Test262Error('#48: typeof Math["sin"] === "function". Actual: ' + (typeof Math["sin"] )); +if (typeof Math.sqrt !== "function") throw new Test262Error('#49: typeof Math.sqrt === "function". Actual: ' + (typeof Math.sqrt )); +if (typeof Math['sqrt'] !== "function") throw new Test262Error('#50: typeof Math["sqrt"] === "function". Actual: ' + (typeof Math["sqrt"] )); +if (typeof Math.tan !== "function") throw new Test262Error('#51: typeof Math.tan === "function". Actual: ' + (typeof Math.tan )); +if (typeof Math['tan'] !== "function") throw new Test262Error('#52: typeof Math["tan"] === "function". Actual: ' + (typeof Math["tan"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T9.js b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T9.js new file mode 100644 index 0000000000..db5a9d80d6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S11.2.1_A4_T9.js @@ -0,0 +1,92 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check type of various properties +es5id: 11.2.1_A4_T9 +description: Checking properties of the Date object +---*/ + +//CHECK#1-86 +if (typeof Date.parse !== "function") throw new Test262Error('#1: typeof Date.parse === "function". Actual: ' + (typeof Date.parse )); +if (typeof Date['parse'] !== "function") throw new Test262Error('#2: typeof Date["parse"] === "function". Actual: ' + (typeof Date["parse"] )); +if (typeof Date.prototype !== "object") throw new Test262Error('#3: typeof Date.prototype === "object". Actual: ' + (typeof Date.prototype )); +if (typeof Date['prototype'] !== "object") throw new Test262Error('#4: typeof Date["prototype"] === "object". Actual: ' + (typeof Date["prototype"] )); +if (typeof Date.UTC !== "function") throw new Test262Error('#5: typeof Date.UTC === "function". Actual: ' + (typeof Date.UTC )); +if (typeof Date['UTC'] !== "function") throw new Test262Error('#6: typeof Date["UTC"] === "function". Actual: ' + (typeof Date["UTC"] )); +if (typeof Date.prototype.constructor !== "function") throw new Test262Error('#7: typeof Date.prototype.constructor === "funvtion". Actual: ' + (typeof Date.prototype.constructor )); +if (typeof Date.prototype['constructor'] !== "function") throw new Test262Error('#8: typeof Date.prototype["constructor"] === "function". Actual: ' + (typeof Date.prototype["constructor"] )); +if (typeof Date.prototype.toString !== "function") throw new Test262Error('#9: typeof Date.prototype.toString === "function". Actual: ' + (typeof Date.prototype.toString )); +if (typeof Date.prototype['toString'] !== "function") throw new Test262Error('#10: typeof Date.prototype["toString"] === "function". Actual: ' + (typeof Date.prototype["toString"] )); +if (typeof Date.prototype.valueOf !== "function") throw new Test262Error('#11: typeof Date.prototype.valueOf === "function". Actual: ' + (typeof Date.prototype.valueOf )); +if (typeof Date.prototype['valueOf'] !== "function") throw new Test262Error('#12: typeof Date.prototype["valueOf"] === "function". Actual: ' + (typeof Date.prototype["valueOf"] )); +if (typeof Date.prototype.getTime !== "function") throw new Test262Error('#13: typeof Date.prototype.getTime === "function". Actual: ' + (typeof Date.prototype.getTime )); +if (typeof Date.prototype['getTime'] !== "function") throw new Test262Error('#14: typeof Date.prototype["getTime"] === "function". Actual: ' + (typeof Date.prototype["getTime"] )); +if (typeof Date.prototype.getFullYear !== "function") throw new Test262Error('#17: typeof Date.prototype.getFullYear === "function". Actual: ' + (typeof Date.prototype.getFullYear )); +if (typeof Date.prototype['getFullYear'] !== "function") throw new Test262Error('#18: typeof Date.prototype["getFullYear"] === "function". Actual: ' + (typeof Date.prototype["getFullYear"] )); +if (typeof Date.prototype.getUTCFullYear !== "function") throw new Test262Error('#19: typeof Date.prototype.getUTCFullYear === "function". Actual: ' + (typeof Date.prototype.getUTCFullYear )); +if (typeof Date.prototype['getUTCFullYear'] !== "function") throw new Test262Error('#20: typeof Date.prototype["getUTCFullYear"] === "function". Actual: ' + (typeof Date.prototype["getUTCFullYear"] )); +if (typeof Date.prototype.getMonth !== "function") throw new Test262Error('#21: typeof Date.prototype.getMonth === "function". Actual: ' + (typeof Date.prototype.getMonth )); +if (typeof Date.prototype['getMonth'] !== "function") throw new Test262Error('#22: typeof Date.prototype["getMonth"] === "function". Actual: ' + (typeof Date.prototype["getMonth"] )); +if (typeof Date.prototype.getUTCMonth !== "function") throw new Test262Error('#23: typeof Date.prototype.getUTCMonth === "function". Actual: ' + (typeof Date.prototype.getUTCMonth )); +if (typeof Date.prototype['getUTCMonth'] !== "function") throw new Test262Error('#24: typeof Date.prototype["getUTCMonth"] === "function". Actual: ' + (typeof Date.prototype["getUTCMonth"] )); +if (typeof Date.prototype.getDate !== "function") throw new Test262Error('#25: typeof Date.prototype.getDate === "function". Actual: ' + (typeof Date.prototype.getDate )); +if (typeof Date.prototype['getDate'] !== "function") throw new Test262Error('#26: typeof Date.prototype["getDate"] === "function". Actual: ' + (typeof Date.prototype["getDate"] )); +if (typeof Date.prototype.getUTCDate !== "function") throw new Test262Error('#27: typeof Date.prototype.getUTCDate === "function". Actual: ' + (typeof Date.prototype.getUTCDate )); +if (typeof Date.prototype['getUTCDate'] !== "function") throw new Test262Error('#28: typeof Date.prototype["getUTCDate"] === "function". Actual: ' + (typeof Date.prototype["getUTCDate"] )); +if (typeof Date.prototype.getDay !== "function") throw new Test262Error('#29: typeof Date.prototype.getDay === "function". Actual: ' + (typeof Date.prototype.getDay )); +if (typeof Date.prototype['getDay'] !== "function") throw new Test262Error('#30: typeof Date.prototype["getDay"] === "function". Actual: ' + (typeof Date.prototype["getDay"] )); +if (typeof Date.prototype.getUTCDay !== "function") throw new Test262Error('#31: typeof Date.prototype.getUTCDay === "function". Actual: ' + (typeof Date.prototype.getUTCDay )); +if (typeof Date.prototype['getUTCDay'] !== "function") throw new Test262Error('#32: typeof Date.prototype["getUTCDay"] === "function". Actual: ' + (typeof Date.prototype["getUTCDay"] )); +if (typeof Date.prototype.getHours !== "function") throw new Test262Error('#33: typeof Date.prototype.getHours === "function". Actual: ' + (typeof Date.prototype.getHours )); +if (typeof Date.prototype['getHours'] !== "function") throw new Test262Error('#34: typeof Date.prototype["getHours"] === "function". Actual: ' + (typeof Date.prototype["getHours"] )); +if (typeof Date.prototype.getUTCHours !== "function") throw new Test262Error('#35: typeof Date.prototype.getUTCHours === "function". Actual: ' + (typeof Date.prototype.getUTCHours )); +if (typeof Date.prototype['getUTCHours'] !== "function") throw new Test262Error('#36: typeof Date.prototype["getUTCHours"] === "function". Actual: ' + (typeof Date.prototype["getUTCHours"] )); +if (typeof Date.prototype.getMinutes !== "function") throw new Test262Error('#37: typeof Date.prototype.getMinutes === "function". Actual: ' + (typeof Date.prototype.getMinutes )); +if (typeof Date.prototype['getMinutes'] !== "function") throw new Test262Error('#38: typeof Date.prototype["getMinutes"] === "function". Actual: ' + (typeof Date.prototype["getMinutes"] )); +if (typeof Date.prototype.getUTCMinutes !== "function") throw new Test262Error('#39: typeof Date.prototype.getUTCMinutes === "function". Actual: ' + (typeof Date.prototype.getUTCMinutes )); +if (typeof Date.prototype['getUTCMinutes'] !== "function") throw new Test262Error('#40: typeof Date.prototype["getUTCMinutes"] === "function". Actual: ' + (typeof Date.prototype["getUTCMinutes"] )); +if (typeof Date.prototype.getSeconds !== "function") throw new Test262Error('#41: typeof Date.prototype.getSeconds === "function". Actual: ' + (typeof Date.prototype.getSeconds )); +if (typeof Date.prototype['getSeconds'] !== "function") throw new Test262Error('#42: typeof Date.prototype["getSeconds"] === "function". Actual: ' + (typeof Date.prototype["getSeconds"] )); +if (typeof Date.prototype.getUTCSeconds !== "function") throw new Test262Error('#43: typeof Date.prototype.getUTCSeconds === "function". Actual: ' + (typeof Date.prototype.getUTCSeconds )); +if (typeof Date.prototype['getUTCSeconds'] !== "function") throw new Test262Error('#44: typeof Date.prototype["getUTCSeconds"] === "function". Actual: ' + (typeof Date.prototype["getUTCSeconds"] )); +if (typeof Date.prototype.getMilliseconds !== "function") throw new Test262Error('#45: typeof Date.prototype.getMilliseconds === "function". Actual: ' + (typeof Date.prototype.getMilliseconds )); +if (typeof Date.prototype['getMilliseconds'] !== "function") throw new Test262Error('#46: typeof Date.prototype["getMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["getMilliseconds"] )); +if (typeof Date.prototype.getUTCMilliseconds !== "function") throw new Test262Error('#47: typeof Date.prototype.getUTCMilliseconds === "function". Actual: ' + (typeof Date.prototype.getUTCMilliseconds )); +if (typeof Date.prototype['getUTCMilliseconds'] !== "function") throw new Test262Error('#48: typeof Date.prototype["getUTCMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["getUTCMilliseconds"] )); +if (typeof Date.prototype.setTime !== "function") throw new Test262Error('#49: typeof Date.prototype.setTime === "function". Actual: ' + (typeof Date.prototype.setTime )); +if (typeof Date.prototype['setTime'] !== "function") throw new Test262Error('#50: typeof Date.prototype["setTime"] === "function". Actual: ' + (typeof Date.prototype["setTime"] )); +if (typeof Date.prototype.setMilliseconds !== "function") throw new Test262Error('#51: typeof Date.prototype.setMilliseconds === "function". Actual: ' + (typeof Date.prototype.setMilliseconds )); +if (typeof Date.prototype['setMilliseconds'] !== "function") throw new Test262Error('#52: typeof Date.prototype["setMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["setMilliseconds"] )); +if (typeof Date.prototype.setUTCMilliseconds !== "function") throw new Test262Error('#53: typeof Date.prototype.setUTCMilliseconds === "function". Actual: ' + (typeof Date.prototype.setUTCMilliseconds )); +if (typeof Date.prototype['setUTCMilliseconds'] !== "function") throw new Test262Error('#54: typeof Date.prototype["setUTCMilliseconds"] === "function". Actual: ' + (typeof Date.prototype["setUTCMilliseconds"] )); +if (typeof Date.prototype.setSeconds !== "function") throw new Test262Error('#55: typeof Date.prototype.setSeconds === "function". Actual: ' + (typeof Date.prototype.setSeconds )); +if (typeof Date.prototype['setSeconds'] !== "function") throw new Test262Error('#56: typeof Date.prototype["setSeconds"] === "function". Actual: ' + (typeof Date.prototype["setSeconds"] )); +if (typeof Date.prototype.setUTCSeconds !== "function") throw new Test262Error('#57: typeof Date.prototype.setUTCSeconds === "function". Actual: ' + (typeof Date.prototype.setUTCSeconds )); +if (typeof Date.prototype['setUTCSeconds'] !== "function") throw new Test262Error('#58: typeof Date.prototype["setUTCSeconds"] === "function". Actual: ' + (typeof Date.prototype["setUTCSeconds"] )); +if (typeof Date.prototype.setMinutes !== "function") throw new Test262Error('#59: typeof Date.prototype.setMinutes === "function". Actual: ' + (typeof Date.prototype.setMinutes )); +if (typeof Date.prototype['setMinutes'] !== "function") throw new Test262Error('#60: typeof Date.prototype["setMinutes"] === "function". Actual: ' + (typeof Date.prototype["setMinutes"] )); +if (typeof Date.prototype.setUTCMinutes !== "function") throw new Test262Error('#61: typeof Date.prototype.setUTCMinutes === "function". Actual: ' + (typeof Date.prototype.setUTCMinutes )); +if (typeof Date.prototype['setUTCMinutes'] !== "function") throw new Test262Error('#62: typeof Date.prototype["setUTCMinutes"] === "function". Actual: ' + (typeof Date.prototype["setUTCMinutes"] )); +if (typeof Date.prototype.setHours !== "function") throw new Test262Error('#63: typeof Date.prototype.setHours === "function". Actual: ' + (typeof Date.prototype.setHours )); +if (typeof Date.prototype['setHours'] !== "function") throw new Test262Error('#64: typeof Date.prototype["setHours"] === "function". Actual: ' + (typeof Date.prototype["setHours"] )); +if (typeof Date.prototype.setUTCHours !== "function") throw new Test262Error('#65: typeof Date.prototype.setUTCHours === "function". Actual: ' + (typeof Date.prototype.setUTCHours )); +if (typeof Date.prototype['setUTCHours'] !== "function") throw new Test262Error('#66: typeof Date.prototype["setUTCHours"] === "function". Actual: ' + (typeof Date.prototype["setUTCHours"] )); +if (typeof Date.prototype.setDate !== "function") throw new Test262Error('#67: typeof Date.prototype.setDate === "function". Actual: ' + (typeof Date.prototype.setDate )); +if (typeof Date.prototype['setDate'] !== "function") throw new Test262Error('#68: typeof Date.prototype["setDate"] === "function". Actual: ' + (typeof Date.prototype["setDate"] )); +if (typeof Date.prototype.setUTCDate !== "function") throw new Test262Error('#69: typeof Date.prototype.setUTCDate === "function". Actual: ' + (typeof Date.prototype.setUTCDate )); +if (typeof Date.prototype['setUTCDate'] !== "function") throw new Test262Error('#70: typeof Date.prototype["setUTCDate"] === "function". Actual: ' + (typeof Date.prototype["setUTCDate"] )); +if (typeof Date.prototype.setMonth !== "function") throw new Test262Error('#71: typeof Date.prototype.setMonth === "function". Actual: ' + (typeof Date.prototype.setMonth )); +if (typeof Date.prototype['setMonth'] !== "function") throw new Test262Error('#72: typeof Date.prototype["setMonth"] === "function". Actual: ' + (typeof Date.prototype["setMonth"] )); +if (typeof Date.prototype.setUTCMonth !== "function") throw new Test262Error('#73: typeof Date.prototype.setUTCMonth === "function". Actual: ' + (typeof Date.prototype.setUTCMonth )); +if (typeof Date.prototype['setUTCMonth'] !== "function") throw new Test262Error('#74: typeof Date.prototype["setUTCMonth"] === "function". Actual: ' + (typeof Date.prototype["setUTCMonth"] )); +if (typeof Date.prototype.setFullYear !== "function") throw new Test262Error('#75: typeof Date.prototype.setFullYear === "function". Actual: ' + (typeof Date.prototype.setFullYear )); +if (typeof Date.prototype['setFullYear'] !== "function") throw new Test262Error('#76: typeof Date.prototype["setFullYear"] === "function". Actual: ' + (typeof Date.prototype["setFullYear"] )); +if (typeof Date.prototype.setUTCFullYear !== "function") throw new Test262Error('#77: typeof Date.prototype.setUTCFullYear === "function". Actual: ' + (typeof Date.prototype.setUTCFullYear )); +if (typeof Date.prototype['setUTCFullYear'] !== "function") throw new Test262Error('#78: typeof Date.prototype["setUTCFullYear"] === "function". Actual: ' + (typeof Date.prototype["setUTCFullYear"] )); +if (typeof Date.prototype.toLocaleString !== "function") throw new Test262Error('#81: typeof Date.prototype.toLocaleString === "function". Actual: ' + (typeof Date.prototype.toLocaleString )); +if (typeof Date.prototype['toLocaleString'] !== "function") throw new Test262Error('#82: typeof Date.prototype["toLocaleString"] === "function". Actual: ' + (typeof Date.prototype["toLocaleString"] )); +if (typeof Date.prototype.toUTCString !== "function") throw new Test262Error('#83: typeof Date.prototype.toUTCString === "function". Actual: ' + (typeof Date.prototype.toUTCString )); +if (typeof Date.prototype['toUTCString'] !== "function") throw new Test262Error('#84: typeof Date.prototype["toUTCString"] === "function". Actual: ' + (typeof Date.prototype["toUTCString"] )); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A1.js b/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A1.js new file mode 100644 index 0000000000..1c2f7fe933 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A1.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + [[Get]](P) method should return value when property P does not exist in + instance but prototype contain it +es5id: 8.12.3_A1 +description: > + Try to get P when property P does not exist in instance but + prototype contain it +---*/ + +//Establish foo object +function FooObj(){}; FooObj.prototype.propFoo="some"; + +// Invoke instance of foo object +var __obj= new FooObj; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.propFoo !== "some"){ + throw new Test262Error('#1: function FooObj(){}; FooObj.prototype.propFoo="some"; var __obj= new FooObj; __obj.propFoo === "some". Actual: ' + (__obj.propFoo)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__obj['propFoo'] !== "some"){ + throw new Test262Error('#1: function FooObj(){}; FooObj.prototype.propFoo="some"; var __obj= new FooObj; __obj[\'propFoo\'] === "some". Actual: ' + (__obj['propFoo'])); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A2.js b/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A2.js new file mode 100644 index 0000000000..ff1cf489d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + [[Get]](P) method should return undefined when property P does not exist + both in instance and prototype +es5id: 8.12.3_A2 +description: > + Try to get P when property P does not exist both in instance and + prototype +---*/ + +var __obj={}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__obj.propFoo !== undefined){ + throw new Test262Error('#1: var __obj={}; __obj.propFoo === undefined. Actual: ' + (__obj.propFoo)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__obj['propFoo'] !== undefined){ + throw new Test262Error('#2: var __obj={}; __obj[\'propFoo\'] === undefined. Actual: ' + (__obj['propFoo'])); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A3.js b/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A3.js new file mode 100644 index 0000000000..5465bc0add --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/S8.12.3_A3.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + When the [[Get]] method of O is called with property name P value of P + returns +es5id: 8.12.3_A3 +description: Try to get P property P exist in instance +---*/ + +var __map={shape:"cube", 5:"five", "6":"six"}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__map.shape !== "cube"){ + throw new Test262Error('#1: var __map={shape:"cube", 5:"five", "6":"six"}; __map.shape === "cube". Actual: ' + (__map.shape)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__map["shape"] !== "cube"){ + throw new Test262Error('#2: var __map={shape:"cube", 5:"five", "6":"six"}; __map["shape"] === "cube". Actual: ' + (__map["shape"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__map["5"] !== "five"){ + throw new Test262Error('#3: var __map={shape:"cube", 5:"five", "6":"six"}; __map["5"] === "five". Actual: ' + (__map["5"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (__map[5] !== "five"){ + throw new Test262Error('#4: var __map={shape:"cube", 5:"five", "6":"six"}; __map[5] === "five". Actual: ' + (__map[5])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (__map["6"] !== "six"){ + throw new Test262Error('#5: var __map={shape:"cube", 5:"five", "6":"six"}; __map["6"] === "six". Actual: ' + (__map["6"])); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if (__map[6] !== "six"){ + throw new Test262Error('#6: var __map={shape:"cube", 5:"five", "6":"six"}; __map[6] === "six". Actual: ' + (__map[6])); +} +// +////////////////////////////////////////////////////////////////////////////// + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/property-accessors/browser.js b/js/src/tests/test262/language/expressions/property-accessors/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/property-accessors/non-identifier-name.js b/js/src/tests/test262/language/expressions/property-accessors/non-identifier-name.js new file mode 100644 index 0000000000..50721f9219 --- /dev/null +++ b/js/src/tests/test262/language/expressions/property-accessors/non-identifier-name.js @@ -0,0 +1,21 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-left-hand-side-expressions +info: | + Token following DOT must be a valid identifier-name, test with string literal. +description: > + 12.3 Left-Hand-Side Expressions + MemberExpression[Yield, Await]: + MemberExpression[?Yield, ?Await] . IdentifierName + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +unresolvableReference.""; diff --git a/js/src/tests/test262/language/expressions/property-accessors/shell.js b/js/src/tests/test262/language/expressions/property-accessors/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/relational/S9.1_A1_T4.js b/js/src/tests/test262/language/expressions/relational/S9.1_A1_T4.js new file mode 100644 index 0000000000..0f156d0fdf --- /dev/null +++ b/js/src/tests/test262/language/expressions/relational/S9.1_A1_T4.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of primitive conversion from object is a default value for the + Object +es5id: 9.1_A1_T4 +description: > + Using operator "<". The operator firstly calls ToPrimitive and + then calls ToString or ToNumber +---*/ + +// CHECK#1 +var object = {valueOf: function() {return -2}, toString: function() {return "-2"}}; +if ("-1" < object) { + throw new Test262Error('#1: var object = {valueOf: function() {return -2}, toString: function() {return "-2"}}; "-1" < object'); +} + +// CHECK#2 +var object = {valueOf: function() {return "-2"}, toString: function() {return -2}}; +if (object < "-1") { + throw new Test262Error('#2: var object = {valueOf: function() {return "-2"}, toString: function() {return -2}}; object < "-1"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/relational/browser.js b/js/src/tests/test262/language/expressions/relational/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/relational/shell.js b/js/src/tests/test262/language/expressions/relational/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A1.js new file mode 100644 index 0000000000..1ce8b94542 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between ShiftExpression and ">>" or + between ">>" and AdditiveExpression are allowed +es5id: 11.7.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("-4\u0009>>\u00091") !== -2) { + throw new Test262Error('#1: -4\\u0009>>\\u00091 === -2'); +} + +//CHECK#2 +if (eval("-4\u000B>>\u000B1") !== -2) { + throw new Test262Error('#2: -4\\u000B>>\\u000B1 === -2'); +} + +//CHECK#3 +if (eval("-4\u000C>>\u000C1") !== -2) { + throw new Test262Error('#3: -4\\u000C>>\\u000C1 === -2'); +} + +//CHECK#4 +if (eval("-4\u0020>>\u00201") !== -2) { + throw new Test262Error('#4: -4\\u0020>>\\u00201 === -2'); +} + +//CHECK#5 +if (eval("-4\u00A0>>\u00A01") !== -2) { + throw new Test262Error('#5: -4\\u00A0>>\\u00A01 === -2'); +} + +//CHECK#6 +if (eval("-4\u000A>>\u000A1") !== -2) { + throw new Test262Error('#6: -4\\u000A>>\\u000A1 === -2'); +} + +//CHECK#7 +if (eval("-4\u000D>>\u000D1") !== -2) { + throw new Test262Error('#7: -4\\u000D>>\\u000D1 === -2'); +} + +//CHECK#8 +if (eval("-4\u2028>>\u20281") !== -2) { + throw new Test262Error('#8: -4\\u2028>>\\u20281 === -2'); +} + +//CHECK#9 +if (eval("-4\u2029>>\u20291") !== -2) { + throw new Test262Error('#9: -4\\u2029>>\\u20291 === -2'); +} + +//CHECK#10 +if (eval("-4\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>>\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== -2) { + throw new Test262Error('#10: -4\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>>\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === -2'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T1.js new file mode 100644 index 0000000000..cca0fb8c25 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y uses GetValue +es5id: 11.7.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (-4 >> 1 !== -2) { + throw new Test262Error('#1: -4 >> 1 === -2. Actual: ' + (-4 >> 1)); +} + +//CHECK#2 +var x = -4; +if (x >> 1 !== -2) { + throw new Test262Error('#2: var x = -4; x >> 1 === -2. Actual: ' + (x >> 1)); +} + +//CHECK#3 +var y = 1; +if (-4 >> y !== -2) { + throw new Test262Error('#3: var y = 1; -4 >> y === -2. Actual: ' + (-4 >> y)); +} + +//CHECK#4 +var x = -4; +var y = 1; +if (x >> y !== -2) { + throw new Test262Error('#4: var x = -4; var y = 1; x >> y === -2. Actual: ' + (x >> y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = -4; +objecty.prop = 1; +if (objectx.prop >> objecty.prop !== -2) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = -4; objecty.prop = 1; objectx.prop >> objecty.prop === -2. Actual: ' + (objectx.prop >> objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T2.js new file mode 100644 index 0000000000..eb87c91d02 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y uses GetValue +es5id: 11.7.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x >> 1; + throw new Test262Error('#1.1: x >> 1 throw ReferenceError. Actual: ' + (x >> 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >> 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T3.js new file mode 100644 index 0000000000..ecc0c70543 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y uses GetValue +es5id: 11.7.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 >> y; + throw new Test262Error('#1.1: 1 >> y throw ReferenceError. Actual: ' + (1 >> y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 >> y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.2_T1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.2_T1.js new file mode 100644 index 0000000000..abb86064e3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y uses [[Default Value]] +es5id: 11.7.2_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return -4}} >> 1 !== -2) { + throw new Test262Error('#1: {valueOf: function() {return -4}} >> 1 === -2. Actual: ' + ({valueOf: function() {return -4}} >> 1)); +} + +//CHECK#2 +if ({valueOf: function() {return -4}, toString: function() {return 0}} >> 1 !== -2) { + throw new Test262Error('#2: {valueOf: function() {return -4}, toString: function() {return 0}} >> 1 === -2. Actual: ' + ({valueOf: function() {return -4}, toString: function() {return 0}} >> 1)); +} + +//CHECK#3 +if ({valueOf: function() {return -4}, toString: function() {return {}}} >> 1 !== -2) { + throw new Test262Error('#3: {valueOf: function() {return -4}, toString: function() {return {}}} >> 1 === -2. Actual: ' + ({valueOf: function() {return -4}, toString: function() {return {}}} >> 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return -4}, toString: function() {throw "error"}} >> 1 !== -2) { + throw new Test262Error('#4.1: {valueOf: function() {return -4}, toString: function() {throw "error"}} >> 1 === -2. Actual: ' + ({valueOf: function() {return -4}, toString: function() {throw "error"}} >> 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return -4}, toString: function() {throw "error"}} >> 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return -4}, toString: function() {throw "error"}} >> 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (-4 >> {toString: function() {return 1}} !== -2) { + throw new Test262Error('#5: -4 >> {toString: function() {return 1}} === -2. Actual: ' + (-4 >> {toString: function() {return 1}})); +} + +//CHECK#6 +if (-4 >> {valueOf: function() {return {}}, toString: function() {return 1}} !== -2) { + throw new Test262Error('#6: -4 >> {valueOf: function() {return {}}, toString: function() {return 1}} === -2. Actual: ' + (-4 >> {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + -4 >> {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: -4 >> {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (-4 >> {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: -4 >> {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + -4 >> {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: -4 >> {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (-4 >> {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: -4 >> {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.3_T1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.3_T1.js new file mode 100644 index 0000000000..dbc688c97e --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.7.2_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x >> y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x >> y throw "x". Actual: ' + (x >> y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x >> y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T1.js new file mode 100644 index 0000000000..d1978e2ba1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) >> x !== 0) { + throw new Test262Error('#1: var x = 0; (x = 1) >> x === 0. Actual: ' + ((x = 1) >> x)); +} + +//CHECK#2 +var x = -4; +if (x >> (x = 1) !== -2) { + throw new Test262Error('#2: var x = -4; x >> (x = 1) === -2. Actual: ' + (x >> (x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T2.js new file mode 100644 index 0000000000..7dbe621ea2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() >> y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() >> y() throw "x". Actual: ' + (x() >> y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() >> y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T3.js new file mode 100644 index 0000000000..42d4306bc3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.2_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x >> (x = 1); + throw new Test262Error('#1.1: x >> (x = 1) throw ReferenceError. Actual: ' + (x >> (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >> (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T4.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T4.js new file mode 100644 index 0000000000..6c040d3a83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.2_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) >> y !== 0) { + throw new Test262Error('#1: (y = 1) >> y === 0. Actual: ' + ((y = 1) >> y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.1.js new file mode 100644 index 0000000000..64e68c6340 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (true >> true !== 0) { + throw new Test262Error('#1: true >> true === 0. Actual: ' + (true >> true)); +} + +//CHECK#2 +if (new Boolean(true) >> true !== 0) { + throw new Test262Error('#2: new Boolean(true) >> true === 0. Actual: ' + (new Boolean(true) >> true)); +} + +//CHECK#3 +if (true >> new Boolean(true) !== 0) { + throw new Test262Error('#3: true >> new Boolean(true) === 0. Actual: ' + (true >> new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) >> new Boolean(true) !== 0) { + throw new Test262Error('#4: new Boolean(true) >> new Boolean(true) === 0. Actual: ' + (new Boolean(true) >> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.2.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.2.js new file mode 100644 index 0000000000..317d44ce32 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if (1 >> 1 !== 0) { + throw new Test262Error('#1: 1 >> 1 === 0. Actual: ' + (1 >> 1)); +} + +//CHECK#2 +if (new Number(1) >> 1 !== 0) { + throw new Test262Error('#2: new Number(1) >> 1 === 0. Actual: ' + (new Number(1) >> 1)); +} + +//CHECK#3 +if (1 >> new Number(1) !== 0) { + throw new Test262Error('#3: 1 >> new Number(1) === 0. Actual: ' + (1 >> new Number(1))); +} + +//CHECK#4 +if (new Number(1) >> new Number(1) !== 0) { + throw new Test262Error('#4: new Number(1) >> new Number(1) === 0. Actual: ' + (new Number(1) >> new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.3.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.3.js new file mode 100644 index 0000000000..0cfb5ed256 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if ("1" >> "1" !== 0) { + throw new Test262Error('#1: "1" >> "1" === 0. Actual: ' + ("1" >> "1")); +} + +//CHECK#2 +if (new String("1") >> "1" !== 0) { + throw new Test262Error('#2: new String("1") >> "1" === 0. Actual: ' + (new String("1") >> "1")); +} + +//CHECK#3 +if ("1" >> new String("1") !== 0) { + throw new Test262Error('#3: "1" >> new String("1") === 0. Actual: ' + ("1" >> new String("1"))); +} + +//CHECK#4 +if (new String("1") >> new String("1") !== 0) { + throw new Test262Error('#4: new String("1") >> new String("1") === 0. Actual: ' + (new String("1") >> new String("1"))); +} + +//CHECK#5 +if ("x" >> "1" !== 0) { + throw new Test262Error('#5: "x" >> "1" === 0. Actual: ' + ("x" >> "1")); +} + +//CHECK#6 +if ("1" >> "x" !== 1) { + throw new Test262Error('#6: "1" >> "x" === 1. Actual: ' + ("1" >> "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.4.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.4.js new file mode 100644 index 0000000000..e14656e7c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if (null >> undefined !== 0) { + throw new Test262Error('#1: null >> undefined === 0. Actual: ' + (null >> undefined)); +} + +//CHECK#2 +if (undefined >> null !== 0) { + throw new Test262Error('#2: undefined >> null === 0. Actual: ' + (undefined >> null)); +} + +//CHECK#3 +if (undefined >> undefined !== 0) { + throw new Test262Error('#3: undefined >> undefined === 0. Actual: ' + (undefined >> undefined)); +} + +//CHECK#4 +if (null >> null !== 0) { + throw new Test262Error('#4: null >> null === 0. Actual: ' + (null >> null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.5.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.5.js new file mode 100644 index 0000000000..51c8d0213c --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (({} >> function(){return 1}) !== 0) { + throw new Test262Error('#1: ({} >> function(){return 1}) === 0. Actual: ' + (({} >> function(){return 1}))); +} + +//CHECK#2 +if ((function(){return 1} >> {}) !== 0) { + throw new Test262Error('#2: (function(){return 1} >> {}) === 0. Actual: ' + ((function(){return 1} >> {}))); +} + +//CHECK#3 +if ((function(){return 1} >> function(){return 1}) !== 0) { + throw new Test262Error('#3: (function(){return 1} >> function(){return 1}) === 0. Actual: ' + ((function(){return 1} >> function(){return 1}))); +} + +//CHECK#4 +if (({} >> {}) !== 0) { + throw new Test262Error('#4: ({} >> {}) === 0. Actual: ' + (({} >> {}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.1.js new file mode 100644 index 0000000000..4ba4c9f4dd --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true >> 1 !== 0) { + throw new Test262Error('#1: true >> 1 === 0. Actual: ' + (true >> 1)); +} + +//CHECK#2 +if (1 >> true !== 0) { + throw new Test262Error('#2: 1 >> true === 0. Actual: ' + (1 >> true)); +} + +//CHECK#3 +if (new Boolean(true) >> 1 !== 0) { + throw new Test262Error('#3: new Boolean(true) >> 1 === 0. Actual: ' + (new Boolean(true) >> 1)); +} + +//CHECK#4 +if (1 >> new Boolean(true) !== 0) { + throw new Test262Error('#4: 1 >> new Boolean(true) === 0. Actual: ' + (1 >> new Boolean(true))); +} + +//CHECK#5 +if (true >> new Number(1) !== 0) { + throw new Test262Error('#5: true >> new Number(1) === 0. Actual: ' + (true >> new Number(1))); +} + +//CHECK#6 +if (new Number(1) >> true !== 0) { + throw new Test262Error('#6: new Number(1) >> true === 0. Actual: ' + (new Number(1) >> true)); +} + +//CHECK#7 +if (new Boolean(true) >> new Number(1) !== 0) { + throw new Test262Error('#7: new Boolean(true) >> new Number(1) === 0. Actual: ' + (new Boolean(true) >> new Number(1))); +} + +//CHECK#8 +if (new Number(1) >> new Boolean(true) !== 0) { + throw new Test262Error('#8: new Number(1) >> new Boolean(true) === 0. Actual: ' + (new Number(1) >> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.2.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.2.js new file mode 100644 index 0000000000..e1ecc86546 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if ("1" >> 1 !== 0) { + throw new Test262Error('#1: "1" >> 1 === 0. Actual: ' + ("1" >> 1)); +} + +//CHECK#2 +if (1 >> "1" !== 0) { + throw new Test262Error('#2: 1 >> "1" === 0. Actual: ' + (1 >> "1")); +} + +//CHECK#3 +if (new String("1") >> 1 !== 0) { + throw new Test262Error('#3: new String("1") >> 1 === 0. Actual: ' + (new String("1") >> 1)); +} + +//CHECK#4 +if (1 >> new String("1") !== 0) { + throw new Test262Error('#4: 1 >> new String("1") === 0. Actual: ' + (1 >> new String("1"))); +} + +//CHECK#5 +if ("1" >> new Number(1) !== 0) { + throw new Test262Error('#5: "1" >> new Number(1) === 0. Actual: ' + ("1" >> new Number(1))); +} + +//CHECK#6 +if (new Number(1) >> "1" !== 0) { + throw new Test262Error('#6: new Number(1) >> "1" === 0. Actual: ' + (new Number(1) >> "1")); +} + +//CHECK#7 +if (new String("1") >> new Number(1) !== 0) { + throw new Test262Error('#7: new String("1") >> new Number(1) === 0. Actual: ' + (new String("1") >> new Number(1))); +} + +//CHECK#8 +if (new Number(1) >> new String("1") !== 0) { + throw new Test262Error('#8: new Number(1) >> new String("1") === 0. Actual: ' + (new Number(1) >> new String("1"))); +} + +//CHECK#9 +if ("x" >> 1 !== 0) { + throw new Test262Error('#9: "x" >> 1 === 0. Actual: ' + ("x" >> 1)); +} + +//CHECK#10 +if (1 >> "x" !== 1) { + throw new Test262Error('#10: 1 >> "x" === 1. Actual: ' + (1 >> "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.3.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.3.js new file mode 100644 index 0000000000..9fdf5edb11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 >> null !== 1) { + throw new Test262Error('#1: 1 >> null === 1. Actual: ' + (1 >> null)); +} + +//CHECK#2 +if (null >> 1 !== 0) { + throw new Test262Error('#2: null >> 1 === 0. Actual: ' + (null >> 1)); +} + +//CHECK#3 +if (new Number(1) >> null !== 1) { + throw new Test262Error('#3: new Number(1) >> null === 1. Actual: ' + (new Number(1) >> null)); +} + +//CHECK#4 +if (null >> new Number(1) !== 0) { + throw new Test262Error('#4: null >> new Number(1) === 0. Actual: ' + (null >> new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.4.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.4.js new file mode 100644 index 0000000000..bc224774a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 >> undefined !== 1) { + throw new Test262Error('#1: 1 >> undefined === 1. Actual: ' + (1 >> undefined)); +} + +//CHECK#2 +if (undefined >> 1 !== 0) { + throw new Test262Error('#2: undefined >> 1 === 0. Actual: ' + (undefined >> 1)); +} + +//CHECK#3 +if (new Number(1) >> undefined !== 1) { + throw new Test262Error('#3: new Number(1) >> undefined === 1. Actual: ' + (new Number(1) >> undefined)); +} + +//CHECK#4 +if (undefined >> new Number(1) !== 0) { + throw new Test262Error('#4: undefined >> new Number(1) === 0. Actual: ' + (undefined >> new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.5.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.5.js new file mode 100644 index 0000000000..7d994b4d53 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true >> "1" !== 0) { + throw new Test262Error('#1: true >> "1" === 0. Actual: ' + (true >> "1")); +} + +//CHECK#2 +if ("1" >> true !== 0) { + throw new Test262Error('#2: "1" >> true === 0. Actual: ' + ("1" >> true)); +} + +//CHECK#3 +if (new Boolean(true) >> "1" !== 0) { + throw new Test262Error('#3: new Boolean(true) >> "1" === 0. Actual: ' + (new Boolean(true) >> "1")); +} + +//CHECK#4 +if ("1" >> new Boolean(true) !== 0) { + throw new Test262Error('#4: "1" >> new Boolean(true) === 0. Actual: ' + ("1" >> new Boolean(true))); +} + +//CHECK#5 +if (true >> new String("1") !== 0) { + throw new Test262Error('#5: true >> new String("1") === 0. Actual: ' + (true >> new String("1"))); +} + +//CHECK#6 +if (new String("1") >> true !== 0) { + throw new Test262Error('#6: new String("1") >> true === 0. Actual: ' + (new String("1") >> true)); +} + +//CHECK#7 +if (new Boolean(true) >> new String("1") !== 0) { + throw new Test262Error('#7: new Boolean(true) >> new String("1") === 0. Actual: ' + (new Boolean(true) >> new String("1"))); +} + +//CHECK#8 +if (new String("1") >> new Boolean(true) !== 0) { + throw new Test262Error('#8: new String("1") >> new Boolean(true) === 0. Actual: ' + (new String("1") >> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.6.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.6.js new file mode 100644 index 0000000000..0fcdb2db86 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" >> undefined !== 1) { + throw new Test262Error('#1: "1" >> undefined === 1. Actual: ' + ("1" >> undefined)); +} + +//CHECK#2 +if (undefined >> "1" !== 0) { + throw new Test262Error('#2: undefined >> "1" === 0. Actual: ' + (undefined >> "1")); +} + +//CHECK#3 +if (new String("1") >> undefined !== 1) { + throw new Test262Error('#3: new String("1") >> undefined === 1. Actual: ' + (new String("1") >> undefined)); +} + +//CHECK#4 +if (undefined >> new String("1") !== 0) { + throw new Test262Error('#4: undefined >> new String("1") === 0. Actual: ' + (undefined >> new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.7.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.7.js new file mode 100644 index 0000000000..ea9c4a4c54 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" >> null !== 1) { + throw new Test262Error('#1: "1" >> null === 1. Actual: ' + ("1" >> null)); +} + +//CHECK#2 +if (null >> "1" !== 0) { + throw new Test262Error('#2: null >> "1" === 0. Actual: ' + (null >> "1")); +} + +//CHECK#3 +if (new String("1") >> null !== 1) { + throw new Test262Error('#3: new String("1") >> null === 1. Actual: ' + (new String("1") >> null)); +} + +//CHECK#4 +if (null >> new String("1") !== 0) { + throw new Test262Error('#4: null >> new String("1") === 0. Actual: ' + (null >> new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.8.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.8.js new file mode 100644 index 0000000000..dbfd7d265d --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true >> undefined !== 1) { + throw new Test262Error('#1: true >> undefined === 1. Actual: ' + (true >> undefined)); +} + +//CHECK#2 +if (undefined >> true !== 0) { + throw new Test262Error('#2: undefined >> true === 0. Actual: ' + (undefined >> true)); +} + +//CHECK#3 +if (new Boolean(true) >> undefined !== 1) { + throw new Test262Error('#3: new Boolean(true) >> undefined === 1. Actual: ' + (new Boolean(true) >> undefined)); +} + +//CHECK#4 +if (undefined >> new Boolean(true) !== 0) { + throw new Test262Error('#4: undefined >> new Boolean(true) === 0. Actual: ' + (undefined >> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.9.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.9.js new file mode 100644 index 0000000000..f9e299a390 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y returns ToNumber(x) >> ToNumber(y) +es5id: 11.7.2_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true >> null !== 1) { + throw new Test262Error('#1: true >> null === 1. Actual: ' + (true >> null)); +} + +//CHECK#2 +if (null >> true !== 0) { + throw new Test262Error('#2: null >> true === 0. Actual: ' + (null >> true)); +} + +//CHECK#3 +if (new Boolean(true) >> null !== 1) { + throw new Test262Error('#3: new Boolean(true) >> null === 1. Actual: ' + (new Boolean(true) >> null)); +} + +//CHECK#4 +if (null >> new Boolean(true) !== 0) { + throw new Test262Error('#4: null >> new Boolean(true) === 0. Actual: ' + (null >> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T1.js new file mode 100644 index 0000000000..f6c211d5ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T1.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check x >> y operator in distinct points +es5id: 11.7.2_A4_T1 +description: ShiftExpression = -2^n, n = 0...15 +---*/ + +//CHECK + +if (-1 >> 0 !== -1) { + throw new Test262Error('#1: -1 >> 0 === -1. Actual: ' + (-1 >> 0)); +} + + +if (-2 >> 0 !== -2) { + throw new Test262Error('#2: -2 >> 0 === -2. Actual: ' + (-2 >> 0)); +} + + +if (-4 >> 0 !== -4) { + throw new Test262Error('#3: -4 >> 0 === -4. Actual: ' + (-4 >> 0)); +} + + +if (-8 >> 0 !== -8) { + throw new Test262Error('#4: -8 >> 0 === -8. Actual: ' + (-8 >> 0)); +} + + +if (-16 >> 0 !== -16) { + throw new Test262Error('#5: -16 >> 0 === -16. Actual: ' + (-16 >> 0)); +} + + +if (-32 >> 0 !== -32) { + throw new Test262Error('#6: -32 >> 0 === -32. Actual: ' + (-32 >> 0)); +} + + +if (-64 >> 0 !== -64) { + throw new Test262Error('#7: -64 >> 0 === -64. Actual: ' + (-64 >> 0)); +} + + +if (-128 >> 0 !== -128) { + throw new Test262Error('#8: -128 >> 0 === -128. Actual: ' + (-128 >> 0)); +} + + +if (-256 >> 0 !== -256) { + throw new Test262Error('#9: -256 >> 0 === -256. Actual: ' + (-256 >> 0)); +} + + +if (-512 >> 0 !== -512) { + throw new Test262Error('#10: -512 >> 0 === -512. Actual: ' + (-512 >> 0)); +} + + +if (-1024 >> 0 !== -1024) { + throw new Test262Error('#11: -1024 >> 0 === -1024. Actual: ' + (-1024 >> 0)); +} + + +if (-2048 >> 0 !== -2048) { + throw new Test262Error('#12: -2048 >> 0 === -2048. Actual: ' + (-2048 >> 0)); +} + + +if (-4096 >> 0 !== -4096) { + throw new Test262Error('#13: -4096 >> 0 === -4096. Actual: ' + (-4096 >> 0)); +} + + +if (-8192 >> 0 !== -8192) { + throw new Test262Error('#14: -8192 >> 0 === -8192. Actual: ' + (-8192 >> 0)); +} + + +if (-16384 >> 0 !== -16384) { + throw new Test262Error('#15: -16384 >> 0 === -16384. Actual: ' + (-16384 >> 0)); +} + + +if (-32768 >> 0 !== -32768) { + throw new Test262Error('#16: -32768 >> 0 === -32768. Actual: ' + (-32768 >> 0)); +} + + +if (-65536 >> 0 !== -65536) { + throw new Test262Error('#17: -65536 >> 0 === -65536. Actual: ' + (-65536 >> 0)); +} + + +if (-131072 >> 0 !== -131072) { + throw new Test262Error('#18: -131072 >> 0 === -131072. Actual: ' + (-131072 >> 0)); +} + + +if (-262144 >> 0 !== -262144) { + throw new Test262Error('#19: -262144 >> 0 === -262144. Actual: ' + (-262144 >> 0)); +} + + +if (-524288 >> 0 !== -524288) { + throw new Test262Error('#20: -524288 >> 0 === -524288. Actual: ' + (-524288 >> 0)); +} + + +if (-1048576 >> 0 !== -1048576) { + throw new Test262Error('#21: -1048576 >> 0 === -1048576. Actual: ' + (-1048576 >> 0)); +} + + +if (-2097152 >> 0 !== -2097152) { + throw new Test262Error('#22: -2097152 >> 0 === -2097152. Actual: ' + (-2097152 >> 0)); +} + + +if (-4194304 >> 0 !== -4194304) { + throw new Test262Error('#23: -4194304 >> 0 === -4194304. Actual: ' + (-4194304 >> 0)); +} + + +if (-8388608 >> 0 !== -8388608) { + throw new Test262Error('#24: -8388608 >> 0 === -8388608. Actual: ' + (-8388608 >> 0)); +} + + +if (-16777216 >> 0 !== -16777216) { + throw new Test262Error('#25: -16777216 >> 0 === -16777216. Actual: ' + (-16777216 >> 0)); +} + + +if (-33554432 >> 0 !== -33554432) { + throw new Test262Error('#26: -33554432 >> 0 === -33554432. Actual: ' + (-33554432 >> 0)); +} + + +if (-67108864 >> 0 !== -67108864) { + throw new Test262Error('#27: -67108864 >> 0 === -67108864. Actual: ' + (-67108864 >> 0)); +} + + +if (-134217728 >> 0 !== -134217728) { + throw new Test262Error('#28: -134217728 >> 0 === -134217728. Actual: ' + (-134217728 >> 0)); +} + + +if (-268435456 >> 0 !== -268435456) { + throw new Test262Error('#29: -268435456 >> 0 === -268435456. Actual: ' + (-268435456 >> 0)); +} + + +if (-536870912 >> 0 !== -536870912) { + throw new Test262Error('#30: -536870912 >> 0 === -536870912. Actual: ' + (-536870912 >> 0)); +} + + +if (-1073741824 >> 0 !== -1073741824) { + throw new Test262Error('#31: -1073741824 >> 0 === -1073741824. Actual: ' + (-1073741824 >> 0)); +} + + +if (-2147483648 >> 0 !== -2147483648) { + throw new Test262Error('#32: -2147483648 >> 0 === -2147483648. Actual: ' + (-2147483648 >> 0)); +} + + +if (-1 >> 1 !== -1) { + throw new Test262Error('#33: -1 >> 1 === -1. Actual: ' + (-1 >> 1)); +} + + +if (-2 >> 1 !== -1) { + throw new Test262Error('#34: -2 >> 1 === -1. Actual: ' + (-2 >> 1)); +} + + +if (-4 >> 1 !== -2) { + throw new Test262Error('#35: -4 >> 1 === -2. Actual: ' + (-4 >> 1)); +} + + +if (-8 >> 1 !== -4) { + throw new Test262Error('#36: -8 >> 1 === -4. Actual: ' + (-8 >> 1)); +} + + +if (-16 >> 1 !== -8) { + throw new Test262Error('#37: -16 >> 1 === -8. Actual: ' + (-16 >> 1)); +} + + +if (-32 >> 1 !== -16) { + throw new Test262Error('#38: -32 >> 1 === -16. Actual: ' + (-32 >> 1)); +} + + +if (-64 >> 1 !== -32) { + throw new Test262Error('#39: -64 >> 1 === -32. Actual: ' + (-64 >> 1)); +} + + +if (-128 >> 1 !== -64) { + throw new Test262Error('#40: -128 >> 1 === -64. Actual: ' + (-128 >> 1)); +} + + +if (-256 >> 1 !== -128) { + throw new Test262Error('#41: -256 >> 1 === -128. Actual: ' + (-256 >> 1)); +} + + +if (-512 >> 1 !== -256) { + throw new Test262Error('#42: -512 >> 1 === -256. Actual: ' + (-512 >> 1)); +} + + +if (-1024 >> 1 !== -512) { + throw new Test262Error('#43: -1024 >> 1 === -512. Actual: ' + (-1024 >> 1)); +} + + +if (-2048 >> 1 !== -1024) { + throw new Test262Error('#44: -2048 >> 1 === -1024. Actual: ' + (-2048 >> 1)); +} + + +if (-4096 >> 1 !== -2048) { + throw new Test262Error('#45: -4096 >> 1 === -2048. Actual: ' + (-4096 >> 1)); +} + + +if (-8192 >> 1 !== -4096) { + throw new Test262Error('#46: -8192 >> 1 === -4096. Actual: ' + (-8192 >> 1)); +} + + +if (-16384 >> 1 !== -8192) { + throw new Test262Error('#47: -16384 >> 1 === -8192. Actual: ' + (-16384 >> 1)); +} + + +if (-32768 >> 1 !== -16384) { + throw new Test262Error('#48: -32768 >> 1 === -16384. Actual: ' + (-32768 >> 1)); +} + + +if (-65536 >> 1 !== -32768) { + throw new Test262Error('#49: -65536 >> 1 === -32768. Actual: ' + (-65536 >> 1)); +} + + +if (-131072 >> 1 !== -65536) { + throw new Test262Error('#50: -131072 >> 1 === -65536. Actual: ' + (-131072 >> 1)); +} + + +if (-262144 >> 1 !== -131072) { + throw new Test262Error('#51: -262144 >> 1 === -131072. Actual: ' + (-262144 >> 1)); +} + + +if (-524288 >> 1 !== -262144) { + throw new Test262Error('#52: -524288 >> 1 === -262144. Actual: ' + (-524288 >> 1)); +} + + +if (-1048576 >> 1 !== -524288) { + throw new Test262Error('#53: -1048576 >> 1 === -524288. Actual: ' + (-1048576 >> 1)); +} + + +if (-2097152 >> 1 !== -1048576) { + throw new Test262Error('#54: -2097152 >> 1 === -1048576. Actual: ' + (-2097152 >> 1)); +} + + +if (-4194304 >> 1 !== -2097152) { + throw new Test262Error('#55: -4194304 >> 1 === -2097152. Actual: ' + (-4194304 >> 1)); +} + + +if (-8388608 >> 1 !== -4194304) { + throw new Test262Error('#56: -8388608 >> 1 === -4194304. Actual: ' + (-8388608 >> 1)); +} + + +if (-16777216 >> 1 !== -8388608) { + throw new Test262Error('#57: -16777216 >> 1 === -8388608. Actual: ' + (-16777216 >> 1)); +} + + +if (-33554432 >> 1 !== -16777216) { + throw new Test262Error('#58: -33554432 >> 1 === -16777216. Actual: ' + (-33554432 >> 1)); +} + + +if (-67108864 >> 1 !== -33554432) { + throw new Test262Error('#59: -67108864 >> 1 === -33554432. Actual: ' + (-67108864 >> 1)); +} + + +if (-134217728 >> 1 !== -67108864) { + throw new Test262Error('#60: -134217728 >> 1 === -67108864. Actual: ' + (-134217728 >> 1)); +} + + +if (-268435456 >> 1 !== -134217728) { + throw new Test262Error('#61: -268435456 >> 1 === -134217728. Actual: ' + (-268435456 >> 1)); +} + + +if (-536870912 >> 1 !== -268435456) { + throw new Test262Error('#62: -536870912 >> 1 === -268435456. Actual: ' + (-536870912 >> 1)); +} + + +if (-1073741824 >> 1 !== -536870912) { + throw new Test262Error('#63: -1073741824 >> 1 === -536870912. Actual: ' + (-1073741824 >> 1)); +} + + +if (-2147483648 >> 1 !== -1073741824) { + throw new Test262Error('#64: -2147483648 >> 1 === -1073741824. Actual: ' + (-2147483648 >> 1)); +} + + +if (-1 >> 2 !== -1) { + throw new Test262Error('#65: -1 >> 2 === -1. Actual: ' + (-1 >> 2)); +} + + +if (-2 >> 2 !== -1) { + throw new Test262Error('#66: -2 >> 2 === -1. Actual: ' + (-2 >> 2)); +} + + +if (-4 >> 2 !== -1) { + throw new Test262Error('#67: -4 >> 2 === -1. Actual: ' + (-4 >> 2)); +} + + +if (-8 >> 2 !== -2) { + throw new Test262Error('#68: -8 >> 2 === -2. Actual: ' + (-8 >> 2)); +} + + +if (-16 >> 2 !== -4) { + throw new Test262Error('#69: -16 >> 2 === -4. Actual: ' + (-16 >> 2)); +} + + +if (-32 >> 2 !== -8) { + throw new Test262Error('#70: -32 >> 2 === -8. Actual: ' + (-32 >> 2)); +} + + +if (-64 >> 2 !== -16) { + throw new Test262Error('#71: -64 >> 2 === -16. Actual: ' + (-64 >> 2)); +} + + +if (-128 >> 2 !== -32) { + throw new Test262Error('#72: -128 >> 2 === -32. Actual: ' + (-128 >> 2)); +} + + +if (-256 >> 2 !== -64) { + throw new Test262Error('#73: -256 >> 2 === -64. Actual: ' + (-256 >> 2)); +} + + +if (-512 >> 2 !== -128) { + throw new Test262Error('#74: -512 >> 2 === -128. Actual: ' + (-512 >> 2)); +} + + +if (-1024 >> 2 !== -256) { + throw new Test262Error('#75: -1024 >> 2 === -256. Actual: ' + (-1024 >> 2)); +} + + +if (-2048 >> 2 !== -512) { + throw new Test262Error('#76: -2048 >> 2 === -512. Actual: ' + (-2048 >> 2)); +} + + +if (-4096 >> 2 !== -1024) { + throw new Test262Error('#77: -4096 >> 2 === -1024. Actual: ' + (-4096 >> 2)); +} + + +if (-8192 >> 2 !== -2048) { + throw new Test262Error('#78: -8192 >> 2 === -2048. Actual: ' + (-8192 >> 2)); +} + + +if (-16384 >> 2 !== -4096) { + throw new Test262Error('#79: -16384 >> 2 === -4096. Actual: ' + (-16384 >> 2)); +} + + +if (-32768 >> 2 !== -8192) { + throw new Test262Error('#80: -32768 >> 2 === -8192. Actual: ' + (-32768 >> 2)); +} + + +if (-65536 >> 2 !== -16384) { + throw new Test262Error('#81: -65536 >> 2 === -16384. Actual: ' + (-65536 >> 2)); +} + + +if (-131072 >> 2 !== -32768) { + throw new Test262Error('#82: -131072 >> 2 === -32768. Actual: ' + (-131072 >> 2)); +} + + +if (-262144 >> 2 !== -65536) { + throw new Test262Error('#83: -262144 >> 2 === -65536. Actual: ' + (-262144 >> 2)); +} + + +if (-524288 >> 2 !== -131072) { + throw new Test262Error('#84: -524288 >> 2 === -131072. Actual: ' + (-524288 >> 2)); +} + + +if (-1048576 >> 2 !== -262144) { + throw new Test262Error('#85: -1048576 >> 2 === -262144. Actual: ' + (-1048576 >> 2)); +} + + +if (-2097152 >> 2 !== -524288) { + throw new Test262Error('#86: -2097152 >> 2 === -524288. Actual: ' + (-2097152 >> 2)); +} + + +if (-4194304 >> 2 !== -1048576) { + throw new Test262Error('#87: -4194304 >> 2 === -1048576. Actual: ' + (-4194304 >> 2)); +} + + +if (-8388608 >> 2 !== -2097152) { + throw new Test262Error('#88: -8388608 >> 2 === -2097152. Actual: ' + (-8388608 >> 2)); +} + + +if (-16777216 >> 2 !== -4194304) { + throw new Test262Error('#89: -16777216 >> 2 === -4194304. Actual: ' + (-16777216 >> 2)); +} + + +if (-33554432 >> 2 !== -8388608) { + throw new Test262Error('#90: -33554432 >> 2 === -8388608. Actual: ' + (-33554432 >> 2)); +} + + +if (-67108864 >> 2 !== -16777216) { + throw new Test262Error('#91: -67108864 >> 2 === -16777216. Actual: ' + (-67108864 >> 2)); +} + + +if (-134217728 >> 2 !== -33554432) { + throw new Test262Error('#92: -134217728 >> 2 === -33554432. Actual: ' + (-134217728 >> 2)); +} + + +if (-268435456 >> 2 !== -67108864) { + throw new Test262Error('#93: -268435456 >> 2 === -67108864. Actual: ' + (-268435456 >> 2)); +} + + +if (-536870912 >> 2 !== -134217728) { + throw new Test262Error('#94: -536870912 >> 2 === -134217728. Actual: ' + (-536870912 >> 2)); +} + + +if (-1073741824 >> 2 !== -268435456) { + throw new Test262Error('#95: -1073741824 >> 2 === -268435456. Actual: ' + (-1073741824 >> 2)); +} + + +if (-2147483648 >> 2 !== -536870912) { + throw new Test262Error('#96: -2147483648 >> 2 === -536870912. Actual: ' + (-2147483648 >> 2)); +} + + +if (-1 >> 3 !== -1) { + throw new Test262Error('#97: -1 >> 3 === -1. Actual: ' + (-1 >> 3)); +} + + +if (-2 >> 3 !== -1) { + throw new Test262Error('#98: -2 >> 3 === -1. Actual: ' + (-2 >> 3)); +} + + +if (-4 >> 3 !== -1) { + throw new Test262Error('#99: -4 >> 3 === -1. Actual: ' + (-4 >> 3)); +} + + +if (-8 >> 3 !== -1) { + throw new Test262Error('#100: -8 >> 3 === -1. Actual: ' + (-8 >> 3)); +} + + +if (-16 >> 3 !== -2) { + throw new Test262Error('#101: -16 >> 3 === -2. Actual: ' + (-16 >> 3)); +} + + +if (-32 >> 3 !== -4) { + throw new Test262Error('#102: -32 >> 3 === -4. Actual: ' + (-32 >> 3)); +} + + +if (-64 >> 3 !== -8) { + throw new Test262Error('#103: -64 >> 3 === -8. Actual: ' + (-64 >> 3)); +} + + +if (-128 >> 3 !== -16) { + throw new Test262Error('#104: -128 >> 3 === -16. Actual: ' + (-128 >> 3)); +} + + +if (-256 >> 3 !== -32) { + throw new Test262Error('#105: -256 >> 3 === -32. Actual: ' + (-256 >> 3)); +} + + +if (-512 >> 3 !== -64) { + throw new Test262Error('#106: -512 >> 3 === -64. Actual: ' + (-512 >> 3)); +} + + +if (-1024 >> 3 !== -128) { + throw new Test262Error('#107: -1024 >> 3 === -128. Actual: ' + (-1024 >> 3)); +} + + +if (-2048 >> 3 !== -256) { + throw new Test262Error('#108: -2048 >> 3 === -256. Actual: ' + (-2048 >> 3)); +} + + +if (-4096 >> 3 !== -512) { + throw new Test262Error('#109: -4096 >> 3 === -512. Actual: ' + (-4096 >> 3)); +} + + +if (-8192 >> 3 !== -1024) { + throw new Test262Error('#110: -8192 >> 3 === -1024. Actual: ' + (-8192 >> 3)); +} + + +if (-16384 >> 3 !== -2048) { + throw new Test262Error('#111: -16384 >> 3 === -2048. Actual: ' + (-16384 >> 3)); +} + + +if (-32768 >> 3 !== -4096) { + throw new Test262Error('#112: -32768 >> 3 === -4096. Actual: ' + (-32768 >> 3)); +} + + +if (-65536 >> 3 !== -8192) { + throw new Test262Error('#113: -65536 >> 3 === -8192. Actual: ' + (-65536 >> 3)); +} + + +if (-131072 >> 3 !== -16384) { + throw new Test262Error('#114: -131072 >> 3 === -16384. Actual: ' + (-131072 >> 3)); +} + + +if (-262144 >> 3 !== -32768) { + throw new Test262Error('#115: -262144 >> 3 === -32768. Actual: ' + (-262144 >> 3)); +} + + +if (-524288 >> 3 !== -65536) { + throw new Test262Error('#116: -524288 >> 3 === -65536. Actual: ' + (-524288 >> 3)); +} + + +if (-1048576 >> 3 !== -131072) { + throw new Test262Error('#117: -1048576 >> 3 === -131072. Actual: ' + (-1048576 >> 3)); +} + + +if (-2097152 >> 3 !== -262144) { + throw new Test262Error('#118: -2097152 >> 3 === -262144. Actual: ' + (-2097152 >> 3)); +} + + +if (-4194304 >> 3 !== -524288) { + throw new Test262Error('#119: -4194304 >> 3 === -524288. Actual: ' + (-4194304 >> 3)); +} + + +if (-8388608 >> 3 !== -1048576) { + throw new Test262Error('#120: -8388608 >> 3 === -1048576. Actual: ' + (-8388608 >> 3)); +} + + +if (-16777216 >> 3 !== -2097152) { + throw new Test262Error('#121: -16777216 >> 3 === -2097152. Actual: ' + (-16777216 >> 3)); +} + + +if (-33554432 >> 3 !== -4194304) { + throw new Test262Error('#122: -33554432 >> 3 === -4194304. Actual: ' + (-33554432 >> 3)); +} + + +if (-67108864 >> 3 !== -8388608) { + throw new Test262Error('#123: -67108864 >> 3 === -8388608. Actual: ' + (-67108864 >> 3)); +} + + +if (-134217728 >> 3 !== -16777216) { + throw new Test262Error('#124: -134217728 >> 3 === -16777216. Actual: ' + (-134217728 >> 3)); +} + + +if (-268435456 >> 3 !== -33554432) { + throw new Test262Error('#125: -268435456 >> 3 === -33554432. Actual: ' + (-268435456 >> 3)); +} + + +if (-536870912 >> 3 !== -67108864) { + throw new Test262Error('#126: -536870912 >> 3 === -67108864. Actual: ' + (-536870912 >> 3)); +} + + +if (-1073741824 >> 3 !== -134217728) { + throw new Test262Error('#127: -1073741824 >> 3 === -134217728. Actual: ' + (-1073741824 >> 3)); +} + + +if (-2147483648 >> 3 !== -268435456) { + throw new Test262Error('#128: -2147483648 >> 3 === -268435456. Actual: ' + (-2147483648 >> 3)); +} + + +if (-1 >> 4 !== -1) { + throw new Test262Error('#129: -1 >> 4 === -1. Actual: ' + (-1 >> 4)); +} + + +if (-2 >> 4 !== -1) { + throw new Test262Error('#130: -2 >> 4 === -1. Actual: ' + (-2 >> 4)); +} + + +if (-4 >> 4 !== -1) { + throw new Test262Error('#131: -4 >> 4 === -1. Actual: ' + (-4 >> 4)); +} + + +if (-8 >> 4 !== -1) { + throw new Test262Error('#132: -8 >> 4 === -1. Actual: ' + (-8 >> 4)); +} + + +if (-16 >> 4 !== -1) { + throw new Test262Error('#133: -16 >> 4 === -1. Actual: ' + (-16 >> 4)); +} + + +if (-32 >> 4 !== -2) { + throw new Test262Error('#134: -32 >> 4 === -2. Actual: ' + (-32 >> 4)); +} + + +if (-64 >> 4 !== -4) { + throw new Test262Error('#135: -64 >> 4 === -4. Actual: ' + (-64 >> 4)); +} + + +if (-128 >> 4 !== -8) { + throw new Test262Error('#136: -128 >> 4 === -8. Actual: ' + (-128 >> 4)); +} + + +if (-256 >> 4 !== -16) { + throw new Test262Error('#137: -256 >> 4 === -16. Actual: ' + (-256 >> 4)); +} + + +if (-512 >> 4 !== -32) { + throw new Test262Error('#138: -512 >> 4 === -32. Actual: ' + (-512 >> 4)); +} + + +if (-1024 >> 4 !== -64) { + throw new Test262Error('#139: -1024 >> 4 === -64. Actual: ' + (-1024 >> 4)); +} + + +if (-2048 >> 4 !== -128) { + throw new Test262Error('#140: -2048 >> 4 === -128. Actual: ' + (-2048 >> 4)); +} + + +if (-4096 >> 4 !== -256) { + throw new Test262Error('#141: -4096 >> 4 === -256. Actual: ' + (-4096 >> 4)); +} + + +if (-8192 >> 4 !== -512) { + throw new Test262Error('#142: -8192 >> 4 === -512. Actual: ' + (-8192 >> 4)); +} + + +if (-16384 >> 4 !== -1024) { + throw new Test262Error('#143: -16384 >> 4 === -1024. Actual: ' + (-16384 >> 4)); +} + + +if (-32768 >> 4 !== -2048) { + throw new Test262Error('#144: -32768 >> 4 === -2048. Actual: ' + (-32768 >> 4)); +} + + +if (-65536 >> 4 !== -4096) { + throw new Test262Error('#145: -65536 >> 4 === -4096. Actual: ' + (-65536 >> 4)); +} + + +if (-131072 >> 4 !== -8192) { + throw new Test262Error('#146: -131072 >> 4 === -8192. Actual: ' + (-131072 >> 4)); +} + + +if (-262144 >> 4 !== -16384) { + throw new Test262Error('#147: -262144 >> 4 === -16384. Actual: ' + (-262144 >> 4)); +} + + +if (-524288 >> 4 !== -32768) { + throw new Test262Error('#148: -524288 >> 4 === -32768. Actual: ' + (-524288 >> 4)); +} + + +if (-1048576 >> 4 !== -65536) { + throw new Test262Error('#149: -1048576 >> 4 === -65536. Actual: ' + (-1048576 >> 4)); +} + + +if (-2097152 >> 4 !== -131072) { + throw new Test262Error('#150: -2097152 >> 4 === -131072. Actual: ' + (-2097152 >> 4)); +} + + +if (-4194304 >> 4 !== -262144) { + throw new Test262Error('#151: -4194304 >> 4 === -262144. Actual: ' + (-4194304 >> 4)); +} + + +if (-8388608 >> 4 !== -524288) { + throw new Test262Error('#152: -8388608 >> 4 === -524288. Actual: ' + (-8388608 >> 4)); +} + + +if (-16777216 >> 4 !== -1048576) { + throw new Test262Error('#153: -16777216 >> 4 === -1048576. Actual: ' + (-16777216 >> 4)); +} + + +if (-33554432 >> 4 !== -2097152) { + throw new Test262Error('#154: -33554432 >> 4 === -2097152. Actual: ' + (-33554432 >> 4)); +} + + +if (-67108864 >> 4 !== -4194304) { + throw new Test262Error('#155: -67108864 >> 4 === -4194304. Actual: ' + (-67108864 >> 4)); +} + + +if (-134217728 >> 4 !== -8388608) { + throw new Test262Error('#156: -134217728 >> 4 === -8388608. Actual: ' + (-134217728 >> 4)); +} + + +if (-268435456 >> 4 !== -16777216) { + throw new Test262Error('#157: -268435456 >> 4 === -16777216. Actual: ' + (-268435456 >> 4)); +} + + +if (-536870912 >> 4 !== -33554432) { + throw new Test262Error('#158: -536870912 >> 4 === -33554432. Actual: ' + (-536870912 >> 4)); +} + + +if (-1073741824 >> 4 !== -67108864) { + throw new Test262Error('#159: -1073741824 >> 4 === -67108864. Actual: ' + (-1073741824 >> 4)); +} + + +if (-2147483648 >> 4 !== -134217728) { + throw new Test262Error('#160: -2147483648 >> 4 === -134217728. Actual: ' + (-2147483648 >> 4)); +} + + +if (-1 >> 5 !== -1) { + throw new Test262Error('#161: -1 >> 5 === -1. Actual: ' + (-1 >> 5)); +} + + +if (-2 >> 5 !== -1) { + throw new Test262Error('#162: -2 >> 5 === -1. Actual: ' + (-2 >> 5)); +} + + +if (-4 >> 5 !== -1) { + throw new Test262Error('#163: -4 >> 5 === -1. Actual: ' + (-4 >> 5)); +} + + +if (-8 >> 5 !== -1) { + throw new Test262Error('#164: -8 >> 5 === -1. Actual: ' + (-8 >> 5)); +} + + +if (-16 >> 5 !== -1) { + throw new Test262Error('#165: -16 >> 5 === -1. Actual: ' + (-16 >> 5)); +} + + +if (-32 >> 5 !== -1) { + throw new Test262Error('#166: -32 >> 5 === -1. Actual: ' + (-32 >> 5)); +} + + +if (-64 >> 5 !== -2) { + throw new Test262Error('#167: -64 >> 5 === -2. Actual: ' + (-64 >> 5)); +} + + +if (-128 >> 5 !== -4) { + throw new Test262Error('#168: -128 >> 5 === -4. Actual: ' + (-128 >> 5)); +} + + +if (-256 >> 5 !== -8) { + throw new Test262Error('#169: -256 >> 5 === -8. Actual: ' + (-256 >> 5)); +} + + +if (-512 >> 5 !== -16) { + throw new Test262Error('#170: -512 >> 5 === -16. Actual: ' + (-512 >> 5)); +} + + +if (-1024 >> 5 !== -32) { + throw new Test262Error('#171: -1024 >> 5 === -32. Actual: ' + (-1024 >> 5)); +} + + +if (-2048 >> 5 !== -64) { + throw new Test262Error('#172: -2048 >> 5 === -64. Actual: ' + (-2048 >> 5)); +} + + +if (-4096 >> 5 !== -128) { + throw new Test262Error('#173: -4096 >> 5 === -128. Actual: ' + (-4096 >> 5)); +} + + +if (-8192 >> 5 !== -256) { + throw new Test262Error('#174: -8192 >> 5 === -256. Actual: ' + (-8192 >> 5)); +} + + +if (-16384 >> 5 !== -512) { + throw new Test262Error('#175: -16384 >> 5 === -512. Actual: ' + (-16384 >> 5)); +} + + +if (-32768 >> 5 !== -1024) { + throw new Test262Error('#176: -32768 >> 5 === -1024. Actual: ' + (-32768 >> 5)); +} + + +if (-65536 >> 5 !== -2048) { + throw new Test262Error('#177: -65536 >> 5 === -2048. Actual: ' + (-65536 >> 5)); +} + + +if (-131072 >> 5 !== -4096) { + throw new Test262Error('#178: -131072 >> 5 === -4096. Actual: ' + (-131072 >> 5)); +} + + +if (-262144 >> 5 !== -8192) { + throw new Test262Error('#179: -262144 >> 5 === -8192. Actual: ' + (-262144 >> 5)); +} + + +if (-524288 >> 5 !== -16384) { + throw new Test262Error('#180: -524288 >> 5 === -16384. Actual: ' + (-524288 >> 5)); +} + + +if (-1048576 >> 5 !== -32768) { + throw new Test262Error('#181: -1048576 >> 5 === -32768. Actual: ' + (-1048576 >> 5)); +} + + +if (-2097152 >> 5 !== -65536) { + throw new Test262Error('#182: -2097152 >> 5 === -65536. Actual: ' + (-2097152 >> 5)); +} + + +if (-4194304 >> 5 !== -131072) { + throw new Test262Error('#183: -4194304 >> 5 === -131072. Actual: ' + (-4194304 >> 5)); +} + + +if (-8388608 >> 5 !== -262144) { + throw new Test262Error('#184: -8388608 >> 5 === -262144. Actual: ' + (-8388608 >> 5)); +} + + +if (-16777216 >> 5 !== -524288) { + throw new Test262Error('#185: -16777216 >> 5 === -524288. Actual: ' + (-16777216 >> 5)); +} + + +if (-33554432 >> 5 !== -1048576) { + throw new Test262Error('#186: -33554432 >> 5 === -1048576. Actual: ' + (-33554432 >> 5)); +} + + +if (-67108864 >> 5 !== -2097152) { + throw new Test262Error('#187: -67108864 >> 5 === -2097152. Actual: ' + (-67108864 >> 5)); +} + + +if (-134217728 >> 5 !== -4194304) { + throw new Test262Error('#188: -134217728 >> 5 === -4194304. Actual: ' + (-134217728 >> 5)); +} + + +if (-268435456 >> 5 !== -8388608) { + throw new Test262Error('#189: -268435456 >> 5 === -8388608. Actual: ' + (-268435456 >> 5)); +} + + +if (-536870912 >> 5 !== -16777216) { + throw new Test262Error('#190: -536870912 >> 5 === -16777216. Actual: ' + (-536870912 >> 5)); +} + + +if (-1073741824 >> 5 !== -33554432) { + throw new Test262Error('#191: -1073741824 >> 5 === -33554432. Actual: ' + (-1073741824 >> 5)); +} + + +if (-2147483648 >> 5 !== -67108864) { + throw new Test262Error('#192: -2147483648 >> 5 === -67108864. Actual: ' + (-2147483648 >> 5)); +} + + +if (-1 >> 6 !== -1) { + throw new Test262Error('#193: -1 >> 6 === -1. Actual: ' + (-1 >> 6)); +} + + +if (-2 >> 6 !== -1) { + throw new Test262Error('#194: -2 >> 6 === -1. Actual: ' + (-2 >> 6)); +} + + +if (-4 >> 6 !== -1) { + throw new Test262Error('#195: -4 >> 6 === -1. Actual: ' + (-4 >> 6)); +} + + +if (-8 >> 6 !== -1) { + throw new Test262Error('#196: -8 >> 6 === -1. Actual: ' + (-8 >> 6)); +} + + +if (-16 >> 6 !== -1) { + throw new Test262Error('#197: -16 >> 6 === -1. Actual: ' + (-16 >> 6)); +} + + +if (-32 >> 6 !== -1) { + throw new Test262Error('#198: -32 >> 6 === -1. Actual: ' + (-32 >> 6)); +} + + +if (-64 >> 6 !== -1) { + throw new Test262Error('#199: -64 >> 6 === -1. Actual: ' + (-64 >> 6)); +} + + +if (-128 >> 6 !== -2) { + throw new Test262Error('#200: -128 >> 6 === -2. Actual: ' + (-128 >> 6)); +} + + +if (-256 >> 6 !== -4) { + throw new Test262Error('#201: -256 >> 6 === -4. Actual: ' + (-256 >> 6)); +} + + +if (-512 >> 6 !== -8) { + throw new Test262Error('#202: -512 >> 6 === -8. Actual: ' + (-512 >> 6)); +} + + +if (-1024 >> 6 !== -16) { + throw new Test262Error('#203: -1024 >> 6 === -16. Actual: ' + (-1024 >> 6)); +} + + +if (-2048 >> 6 !== -32) { + throw new Test262Error('#204: -2048 >> 6 === -32. Actual: ' + (-2048 >> 6)); +} + + +if (-4096 >> 6 !== -64) { + throw new Test262Error('#205: -4096 >> 6 === -64. Actual: ' + (-4096 >> 6)); +} + + +if (-8192 >> 6 !== -128) { + throw new Test262Error('#206: -8192 >> 6 === -128. Actual: ' + (-8192 >> 6)); +} + + +if (-16384 >> 6 !== -256) { + throw new Test262Error('#207: -16384 >> 6 === -256. Actual: ' + (-16384 >> 6)); +} + + +if (-32768 >> 6 !== -512) { + throw new Test262Error('#208: -32768 >> 6 === -512. Actual: ' + (-32768 >> 6)); +} + + +if (-65536 >> 6 !== -1024) { + throw new Test262Error('#209: -65536 >> 6 === -1024. Actual: ' + (-65536 >> 6)); +} + + +if (-131072 >> 6 !== -2048) { + throw new Test262Error('#210: -131072 >> 6 === -2048. Actual: ' + (-131072 >> 6)); +} + + +if (-262144 >> 6 !== -4096) { + throw new Test262Error('#211: -262144 >> 6 === -4096. Actual: ' + (-262144 >> 6)); +} + + +if (-524288 >> 6 !== -8192) { + throw new Test262Error('#212: -524288 >> 6 === -8192. Actual: ' + (-524288 >> 6)); +} + + +if (-1048576 >> 6 !== -16384) { + throw new Test262Error('#213: -1048576 >> 6 === -16384. Actual: ' + (-1048576 >> 6)); +} + + +if (-2097152 >> 6 !== -32768) { + throw new Test262Error('#214: -2097152 >> 6 === -32768. Actual: ' + (-2097152 >> 6)); +} + + +if (-4194304 >> 6 !== -65536) { + throw new Test262Error('#215: -4194304 >> 6 === -65536. Actual: ' + (-4194304 >> 6)); +} + + +if (-8388608 >> 6 !== -131072) { + throw new Test262Error('#216: -8388608 >> 6 === -131072. Actual: ' + (-8388608 >> 6)); +} + + +if (-16777216 >> 6 !== -262144) { + throw new Test262Error('#217: -16777216 >> 6 === -262144. Actual: ' + (-16777216 >> 6)); +} + + +if (-33554432 >> 6 !== -524288) { + throw new Test262Error('#218: -33554432 >> 6 === -524288. Actual: ' + (-33554432 >> 6)); +} + + +if (-67108864 >> 6 !== -1048576) { + throw new Test262Error('#219: -67108864 >> 6 === -1048576. Actual: ' + (-67108864 >> 6)); +} + + +if (-134217728 >> 6 !== -2097152) { + throw new Test262Error('#220: -134217728 >> 6 === -2097152. Actual: ' + (-134217728 >> 6)); +} + + +if (-268435456 >> 6 !== -4194304) { + throw new Test262Error('#221: -268435456 >> 6 === -4194304. Actual: ' + (-268435456 >> 6)); +} + + +if (-536870912 >> 6 !== -8388608) { + throw new Test262Error('#222: -536870912 >> 6 === -8388608. Actual: ' + (-536870912 >> 6)); +} + + +if (-1073741824 >> 6 !== -16777216) { + throw new Test262Error('#223: -1073741824 >> 6 === -16777216. Actual: ' + (-1073741824 >> 6)); +} + + +if (-2147483648 >> 6 !== -33554432) { + throw new Test262Error('#224: -2147483648 >> 6 === -33554432. Actual: ' + (-2147483648 >> 6)); +} + + +if (-1 >> 7 !== -1) { + throw new Test262Error('#225: -1 >> 7 === -1. Actual: ' + (-1 >> 7)); +} + + +if (-2 >> 7 !== -1) { + throw new Test262Error('#226: -2 >> 7 === -1. Actual: ' + (-2 >> 7)); +} + + +if (-4 >> 7 !== -1) { + throw new Test262Error('#227: -4 >> 7 === -1. Actual: ' + (-4 >> 7)); +} + + +if (-8 >> 7 !== -1) { + throw new Test262Error('#228: -8 >> 7 === -1. Actual: ' + (-8 >> 7)); +} + + +if (-16 >> 7 !== -1) { + throw new Test262Error('#229: -16 >> 7 === -1. Actual: ' + (-16 >> 7)); +} + + +if (-32 >> 7 !== -1) { + throw new Test262Error('#230: -32 >> 7 === -1. Actual: ' + (-32 >> 7)); +} + + +if (-64 >> 7 !== -1) { + throw new Test262Error('#231: -64 >> 7 === -1. Actual: ' + (-64 >> 7)); +} + + +if (-128 >> 7 !== -1) { + throw new Test262Error('#232: -128 >> 7 === -1. Actual: ' + (-128 >> 7)); +} + + +if (-256 >> 7 !== -2) { + throw new Test262Error('#233: -256 >> 7 === -2. Actual: ' + (-256 >> 7)); +} + + +if (-512 >> 7 !== -4) { + throw new Test262Error('#234: -512 >> 7 === -4. Actual: ' + (-512 >> 7)); +} + + +if (-1024 >> 7 !== -8) { + throw new Test262Error('#235: -1024 >> 7 === -8. Actual: ' + (-1024 >> 7)); +} + + +if (-2048 >> 7 !== -16) { + throw new Test262Error('#236: -2048 >> 7 === -16. Actual: ' + (-2048 >> 7)); +} + + +if (-4096 >> 7 !== -32) { + throw new Test262Error('#237: -4096 >> 7 === -32. Actual: ' + (-4096 >> 7)); +} + + +if (-8192 >> 7 !== -64) { + throw new Test262Error('#238: -8192 >> 7 === -64. Actual: ' + (-8192 >> 7)); +} + + +if (-16384 >> 7 !== -128) { + throw new Test262Error('#239: -16384 >> 7 === -128. Actual: ' + (-16384 >> 7)); +} + + +if (-32768 >> 7 !== -256) { + throw new Test262Error('#240: -32768 >> 7 === -256. Actual: ' + (-32768 >> 7)); +} + + +if (-65536 >> 7 !== -512) { + throw new Test262Error('#241: -65536 >> 7 === -512. Actual: ' + (-65536 >> 7)); +} + + +if (-131072 >> 7 !== -1024) { + throw new Test262Error('#242: -131072 >> 7 === -1024. Actual: ' + (-131072 >> 7)); +} + + +if (-262144 >> 7 !== -2048) { + throw new Test262Error('#243: -262144 >> 7 === -2048. Actual: ' + (-262144 >> 7)); +} + + +if (-524288 >> 7 !== -4096) { + throw new Test262Error('#244: -524288 >> 7 === -4096. Actual: ' + (-524288 >> 7)); +} + + +if (-1048576 >> 7 !== -8192) { + throw new Test262Error('#245: -1048576 >> 7 === -8192. Actual: ' + (-1048576 >> 7)); +} + + +if (-2097152 >> 7 !== -16384) { + throw new Test262Error('#246: -2097152 >> 7 === -16384. Actual: ' + (-2097152 >> 7)); +} + + +if (-4194304 >> 7 !== -32768) { + throw new Test262Error('#247: -4194304 >> 7 === -32768. Actual: ' + (-4194304 >> 7)); +} + + +if (-8388608 >> 7 !== -65536) { + throw new Test262Error('#248: -8388608 >> 7 === -65536. Actual: ' + (-8388608 >> 7)); +} + + +if (-16777216 >> 7 !== -131072) { + throw new Test262Error('#249: -16777216 >> 7 === -131072. Actual: ' + (-16777216 >> 7)); +} + + +if (-33554432 >> 7 !== -262144) { + throw new Test262Error('#250: -33554432 >> 7 === -262144. Actual: ' + (-33554432 >> 7)); +} + + +if (-67108864 >> 7 !== -524288) { + throw new Test262Error('#251: -67108864 >> 7 === -524288. Actual: ' + (-67108864 >> 7)); +} + + +if (-134217728 >> 7 !== -1048576) { + throw new Test262Error('#252: -134217728 >> 7 === -1048576. Actual: ' + (-134217728 >> 7)); +} + + +if (-268435456 >> 7 !== -2097152) { + throw new Test262Error('#253: -268435456 >> 7 === -2097152. Actual: ' + (-268435456 >> 7)); +} + + +if (-536870912 >> 7 !== -4194304) { + throw new Test262Error('#254: -536870912 >> 7 === -4194304. Actual: ' + (-536870912 >> 7)); +} + + +if (-1073741824 >> 7 !== -8388608) { + throw new Test262Error('#255: -1073741824 >> 7 === -8388608. Actual: ' + (-1073741824 >> 7)); +} + + +if (-2147483648 >> 7 !== -16777216) { + throw new Test262Error('#256: -2147483648 >> 7 === -16777216. Actual: ' + (-2147483648 >> 7)); +} + + +if (-1 >> 8 !== -1) { + throw new Test262Error('#257: -1 >> 8 === -1. Actual: ' + (-1 >> 8)); +} + + +if (-2 >> 8 !== -1) { + throw new Test262Error('#258: -2 >> 8 === -1. Actual: ' + (-2 >> 8)); +} + + +if (-4 >> 8 !== -1) { + throw new Test262Error('#259: -4 >> 8 === -1. Actual: ' + (-4 >> 8)); +} + + +if (-8 >> 8 !== -1) { + throw new Test262Error('#260: -8 >> 8 === -1. Actual: ' + (-8 >> 8)); +} + + +if (-16 >> 8 !== -1) { + throw new Test262Error('#261: -16 >> 8 === -1. Actual: ' + (-16 >> 8)); +} + + +if (-32 >> 8 !== -1) { + throw new Test262Error('#262: -32 >> 8 === -1. Actual: ' + (-32 >> 8)); +} + + +if (-64 >> 8 !== -1) { + throw new Test262Error('#263: -64 >> 8 === -1. Actual: ' + (-64 >> 8)); +} + + +if (-128 >> 8 !== -1) { + throw new Test262Error('#264: -128 >> 8 === -1. Actual: ' + (-128 >> 8)); +} + + +if (-256 >> 8 !== -1) { + throw new Test262Error('#265: -256 >> 8 === -1. Actual: ' + (-256 >> 8)); +} + + +if (-512 >> 8 !== -2) { + throw new Test262Error('#266: -512 >> 8 === -2. Actual: ' + (-512 >> 8)); +} + + +if (-1024 >> 8 !== -4) { + throw new Test262Error('#267: -1024 >> 8 === -4. Actual: ' + (-1024 >> 8)); +} + + +if (-2048 >> 8 !== -8) { + throw new Test262Error('#268: -2048 >> 8 === -8. Actual: ' + (-2048 >> 8)); +} + + +if (-4096 >> 8 !== -16) { + throw new Test262Error('#269: -4096 >> 8 === -16. Actual: ' + (-4096 >> 8)); +} + + +if (-8192 >> 8 !== -32) { + throw new Test262Error('#270: -8192 >> 8 === -32. Actual: ' + (-8192 >> 8)); +} + + +if (-16384 >> 8 !== -64) { + throw new Test262Error('#271: -16384 >> 8 === -64. Actual: ' + (-16384 >> 8)); +} + + +if (-32768 >> 8 !== -128) { + throw new Test262Error('#272: -32768 >> 8 === -128. Actual: ' + (-32768 >> 8)); +} + + +if (-65536 >> 8 !== -256) { + throw new Test262Error('#273: -65536 >> 8 === -256. Actual: ' + (-65536 >> 8)); +} + + +if (-131072 >> 8 !== -512) { + throw new Test262Error('#274: -131072 >> 8 === -512. Actual: ' + (-131072 >> 8)); +} + + +if (-262144 >> 8 !== -1024) { + throw new Test262Error('#275: -262144 >> 8 === -1024. Actual: ' + (-262144 >> 8)); +} + + +if (-524288 >> 8 !== -2048) { + throw new Test262Error('#276: -524288 >> 8 === -2048. Actual: ' + (-524288 >> 8)); +} + + +if (-1048576 >> 8 !== -4096) { + throw new Test262Error('#277: -1048576 >> 8 === -4096. Actual: ' + (-1048576 >> 8)); +} + + +if (-2097152 >> 8 !== -8192) { + throw new Test262Error('#278: -2097152 >> 8 === -8192. Actual: ' + (-2097152 >> 8)); +} + + +if (-4194304 >> 8 !== -16384) { + throw new Test262Error('#279: -4194304 >> 8 === -16384. Actual: ' + (-4194304 >> 8)); +} + + +if (-8388608 >> 8 !== -32768) { + throw new Test262Error('#280: -8388608 >> 8 === -32768. Actual: ' + (-8388608 >> 8)); +} + + +if (-16777216 >> 8 !== -65536) { + throw new Test262Error('#281: -16777216 >> 8 === -65536. Actual: ' + (-16777216 >> 8)); +} + + +if (-33554432 >> 8 !== -131072) { + throw new Test262Error('#282: -33554432 >> 8 === -131072. Actual: ' + (-33554432 >> 8)); +} + + +if (-67108864 >> 8 !== -262144) { + throw new Test262Error('#283: -67108864 >> 8 === -262144. Actual: ' + (-67108864 >> 8)); +} + + +if (-134217728 >> 8 !== -524288) { + throw new Test262Error('#284: -134217728 >> 8 === -524288. Actual: ' + (-134217728 >> 8)); +} + + +if (-268435456 >> 8 !== -1048576) { + throw new Test262Error('#285: -268435456 >> 8 === -1048576. Actual: ' + (-268435456 >> 8)); +} + + +if (-536870912 >> 8 !== -2097152) { + throw new Test262Error('#286: -536870912 >> 8 === -2097152. Actual: ' + (-536870912 >> 8)); +} + + +if (-1073741824 >> 8 !== -4194304) { + throw new Test262Error('#287: -1073741824 >> 8 === -4194304. Actual: ' + (-1073741824 >> 8)); +} + + +if (-2147483648 >> 8 !== -8388608) { + throw new Test262Error('#288: -2147483648 >> 8 === -8388608. Actual: ' + (-2147483648 >> 8)); +} + + +if (-1 >> 9 !== -1) { + throw new Test262Error('#289: -1 >> 9 === -1. Actual: ' + (-1 >> 9)); +} + + +if (-2 >> 9 !== -1) { + throw new Test262Error('#290: -2 >> 9 === -1. Actual: ' + (-2 >> 9)); +} + + +if (-4 >> 9 !== -1) { + throw new Test262Error('#291: -4 >> 9 === -1. Actual: ' + (-4 >> 9)); +} + + +if (-8 >> 9 !== -1) { + throw new Test262Error('#292: -8 >> 9 === -1. Actual: ' + (-8 >> 9)); +} + + +if (-16 >> 9 !== -1) { + throw new Test262Error('#293: -16 >> 9 === -1. Actual: ' + (-16 >> 9)); +} + + +if (-32 >> 9 !== -1) { + throw new Test262Error('#294: -32 >> 9 === -1. Actual: ' + (-32 >> 9)); +} + + +if (-64 >> 9 !== -1) { + throw new Test262Error('#295: -64 >> 9 === -1. Actual: ' + (-64 >> 9)); +} + + +if (-128 >> 9 !== -1) { + throw new Test262Error('#296: -128 >> 9 === -1. Actual: ' + (-128 >> 9)); +} + + +if (-256 >> 9 !== -1) { + throw new Test262Error('#297: -256 >> 9 === -1. Actual: ' + (-256 >> 9)); +} + + +if (-512 >> 9 !== -1) { + throw new Test262Error('#298: -512 >> 9 === -1. Actual: ' + (-512 >> 9)); +} + + +if (-1024 >> 9 !== -2) { + throw new Test262Error('#299: -1024 >> 9 === -2. Actual: ' + (-1024 >> 9)); +} + + +if (-2048 >> 9 !== -4) { + throw new Test262Error('#300: -2048 >> 9 === -4. Actual: ' + (-2048 >> 9)); +} + + +if (-4096 >> 9 !== -8) { + throw new Test262Error('#301: -4096 >> 9 === -8. Actual: ' + (-4096 >> 9)); +} + + +if (-8192 >> 9 !== -16) { + throw new Test262Error('#302: -8192 >> 9 === -16. Actual: ' + (-8192 >> 9)); +} + + +if (-16384 >> 9 !== -32) { + throw new Test262Error('#303: -16384 >> 9 === -32. Actual: ' + (-16384 >> 9)); +} + + +if (-32768 >> 9 !== -64) { + throw new Test262Error('#304: -32768 >> 9 === -64. Actual: ' + (-32768 >> 9)); +} + + +if (-65536 >> 9 !== -128) { + throw new Test262Error('#305: -65536 >> 9 === -128. Actual: ' + (-65536 >> 9)); +} + + +if (-131072 >> 9 !== -256) { + throw new Test262Error('#306: -131072 >> 9 === -256. Actual: ' + (-131072 >> 9)); +} + + +if (-262144 >> 9 !== -512) { + throw new Test262Error('#307: -262144 >> 9 === -512. Actual: ' + (-262144 >> 9)); +} + + +if (-524288 >> 9 !== -1024) { + throw new Test262Error('#308: -524288 >> 9 === -1024. Actual: ' + (-524288 >> 9)); +} + + +if (-1048576 >> 9 !== -2048) { + throw new Test262Error('#309: -1048576 >> 9 === -2048. Actual: ' + (-1048576 >> 9)); +} + + +if (-2097152 >> 9 !== -4096) { + throw new Test262Error('#310: -2097152 >> 9 === -4096. Actual: ' + (-2097152 >> 9)); +} + + +if (-4194304 >> 9 !== -8192) { + throw new Test262Error('#311: -4194304 >> 9 === -8192. Actual: ' + (-4194304 >> 9)); +} + + +if (-8388608 >> 9 !== -16384) { + throw new Test262Error('#312: -8388608 >> 9 === -16384. Actual: ' + (-8388608 >> 9)); +} + + +if (-16777216 >> 9 !== -32768) { + throw new Test262Error('#313: -16777216 >> 9 === -32768. Actual: ' + (-16777216 >> 9)); +} + + +if (-33554432 >> 9 !== -65536) { + throw new Test262Error('#314: -33554432 >> 9 === -65536. Actual: ' + (-33554432 >> 9)); +} + + +if (-67108864 >> 9 !== -131072) { + throw new Test262Error('#315: -67108864 >> 9 === -131072. Actual: ' + (-67108864 >> 9)); +} + + +if (-134217728 >> 9 !== -262144) { + throw new Test262Error('#316: -134217728 >> 9 === -262144. Actual: ' + (-134217728 >> 9)); +} + + +if (-268435456 >> 9 !== -524288) { + throw new Test262Error('#317: -268435456 >> 9 === -524288. Actual: ' + (-268435456 >> 9)); +} + + +if (-536870912 >> 9 !== -1048576) { + throw new Test262Error('#318: -536870912 >> 9 === -1048576. Actual: ' + (-536870912 >> 9)); +} + + +if (-1073741824 >> 9 !== -2097152) { + throw new Test262Error('#319: -1073741824 >> 9 === -2097152. Actual: ' + (-1073741824 >> 9)); +} + + +if (-2147483648 >> 9 !== -4194304) { + throw new Test262Error('#320: -2147483648 >> 9 === -4194304. Actual: ' + (-2147483648 >> 9)); +} + + +if (-1 >> 10 !== -1) { + throw new Test262Error('#321: -1 >> 10 === -1. Actual: ' + (-1 >> 10)); +} + + +if (-2 >> 10 !== -1) { + throw new Test262Error('#322: -2 >> 10 === -1. Actual: ' + (-2 >> 10)); +} + + +if (-4 >> 10 !== -1) { + throw new Test262Error('#323: -4 >> 10 === -1. Actual: ' + (-4 >> 10)); +} + + +if (-8 >> 10 !== -1) { + throw new Test262Error('#324: -8 >> 10 === -1. Actual: ' + (-8 >> 10)); +} + + +if (-16 >> 10 !== -1) { + throw new Test262Error('#325: -16 >> 10 === -1. Actual: ' + (-16 >> 10)); +} + + +if (-32 >> 10 !== -1) { + throw new Test262Error('#326: -32 >> 10 === -1. Actual: ' + (-32 >> 10)); +} + + +if (-64 >> 10 !== -1) { + throw new Test262Error('#327: -64 >> 10 === -1. Actual: ' + (-64 >> 10)); +} + + +if (-128 >> 10 !== -1) { + throw new Test262Error('#328: -128 >> 10 === -1. Actual: ' + (-128 >> 10)); +} + + +if (-256 >> 10 !== -1) { + throw new Test262Error('#329: -256 >> 10 === -1. Actual: ' + (-256 >> 10)); +} + + +if (-512 >> 10 !== -1) { + throw new Test262Error('#330: -512 >> 10 === -1. Actual: ' + (-512 >> 10)); +} + + +if (-1024 >> 10 !== -1) { + throw new Test262Error('#331: -1024 >> 10 === -1. Actual: ' + (-1024 >> 10)); +} + + +if (-2048 >> 10 !== -2) { + throw new Test262Error('#332: -2048 >> 10 === -2. Actual: ' + (-2048 >> 10)); +} + + +if (-4096 >> 10 !== -4) { + throw new Test262Error('#333: -4096 >> 10 === -4. Actual: ' + (-4096 >> 10)); +} + + +if (-8192 >> 10 !== -8) { + throw new Test262Error('#334: -8192 >> 10 === -8. Actual: ' + (-8192 >> 10)); +} + + +if (-16384 >> 10 !== -16) { + throw new Test262Error('#335: -16384 >> 10 === -16. Actual: ' + (-16384 >> 10)); +} + + +if (-32768 >> 10 !== -32) { + throw new Test262Error('#336: -32768 >> 10 === -32. Actual: ' + (-32768 >> 10)); +} + + +if (-65536 >> 10 !== -64) { + throw new Test262Error('#337: -65536 >> 10 === -64. Actual: ' + (-65536 >> 10)); +} + + +if (-131072 >> 10 !== -128) { + throw new Test262Error('#338: -131072 >> 10 === -128. Actual: ' + (-131072 >> 10)); +} + + +if (-262144 >> 10 !== -256) { + throw new Test262Error('#339: -262144 >> 10 === -256. Actual: ' + (-262144 >> 10)); +} + + +if (-524288 >> 10 !== -512) { + throw new Test262Error('#340: -524288 >> 10 === -512. Actual: ' + (-524288 >> 10)); +} + + +if (-1048576 >> 10 !== -1024) { + throw new Test262Error('#341: -1048576 >> 10 === -1024. Actual: ' + (-1048576 >> 10)); +} + + +if (-2097152 >> 10 !== -2048) { + throw new Test262Error('#342: -2097152 >> 10 === -2048. Actual: ' + (-2097152 >> 10)); +} + + +if (-4194304 >> 10 !== -4096) { + throw new Test262Error('#343: -4194304 >> 10 === -4096. Actual: ' + (-4194304 >> 10)); +} + + +if (-8388608 >> 10 !== -8192) { + throw new Test262Error('#344: -8388608 >> 10 === -8192. Actual: ' + (-8388608 >> 10)); +} + + +if (-16777216 >> 10 !== -16384) { + throw new Test262Error('#345: -16777216 >> 10 === -16384. Actual: ' + (-16777216 >> 10)); +} + + +if (-33554432 >> 10 !== -32768) { + throw new Test262Error('#346: -33554432 >> 10 === -32768. Actual: ' + (-33554432 >> 10)); +} + + +if (-67108864 >> 10 !== -65536) { + throw new Test262Error('#347: -67108864 >> 10 === -65536. Actual: ' + (-67108864 >> 10)); +} + + +if (-134217728 >> 10 !== -131072) { + throw new Test262Error('#348: -134217728 >> 10 === -131072. Actual: ' + (-134217728 >> 10)); +} + + +if (-268435456 >> 10 !== -262144) { + throw new Test262Error('#349: -268435456 >> 10 === -262144. Actual: ' + (-268435456 >> 10)); +} + + +if (-536870912 >> 10 !== -524288) { + throw new Test262Error('#350: -536870912 >> 10 === -524288. Actual: ' + (-536870912 >> 10)); +} + + +if (-1073741824 >> 10 !== -1048576) { + throw new Test262Error('#351: -1073741824 >> 10 === -1048576. Actual: ' + (-1073741824 >> 10)); +} + + +if (-2147483648 >> 10 !== -2097152) { + throw new Test262Error('#352: -2147483648 >> 10 === -2097152. Actual: ' + (-2147483648 >> 10)); +} + + +if (-1 >> 11 !== -1) { + throw new Test262Error('#353: -1 >> 11 === -1. Actual: ' + (-1 >> 11)); +} + + +if (-2 >> 11 !== -1) { + throw new Test262Error('#354: -2 >> 11 === -1. Actual: ' + (-2 >> 11)); +} + + +if (-4 >> 11 !== -1) { + throw new Test262Error('#355: -4 >> 11 === -1. Actual: ' + (-4 >> 11)); +} + + +if (-8 >> 11 !== -1) { + throw new Test262Error('#356: -8 >> 11 === -1. Actual: ' + (-8 >> 11)); +} + + +if (-16 >> 11 !== -1) { + throw new Test262Error('#357: -16 >> 11 === -1. Actual: ' + (-16 >> 11)); +} + + +if (-32 >> 11 !== -1) { + throw new Test262Error('#358: -32 >> 11 === -1. Actual: ' + (-32 >> 11)); +} + + +if (-64 >> 11 !== -1) { + throw new Test262Error('#359: -64 >> 11 === -1. Actual: ' + (-64 >> 11)); +} + + +if (-128 >> 11 !== -1) { + throw new Test262Error('#360: -128 >> 11 === -1. Actual: ' + (-128 >> 11)); +} + + +if (-256 >> 11 !== -1) { + throw new Test262Error('#361: -256 >> 11 === -1. Actual: ' + (-256 >> 11)); +} + + +if (-512 >> 11 !== -1) { + throw new Test262Error('#362: -512 >> 11 === -1. Actual: ' + (-512 >> 11)); +} + + +if (-1024 >> 11 !== -1) { + throw new Test262Error('#363: -1024 >> 11 === -1. Actual: ' + (-1024 >> 11)); +} + + +if (-2048 >> 11 !== -1) { + throw new Test262Error('#364: -2048 >> 11 === -1. Actual: ' + (-2048 >> 11)); +} + + +if (-4096 >> 11 !== -2) { + throw new Test262Error('#365: -4096 >> 11 === -2. Actual: ' + (-4096 >> 11)); +} + + +if (-8192 >> 11 !== -4) { + throw new Test262Error('#366: -8192 >> 11 === -4. Actual: ' + (-8192 >> 11)); +} + + +if (-16384 >> 11 !== -8) { + throw new Test262Error('#367: -16384 >> 11 === -8. Actual: ' + (-16384 >> 11)); +} + + +if (-32768 >> 11 !== -16) { + throw new Test262Error('#368: -32768 >> 11 === -16. Actual: ' + (-32768 >> 11)); +} + + +if (-65536 >> 11 !== -32) { + throw new Test262Error('#369: -65536 >> 11 === -32. Actual: ' + (-65536 >> 11)); +} + + +if (-131072 >> 11 !== -64) { + throw new Test262Error('#370: -131072 >> 11 === -64. Actual: ' + (-131072 >> 11)); +} + + +if (-262144 >> 11 !== -128) { + throw new Test262Error('#371: -262144 >> 11 === -128. Actual: ' + (-262144 >> 11)); +} + + +if (-524288 >> 11 !== -256) { + throw new Test262Error('#372: -524288 >> 11 === -256. Actual: ' + (-524288 >> 11)); +} + + +if (-1048576 >> 11 !== -512) { + throw new Test262Error('#373: -1048576 >> 11 === -512. Actual: ' + (-1048576 >> 11)); +} + + +if (-2097152 >> 11 !== -1024) { + throw new Test262Error('#374: -2097152 >> 11 === -1024. Actual: ' + (-2097152 >> 11)); +} + + +if (-4194304 >> 11 !== -2048) { + throw new Test262Error('#375: -4194304 >> 11 === -2048. Actual: ' + (-4194304 >> 11)); +} + + +if (-8388608 >> 11 !== -4096) { + throw new Test262Error('#376: -8388608 >> 11 === -4096. Actual: ' + (-8388608 >> 11)); +} + + +if (-16777216 >> 11 !== -8192) { + throw new Test262Error('#377: -16777216 >> 11 === -8192. Actual: ' + (-16777216 >> 11)); +} + + +if (-33554432 >> 11 !== -16384) { + throw new Test262Error('#378: -33554432 >> 11 === -16384. Actual: ' + (-33554432 >> 11)); +} + + +if (-67108864 >> 11 !== -32768) { + throw new Test262Error('#379: -67108864 >> 11 === -32768. Actual: ' + (-67108864 >> 11)); +} + + +if (-134217728 >> 11 !== -65536) { + throw new Test262Error('#380: -134217728 >> 11 === -65536. Actual: ' + (-134217728 >> 11)); +} + + +if (-268435456 >> 11 !== -131072) { + throw new Test262Error('#381: -268435456 >> 11 === -131072. Actual: ' + (-268435456 >> 11)); +} + + +if (-536870912 >> 11 !== -262144) { + throw new Test262Error('#382: -536870912 >> 11 === -262144. Actual: ' + (-536870912 >> 11)); +} + + +if (-1073741824 >> 11 !== -524288) { + throw new Test262Error('#383: -1073741824 >> 11 === -524288. Actual: ' + (-1073741824 >> 11)); +} + + +if (-2147483648 >> 11 !== -1048576) { + throw new Test262Error('#384: -2147483648 >> 11 === -1048576. Actual: ' + (-2147483648 >> 11)); +} + + +if (-1 >> 12 !== -1) { + throw new Test262Error('#385: -1 >> 12 === -1. Actual: ' + (-1 >> 12)); +} + + +if (-2 >> 12 !== -1) { + throw new Test262Error('#386: -2 >> 12 === -1. Actual: ' + (-2 >> 12)); +} + + +if (-4 >> 12 !== -1) { + throw new Test262Error('#387: -4 >> 12 === -1. Actual: ' + (-4 >> 12)); +} + + +if (-8 >> 12 !== -1) { + throw new Test262Error('#388: -8 >> 12 === -1. Actual: ' + (-8 >> 12)); +} + + +if (-16 >> 12 !== -1) { + throw new Test262Error('#389: -16 >> 12 === -1. Actual: ' + (-16 >> 12)); +} + + +if (-32 >> 12 !== -1) { + throw new Test262Error('#390: -32 >> 12 === -1. Actual: ' + (-32 >> 12)); +} + + +if (-64 >> 12 !== -1) { + throw new Test262Error('#391: -64 >> 12 === -1. Actual: ' + (-64 >> 12)); +} + + +if (-128 >> 12 !== -1) { + throw new Test262Error('#392: -128 >> 12 === -1. Actual: ' + (-128 >> 12)); +} + + +if (-256 >> 12 !== -1) { + throw new Test262Error('#393: -256 >> 12 === -1. Actual: ' + (-256 >> 12)); +} + + +if (-512 >> 12 !== -1) { + throw new Test262Error('#394: -512 >> 12 === -1. Actual: ' + (-512 >> 12)); +} + + +if (-1024 >> 12 !== -1) { + throw new Test262Error('#395: -1024 >> 12 === -1. Actual: ' + (-1024 >> 12)); +} + + +if (-2048 >> 12 !== -1) { + throw new Test262Error('#396: -2048 >> 12 === -1. Actual: ' + (-2048 >> 12)); +} + + +if (-4096 >> 12 !== -1) { + throw new Test262Error('#397: -4096 >> 12 === -1. Actual: ' + (-4096 >> 12)); +} + + +if (-8192 >> 12 !== -2) { + throw new Test262Error('#398: -8192 >> 12 === -2. Actual: ' + (-8192 >> 12)); +} + + +if (-16384 >> 12 !== -4) { + throw new Test262Error('#399: -16384 >> 12 === -4. Actual: ' + (-16384 >> 12)); +} + + +if (-32768 >> 12 !== -8) { + throw new Test262Error('#400: -32768 >> 12 === -8. Actual: ' + (-32768 >> 12)); +} + + +if (-65536 >> 12 !== -16) { + throw new Test262Error('#401: -65536 >> 12 === -16. Actual: ' + (-65536 >> 12)); +} + + +if (-131072 >> 12 !== -32) { + throw new Test262Error('#402: -131072 >> 12 === -32. Actual: ' + (-131072 >> 12)); +} + + +if (-262144 >> 12 !== -64) { + throw new Test262Error('#403: -262144 >> 12 === -64. Actual: ' + (-262144 >> 12)); +} + + +if (-524288 >> 12 !== -128) { + throw new Test262Error('#404: -524288 >> 12 === -128. Actual: ' + (-524288 >> 12)); +} + + +if (-1048576 >> 12 !== -256) { + throw new Test262Error('#405: -1048576 >> 12 === -256. Actual: ' + (-1048576 >> 12)); +} + + +if (-2097152 >> 12 !== -512) { + throw new Test262Error('#406: -2097152 >> 12 === -512. Actual: ' + (-2097152 >> 12)); +} + + +if (-4194304 >> 12 !== -1024) { + throw new Test262Error('#407: -4194304 >> 12 === -1024. Actual: ' + (-4194304 >> 12)); +} + + +if (-8388608 >> 12 !== -2048) { + throw new Test262Error('#408: -8388608 >> 12 === -2048. Actual: ' + (-8388608 >> 12)); +} + + +if (-16777216 >> 12 !== -4096) { + throw new Test262Error('#409: -16777216 >> 12 === -4096. Actual: ' + (-16777216 >> 12)); +} + + +if (-33554432 >> 12 !== -8192) { + throw new Test262Error('#410: -33554432 >> 12 === -8192. Actual: ' + (-33554432 >> 12)); +} + + +if (-67108864 >> 12 !== -16384) { + throw new Test262Error('#411: -67108864 >> 12 === -16384. Actual: ' + (-67108864 >> 12)); +} + + +if (-134217728 >> 12 !== -32768) { + throw new Test262Error('#412: -134217728 >> 12 === -32768. Actual: ' + (-134217728 >> 12)); +} + + +if (-268435456 >> 12 !== -65536) { + throw new Test262Error('#413: -268435456 >> 12 === -65536. Actual: ' + (-268435456 >> 12)); +} + + +if (-536870912 >> 12 !== -131072) { + throw new Test262Error('#414: -536870912 >> 12 === -131072. Actual: ' + (-536870912 >> 12)); +} + + +if (-1073741824 >> 12 !== -262144) { + throw new Test262Error('#415: -1073741824 >> 12 === -262144. Actual: ' + (-1073741824 >> 12)); +} + + +if (-2147483648 >> 12 !== -524288) { + throw new Test262Error('#416: -2147483648 >> 12 === -524288. Actual: ' + (-2147483648 >> 12)); +} + + +if (-1 >> 13 !== -1) { + throw new Test262Error('#417: -1 >> 13 === -1. Actual: ' + (-1 >> 13)); +} + + +if (-2 >> 13 !== -1) { + throw new Test262Error('#418: -2 >> 13 === -1. Actual: ' + (-2 >> 13)); +} + + +if (-4 >> 13 !== -1) { + throw new Test262Error('#419: -4 >> 13 === -1. Actual: ' + (-4 >> 13)); +} + + +if (-8 >> 13 !== -1) { + throw new Test262Error('#420: -8 >> 13 === -1. Actual: ' + (-8 >> 13)); +} + + +if (-16 >> 13 !== -1) { + throw new Test262Error('#421: -16 >> 13 === -1. Actual: ' + (-16 >> 13)); +} + + +if (-32 >> 13 !== -1) { + throw new Test262Error('#422: -32 >> 13 === -1. Actual: ' + (-32 >> 13)); +} + + +if (-64 >> 13 !== -1) { + throw new Test262Error('#423: -64 >> 13 === -1. Actual: ' + (-64 >> 13)); +} + + +if (-128 >> 13 !== -1) { + throw new Test262Error('#424: -128 >> 13 === -1. Actual: ' + (-128 >> 13)); +} + + +if (-256 >> 13 !== -1) { + throw new Test262Error('#425: -256 >> 13 === -1. Actual: ' + (-256 >> 13)); +} + + +if (-512 >> 13 !== -1) { + throw new Test262Error('#426: -512 >> 13 === -1. Actual: ' + (-512 >> 13)); +} + + +if (-1024 >> 13 !== -1) { + throw new Test262Error('#427: -1024 >> 13 === -1. Actual: ' + (-1024 >> 13)); +} + + +if (-2048 >> 13 !== -1) { + throw new Test262Error('#428: -2048 >> 13 === -1. Actual: ' + (-2048 >> 13)); +} + + +if (-4096 >> 13 !== -1) { + throw new Test262Error('#429: -4096 >> 13 === -1. Actual: ' + (-4096 >> 13)); +} + + +if (-8192 >> 13 !== -1) { + throw new Test262Error('#430: -8192 >> 13 === -1. Actual: ' + (-8192 >> 13)); +} + + +if (-16384 >> 13 !== -2) { + throw new Test262Error('#431: -16384 >> 13 === -2. Actual: ' + (-16384 >> 13)); +} + + +if (-32768 >> 13 !== -4) { + throw new Test262Error('#432: -32768 >> 13 === -4. Actual: ' + (-32768 >> 13)); +} + + +if (-65536 >> 13 !== -8) { + throw new Test262Error('#433: -65536 >> 13 === -8. Actual: ' + (-65536 >> 13)); +} + + +if (-131072 >> 13 !== -16) { + throw new Test262Error('#434: -131072 >> 13 === -16. Actual: ' + (-131072 >> 13)); +} + + +if (-262144 >> 13 !== -32) { + throw new Test262Error('#435: -262144 >> 13 === -32. Actual: ' + (-262144 >> 13)); +} + + +if (-524288 >> 13 !== -64) { + throw new Test262Error('#436: -524288 >> 13 === -64. Actual: ' + (-524288 >> 13)); +} + + +if (-1048576 >> 13 !== -128) { + throw new Test262Error('#437: -1048576 >> 13 === -128. Actual: ' + (-1048576 >> 13)); +} + + +if (-2097152 >> 13 !== -256) { + throw new Test262Error('#438: -2097152 >> 13 === -256. Actual: ' + (-2097152 >> 13)); +} + + +if (-4194304 >> 13 !== -512) { + throw new Test262Error('#439: -4194304 >> 13 === -512. Actual: ' + (-4194304 >> 13)); +} + + +if (-8388608 >> 13 !== -1024) { + throw new Test262Error('#440: -8388608 >> 13 === -1024. Actual: ' + (-8388608 >> 13)); +} + + +if (-16777216 >> 13 !== -2048) { + throw new Test262Error('#441: -16777216 >> 13 === -2048. Actual: ' + (-16777216 >> 13)); +} + + +if (-33554432 >> 13 !== -4096) { + throw new Test262Error('#442: -33554432 >> 13 === -4096. Actual: ' + (-33554432 >> 13)); +} + + +if (-67108864 >> 13 !== -8192) { + throw new Test262Error('#443: -67108864 >> 13 === -8192. Actual: ' + (-67108864 >> 13)); +} + + +if (-134217728 >> 13 !== -16384) { + throw new Test262Error('#444: -134217728 >> 13 === -16384. Actual: ' + (-134217728 >> 13)); +} + + +if (-268435456 >> 13 !== -32768) { + throw new Test262Error('#445: -268435456 >> 13 === -32768. Actual: ' + (-268435456 >> 13)); +} + + +if (-536870912 >> 13 !== -65536) { + throw new Test262Error('#446: -536870912 >> 13 === -65536. Actual: ' + (-536870912 >> 13)); +} + + +if (-1073741824 >> 13 !== -131072) { + throw new Test262Error('#447: -1073741824 >> 13 === -131072. Actual: ' + (-1073741824 >> 13)); +} + + +if (-2147483648 >> 13 !== -262144) { + throw new Test262Error('#448: -2147483648 >> 13 === -262144. Actual: ' + (-2147483648 >> 13)); +} + + +if (-1 >> 14 !== -1) { + throw new Test262Error('#449: -1 >> 14 === -1. Actual: ' + (-1 >> 14)); +} + + +if (-2 >> 14 !== -1) { + throw new Test262Error('#450: -2 >> 14 === -1. Actual: ' + (-2 >> 14)); +} + + +if (-4 >> 14 !== -1) { + throw new Test262Error('#451: -4 >> 14 === -1. Actual: ' + (-4 >> 14)); +} + + +if (-8 >> 14 !== -1) { + throw new Test262Error('#452: -8 >> 14 === -1. Actual: ' + (-8 >> 14)); +} + + +if (-16 >> 14 !== -1) { + throw new Test262Error('#453: -16 >> 14 === -1. Actual: ' + (-16 >> 14)); +} + + +if (-32 >> 14 !== -1) { + throw new Test262Error('#454: -32 >> 14 === -1. Actual: ' + (-32 >> 14)); +} + + +if (-64 >> 14 !== -1) { + throw new Test262Error('#455: -64 >> 14 === -1. Actual: ' + (-64 >> 14)); +} + + +if (-128 >> 14 !== -1) { + throw new Test262Error('#456: -128 >> 14 === -1. Actual: ' + (-128 >> 14)); +} + + +if (-256 >> 14 !== -1) { + throw new Test262Error('#457: -256 >> 14 === -1. Actual: ' + (-256 >> 14)); +} + + +if (-512 >> 14 !== -1) { + throw new Test262Error('#458: -512 >> 14 === -1. Actual: ' + (-512 >> 14)); +} + + +if (-1024 >> 14 !== -1) { + throw new Test262Error('#459: -1024 >> 14 === -1. Actual: ' + (-1024 >> 14)); +} + + +if (-2048 >> 14 !== -1) { + throw new Test262Error('#460: -2048 >> 14 === -1. Actual: ' + (-2048 >> 14)); +} + + +if (-4096 >> 14 !== -1) { + throw new Test262Error('#461: -4096 >> 14 === -1. Actual: ' + (-4096 >> 14)); +} + + +if (-8192 >> 14 !== -1) { + throw new Test262Error('#462: -8192 >> 14 === -1. Actual: ' + (-8192 >> 14)); +} + + +if (-16384 >> 14 !== -1) { + throw new Test262Error('#463: -16384 >> 14 === -1. Actual: ' + (-16384 >> 14)); +} + + +if (-32768 >> 14 !== -2) { + throw new Test262Error('#464: -32768 >> 14 === -2. Actual: ' + (-32768 >> 14)); +} + + +if (-65536 >> 14 !== -4) { + throw new Test262Error('#465: -65536 >> 14 === -4. Actual: ' + (-65536 >> 14)); +} + + +if (-131072 >> 14 !== -8) { + throw new Test262Error('#466: -131072 >> 14 === -8. Actual: ' + (-131072 >> 14)); +} + + +if (-262144 >> 14 !== -16) { + throw new Test262Error('#467: -262144 >> 14 === -16. Actual: ' + (-262144 >> 14)); +} + + +if (-524288 >> 14 !== -32) { + throw new Test262Error('#468: -524288 >> 14 === -32. Actual: ' + (-524288 >> 14)); +} + + +if (-1048576 >> 14 !== -64) { + throw new Test262Error('#469: -1048576 >> 14 === -64. Actual: ' + (-1048576 >> 14)); +} + + +if (-2097152 >> 14 !== -128) { + throw new Test262Error('#470: -2097152 >> 14 === -128. Actual: ' + (-2097152 >> 14)); +} + + +if (-4194304 >> 14 !== -256) { + throw new Test262Error('#471: -4194304 >> 14 === -256. Actual: ' + (-4194304 >> 14)); +} + + +if (-8388608 >> 14 !== -512) { + throw new Test262Error('#472: -8388608 >> 14 === -512. Actual: ' + (-8388608 >> 14)); +} + + +if (-16777216 >> 14 !== -1024) { + throw new Test262Error('#473: -16777216 >> 14 === -1024. Actual: ' + (-16777216 >> 14)); +} + + +if (-33554432 >> 14 !== -2048) { + throw new Test262Error('#474: -33554432 >> 14 === -2048. Actual: ' + (-33554432 >> 14)); +} + + +if (-67108864 >> 14 !== -4096) { + throw new Test262Error('#475: -67108864 >> 14 === -4096. Actual: ' + (-67108864 >> 14)); +} + + +if (-134217728 >> 14 !== -8192) { + throw new Test262Error('#476: -134217728 >> 14 === -8192. Actual: ' + (-134217728 >> 14)); +} + + +if (-268435456 >> 14 !== -16384) { + throw new Test262Error('#477: -268435456 >> 14 === -16384. Actual: ' + (-268435456 >> 14)); +} + + +if (-536870912 >> 14 !== -32768) { + throw new Test262Error('#478: -536870912 >> 14 === -32768. Actual: ' + (-536870912 >> 14)); +} + + +if (-1073741824 >> 14 !== -65536) { + throw new Test262Error('#479: -1073741824 >> 14 === -65536. Actual: ' + (-1073741824 >> 14)); +} + + +if (-2147483648 >> 14 !== -131072) { + throw new Test262Error('#480: -2147483648 >> 14 === -131072. Actual: ' + (-2147483648 >> 14)); +} + + +if (-1 >> 15 !== -1) { + throw new Test262Error('#481: -1 >> 15 === -1. Actual: ' + (-1 >> 15)); +} + + +if (-2 >> 15 !== -1) { + throw new Test262Error('#482: -2 >> 15 === -1. Actual: ' + (-2 >> 15)); +} + + +if (-4 >> 15 !== -1) { + throw new Test262Error('#483: -4 >> 15 === -1. Actual: ' + (-4 >> 15)); +} + + +if (-8 >> 15 !== -1) { + throw new Test262Error('#484: -8 >> 15 === -1. Actual: ' + (-8 >> 15)); +} + + +if (-16 >> 15 !== -1) { + throw new Test262Error('#485: -16 >> 15 === -1. Actual: ' + (-16 >> 15)); +} + + +if (-32 >> 15 !== -1) { + throw new Test262Error('#486: -32 >> 15 === -1. Actual: ' + (-32 >> 15)); +} + + +if (-64 >> 15 !== -1) { + throw new Test262Error('#487: -64 >> 15 === -1. Actual: ' + (-64 >> 15)); +} + + +if (-128 >> 15 !== -1) { + throw new Test262Error('#488: -128 >> 15 === -1. Actual: ' + (-128 >> 15)); +} + + +if (-256 >> 15 !== -1) { + throw new Test262Error('#489: -256 >> 15 === -1. Actual: ' + (-256 >> 15)); +} + + +if (-512 >> 15 !== -1) { + throw new Test262Error('#490: -512 >> 15 === -1. Actual: ' + (-512 >> 15)); +} + + +if (-1024 >> 15 !== -1) { + throw new Test262Error('#491: -1024 >> 15 === -1. Actual: ' + (-1024 >> 15)); +} + + +if (-2048 >> 15 !== -1) { + throw new Test262Error('#492: -2048 >> 15 === -1. Actual: ' + (-2048 >> 15)); +} + + +if (-4096 >> 15 !== -1) { + throw new Test262Error('#493: -4096 >> 15 === -1. Actual: ' + (-4096 >> 15)); +} + + +if (-8192 >> 15 !== -1) { + throw new Test262Error('#494: -8192 >> 15 === -1. Actual: ' + (-8192 >> 15)); +} + + +if (-16384 >> 15 !== -1) { + throw new Test262Error('#495: -16384 >> 15 === -1. Actual: ' + (-16384 >> 15)); +} + + +if (-32768 >> 15 !== -1) { + throw new Test262Error('#496: -32768 >> 15 === -1. Actual: ' + (-32768 >> 15)); +} + + +if (-65536 >> 15 !== -2) { + throw new Test262Error('#497: -65536 >> 15 === -2. Actual: ' + (-65536 >> 15)); +} + + +if (-131072 >> 15 !== -4) { + throw new Test262Error('#498: -131072 >> 15 === -4. Actual: ' + (-131072 >> 15)); +} + + +if (-262144 >> 15 !== -8) { + throw new Test262Error('#499: -262144 >> 15 === -8. Actual: ' + (-262144 >> 15)); +} + + +if (-524288 >> 15 !== -16) { + throw new Test262Error('#500: -524288 >> 15 === -16. Actual: ' + (-524288 >> 15)); +} + + +if (-1048576 >> 15 !== -32) { + throw new Test262Error('#501: -1048576 >> 15 === -32. Actual: ' + (-1048576 >> 15)); +} + + +if (-2097152 >> 15 !== -64) { + throw new Test262Error('#502: -2097152 >> 15 === -64. Actual: ' + (-2097152 >> 15)); +} + + +if (-4194304 >> 15 !== -128) { + throw new Test262Error('#503: -4194304 >> 15 === -128. Actual: ' + (-4194304 >> 15)); +} + + +if (-8388608 >> 15 !== -256) { + throw new Test262Error('#504: -8388608 >> 15 === -256. Actual: ' + (-8388608 >> 15)); +} + + +if (-16777216 >> 15 !== -512) { + throw new Test262Error('#505: -16777216 >> 15 === -512. Actual: ' + (-16777216 >> 15)); +} + + +if (-33554432 >> 15 !== -1024) { + throw new Test262Error('#506: -33554432 >> 15 === -1024. Actual: ' + (-33554432 >> 15)); +} + + +if (-67108864 >> 15 !== -2048) { + throw new Test262Error('#507: -67108864 >> 15 === -2048. Actual: ' + (-67108864 >> 15)); +} + + +if (-134217728 >> 15 !== -4096) { + throw new Test262Error('#508: -134217728 >> 15 === -4096. Actual: ' + (-134217728 >> 15)); +} + + +if (-268435456 >> 15 !== -8192) { + throw new Test262Error('#509: -268435456 >> 15 === -8192. Actual: ' + (-268435456 >> 15)); +} + + +if (-536870912 >> 15 !== -16384) { + throw new Test262Error('#510: -536870912 >> 15 === -16384. Actual: ' + (-536870912 >> 15)); +} + + +if (-1073741824 >> 15 !== -32768) { + throw new Test262Error('#511: -1073741824 >> 15 === -32768. Actual: ' + (-1073741824 >> 15)); +} + + +if (-2147483648 >> 15 !== -65536) { + throw new Test262Error('#512: -2147483648 >> 15 === -65536. Actual: ' + (-2147483648 >> 15)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T2.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T2.js new file mode 100644 index 0000000000..a23ff1d3ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T2.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check x >> y operator in distinct points +es5id: 11.7.2_A4_T2 +description: ShiftExpression = 2^n - 1, n = 16...31 +---*/ + +//CHECK + +if (-1 >> 16 !== -1) { + throw new Test262Error('#513: -1 >> 16 === -1. Actual: ' + (-1 >> 16)); +} + + +if (-2 >> 16 !== -1) { + throw new Test262Error('#514: -2 >> 16 === -1. Actual: ' + (-2 >> 16)); +} + + +if (-4 >> 16 !== -1) { + throw new Test262Error('#515: -4 >> 16 === -1. Actual: ' + (-4 >> 16)); +} + + +if (-8 >> 16 !== -1) { + throw new Test262Error('#516: -8 >> 16 === -1. Actual: ' + (-8 >> 16)); +} + + +if (-16 >> 16 !== -1) { + throw new Test262Error('#517: -16 >> 16 === -1. Actual: ' + (-16 >> 16)); +} + + +if (-32 >> 16 !== -1) { + throw new Test262Error('#518: -32 >> 16 === -1. Actual: ' + (-32 >> 16)); +} + + +if (-64 >> 16 !== -1) { + throw new Test262Error('#519: -64 >> 16 === -1. Actual: ' + (-64 >> 16)); +} + + +if (-128 >> 16 !== -1) { + throw new Test262Error('#520: -128 >> 16 === -1. Actual: ' + (-128 >> 16)); +} + + +if (-256 >> 16 !== -1) { + throw new Test262Error('#521: -256 >> 16 === -1. Actual: ' + (-256 >> 16)); +} + + +if (-512 >> 16 !== -1) { + throw new Test262Error('#522: -512 >> 16 === -1. Actual: ' + (-512 >> 16)); +} + + +if (-1024 >> 16 !== -1) { + throw new Test262Error('#523: -1024 >> 16 === -1. Actual: ' + (-1024 >> 16)); +} + + +if (-2048 >> 16 !== -1) { + throw new Test262Error('#524: -2048 >> 16 === -1. Actual: ' + (-2048 >> 16)); +} + + +if (-4096 >> 16 !== -1) { + throw new Test262Error('#525: -4096 >> 16 === -1. Actual: ' + (-4096 >> 16)); +} + + +if (-8192 >> 16 !== -1) { + throw new Test262Error('#526: -8192 >> 16 === -1. Actual: ' + (-8192 >> 16)); +} + + +if (-16384 >> 16 !== -1) { + throw new Test262Error('#527: -16384 >> 16 === -1. Actual: ' + (-16384 >> 16)); +} + + +if (-32768 >> 16 !== -1) { + throw new Test262Error('#528: -32768 >> 16 === -1. Actual: ' + (-32768 >> 16)); +} + + +if (-65536 >> 16 !== -1) { + throw new Test262Error('#529: -65536 >> 16 === -1. Actual: ' + (-65536 >> 16)); +} + + +if (-131072 >> 16 !== -2) { + throw new Test262Error('#530: -131072 >> 16 === -2. Actual: ' + (-131072 >> 16)); +} + + +if (-262144 >> 16 !== -4) { + throw new Test262Error('#531: -262144 >> 16 === -4. Actual: ' + (-262144 >> 16)); +} + + +if (-524288 >> 16 !== -8) { + throw new Test262Error('#532: -524288 >> 16 === -8. Actual: ' + (-524288 >> 16)); +} + + +if (-1048576 >> 16 !== -16) { + throw new Test262Error('#533: -1048576 >> 16 === -16. Actual: ' + (-1048576 >> 16)); +} + + +if (-2097152 >> 16 !== -32) { + throw new Test262Error('#534: -2097152 >> 16 === -32. Actual: ' + (-2097152 >> 16)); +} + + +if (-4194304 >> 16 !== -64) { + throw new Test262Error('#535: -4194304 >> 16 === -64. Actual: ' + (-4194304 >> 16)); +} + + +if (-8388608 >> 16 !== -128) { + throw new Test262Error('#536: -8388608 >> 16 === -128. Actual: ' + (-8388608 >> 16)); +} + + +if (-16777216 >> 16 !== -256) { + throw new Test262Error('#537: -16777216 >> 16 === -256. Actual: ' + (-16777216 >> 16)); +} + + +if (-33554432 >> 16 !== -512) { + throw new Test262Error('#538: -33554432 >> 16 === -512. Actual: ' + (-33554432 >> 16)); +} + + +if (-67108864 >> 16 !== -1024) { + throw new Test262Error('#539: -67108864 >> 16 === -1024. Actual: ' + (-67108864 >> 16)); +} + + +if (-134217728 >> 16 !== -2048) { + throw new Test262Error('#540: -134217728 >> 16 === -2048. Actual: ' + (-134217728 >> 16)); +} + + +if (-268435456 >> 16 !== -4096) { + throw new Test262Error('#541: -268435456 >> 16 === -4096. Actual: ' + (-268435456 >> 16)); +} + + +if (-536870912 >> 16 !== -8192) { + throw new Test262Error('#542: -536870912 >> 16 === -8192. Actual: ' + (-536870912 >> 16)); +} + + +if (-1073741824 >> 16 !== -16384) { + throw new Test262Error('#543: -1073741824 >> 16 === -16384. Actual: ' + (-1073741824 >> 16)); +} + + +if (-2147483648 >> 16 !== -32768) { + throw new Test262Error('#544: -2147483648 >> 16 === -32768. Actual: ' + (-2147483648 >> 16)); +} + + +if (-1 >> 17 !== -1) { + throw new Test262Error('#545: -1 >> 17 === -1. Actual: ' + (-1 >> 17)); +} + + +if (-2 >> 17 !== -1) { + throw new Test262Error('#546: -2 >> 17 === -1. Actual: ' + (-2 >> 17)); +} + + +if (-4 >> 17 !== -1) { + throw new Test262Error('#547: -4 >> 17 === -1. Actual: ' + (-4 >> 17)); +} + + +if (-8 >> 17 !== -1) { + throw new Test262Error('#548: -8 >> 17 === -1. Actual: ' + (-8 >> 17)); +} + + +if (-16 >> 17 !== -1) { + throw new Test262Error('#549: -16 >> 17 === -1. Actual: ' + (-16 >> 17)); +} + + +if (-32 >> 17 !== -1) { + throw new Test262Error('#550: -32 >> 17 === -1. Actual: ' + (-32 >> 17)); +} + + +if (-64 >> 17 !== -1) { + throw new Test262Error('#551: -64 >> 17 === -1. Actual: ' + (-64 >> 17)); +} + + +if (-128 >> 17 !== -1) { + throw new Test262Error('#552: -128 >> 17 === -1. Actual: ' + (-128 >> 17)); +} + + +if (-256 >> 17 !== -1) { + throw new Test262Error('#553: -256 >> 17 === -1. Actual: ' + (-256 >> 17)); +} + + +if (-512 >> 17 !== -1) { + throw new Test262Error('#554: -512 >> 17 === -1. Actual: ' + (-512 >> 17)); +} + + +if (-1024 >> 17 !== -1) { + throw new Test262Error('#555: -1024 >> 17 === -1. Actual: ' + (-1024 >> 17)); +} + + +if (-2048 >> 17 !== -1) { + throw new Test262Error('#556: -2048 >> 17 === -1. Actual: ' + (-2048 >> 17)); +} + + +if (-4096 >> 17 !== -1) { + throw new Test262Error('#557: -4096 >> 17 === -1. Actual: ' + (-4096 >> 17)); +} + + +if (-8192 >> 17 !== -1) { + throw new Test262Error('#558: -8192 >> 17 === -1. Actual: ' + (-8192 >> 17)); +} + + +if (-16384 >> 17 !== -1) { + throw new Test262Error('#559: -16384 >> 17 === -1. Actual: ' + (-16384 >> 17)); +} + + +if (-32768 >> 17 !== -1) { + throw new Test262Error('#560: -32768 >> 17 === -1. Actual: ' + (-32768 >> 17)); +} + + +if (-65536 >> 17 !== -1) { + throw new Test262Error('#561: -65536 >> 17 === -1. Actual: ' + (-65536 >> 17)); +} + + +if (-131072 >> 17 !== -1) { + throw new Test262Error('#562: -131072 >> 17 === -1. Actual: ' + (-131072 >> 17)); +} + + +if (-262144 >> 17 !== -2) { + throw new Test262Error('#563: -262144 >> 17 === -2. Actual: ' + (-262144 >> 17)); +} + + +if (-524288 >> 17 !== -4) { + throw new Test262Error('#564: -524288 >> 17 === -4. Actual: ' + (-524288 >> 17)); +} + + +if (-1048576 >> 17 !== -8) { + throw new Test262Error('#565: -1048576 >> 17 === -8. Actual: ' + (-1048576 >> 17)); +} + + +if (-2097152 >> 17 !== -16) { + throw new Test262Error('#566: -2097152 >> 17 === -16. Actual: ' + (-2097152 >> 17)); +} + + +if (-4194304 >> 17 !== -32) { + throw new Test262Error('#567: -4194304 >> 17 === -32. Actual: ' + (-4194304 >> 17)); +} + + +if (-8388608 >> 17 !== -64) { + throw new Test262Error('#568: -8388608 >> 17 === -64. Actual: ' + (-8388608 >> 17)); +} + + +if (-16777216 >> 17 !== -128) { + throw new Test262Error('#569: -16777216 >> 17 === -128. Actual: ' + (-16777216 >> 17)); +} + + +if (-33554432 >> 17 !== -256) { + throw new Test262Error('#570: -33554432 >> 17 === -256. Actual: ' + (-33554432 >> 17)); +} + + +if (-67108864 >> 17 !== -512) { + throw new Test262Error('#571: -67108864 >> 17 === -512. Actual: ' + (-67108864 >> 17)); +} + + +if (-134217728 >> 17 !== -1024) { + throw new Test262Error('#572: -134217728 >> 17 === -1024. Actual: ' + (-134217728 >> 17)); +} + + +if (-268435456 >> 17 !== -2048) { + throw new Test262Error('#573: -268435456 >> 17 === -2048. Actual: ' + (-268435456 >> 17)); +} + + +if (-536870912 >> 17 !== -4096) { + throw new Test262Error('#574: -536870912 >> 17 === -4096. Actual: ' + (-536870912 >> 17)); +} + + +if (-1073741824 >> 17 !== -8192) { + throw new Test262Error('#575: -1073741824 >> 17 === -8192. Actual: ' + (-1073741824 >> 17)); +} + + +if (-2147483648 >> 17 !== -16384) { + throw new Test262Error('#576: -2147483648 >> 17 === -16384. Actual: ' + (-2147483648 >> 17)); +} + + +if (-1 >> 18 !== -1) { + throw new Test262Error('#577: -1 >> 18 === -1. Actual: ' + (-1 >> 18)); +} + + +if (-2 >> 18 !== -1) { + throw new Test262Error('#578: -2 >> 18 === -1. Actual: ' + (-2 >> 18)); +} + + +if (-4 >> 18 !== -1) { + throw new Test262Error('#579: -4 >> 18 === -1. Actual: ' + (-4 >> 18)); +} + + +if (-8 >> 18 !== -1) { + throw new Test262Error('#580: -8 >> 18 === -1. Actual: ' + (-8 >> 18)); +} + + +if (-16 >> 18 !== -1) { + throw new Test262Error('#581: -16 >> 18 === -1. Actual: ' + (-16 >> 18)); +} + + +if (-32 >> 18 !== -1) { + throw new Test262Error('#582: -32 >> 18 === -1. Actual: ' + (-32 >> 18)); +} + + +if (-64 >> 18 !== -1) { + throw new Test262Error('#583: -64 >> 18 === -1. Actual: ' + (-64 >> 18)); +} + + +if (-128 >> 18 !== -1) { + throw new Test262Error('#584: -128 >> 18 === -1. Actual: ' + (-128 >> 18)); +} + + +if (-256 >> 18 !== -1) { + throw new Test262Error('#585: -256 >> 18 === -1. Actual: ' + (-256 >> 18)); +} + + +if (-512 >> 18 !== -1) { + throw new Test262Error('#586: -512 >> 18 === -1. Actual: ' + (-512 >> 18)); +} + + +if (-1024 >> 18 !== -1) { + throw new Test262Error('#587: -1024 >> 18 === -1. Actual: ' + (-1024 >> 18)); +} + + +if (-2048 >> 18 !== -1) { + throw new Test262Error('#588: -2048 >> 18 === -1. Actual: ' + (-2048 >> 18)); +} + + +if (-4096 >> 18 !== -1) { + throw new Test262Error('#589: -4096 >> 18 === -1. Actual: ' + (-4096 >> 18)); +} + + +if (-8192 >> 18 !== -1) { + throw new Test262Error('#590: -8192 >> 18 === -1. Actual: ' + (-8192 >> 18)); +} + + +if (-16384 >> 18 !== -1) { + throw new Test262Error('#591: -16384 >> 18 === -1. Actual: ' + (-16384 >> 18)); +} + + +if (-32768 >> 18 !== -1) { + throw new Test262Error('#592: -32768 >> 18 === -1. Actual: ' + (-32768 >> 18)); +} + + +if (-65536 >> 18 !== -1) { + throw new Test262Error('#593: -65536 >> 18 === -1. Actual: ' + (-65536 >> 18)); +} + + +if (-131072 >> 18 !== -1) { + throw new Test262Error('#594: -131072 >> 18 === -1. Actual: ' + (-131072 >> 18)); +} + + +if (-262144 >> 18 !== -1) { + throw new Test262Error('#595: -262144 >> 18 === -1. Actual: ' + (-262144 >> 18)); +} + + +if (-524288 >> 18 !== -2) { + throw new Test262Error('#596: -524288 >> 18 === -2. Actual: ' + (-524288 >> 18)); +} + + +if (-1048576 >> 18 !== -4) { + throw new Test262Error('#597: -1048576 >> 18 === -4. Actual: ' + (-1048576 >> 18)); +} + + +if (-2097152 >> 18 !== -8) { + throw new Test262Error('#598: -2097152 >> 18 === -8. Actual: ' + (-2097152 >> 18)); +} + + +if (-4194304 >> 18 !== -16) { + throw new Test262Error('#599: -4194304 >> 18 === -16. Actual: ' + (-4194304 >> 18)); +} + + +if (-8388608 >> 18 !== -32) { + throw new Test262Error('#600: -8388608 >> 18 === -32. Actual: ' + (-8388608 >> 18)); +} + + +if (-16777216 >> 18 !== -64) { + throw new Test262Error('#601: -16777216 >> 18 === -64. Actual: ' + (-16777216 >> 18)); +} + + +if (-33554432 >> 18 !== -128) { + throw new Test262Error('#602: -33554432 >> 18 === -128. Actual: ' + (-33554432 >> 18)); +} + + +if (-67108864 >> 18 !== -256) { + throw new Test262Error('#603: -67108864 >> 18 === -256. Actual: ' + (-67108864 >> 18)); +} + + +if (-134217728 >> 18 !== -512) { + throw new Test262Error('#604: -134217728 >> 18 === -512. Actual: ' + (-134217728 >> 18)); +} + + +if (-268435456 >> 18 !== -1024) { + throw new Test262Error('#605: -268435456 >> 18 === -1024. Actual: ' + (-268435456 >> 18)); +} + + +if (-536870912 >> 18 !== -2048) { + throw new Test262Error('#606: -536870912 >> 18 === -2048. Actual: ' + (-536870912 >> 18)); +} + + +if (-1073741824 >> 18 !== -4096) { + throw new Test262Error('#607: -1073741824 >> 18 === -4096. Actual: ' + (-1073741824 >> 18)); +} + + +if (-2147483648 >> 18 !== -8192) { + throw new Test262Error('#608: -2147483648 >> 18 === -8192. Actual: ' + (-2147483648 >> 18)); +} + + +if (-1 >> 19 !== -1) { + throw new Test262Error('#609: -1 >> 19 === -1. Actual: ' + (-1 >> 19)); +} + + +if (-2 >> 19 !== -1) { + throw new Test262Error('#610: -2 >> 19 === -1. Actual: ' + (-2 >> 19)); +} + + +if (-4 >> 19 !== -1) { + throw new Test262Error('#611: -4 >> 19 === -1. Actual: ' + (-4 >> 19)); +} + + +if (-8 >> 19 !== -1) { + throw new Test262Error('#612: -8 >> 19 === -1. Actual: ' + (-8 >> 19)); +} + + +if (-16 >> 19 !== -1) { + throw new Test262Error('#613: -16 >> 19 === -1. Actual: ' + (-16 >> 19)); +} + + +if (-32 >> 19 !== -1) { + throw new Test262Error('#614: -32 >> 19 === -1. Actual: ' + (-32 >> 19)); +} + + +if (-64 >> 19 !== -1) { + throw new Test262Error('#615: -64 >> 19 === -1. Actual: ' + (-64 >> 19)); +} + + +if (-128 >> 19 !== -1) { + throw new Test262Error('#616: -128 >> 19 === -1. Actual: ' + (-128 >> 19)); +} + + +if (-256 >> 19 !== -1) { + throw new Test262Error('#617: -256 >> 19 === -1. Actual: ' + (-256 >> 19)); +} + + +if (-512 >> 19 !== -1) { + throw new Test262Error('#618: -512 >> 19 === -1. Actual: ' + (-512 >> 19)); +} + + +if (-1024 >> 19 !== -1) { + throw new Test262Error('#619: -1024 >> 19 === -1. Actual: ' + (-1024 >> 19)); +} + + +if (-2048 >> 19 !== -1) { + throw new Test262Error('#620: -2048 >> 19 === -1. Actual: ' + (-2048 >> 19)); +} + + +if (-4096 >> 19 !== -1) { + throw new Test262Error('#621: -4096 >> 19 === -1. Actual: ' + (-4096 >> 19)); +} + + +if (-8192 >> 19 !== -1) { + throw new Test262Error('#622: -8192 >> 19 === -1. Actual: ' + (-8192 >> 19)); +} + + +if (-16384 >> 19 !== -1) { + throw new Test262Error('#623: -16384 >> 19 === -1. Actual: ' + (-16384 >> 19)); +} + + +if (-32768 >> 19 !== -1) { + throw new Test262Error('#624: -32768 >> 19 === -1. Actual: ' + (-32768 >> 19)); +} + + +if (-65536 >> 19 !== -1) { + throw new Test262Error('#625: -65536 >> 19 === -1. Actual: ' + (-65536 >> 19)); +} + + +if (-131072 >> 19 !== -1) { + throw new Test262Error('#626: -131072 >> 19 === -1. Actual: ' + (-131072 >> 19)); +} + + +if (-262144 >> 19 !== -1) { + throw new Test262Error('#627: -262144 >> 19 === -1. Actual: ' + (-262144 >> 19)); +} + + +if (-524288 >> 19 !== -1) { + throw new Test262Error('#628: -524288 >> 19 === -1. Actual: ' + (-524288 >> 19)); +} + + +if (-1048576 >> 19 !== -2) { + throw new Test262Error('#629: -1048576 >> 19 === -2. Actual: ' + (-1048576 >> 19)); +} + + +if (-2097152 >> 19 !== -4) { + throw new Test262Error('#630: -2097152 >> 19 === -4. Actual: ' + (-2097152 >> 19)); +} + + +if (-4194304 >> 19 !== -8) { + throw new Test262Error('#631: -4194304 >> 19 === -8. Actual: ' + (-4194304 >> 19)); +} + + +if (-8388608 >> 19 !== -16) { + throw new Test262Error('#632: -8388608 >> 19 === -16. Actual: ' + (-8388608 >> 19)); +} + + +if (-16777216 >> 19 !== -32) { + throw new Test262Error('#633: -16777216 >> 19 === -32. Actual: ' + (-16777216 >> 19)); +} + + +if (-33554432 >> 19 !== -64) { + throw new Test262Error('#634: -33554432 >> 19 === -64. Actual: ' + (-33554432 >> 19)); +} + + +if (-67108864 >> 19 !== -128) { + throw new Test262Error('#635: -67108864 >> 19 === -128. Actual: ' + (-67108864 >> 19)); +} + + +if (-134217728 >> 19 !== -256) { + throw new Test262Error('#636: -134217728 >> 19 === -256. Actual: ' + (-134217728 >> 19)); +} + + +if (-268435456 >> 19 !== -512) { + throw new Test262Error('#637: -268435456 >> 19 === -512. Actual: ' + (-268435456 >> 19)); +} + + +if (-536870912 >> 19 !== -1024) { + throw new Test262Error('#638: -536870912 >> 19 === -1024. Actual: ' + (-536870912 >> 19)); +} + + +if (-1073741824 >> 19 !== -2048) { + throw new Test262Error('#639: -1073741824 >> 19 === -2048. Actual: ' + (-1073741824 >> 19)); +} + + +if (-2147483648 >> 19 !== -4096) { + throw new Test262Error('#640: -2147483648 >> 19 === -4096. Actual: ' + (-2147483648 >> 19)); +} + + +if (-1 >> 20 !== -1) { + throw new Test262Error('#641: -1 >> 20 === -1. Actual: ' + (-1 >> 20)); +} + + +if (-2 >> 20 !== -1) { + throw new Test262Error('#642: -2 >> 20 === -1. Actual: ' + (-2 >> 20)); +} + + +if (-4 >> 20 !== -1) { + throw new Test262Error('#643: -4 >> 20 === -1. Actual: ' + (-4 >> 20)); +} + + +if (-8 >> 20 !== -1) { + throw new Test262Error('#644: -8 >> 20 === -1. Actual: ' + (-8 >> 20)); +} + + +if (-16 >> 20 !== -1) { + throw new Test262Error('#645: -16 >> 20 === -1. Actual: ' + (-16 >> 20)); +} + + +if (-32 >> 20 !== -1) { + throw new Test262Error('#646: -32 >> 20 === -1. Actual: ' + (-32 >> 20)); +} + + +if (-64 >> 20 !== -1) { + throw new Test262Error('#647: -64 >> 20 === -1. Actual: ' + (-64 >> 20)); +} + + +if (-128 >> 20 !== -1) { + throw new Test262Error('#648: -128 >> 20 === -1. Actual: ' + (-128 >> 20)); +} + + +if (-256 >> 20 !== -1) { + throw new Test262Error('#649: -256 >> 20 === -1. Actual: ' + (-256 >> 20)); +} + + +if (-512 >> 20 !== -1) { + throw new Test262Error('#650: -512 >> 20 === -1. Actual: ' + (-512 >> 20)); +} + + +if (-1024 >> 20 !== -1) { + throw new Test262Error('#651: -1024 >> 20 === -1. Actual: ' + (-1024 >> 20)); +} + + +if (-2048 >> 20 !== -1) { + throw new Test262Error('#652: -2048 >> 20 === -1. Actual: ' + (-2048 >> 20)); +} + + +if (-4096 >> 20 !== -1) { + throw new Test262Error('#653: -4096 >> 20 === -1. Actual: ' + (-4096 >> 20)); +} + + +if (-8192 >> 20 !== -1) { + throw new Test262Error('#654: -8192 >> 20 === -1. Actual: ' + (-8192 >> 20)); +} + + +if (-16384 >> 20 !== -1) { + throw new Test262Error('#655: -16384 >> 20 === -1. Actual: ' + (-16384 >> 20)); +} + + +if (-32768 >> 20 !== -1) { + throw new Test262Error('#656: -32768 >> 20 === -1. Actual: ' + (-32768 >> 20)); +} + + +if (-65536 >> 20 !== -1) { + throw new Test262Error('#657: -65536 >> 20 === -1. Actual: ' + (-65536 >> 20)); +} + + +if (-131072 >> 20 !== -1) { + throw new Test262Error('#658: -131072 >> 20 === -1. Actual: ' + (-131072 >> 20)); +} + + +if (-262144 >> 20 !== -1) { + throw new Test262Error('#659: -262144 >> 20 === -1. Actual: ' + (-262144 >> 20)); +} + + +if (-524288 >> 20 !== -1) { + throw new Test262Error('#660: -524288 >> 20 === -1. Actual: ' + (-524288 >> 20)); +} + + +if (-1048576 >> 20 !== -1) { + throw new Test262Error('#661: -1048576 >> 20 === -1. Actual: ' + (-1048576 >> 20)); +} + + +if (-2097152 >> 20 !== -2) { + throw new Test262Error('#662: -2097152 >> 20 === -2. Actual: ' + (-2097152 >> 20)); +} + + +if (-4194304 >> 20 !== -4) { + throw new Test262Error('#663: -4194304 >> 20 === -4. Actual: ' + (-4194304 >> 20)); +} + + +if (-8388608 >> 20 !== -8) { + throw new Test262Error('#664: -8388608 >> 20 === -8. Actual: ' + (-8388608 >> 20)); +} + + +if (-16777216 >> 20 !== -16) { + throw new Test262Error('#665: -16777216 >> 20 === -16. Actual: ' + (-16777216 >> 20)); +} + + +if (-33554432 >> 20 !== -32) { + throw new Test262Error('#666: -33554432 >> 20 === -32. Actual: ' + (-33554432 >> 20)); +} + + +if (-67108864 >> 20 !== -64) { + throw new Test262Error('#667: -67108864 >> 20 === -64. Actual: ' + (-67108864 >> 20)); +} + + +if (-134217728 >> 20 !== -128) { + throw new Test262Error('#668: -134217728 >> 20 === -128. Actual: ' + (-134217728 >> 20)); +} + + +if (-268435456 >> 20 !== -256) { + throw new Test262Error('#669: -268435456 >> 20 === -256. Actual: ' + (-268435456 >> 20)); +} + + +if (-536870912 >> 20 !== -512) { + throw new Test262Error('#670: -536870912 >> 20 === -512. Actual: ' + (-536870912 >> 20)); +} + + +if (-1073741824 >> 20 !== -1024) { + throw new Test262Error('#671: -1073741824 >> 20 === -1024. Actual: ' + (-1073741824 >> 20)); +} + + +if (-2147483648 >> 20 !== -2048) { + throw new Test262Error('#672: -2147483648 >> 20 === -2048. Actual: ' + (-2147483648 >> 20)); +} + + +if (-1 >> 21 !== -1) { + throw new Test262Error('#673: -1 >> 21 === -1. Actual: ' + (-1 >> 21)); +} + + +if (-2 >> 21 !== -1) { + throw new Test262Error('#674: -2 >> 21 === -1. Actual: ' + (-2 >> 21)); +} + + +if (-4 >> 21 !== -1) { + throw new Test262Error('#675: -4 >> 21 === -1. Actual: ' + (-4 >> 21)); +} + + +if (-8 >> 21 !== -1) { + throw new Test262Error('#676: -8 >> 21 === -1. Actual: ' + (-8 >> 21)); +} + + +if (-16 >> 21 !== -1) { + throw new Test262Error('#677: -16 >> 21 === -1. Actual: ' + (-16 >> 21)); +} + + +if (-32 >> 21 !== -1) { + throw new Test262Error('#678: -32 >> 21 === -1. Actual: ' + (-32 >> 21)); +} + + +if (-64 >> 21 !== -1) { + throw new Test262Error('#679: -64 >> 21 === -1. Actual: ' + (-64 >> 21)); +} + + +if (-128 >> 21 !== -1) { + throw new Test262Error('#680: -128 >> 21 === -1. Actual: ' + (-128 >> 21)); +} + + +if (-256 >> 21 !== -1) { + throw new Test262Error('#681: -256 >> 21 === -1. Actual: ' + (-256 >> 21)); +} + + +if (-512 >> 21 !== -1) { + throw new Test262Error('#682: -512 >> 21 === -1. Actual: ' + (-512 >> 21)); +} + + +if (-1024 >> 21 !== -1) { + throw new Test262Error('#683: -1024 >> 21 === -1. Actual: ' + (-1024 >> 21)); +} + + +if (-2048 >> 21 !== -1) { + throw new Test262Error('#684: -2048 >> 21 === -1. Actual: ' + (-2048 >> 21)); +} + + +if (-4096 >> 21 !== -1) { + throw new Test262Error('#685: -4096 >> 21 === -1. Actual: ' + (-4096 >> 21)); +} + + +if (-8192 >> 21 !== -1) { + throw new Test262Error('#686: -8192 >> 21 === -1. Actual: ' + (-8192 >> 21)); +} + + +if (-16384 >> 21 !== -1) { + throw new Test262Error('#687: -16384 >> 21 === -1. Actual: ' + (-16384 >> 21)); +} + + +if (-32768 >> 21 !== -1) { + throw new Test262Error('#688: -32768 >> 21 === -1. Actual: ' + (-32768 >> 21)); +} + + +if (-65536 >> 21 !== -1) { + throw new Test262Error('#689: -65536 >> 21 === -1. Actual: ' + (-65536 >> 21)); +} + + +if (-131072 >> 21 !== -1) { + throw new Test262Error('#690: -131072 >> 21 === -1. Actual: ' + (-131072 >> 21)); +} + + +if (-262144 >> 21 !== -1) { + throw new Test262Error('#691: -262144 >> 21 === -1. Actual: ' + (-262144 >> 21)); +} + + +if (-524288 >> 21 !== -1) { + throw new Test262Error('#692: -524288 >> 21 === -1. Actual: ' + (-524288 >> 21)); +} + + +if (-1048576 >> 21 !== -1) { + throw new Test262Error('#693: -1048576 >> 21 === -1. Actual: ' + (-1048576 >> 21)); +} + + +if (-2097152 >> 21 !== -1) { + throw new Test262Error('#694: -2097152 >> 21 === -1. Actual: ' + (-2097152 >> 21)); +} + + +if (-4194304 >> 21 !== -2) { + throw new Test262Error('#695: -4194304 >> 21 === -2. Actual: ' + (-4194304 >> 21)); +} + + +if (-8388608 >> 21 !== -4) { + throw new Test262Error('#696: -8388608 >> 21 === -4. Actual: ' + (-8388608 >> 21)); +} + + +if (-16777216 >> 21 !== -8) { + throw new Test262Error('#697: -16777216 >> 21 === -8. Actual: ' + (-16777216 >> 21)); +} + + +if (-33554432 >> 21 !== -16) { + throw new Test262Error('#698: -33554432 >> 21 === -16. Actual: ' + (-33554432 >> 21)); +} + + +if (-67108864 >> 21 !== -32) { + throw new Test262Error('#699: -67108864 >> 21 === -32. Actual: ' + (-67108864 >> 21)); +} + + +if (-134217728 >> 21 !== -64) { + throw new Test262Error('#700: -134217728 >> 21 === -64. Actual: ' + (-134217728 >> 21)); +} + + +if (-268435456 >> 21 !== -128) { + throw new Test262Error('#701: -268435456 >> 21 === -128. Actual: ' + (-268435456 >> 21)); +} + + +if (-536870912 >> 21 !== -256) { + throw new Test262Error('#702: -536870912 >> 21 === -256. Actual: ' + (-536870912 >> 21)); +} + + +if (-1073741824 >> 21 !== -512) { + throw new Test262Error('#703: -1073741824 >> 21 === -512. Actual: ' + (-1073741824 >> 21)); +} + + +if (-2147483648 >> 21 !== -1024) { + throw new Test262Error('#704: -2147483648 >> 21 === -1024. Actual: ' + (-2147483648 >> 21)); +} + + +if (-1 >> 22 !== -1) { + throw new Test262Error('#705: -1 >> 22 === -1. Actual: ' + (-1 >> 22)); +} + + +if (-2 >> 22 !== -1) { + throw new Test262Error('#706: -2 >> 22 === -1. Actual: ' + (-2 >> 22)); +} + + +if (-4 >> 22 !== -1) { + throw new Test262Error('#707: -4 >> 22 === -1. Actual: ' + (-4 >> 22)); +} + + +if (-8 >> 22 !== -1) { + throw new Test262Error('#708: -8 >> 22 === -1. Actual: ' + (-8 >> 22)); +} + + +if (-16 >> 22 !== -1) { + throw new Test262Error('#709: -16 >> 22 === -1. Actual: ' + (-16 >> 22)); +} + + +if (-32 >> 22 !== -1) { + throw new Test262Error('#710: -32 >> 22 === -1. Actual: ' + (-32 >> 22)); +} + + +if (-64 >> 22 !== -1) { + throw new Test262Error('#711: -64 >> 22 === -1. Actual: ' + (-64 >> 22)); +} + + +if (-128 >> 22 !== -1) { + throw new Test262Error('#712: -128 >> 22 === -1. Actual: ' + (-128 >> 22)); +} + + +if (-256 >> 22 !== -1) { + throw new Test262Error('#713: -256 >> 22 === -1. Actual: ' + (-256 >> 22)); +} + + +if (-512 >> 22 !== -1) { + throw new Test262Error('#714: -512 >> 22 === -1. Actual: ' + (-512 >> 22)); +} + + +if (-1024 >> 22 !== -1) { + throw new Test262Error('#715: -1024 >> 22 === -1. Actual: ' + (-1024 >> 22)); +} + + +if (-2048 >> 22 !== -1) { + throw new Test262Error('#716: -2048 >> 22 === -1. Actual: ' + (-2048 >> 22)); +} + + +if (-4096 >> 22 !== -1) { + throw new Test262Error('#717: -4096 >> 22 === -1. Actual: ' + (-4096 >> 22)); +} + + +if (-8192 >> 22 !== -1) { + throw new Test262Error('#718: -8192 >> 22 === -1. Actual: ' + (-8192 >> 22)); +} + + +if (-16384 >> 22 !== -1) { + throw new Test262Error('#719: -16384 >> 22 === -1. Actual: ' + (-16384 >> 22)); +} + + +if (-32768 >> 22 !== -1) { + throw new Test262Error('#720: -32768 >> 22 === -1. Actual: ' + (-32768 >> 22)); +} + + +if (-65536 >> 22 !== -1) { + throw new Test262Error('#721: -65536 >> 22 === -1. Actual: ' + (-65536 >> 22)); +} + + +if (-131072 >> 22 !== -1) { + throw new Test262Error('#722: -131072 >> 22 === -1. Actual: ' + (-131072 >> 22)); +} + + +if (-262144 >> 22 !== -1) { + throw new Test262Error('#723: -262144 >> 22 === -1. Actual: ' + (-262144 >> 22)); +} + + +if (-524288 >> 22 !== -1) { + throw new Test262Error('#724: -524288 >> 22 === -1. Actual: ' + (-524288 >> 22)); +} + + +if (-1048576 >> 22 !== -1) { + throw new Test262Error('#725: -1048576 >> 22 === -1. Actual: ' + (-1048576 >> 22)); +} + + +if (-2097152 >> 22 !== -1) { + throw new Test262Error('#726: -2097152 >> 22 === -1. Actual: ' + (-2097152 >> 22)); +} + + +if (-4194304 >> 22 !== -1) { + throw new Test262Error('#727: -4194304 >> 22 === -1. Actual: ' + (-4194304 >> 22)); +} + + +if (-8388608 >> 22 !== -2) { + throw new Test262Error('#728: -8388608 >> 22 === -2. Actual: ' + (-8388608 >> 22)); +} + + +if (-16777216 >> 22 !== -4) { + throw new Test262Error('#729: -16777216 >> 22 === -4. Actual: ' + (-16777216 >> 22)); +} + + +if (-33554432 >> 22 !== -8) { + throw new Test262Error('#730: -33554432 >> 22 === -8. Actual: ' + (-33554432 >> 22)); +} + + +if (-67108864 >> 22 !== -16) { + throw new Test262Error('#731: -67108864 >> 22 === -16. Actual: ' + (-67108864 >> 22)); +} + + +if (-134217728 >> 22 !== -32) { + throw new Test262Error('#732: -134217728 >> 22 === -32. Actual: ' + (-134217728 >> 22)); +} + + +if (-268435456 >> 22 !== -64) { + throw new Test262Error('#733: -268435456 >> 22 === -64. Actual: ' + (-268435456 >> 22)); +} + + +if (-536870912 >> 22 !== -128) { + throw new Test262Error('#734: -536870912 >> 22 === -128. Actual: ' + (-536870912 >> 22)); +} + + +if (-1073741824 >> 22 !== -256) { + throw new Test262Error('#735: -1073741824 >> 22 === -256. Actual: ' + (-1073741824 >> 22)); +} + + +if (-2147483648 >> 22 !== -512) { + throw new Test262Error('#736: -2147483648 >> 22 === -512. Actual: ' + (-2147483648 >> 22)); +} + + +if (-1 >> 23 !== -1) { + throw new Test262Error('#737: -1 >> 23 === -1. Actual: ' + (-1 >> 23)); +} + + +if (-2 >> 23 !== -1) { + throw new Test262Error('#738: -2 >> 23 === -1. Actual: ' + (-2 >> 23)); +} + + +if (-4 >> 23 !== -1) { + throw new Test262Error('#739: -4 >> 23 === -1. Actual: ' + (-4 >> 23)); +} + + +if (-8 >> 23 !== -1) { + throw new Test262Error('#740: -8 >> 23 === -1. Actual: ' + (-8 >> 23)); +} + + +if (-16 >> 23 !== -1) { + throw new Test262Error('#741: -16 >> 23 === -1. Actual: ' + (-16 >> 23)); +} + + +if (-32 >> 23 !== -1) { + throw new Test262Error('#742: -32 >> 23 === -1. Actual: ' + (-32 >> 23)); +} + + +if (-64 >> 23 !== -1) { + throw new Test262Error('#743: -64 >> 23 === -1. Actual: ' + (-64 >> 23)); +} + + +if (-128 >> 23 !== -1) { + throw new Test262Error('#744: -128 >> 23 === -1. Actual: ' + (-128 >> 23)); +} + + +if (-256 >> 23 !== -1) { + throw new Test262Error('#745: -256 >> 23 === -1. Actual: ' + (-256 >> 23)); +} + + +if (-512 >> 23 !== -1) { + throw new Test262Error('#746: -512 >> 23 === -1. Actual: ' + (-512 >> 23)); +} + + +if (-1024 >> 23 !== -1) { + throw new Test262Error('#747: -1024 >> 23 === -1. Actual: ' + (-1024 >> 23)); +} + + +if (-2048 >> 23 !== -1) { + throw new Test262Error('#748: -2048 >> 23 === -1. Actual: ' + (-2048 >> 23)); +} + + +if (-4096 >> 23 !== -1) { + throw new Test262Error('#749: -4096 >> 23 === -1. Actual: ' + (-4096 >> 23)); +} + + +if (-8192 >> 23 !== -1) { + throw new Test262Error('#750: -8192 >> 23 === -1. Actual: ' + (-8192 >> 23)); +} + + +if (-16384 >> 23 !== -1) { + throw new Test262Error('#751: -16384 >> 23 === -1. Actual: ' + (-16384 >> 23)); +} + + +if (-32768 >> 23 !== -1) { + throw new Test262Error('#752: -32768 >> 23 === -1. Actual: ' + (-32768 >> 23)); +} + + +if (-65536 >> 23 !== -1) { + throw new Test262Error('#753: -65536 >> 23 === -1. Actual: ' + (-65536 >> 23)); +} + + +if (-131072 >> 23 !== -1) { + throw new Test262Error('#754: -131072 >> 23 === -1. Actual: ' + (-131072 >> 23)); +} + + +if (-262144 >> 23 !== -1) { + throw new Test262Error('#755: -262144 >> 23 === -1. Actual: ' + (-262144 >> 23)); +} + + +if (-524288 >> 23 !== -1) { + throw new Test262Error('#756: -524288 >> 23 === -1. Actual: ' + (-524288 >> 23)); +} + + +if (-1048576 >> 23 !== -1) { + throw new Test262Error('#757: -1048576 >> 23 === -1. Actual: ' + (-1048576 >> 23)); +} + + +if (-2097152 >> 23 !== -1) { + throw new Test262Error('#758: -2097152 >> 23 === -1. Actual: ' + (-2097152 >> 23)); +} + + +if (-4194304 >> 23 !== -1) { + throw new Test262Error('#759: -4194304 >> 23 === -1. Actual: ' + (-4194304 >> 23)); +} + + +if (-8388608 >> 23 !== -1) { + throw new Test262Error('#760: -8388608 >> 23 === -1. Actual: ' + (-8388608 >> 23)); +} + + +if (-16777216 >> 23 !== -2) { + throw new Test262Error('#761: -16777216 >> 23 === -2. Actual: ' + (-16777216 >> 23)); +} + + +if (-33554432 >> 23 !== -4) { + throw new Test262Error('#762: -33554432 >> 23 === -4. Actual: ' + (-33554432 >> 23)); +} + + +if (-67108864 >> 23 !== -8) { + throw new Test262Error('#763: -67108864 >> 23 === -8. Actual: ' + (-67108864 >> 23)); +} + + +if (-134217728 >> 23 !== -16) { + throw new Test262Error('#764: -134217728 >> 23 === -16. Actual: ' + (-134217728 >> 23)); +} + + +if (-268435456 >> 23 !== -32) { + throw new Test262Error('#765: -268435456 >> 23 === -32. Actual: ' + (-268435456 >> 23)); +} + + +if (-536870912 >> 23 !== -64) { + throw new Test262Error('#766: -536870912 >> 23 === -64. Actual: ' + (-536870912 >> 23)); +} + + +if (-1073741824 >> 23 !== -128) { + throw new Test262Error('#767: -1073741824 >> 23 === -128. Actual: ' + (-1073741824 >> 23)); +} + + +if (-2147483648 >> 23 !== -256) { + throw new Test262Error('#768: -2147483648 >> 23 === -256. Actual: ' + (-2147483648 >> 23)); +} + + +if (-1 >> 24 !== -1) { + throw new Test262Error('#769: -1 >> 24 === -1. Actual: ' + (-1 >> 24)); +} + + +if (-2 >> 24 !== -1) { + throw new Test262Error('#770: -2 >> 24 === -1. Actual: ' + (-2 >> 24)); +} + + +if (-4 >> 24 !== -1) { + throw new Test262Error('#771: -4 >> 24 === -1. Actual: ' + (-4 >> 24)); +} + + +if (-8 >> 24 !== -1) { + throw new Test262Error('#772: -8 >> 24 === -1. Actual: ' + (-8 >> 24)); +} + + +if (-16 >> 24 !== -1) { + throw new Test262Error('#773: -16 >> 24 === -1. Actual: ' + (-16 >> 24)); +} + + +if (-32 >> 24 !== -1) { + throw new Test262Error('#774: -32 >> 24 === -1. Actual: ' + (-32 >> 24)); +} + + +if (-64 >> 24 !== -1) { + throw new Test262Error('#775: -64 >> 24 === -1. Actual: ' + (-64 >> 24)); +} + + +if (-128 >> 24 !== -1) { + throw new Test262Error('#776: -128 >> 24 === -1. Actual: ' + (-128 >> 24)); +} + + +if (-256 >> 24 !== -1) { + throw new Test262Error('#777: -256 >> 24 === -1. Actual: ' + (-256 >> 24)); +} + + +if (-512 >> 24 !== -1) { + throw new Test262Error('#778: -512 >> 24 === -1. Actual: ' + (-512 >> 24)); +} + + +if (-1024 >> 24 !== -1) { + throw new Test262Error('#779: -1024 >> 24 === -1. Actual: ' + (-1024 >> 24)); +} + + +if (-2048 >> 24 !== -1) { + throw new Test262Error('#780: -2048 >> 24 === -1. Actual: ' + (-2048 >> 24)); +} + + +if (-4096 >> 24 !== -1) { + throw new Test262Error('#781: -4096 >> 24 === -1. Actual: ' + (-4096 >> 24)); +} + + +if (-8192 >> 24 !== -1) { + throw new Test262Error('#782: -8192 >> 24 === -1. Actual: ' + (-8192 >> 24)); +} + + +if (-16384 >> 24 !== -1) { + throw new Test262Error('#783: -16384 >> 24 === -1. Actual: ' + (-16384 >> 24)); +} + + +if (-32768 >> 24 !== -1) { + throw new Test262Error('#784: -32768 >> 24 === -1. Actual: ' + (-32768 >> 24)); +} + + +if (-65536 >> 24 !== -1) { + throw new Test262Error('#785: -65536 >> 24 === -1. Actual: ' + (-65536 >> 24)); +} + + +if (-131072 >> 24 !== -1) { + throw new Test262Error('#786: -131072 >> 24 === -1. Actual: ' + (-131072 >> 24)); +} + + +if (-262144 >> 24 !== -1) { + throw new Test262Error('#787: -262144 >> 24 === -1. Actual: ' + (-262144 >> 24)); +} + + +if (-524288 >> 24 !== -1) { + throw new Test262Error('#788: -524288 >> 24 === -1. Actual: ' + (-524288 >> 24)); +} + + +if (-1048576 >> 24 !== -1) { + throw new Test262Error('#789: -1048576 >> 24 === -1. Actual: ' + (-1048576 >> 24)); +} + + +if (-2097152 >> 24 !== -1) { + throw new Test262Error('#790: -2097152 >> 24 === -1. Actual: ' + (-2097152 >> 24)); +} + + +if (-4194304 >> 24 !== -1) { + throw new Test262Error('#791: -4194304 >> 24 === -1. Actual: ' + (-4194304 >> 24)); +} + + +if (-8388608 >> 24 !== -1) { + throw new Test262Error('#792: -8388608 >> 24 === -1. Actual: ' + (-8388608 >> 24)); +} + + +if (-16777216 >> 24 !== -1) { + throw new Test262Error('#793: -16777216 >> 24 === -1. Actual: ' + (-16777216 >> 24)); +} + + +if (-33554432 >> 24 !== -2) { + throw new Test262Error('#794: -33554432 >> 24 === -2. Actual: ' + (-33554432 >> 24)); +} + + +if (-67108864 >> 24 !== -4) { + throw new Test262Error('#795: -67108864 >> 24 === -4. Actual: ' + (-67108864 >> 24)); +} + + +if (-134217728 >> 24 !== -8) { + throw new Test262Error('#796: -134217728 >> 24 === -8. Actual: ' + (-134217728 >> 24)); +} + + +if (-268435456 >> 24 !== -16) { + throw new Test262Error('#797: -268435456 >> 24 === -16. Actual: ' + (-268435456 >> 24)); +} + + +if (-536870912 >> 24 !== -32) { + throw new Test262Error('#798: -536870912 >> 24 === -32. Actual: ' + (-536870912 >> 24)); +} + + +if (-1073741824 >> 24 !== -64) { + throw new Test262Error('#799: -1073741824 >> 24 === -64. Actual: ' + (-1073741824 >> 24)); +} + + +if (-2147483648 >> 24 !== -128) { + throw new Test262Error('#800: -2147483648 >> 24 === -128. Actual: ' + (-2147483648 >> 24)); +} + + +if (-1 >> 25 !== -1) { + throw new Test262Error('#801: -1 >> 25 === -1. Actual: ' + (-1 >> 25)); +} + + +if (-2 >> 25 !== -1) { + throw new Test262Error('#802: -2 >> 25 === -1. Actual: ' + (-2 >> 25)); +} + + +if (-4 >> 25 !== -1) { + throw new Test262Error('#803: -4 >> 25 === -1. Actual: ' + (-4 >> 25)); +} + + +if (-8 >> 25 !== -1) { + throw new Test262Error('#804: -8 >> 25 === -1. Actual: ' + (-8 >> 25)); +} + + +if (-16 >> 25 !== -1) { + throw new Test262Error('#805: -16 >> 25 === -1. Actual: ' + (-16 >> 25)); +} + + +if (-32 >> 25 !== -1) { + throw new Test262Error('#806: -32 >> 25 === -1. Actual: ' + (-32 >> 25)); +} + + +if (-64 >> 25 !== -1) { + throw new Test262Error('#807: -64 >> 25 === -1. Actual: ' + (-64 >> 25)); +} + + +if (-128 >> 25 !== -1) { + throw new Test262Error('#808: -128 >> 25 === -1. Actual: ' + (-128 >> 25)); +} + + +if (-256 >> 25 !== -1) { + throw new Test262Error('#809: -256 >> 25 === -1. Actual: ' + (-256 >> 25)); +} + + +if (-512 >> 25 !== -1) { + throw new Test262Error('#810: -512 >> 25 === -1. Actual: ' + (-512 >> 25)); +} + + +if (-1024 >> 25 !== -1) { + throw new Test262Error('#811: -1024 >> 25 === -1. Actual: ' + (-1024 >> 25)); +} + + +if (-2048 >> 25 !== -1) { + throw new Test262Error('#812: -2048 >> 25 === -1. Actual: ' + (-2048 >> 25)); +} + + +if (-4096 >> 25 !== -1) { + throw new Test262Error('#813: -4096 >> 25 === -1. Actual: ' + (-4096 >> 25)); +} + + +if (-8192 >> 25 !== -1) { + throw new Test262Error('#814: -8192 >> 25 === -1. Actual: ' + (-8192 >> 25)); +} + + +if (-16384 >> 25 !== -1) { + throw new Test262Error('#815: -16384 >> 25 === -1. Actual: ' + (-16384 >> 25)); +} + + +if (-32768 >> 25 !== -1) { + throw new Test262Error('#816: -32768 >> 25 === -1. Actual: ' + (-32768 >> 25)); +} + + +if (-65536 >> 25 !== -1) { + throw new Test262Error('#817: -65536 >> 25 === -1. Actual: ' + (-65536 >> 25)); +} + + +if (-131072 >> 25 !== -1) { + throw new Test262Error('#818: -131072 >> 25 === -1. Actual: ' + (-131072 >> 25)); +} + + +if (-262144 >> 25 !== -1) { + throw new Test262Error('#819: -262144 >> 25 === -1. Actual: ' + (-262144 >> 25)); +} + + +if (-524288 >> 25 !== -1) { + throw new Test262Error('#820: -524288 >> 25 === -1. Actual: ' + (-524288 >> 25)); +} + + +if (-1048576 >> 25 !== -1) { + throw new Test262Error('#821: -1048576 >> 25 === -1. Actual: ' + (-1048576 >> 25)); +} + + +if (-2097152 >> 25 !== -1) { + throw new Test262Error('#822: -2097152 >> 25 === -1. Actual: ' + (-2097152 >> 25)); +} + + +if (-4194304 >> 25 !== -1) { + throw new Test262Error('#823: -4194304 >> 25 === -1. Actual: ' + (-4194304 >> 25)); +} + + +if (-8388608 >> 25 !== -1) { + throw new Test262Error('#824: -8388608 >> 25 === -1. Actual: ' + (-8388608 >> 25)); +} + + +if (-16777216 >> 25 !== -1) { + throw new Test262Error('#825: -16777216 >> 25 === -1. Actual: ' + (-16777216 >> 25)); +} + + +if (-33554432 >> 25 !== -1) { + throw new Test262Error('#826: -33554432 >> 25 === -1. Actual: ' + (-33554432 >> 25)); +} + + +if (-67108864 >> 25 !== -2) { + throw new Test262Error('#827: -67108864 >> 25 === -2. Actual: ' + (-67108864 >> 25)); +} + + +if (-134217728 >> 25 !== -4) { + throw new Test262Error('#828: -134217728 >> 25 === -4. Actual: ' + (-134217728 >> 25)); +} + + +if (-268435456 >> 25 !== -8) { + throw new Test262Error('#829: -268435456 >> 25 === -8. Actual: ' + (-268435456 >> 25)); +} + + +if (-536870912 >> 25 !== -16) { + throw new Test262Error('#830: -536870912 >> 25 === -16. Actual: ' + (-536870912 >> 25)); +} + + +if (-1073741824 >> 25 !== -32) { + throw new Test262Error('#831: -1073741824 >> 25 === -32. Actual: ' + (-1073741824 >> 25)); +} + + +if (-2147483648 >> 25 !== -64) { + throw new Test262Error('#832: -2147483648 >> 25 === -64. Actual: ' + (-2147483648 >> 25)); +} + + +if (-1 >> 26 !== -1) { + throw new Test262Error('#833: -1 >> 26 === -1. Actual: ' + (-1 >> 26)); +} + + +if (-2 >> 26 !== -1) { + throw new Test262Error('#834: -2 >> 26 === -1. Actual: ' + (-2 >> 26)); +} + + +if (-4 >> 26 !== -1) { + throw new Test262Error('#835: -4 >> 26 === -1. Actual: ' + (-4 >> 26)); +} + + +if (-8 >> 26 !== -1) { + throw new Test262Error('#836: -8 >> 26 === -1. Actual: ' + (-8 >> 26)); +} + + +if (-16 >> 26 !== -1) { + throw new Test262Error('#837: -16 >> 26 === -1. Actual: ' + (-16 >> 26)); +} + + +if (-32 >> 26 !== -1) { + throw new Test262Error('#838: -32 >> 26 === -1. Actual: ' + (-32 >> 26)); +} + + +if (-64 >> 26 !== -1) { + throw new Test262Error('#839: -64 >> 26 === -1. Actual: ' + (-64 >> 26)); +} + + +if (-128 >> 26 !== -1) { + throw new Test262Error('#840: -128 >> 26 === -1. Actual: ' + (-128 >> 26)); +} + + +if (-256 >> 26 !== -1) { + throw new Test262Error('#841: -256 >> 26 === -1. Actual: ' + (-256 >> 26)); +} + + +if (-512 >> 26 !== -1) { + throw new Test262Error('#842: -512 >> 26 === -1. Actual: ' + (-512 >> 26)); +} + + +if (-1024 >> 26 !== -1) { + throw new Test262Error('#843: -1024 >> 26 === -1. Actual: ' + (-1024 >> 26)); +} + + +if (-2048 >> 26 !== -1) { + throw new Test262Error('#844: -2048 >> 26 === -1. Actual: ' + (-2048 >> 26)); +} + + +if (-4096 >> 26 !== -1) { + throw new Test262Error('#845: -4096 >> 26 === -1. Actual: ' + (-4096 >> 26)); +} + + +if (-8192 >> 26 !== -1) { + throw new Test262Error('#846: -8192 >> 26 === -1. Actual: ' + (-8192 >> 26)); +} + + +if (-16384 >> 26 !== -1) { + throw new Test262Error('#847: -16384 >> 26 === -1. Actual: ' + (-16384 >> 26)); +} + + +if (-32768 >> 26 !== -1) { + throw new Test262Error('#848: -32768 >> 26 === -1. Actual: ' + (-32768 >> 26)); +} + + +if (-65536 >> 26 !== -1) { + throw new Test262Error('#849: -65536 >> 26 === -1. Actual: ' + (-65536 >> 26)); +} + + +if (-131072 >> 26 !== -1) { + throw new Test262Error('#850: -131072 >> 26 === -1. Actual: ' + (-131072 >> 26)); +} + + +if (-262144 >> 26 !== -1) { + throw new Test262Error('#851: -262144 >> 26 === -1. Actual: ' + (-262144 >> 26)); +} + + +if (-524288 >> 26 !== -1) { + throw new Test262Error('#852: -524288 >> 26 === -1. Actual: ' + (-524288 >> 26)); +} + + +if (-1048576 >> 26 !== -1) { + throw new Test262Error('#853: -1048576 >> 26 === -1. Actual: ' + (-1048576 >> 26)); +} + + +if (-2097152 >> 26 !== -1) { + throw new Test262Error('#854: -2097152 >> 26 === -1. Actual: ' + (-2097152 >> 26)); +} + + +if (-4194304 >> 26 !== -1) { + throw new Test262Error('#855: -4194304 >> 26 === -1. Actual: ' + (-4194304 >> 26)); +} + + +if (-8388608 >> 26 !== -1) { + throw new Test262Error('#856: -8388608 >> 26 === -1. Actual: ' + (-8388608 >> 26)); +} + + +if (-16777216 >> 26 !== -1) { + throw new Test262Error('#857: -16777216 >> 26 === -1. Actual: ' + (-16777216 >> 26)); +} + + +if (-33554432 >> 26 !== -1) { + throw new Test262Error('#858: -33554432 >> 26 === -1. Actual: ' + (-33554432 >> 26)); +} + + +if (-67108864 >> 26 !== -1) { + throw new Test262Error('#859: -67108864 >> 26 === -1. Actual: ' + (-67108864 >> 26)); +} + + +if (-134217728 >> 26 !== -2) { + throw new Test262Error('#860: -134217728 >> 26 === -2. Actual: ' + (-134217728 >> 26)); +} + + +if (-268435456 >> 26 !== -4) { + throw new Test262Error('#861: -268435456 >> 26 === -4. Actual: ' + (-268435456 >> 26)); +} + + +if (-536870912 >> 26 !== -8) { + throw new Test262Error('#862: -536870912 >> 26 === -8. Actual: ' + (-536870912 >> 26)); +} + + +if (-1073741824 >> 26 !== -16) { + throw new Test262Error('#863: -1073741824 >> 26 === -16. Actual: ' + (-1073741824 >> 26)); +} + + +if (-2147483648 >> 26 !== -32) { + throw new Test262Error('#864: -2147483648 >> 26 === -32. Actual: ' + (-2147483648 >> 26)); +} + + +if (-1 >> 27 !== -1) { + throw new Test262Error('#865: -1 >> 27 === -1. Actual: ' + (-1 >> 27)); +} + + +if (-2 >> 27 !== -1) { + throw new Test262Error('#866: -2 >> 27 === -1. Actual: ' + (-2 >> 27)); +} + + +if (-4 >> 27 !== -1) { + throw new Test262Error('#867: -4 >> 27 === -1. Actual: ' + (-4 >> 27)); +} + + +if (-8 >> 27 !== -1) { + throw new Test262Error('#868: -8 >> 27 === -1. Actual: ' + (-8 >> 27)); +} + + +if (-16 >> 27 !== -1) { + throw new Test262Error('#869: -16 >> 27 === -1. Actual: ' + (-16 >> 27)); +} + + +if (-32 >> 27 !== -1) { + throw new Test262Error('#870: -32 >> 27 === -1. Actual: ' + (-32 >> 27)); +} + + +if (-64 >> 27 !== -1) { + throw new Test262Error('#871: -64 >> 27 === -1. Actual: ' + (-64 >> 27)); +} + + +if (-128 >> 27 !== -1) { + throw new Test262Error('#872: -128 >> 27 === -1. Actual: ' + (-128 >> 27)); +} + + +if (-256 >> 27 !== -1) { + throw new Test262Error('#873: -256 >> 27 === -1. Actual: ' + (-256 >> 27)); +} + + +if (-512 >> 27 !== -1) { + throw new Test262Error('#874: -512 >> 27 === -1. Actual: ' + (-512 >> 27)); +} + + +if (-1024 >> 27 !== -1) { + throw new Test262Error('#875: -1024 >> 27 === -1. Actual: ' + (-1024 >> 27)); +} + + +if (-2048 >> 27 !== -1) { + throw new Test262Error('#876: -2048 >> 27 === -1. Actual: ' + (-2048 >> 27)); +} + + +if (-4096 >> 27 !== -1) { + throw new Test262Error('#877: -4096 >> 27 === -1. Actual: ' + (-4096 >> 27)); +} + + +if (-8192 >> 27 !== -1) { + throw new Test262Error('#878: -8192 >> 27 === -1. Actual: ' + (-8192 >> 27)); +} + + +if (-16384 >> 27 !== -1) { + throw new Test262Error('#879: -16384 >> 27 === -1. Actual: ' + (-16384 >> 27)); +} + + +if (-32768 >> 27 !== -1) { + throw new Test262Error('#880: -32768 >> 27 === -1. Actual: ' + (-32768 >> 27)); +} + + +if (-65536 >> 27 !== -1) { + throw new Test262Error('#881: -65536 >> 27 === -1. Actual: ' + (-65536 >> 27)); +} + + +if (-131072 >> 27 !== -1) { + throw new Test262Error('#882: -131072 >> 27 === -1. Actual: ' + (-131072 >> 27)); +} + + +if (-262144 >> 27 !== -1) { + throw new Test262Error('#883: -262144 >> 27 === -1. Actual: ' + (-262144 >> 27)); +} + + +if (-524288 >> 27 !== -1) { + throw new Test262Error('#884: -524288 >> 27 === -1. Actual: ' + (-524288 >> 27)); +} + + +if (-1048576 >> 27 !== -1) { + throw new Test262Error('#885: -1048576 >> 27 === -1. Actual: ' + (-1048576 >> 27)); +} + + +if (-2097152 >> 27 !== -1) { + throw new Test262Error('#886: -2097152 >> 27 === -1. Actual: ' + (-2097152 >> 27)); +} + + +if (-4194304 >> 27 !== -1) { + throw new Test262Error('#887: -4194304 >> 27 === -1. Actual: ' + (-4194304 >> 27)); +} + + +if (-8388608 >> 27 !== -1) { + throw new Test262Error('#888: -8388608 >> 27 === -1. Actual: ' + (-8388608 >> 27)); +} + + +if (-16777216 >> 27 !== -1) { + throw new Test262Error('#889: -16777216 >> 27 === -1. Actual: ' + (-16777216 >> 27)); +} + + +if (-33554432 >> 27 !== -1) { + throw new Test262Error('#890: -33554432 >> 27 === -1. Actual: ' + (-33554432 >> 27)); +} + + +if (-67108864 >> 27 !== -1) { + throw new Test262Error('#891: -67108864 >> 27 === -1. Actual: ' + (-67108864 >> 27)); +} + + +if (-134217728 >> 27 !== -1) { + throw new Test262Error('#892: -134217728 >> 27 === -1. Actual: ' + (-134217728 >> 27)); +} + + +if (-268435456 >> 27 !== -2) { + throw new Test262Error('#893: -268435456 >> 27 === -2. Actual: ' + (-268435456 >> 27)); +} + + +if (-536870912 >> 27 !== -4) { + throw new Test262Error('#894: -536870912 >> 27 === -4. Actual: ' + (-536870912 >> 27)); +} + + +if (-1073741824 >> 27 !== -8) { + throw new Test262Error('#895: -1073741824 >> 27 === -8. Actual: ' + (-1073741824 >> 27)); +} + + +if (-2147483648 >> 27 !== -16) { + throw new Test262Error('#896: -2147483648 >> 27 === -16. Actual: ' + (-2147483648 >> 27)); +} + + +if (-1 >> 28 !== -1) { + throw new Test262Error('#897: -1 >> 28 === -1. Actual: ' + (-1 >> 28)); +} + + +if (-2 >> 28 !== -1) { + throw new Test262Error('#898: -2 >> 28 === -1. Actual: ' + (-2 >> 28)); +} + + +if (-4 >> 28 !== -1) { + throw new Test262Error('#899: -4 >> 28 === -1. Actual: ' + (-4 >> 28)); +} + + +if (-8 >> 28 !== -1) { + throw new Test262Error('#900: -8 >> 28 === -1. Actual: ' + (-8 >> 28)); +} + + +if (-16 >> 28 !== -1) { + throw new Test262Error('#901: -16 >> 28 === -1. Actual: ' + (-16 >> 28)); +} + + +if (-32 >> 28 !== -1) { + throw new Test262Error('#902: -32 >> 28 === -1. Actual: ' + (-32 >> 28)); +} + + +if (-64 >> 28 !== -1) { + throw new Test262Error('#903: -64 >> 28 === -1. Actual: ' + (-64 >> 28)); +} + + +if (-128 >> 28 !== -1) { + throw new Test262Error('#904: -128 >> 28 === -1. Actual: ' + (-128 >> 28)); +} + + +if (-256 >> 28 !== -1) { + throw new Test262Error('#905: -256 >> 28 === -1. Actual: ' + (-256 >> 28)); +} + + +if (-512 >> 28 !== -1) { + throw new Test262Error('#906: -512 >> 28 === -1. Actual: ' + (-512 >> 28)); +} + + +if (-1024 >> 28 !== -1) { + throw new Test262Error('#907: -1024 >> 28 === -1. Actual: ' + (-1024 >> 28)); +} + + +if (-2048 >> 28 !== -1) { + throw new Test262Error('#908: -2048 >> 28 === -1. Actual: ' + (-2048 >> 28)); +} + + +if (-4096 >> 28 !== -1) { + throw new Test262Error('#909: -4096 >> 28 === -1. Actual: ' + (-4096 >> 28)); +} + + +if (-8192 >> 28 !== -1) { + throw new Test262Error('#910: -8192 >> 28 === -1. Actual: ' + (-8192 >> 28)); +} + + +if (-16384 >> 28 !== -1) { + throw new Test262Error('#911: -16384 >> 28 === -1. Actual: ' + (-16384 >> 28)); +} + + +if (-32768 >> 28 !== -1) { + throw new Test262Error('#912: -32768 >> 28 === -1. Actual: ' + (-32768 >> 28)); +} + + +if (-65536 >> 28 !== -1) { + throw new Test262Error('#913: -65536 >> 28 === -1. Actual: ' + (-65536 >> 28)); +} + + +if (-131072 >> 28 !== -1) { + throw new Test262Error('#914: -131072 >> 28 === -1. Actual: ' + (-131072 >> 28)); +} + + +if (-262144 >> 28 !== -1) { + throw new Test262Error('#915: -262144 >> 28 === -1. Actual: ' + (-262144 >> 28)); +} + + +if (-524288 >> 28 !== -1) { + throw new Test262Error('#916: -524288 >> 28 === -1. Actual: ' + (-524288 >> 28)); +} + + +if (-1048576 >> 28 !== -1) { + throw new Test262Error('#917: -1048576 >> 28 === -1. Actual: ' + (-1048576 >> 28)); +} + + +if (-2097152 >> 28 !== -1) { + throw new Test262Error('#918: -2097152 >> 28 === -1. Actual: ' + (-2097152 >> 28)); +} + + +if (-4194304 >> 28 !== -1) { + throw new Test262Error('#919: -4194304 >> 28 === -1. Actual: ' + (-4194304 >> 28)); +} + + +if (-8388608 >> 28 !== -1) { + throw new Test262Error('#920: -8388608 >> 28 === -1. Actual: ' + (-8388608 >> 28)); +} + + +if (-16777216 >> 28 !== -1) { + throw new Test262Error('#921: -16777216 >> 28 === -1. Actual: ' + (-16777216 >> 28)); +} + + +if (-33554432 >> 28 !== -1) { + throw new Test262Error('#922: -33554432 >> 28 === -1. Actual: ' + (-33554432 >> 28)); +} + + +if (-67108864 >> 28 !== -1) { + throw new Test262Error('#923: -67108864 >> 28 === -1. Actual: ' + (-67108864 >> 28)); +} + + +if (-134217728 >> 28 !== -1) { + throw new Test262Error('#924: -134217728 >> 28 === -1. Actual: ' + (-134217728 >> 28)); +} + + +if (-268435456 >> 28 !== -1) { + throw new Test262Error('#925: -268435456 >> 28 === -1. Actual: ' + (-268435456 >> 28)); +} + + +if (-536870912 >> 28 !== -2) { + throw new Test262Error('#926: -536870912 >> 28 === -2. Actual: ' + (-536870912 >> 28)); +} + + +if (-1073741824 >> 28 !== -4) { + throw new Test262Error('#927: -1073741824 >> 28 === -4. Actual: ' + (-1073741824 >> 28)); +} + + +if (-2147483648 >> 28 !== -8) { + throw new Test262Error('#928: -2147483648 >> 28 === -8. Actual: ' + (-2147483648 >> 28)); +} + + +if (-1 >> 29 !== -1) { + throw new Test262Error('#929: -1 >> 29 === -1. Actual: ' + (-1 >> 29)); +} + + +if (-2 >> 29 !== -1) { + throw new Test262Error('#930: -2 >> 29 === -1. Actual: ' + (-2 >> 29)); +} + + +if (-4 >> 29 !== -1) { + throw new Test262Error('#931: -4 >> 29 === -1. Actual: ' + (-4 >> 29)); +} + + +if (-8 >> 29 !== -1) { + throw new Test262Error('#932: -8 >> 29 === -1. Actual: ' + (-8 >> 29)); +} + + +if (-16 >> 29 !== -1) { + throw new Test262Error('#933: -16 >> 29 === -1. Actual: ' + (-16 >> 29)); +} + + +if (-32 >> 29 !== -1) { + throw new Test262Error('#934: -32 >> 29 === -1. Actual: ' + (-32 >> 29)); +} + + +if (-64 >> 29 !== -1) { + throw new Test262Error('#935: -64 >> 29 === -1. Actual: ' + (-64 >> 29)); +} + + +if (-128 >> 29 !== -1) { + throw new Test262Error('#936: -128 >> 29 === -1. Actual: ' + (-128 >> 29)); +} + + +if (-256 >> 29 !== -1) { + throw new Test262Error('#937: -256 >> 29 === -1. Actual: ' + (-256 >> 29)); +} + + +if (-512 >> 29 !== -1) { + throw new Test262Error('#938: -512 >> 29 === -1. Actual: ' + (-512 >> 29)); +} + + +if (-1024 >> 29 !== -1) { + throw new Test262Error('#939: -1024 >> 29 === -1. Actual: ' + (-1024 >> 29)); +} + + +if (-2048 >> 29 !== -1) { + throw new Test262Error('#940: -2048 >> 29 === -1. Actual: ' + (-2048 >> 29)); +} + + +if (-4096 >> 29 !== -1) { + throw new Test262Error('#941: -4096 >> 29 === -1. Actual: ' + (-4096 >> 29)); +} + + +if (-8192 >> 29 !== -1) { + throw new Test262Error('#942: -8192 >> 29 === -1. Actual: ' + (-8192 >> 29)); +} + + +if (-16384 >> 29 !== -1) { + throw new Test262Error('#943: -16384 >> 29 === -1. Actual: ' + (-16384 >> 29)); +} + + +if (-32768 >> 29 !== -1) { + throw new Test262Error('#944: -32768 >> 29 === -1. Actual: ' + (-32768 >> 29)); +} + + +if (-65536 >> 29 !== -1) { + throw new Test262Error('#945: -65536 >> 29 === -1. Actual: ' + (-65536 >> 29)); +} + + +if (-131072 >> 29 !== -1) { + throw new Test262Error('#946: -131072 >> 29 === -1. Actual: ' + (-131072 >> 29)); +} + + +if (-262144 >> 29 !== -1) { + throw new Test262Error('#947: -262144 >> 29 === -1. Actual: ' + (-262144 >> 29)); +} + + +if (-524288 >> 29 !== -1) { + throw new Test262Error('#948: -524288 >> 29 === -1. Actual: ' + (-524288 >> 29)); +} + + +if (-1048576 >> 29 !== -1) { + throw new Test262Error('#949: -1048576 >> 29 === -1. Actual: ' + (-1048576 >> 29)); +} + + +if (-2097152 >> 29 !== -1) { + throw new Test262Error('#950: -2097152 >> 29 === -1. Actual: ' + (-2097152 >> 29)); +} + + +if (-4194304 >> 29 !== -1) { + throw new Test262Error('#951: -4194304 >> 29 === -1. Actual: ' + (-4194304 >> 29)); +} + + +if (-8388608 >> 29 !== -1) { + throw new Test262Error('#952: -8388608 >> 29 === -1. Actual: ' + (-8388608 >> 29)); +} + + +if (-16777216 >> 29 !== -1) { + throw new Test262Error('#953: -16777216 >> 29 === -1. Actual: ' + (-16777216 >> 29)); +} + + +if (-33554432 >> 29 !== -1) { + throw new Test262Error('#954: -33554432 >> 29 === -1. Actual: ' + (-33554432 >> 29)); +} + + +if (-67108864 >> 29 !== -1) { + throw new Test262Error('#955: -67108864 >> 29 === -1. Actual: ' + (-67108864 >> 29)); +} + + +if (-134217728 >> 29 !== -1) { + throw new Test262Error('#956: -134217728 >> 29 === -1. Actual: ' + (-134217728 >> 29)); +} + + +if (-268435456 >> 29 !== -1) { + throw new Test262Error('#957: -268435456 >> 29 === -1. Actual: ' + (-268435456 >> 29)); +} + + +if (-536870912 >> 29 !== -1) { + throw new Test262Error('#958: -536870912 >> 29 === -1. Actual: ' + (-536870912 >> 29)); +} + + +if (-1073741824 >> 29 !== -2) { + throw new Test262Error('#959: -1073741824 >> 29 === -2. Actual: ' + (-1073741824 >> 29)); +} + + +if (-2147483648 >> 29 !== -4) { + throw new Test262Error('#960: -2147483648 >> 29 === -4. Actual: ' + (-2147483648 >> 29)); +} + + +if (-1 >> 30 !== -1) { + throw new Test262Error('#961: -1 >> 30 === -1. Actual: ' + (-1 >> 30)); +} + + +if (-2 >> 30 !== -1) { + throw new Test262Error('#962: -2 >> 30 === -1. Actual: ' + (-2 >> 30)); +} + + +if (-4 >> 30 !== -1) { + throw new Test262Error('#963: -4 >> 30 === -1. Actual: ' + (-4 >> 30)); +} + + +if (-8 >> 30 !== -1) { + throw new Test262Error('#964: -8 >> 30 === -1. Actual: ' + (-8 >> 30)); +} + + +if (-16 >> 30 !== -1) { + throw new Test262Error('#965: -16 >> 30 === -1. Actual: ' + (-16 >> 30)); +} + + +if (-32 >> 30 !== -1) { + throw new Test262Error('#966: -32 >> 30 === -1. Actual: ' + (-32 >> 30)); +} + + +if (-64 >> 30 !== -1) { + throw new Test262Error('#967: -64 >> 30 === -1. Actual: ' + (-64 >> 30)); +} + + +if (-128 >> 30 !== -1) { + throw new Test262Error('#968: -128 >> 30 === -1. Actual: ' + (-128 >> 30)); +} + + +if (-256 >> 30 !== -1) { + throw new Test262Error('#969: -256 >> 30 === -1. Actual: ' + (-256 >> 30)); +} + + +if (-512 >> 30 !== -1) { + throw new Test262Error('#970: -512 >> 30 === -1. Actual: ' + (-512 >> 30)); +} + + +if (-1024 >> 30 !== -1) { + throw new Test262Error('#971: -1024 >> 30 === -1. Actual: ' + (-1024 >> 30)); +} + + +if (-2048 >> 30 !== -1) { + throw new Test262Error('#972: -2048 >> 30 === -1. Actual: ' + (-2048 >> 30)); +} + + +if (-4096 >> 30 !== -1) { + throw new Test262Error('#973: -4096 >> 30 === -1. Actual: ' + (-4096 >> 30)); +} + + +if (-8192 >> 30 !== -1) { + throw new Test262Error('#974: -8192 >> 30 === -1. Actual: ' + (-8192 >> 30)); +} + + +if (-16384 >> 30 !== -1) { + throw new Test262Error('#975: -16384 >> 30 === -1. Actual: ' + (-16384 >> 30)); +} + + +if (-32768 >> 30 !== -1) { + throw new Test262Error('#976: -32768 >> 30 === -1. Actual: ' + (-32768 >> 30)); +} + + +if (-65536 >> 30 !== -1) { + throw new Test262Error('#977: -65536 >> 30 === -1. Actual: ' + (-65536 >> 30)); +} + + +if (-131072 >> 30 !== -1) { + throw new Test262Error('#978: -131072 >> 30 === -1. Actual: ' + (-131072 >> 30)); +} + + +if (-262144 >> 30 !== -1) { + throw new Test262Error('#979: -262144 >> 30 === -1. Actual: ' + (-262144 >> 30)); +} + + +if (-524288 >> 30 !== -1) { + throw new Test262Error('#980: -524288 >> 30 === -1. Actual: ' + (-524288 >> 30)); +} + + +if (-1048576 >> 30 !== -1) { + throw new Test262Error('#981: -1048576 >> 30 === -1. Actual: ' + (-1048576 >> 30)); +} + + +if (-2097152 >> 30 !== -1) { + throw new Test262Error('#982: -2097152 >> 30 === -1. Actual: ' + (-2097152 >> 30)); +} + + +if (-4194304 >> 30 !== -1) { + throw new Test262Error('#983: -4194304 >> 30 === -1. Actual: ' + (-4194304 >> 30)); +} + + +if (-8388608 >> 30 !== -1) { + throw new Test262Error('#984: -8388608 >> 30 === -1. Actual: ' + (-8388608 >> 30)); +} + + +if (-16777216 >> 30 !== -1) { + throw new Test262Error('#985: -16777216 >> 30 === -1. Actual: ' + (-16777216 >> 30)); +} + + +if (-33554432 >> 30 !== -1) { + throw new Test262Error('#986: -33554432 >> 30 === -1. Actual: ' + (-33554432 >> 30)); +} + + +if (-67108864 >> 30 !== -1) { + throw new Test262Error('#987: -67108864 >> 30 === -1. Actual: ' + (-67108864 >> 30)); +} + + +if (-134217728 >> 30 !== -1) { + throw new Test262Error('#988: -134217728 >> 30 === -1. Actual: ' + (-134217728 >> 30)); +} + + +if (-268435456 >> 30 !== -1) { + throw new Test262Error('#989: -268435456 >> 30 === -1. Actual: ' + (-268435456 >> 30)); +} + + +if (-536870912 >> 30 !== -1) { + throw new Test262Error('#990: -536870912 >> 30 === -1. Actual: ' + (-536870912 >> 30)); +} + + +if (-1073741824 >> 30 !== -1) { + throw new Test262Error('#991: -1073741824 >> 30 === -1. Actual: ' + (-1073741824 >> 30)); +} + + +if (-2147483648 >> 30 !== -2) { + throw new Test262Error('#992: -2147483648 >> 30 === -2. Actual: ' + (-2147483648 >> 30)); +} + + +if (-1 >> 31 !== -1) { + throw new Test262Error('#993: -1 >> 31 === -1. Actual: ' + (-1 >> 31)); +} + + +if (-2 >> 31 !== -1) { + throw new Test262Error('#994: -2 >> 31 === -1. Actual: ' + (-2 >> 31)); +} + + +if (-4 >> 31 !== -1) { + throw new Test262Error('#995: -4 >> 31 === -1. Actual: ' + (-4 >> 31)); +} + + +if (-8 >> 31 !== -1) { + throw new Test262Error('#996: -8 >> 31 === -1. Actual: ' + (-8 >> 31)); +} + + +if (-16 >> 31 !== -1) { + throw new Test262Error('#997: -16 >> 31 === -1. Actual: ' + (-16 >> 31)); +} + + +if (-32 >> 31 !== -1) { + throw new Test262Error('#998: -32 >> 31 === -1. Actual: ' + (-32 >> 31)); +} + + +if (-64 >> 31 !== -1) { + throw new Test262Error('#999: -64 >> 31 === -1. Actual: ' + (-64 >> 31)); +} + + +if (-128 >> 31 !== -1) { + throw new Test262Error('#1000: -128 >> 31 === -1. Actual: ' + (-128 >> 31)); +} + + +if (-256 >> 31 !== -1) { + throw new Test262Error('#1001: -256 >> 31 === -1. Actual: ' + (-256 >> 31)); +} + + +if (-512 >> 31 !== -1) { + throw new Test262Error('#1002: -512 >> 31 === -1. Actual: ' + (-512 >> 31)); +} + + +if (-1024 >> 31 !== -1) { + throw new Test262Error('#1003: -1024 >> 31 === -1. Actual: ' + (-1024 >> 31)); +} + + +if (-2048 >> 31 !== -1) { + throw new Test262Error('#1004: -2048 >> 31 === -1. Actual: ' + (-2048 >> 31)); +} + + +if (-4096 >> 31 !== -1) { + throw new Test262Error('#1005: -4096 >> 31 === -1. Actual: ' + (-4096 >> 31)); +} + + +if (-8192 >> 31 !== -1) { + throw new Test262Error('#1006: -8192 >> 31 === -1. Actual: ' + (-8192 >> 31)); +} + + +if (-16384 >> 31 !== -1) { + throw new Test262Error('#1007: -16384 >> 31 === -1. Actual: ' + (-16384 >> 31)); +} + + +if (-32768 >> 31 !== -1) { + throw new Test262Error('#1008: -32768 >> 31 === -1. Actual: ' + (-32768 >> 31)); +} + + +if (-65536 >> 31 !== -1) { + throw new Test262Error('#1009: -65536 >> 31 === -1. Actual: ' + (-65536 >> 31)); +} + + +if (-131072 >> 31 !== -1) { + throw new Test262Error('#1010: -131072 >> 31 === -1. Actual: ' + (-131072 >> 31)); +} + + +if (-262144 >> 31 !== -1) { + throw new Test262Error('#1011: -262144 >> 31 === -1. Actual: ' + (-262144 >> 31)); +} + + +if (-524288 >> 31 !== -1) { + throw new Test262Error('#1012: -524288 >> 31 === -1. Actual: ' + (-524288 >> 31)); +} + + +if (-1048576 >> 31 !== -1) { + throw new Test262Error('#1013: -1048576 >> 31 === -1. Actual: ' + (-1048576 >> 31)); +} + + +if (-2097152 >> 31 !== -1) { + throw new Test262Error('#1014: -2097152 >> 31 === -1. Actual: ' + (-2097152 >> 31)); +} + + +if (-4194304 >> 31 !== -1) { + throw new Test262Error('#1015: -4194304 >> 31 === -1. Actual: ' + (-4194304 >> 31)); +} + + +if (-8388608 >> 31 !== -1) { + throw new Test262Error('#1016: -8388608 >> 31 === -1. Actual: ' + (-8388608 >> 31)); +} + + +if (-16777216 >> 31 !== -1) { + throw new Test262Error('#1017: -16777216 >> 31 === -1. Actual: ' + (-16777216 >> 31)); +} + + +if (-33554432 >> 31 !== -1) { + throw new Test262Error('#1018: -33554432 >> 31 === -1. Actual: ' + (-33554432 >> 31)); +} + + +if (-67108864 >> 31 !== -1) { + throw new Test262Error('#1019: -67108864 >> 31 === -1. Actual: ' + (-67108864 >> 31)); +} + + +if (-134217728 >> 31 !== -1) { + throw new Test262Error('#1020: -134217728 >> 31 === -1. Actual: ' + (-134217728 >> 31)); +} + + +if (-268435456 >> 31 !== -1) { + throw new Test262Error('#1021: -268435456 >> 31 === -1. Actual: ' + (-268435456 >> 31)); +} + + +if (-536870912 >> 31 !== -1) { + throw new Test262Error('#1022: -536870912 >> 31 === -1. Actual: ' + (-536870912 >> 31)); +} + + +if (-1073741824 >> 31 !== -1) { + throw new Test262Error('#1023: -1073741824 >> 31 === -1. Actual: ' + (-1073741824 >> 31)); +} + + +if (-2147483648 >> 31 !== -1) { + throw new Test262Error('#1024: -2147483648 >> 31 === -1. Actual: ' + (-2147483648 >> 31)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T3.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T3.js new file mode 100644 index 0000000000..301f259d59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T3.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check x >> y operator in distinct points +es5id: 11.7.2_A4_T3 +description: ShiftExpression = 2^n - 1, n = 0...15 +---*/ + +//CHECK + +if (0 >> 0 !== 0) { + throw new Test262Error('#1: 0 >> 0 === 0. Actual: ' + (0 >> 0)); +} + + +if (1 >> 0 !== 1) { + throw new Test262Error('#2: 1 >> 0 === 1. Actual: ' + (1 >> 0)); +} + + +if (3 >> 0 !== 3) { + throw new Test262Error('#3: 3 >> 0 === 3. Actual: ' + (3 >> 0)); +} + + +if (7 >> 0 !== 7) { + throw new Test262Error('#4: 7 >> 0 === 7. Actual: ' + (7 >> 0)); +} + + +if (15 >> 0 !== 15) { + throw new Test262Error('#5: 15 >> 0 === 15. Actual: ' + (15 >> 0)); +} + + +if (31 >> 0 !== 31) { + throw new Test262Error('#6: 31 >> 0 === 31. Actual: ' + (31 >> 0)); +} + + +if (63 >> 0 !== 63) { + throw new Test262Error('#7: 63 >> 0 === 63. Actual: ' + (63 >> 0)); +} + + +if (127 >> 0 !== 127) { + throw new Test262Error('#8: 127 >> 0 === 127. Actual: ' + (127 >> 0)); +} + + +if (255 >> 0 !== 255) { + throw new Test262Error('#9: 255 >> 0 === 255. Actual: ' + (255 >> 0)); +} + + +if (511 >> 0 !== 511) { + throw new Test262Error('#10: 511 >> 0 === 511. Actual: ' + (511 >> 0)); +} + + +if (1023 >> 0 !== 1023) { + throw new Test262Error('#11: 1023 >> 0 === 1023. Actual: ' + (1023 >> 0)); +} + + +if (2047 >> 0 !== 2047) { + throw new Test262Error('#12: 2047 >> 0 === 2047. Actual: ' + (2047 >> 0)); +} + + +if (4095 >> 0 !== 4095) { + throw new Test262Error('#13: 4095 >> 0 === 4095. Actual: ' + (4095 >> 0)); +} + + +if (8191 >> 0 !== 8191) { + throw new Test262Error('#14: 8191 >> 0 === 8191. Actual: ' + (8191 >> 0)); +} + + +if (16383 >> 0 !== 16383) { + throw new Test262Error('#15: 16383 >> 0 === 16383. Actual: ' + (16383 >> 0)); +} + + +if (32767 >> 0 !== 32767) { + throw new Test262Error('#16: 32767 >> 0 === 32767. Actual: ' + (32767 >> 0)); +} + + +if (65535 >> 0 !== 65535) { + throw new Test262Error('#17: 65535 >> 0 === 65535. Actual: ' + (65535 >> 0)); +} + + +if (131071 >> 0 !== 131071) { + throw new Test262Error('#18: 131071 >> 0 === 131071. Actual: ' + (131071 >> 0)); +} + + +if (262143 >> 0 !== 262143) { + throw new Test262Error('#19: 262143 >> 0 === 262143. Actual: ' + (262143 >> 0)); +} + + +if (524287 >> 0 !== 524287) { + throw new Test262Error('#20: 524287 >> 0 === 524287. Actual: ' + (524287 >> 0)); +} + + +if (1048575 >> 0 !== 1048575) { + throw new Test262Error('#21: 1048575 >> 0 === 1048575. Actual: ' + (1048575 >> 0)); +} + + +if (2097151 >> 0 !== 2097151) { + throw new Test262Error('#22: 2097151 >> 0 === 2097151. Actual: ' + (2097151 >> 0)); +} + + +if (4194303 >> 0 !== 4194303) { + throw new Test262Error('#23: 4194303 >> 0 === 4194303. Actual: ' + (4194303 >> 0)); +} + + +if (8388607 >> 0 !== 8388607) { + throw new Test262Error('#24: 8388607 >> 0 === 8388607. Actual: ' + (8388607 >> 0)); +} + + +if (16777215 >> 0 !== 16777215) { + throw new Test262Error('#25: 16777215 >> 0 === 16777215. Actual: ' + (16777215 >> 0)); +} + + +if (33554431 >> 0 !== 33554431) { + throw new Test262Error('#26: 33554431 >> 0 === 33554431. Actual: ' + (33554431 >> 0)); +} + + +if (67108863 >> 0 !== 67108863) { + throw new Test262Error('#27: 67108863 >> 0 === 67108863. Actual: ' + (67108863 >> 0)); +} + + +if (134217727 >> 0 !== 134217727) { + throw new Test262Error('#28: 134217727 >> 0 === 134217727. Actual: ' + (134217727 >> 0)); +} + + +if (268435455 >> 0 !== 268435455) { + throw new Test262Error('#29: 268435455 >> 0 === 268435455. Actual: ' + (268435455 >> 0)); +} + + +if (536870911 >> 0 !== 536870911) { + throw new Test262Error('#30: 536870911 >> 0 === 536870911. Actual: ' + (536870911 >> 0)); +} + + +if (1073741823 >> 0 !== 1073741823) { + throw new Test262Error('#31: 1073741823 >> 0 === 1073741823. Actual: ' + (1073741823 >> 0)); +} + + +if (2147483647 >> 0 !== 2147483647) { + throw new Test262Error('#32: 2147483647 >> 0 === 2147483647. Actual: ' + (2147483647 >> 0)); +} + + +if (0 >> 1 !== 0) { + throw new Test262Error('#33: 0 >> 1 === 0. Actual: ' + (0 >> 1)); +} + + +if (1 >> 1 !== 0) { + throw new Test262Error('#34: 1 >> 1 === 0. Actual: ' + (1 >> 1)); +} + + +if (3 >> 1 !== 1) { + throw new Test262Error('#35: 3 >> 1 === 1. Actual: ' + (3 >> 1)); +} + + +if (7 >> 1 !== 3) { + throw new Test262Error('#36: 7 >> 1 === 3. Actual: ' + (7 >> 1)); +} + + +if (15 >> 1 !== 7) { + throw new Test262Error('#37: 15 >> 1 === 7. Actual: ' + (15 >> 1)); +} + + +if (31 >> 1 !== 15) { + throw new Test262Error('#38: 31 >> 1 === 15. Actual: ' + (31 >> 1)); +} + + +if (63 >> 1 !== 31) { + throw new Test262Error('#39: 63 >> 1 === 31. Actual: ' + (63 >> 1)); +} + + +if (127 >> 1 !== 63) { + throw new Test262Error('#40: 127 >> 1 === 63. Actual: ' + (127 >> 1)); +} + + +if (255 >> 1 !== 127) { + throw new Test262Error('#41: 255 >> 1 === 127. Actual: ' + (255 >> 1)); +} + + +if (511 >> 1 !== 255) { + throw new Test262Error('#42: 511 >> 1 === 255. Actual: ' + (511 >> 1)); +} + + +if (1023 >> 1 !== 511) { + throw new Test262Error('#43: 1023 >> 1 === 511. Actual: ' + (1023 >> 1)); +} + + +if (2047 >> 1 !== 1023) { + throw new Test262Error('#44: 2047 >> 1 === 1023. Actual: ' + (2047 >> 1)); +} + + +if (4095 >> 1 !== 2047) { + throw new Test262Error('#45: 4095 >> 1 === 2047. Actual: ' + (4095 >> 1)); +} + + +if (8191 >> 1 !== 4095) { + throw new Test262Error('#46: 8191 >> 1 === 4095. Actual: ' + (8191 >> 1)); +} + + +if (16383 >> 1 !== 8191) { + throw new Test262Error('#47: 16383 >> 1 === 8191. Actual: ' + (16383 >> 1)); +} + + +if (32767 >> 1 !== 16383) { + throw new Test262Error('#48: 32767 >> 1 === 16383. Actual: ' + (32767 >> 1)); +} + + +if (65535 >> 1 !== 32767) { + throw new Test262Error('#49: 65535 >> 1 === 32767. Actual: ' + (65535 >> 1)); +} + + +if (131071 >> 1 !== 65535) { + throw new Test262Error('#50: 131071 >> 1 === 65535. Actual: ' + (131071 >> 1)); +} + + +if (262143 >> 1 !== 131071) { + throw new Test262Error('#51: 262143 >> 1 === 131071. Actual: ' + (262143 >> 1)); +} + + +if (524287 >> 1 !== 262143) { + throw new Test262Error('#52: 524287 >> 1 === 262143. Actual: ' + (524287 >> 1)); +} + + +if (1048575 >> 1 !== 524287) { + throw new Test262Error('#53: 1048575 >> 1 === 524287. Actual: ' + (1048575 >> 1)); +} + + +if (2097151 >> 1 !== 1048575) { + throw new Test262Error('#54: 2097151 >> 1 === 1048575. Actual: ' + (2097151 >> 1)); +} + + +if (4194303 >> 1 !== 2097151) { + throw new Test262Error('#55: 4194303 >> 1 === 2097151. Actual: ' + (4194303 >> 1)); +} + + +if (8388607 >> 1 !== 4194303) { + throw new Test262Error('#56: 8388607 >> 1 === 4194303. Actual: ' + (8388607 >> 1)); +} + + +if (16777215 >> 1 !== 8388607) { + throw new Test262Error('#57: 16777215 >> 1 === 8388607. Actual: ' + (16777215 >> 1)); +} + + +if (33554431 >> 1 !== 16777215) { + throw new Test262Error('#58: 33554431 >> 1 === 16777215. Actual: ' + (33554431 >> 1)); +} + + +if (67108863 >> 1 !== 33554431) { + throw new Test262Error('#59: 67108863 >> 1 === 33554431. Actual: ' + (67108863 >> 1)); +} + + +if (134217727 >> 1 !== 67108863) { + throw new Test262Error('#60: 134217727 >> 1 === 67108863. Actual: ' + (134217727 >> 1)); +} + + +if (268435455 >> 1 !== 134217727) { + throw new Test262Error('#61: 268435455 >> 1 === 134217727. Actual: ' + (268435455 >> 1)); +} + + +if (536870911 >> 1 !== 268435455) { + throw new Test262Error('#62: 536870911 >> 1 === 268435455. Actual: ' + (536870911 >> 1)); +} + + +if (1073741823 >> 1 !== 536870911) { + throw new Test262Error('#63: 1073741823 >> 1 === 536870911. Actual: ' + (1073741823 >> 1)); +} + + +if (2147483647 >> 1 !== 1073741823) { + throw new Test262Error('#64: 2147483647 >> 1 === 1073741823. Actual: ' + (2147483647 >> 1)); +} + + +if (0 >> 2 !== 0) { + throw new Test262Error('#65: 0 >> 2 === 0. Actual: ' + (0 >> 2)); +} + + +if (1 >> 2 !== 0) { + throw new Test262Error('#66: 1 >> 2 === 0. Actual: ' + (1 >> 2)); +} + + +if (3 >> 2 !== 0) { + throw new Test262Error('#67: 3 >> 2 === 0. Actual: ' + (3 >> 2)); +} + + +if (7 >> 2 !== 1) { + throw new Test262Error('#68: 7 >> 2 === 1. Actual: ' + (7 >> 2)); +} + + +if (15 >> 2 !== 3) { + throw new Test262Error('#69: 15 >> 2 === 3. Actual: ' + (15 >> 2)); +} + + +if (31 >> 2 !== 7) { + throw new Test262Error('#70: 31 >> 2 === 7. Actual: ' + (31 >> 2)); +} + + +if (63 >> 2 !== 15) { + throw new Test262Error('#71: 63 >> 2 === 15. Actual: ' + (63 >> 2)); +} + + +if (127 >> 2 !== 31) { + throw new Test262Error('#72: 127 >> 2 === 31. Actual: ' + (127 >> 2)); +} + + +if (255 >> 2 !== 63) { + throw new Test262Error('#73: 255 >> 2 === 63. Actual: ' + (255 >> 2)); +} + + +if (511 >> 2 !== 127) { + throw new Test262Error('#74: 511 >> 2 === 127. Actual: ' + (511 >> 2)); +} + + +if (1023 >> 2 !== 255) { + throw new Test262Error('#75: 1023 >> 2 === 255. Actual: ' + (1023 >> 2)); +} + + +if (2047 >> 2 !== 511) { + throw new Test262Error('#76: 2047 >> 2 === 511. Actual: ' + (2047 >> 2)); +} + + +if (4095 >> 2 !== 1023) { + throw new Test262Error('#77: 4095 >> 2 === 1023. Actual: ' + (4095 >> 2)); +} + + +if (8191 >> 2 !== 2047) { + throw new Test262Error('#78: 8191 >> 2 === 2047. Actual: ' + (8191 >> 2)); +} + + +if (16383 >> 2 !== 4095) { + throw new Test262Error('#79: 16383 >> 2 === 4095. Actual: ' + (16383 >> 2)); +} + + +if (32767 >> 2 !== 8191) { + throw new Test262Error('#80: 32767 >> 2 === 8191. Actual: ' + (32767 >> 2)); +} + + +if (65535 >> 2 !== 16383) { + throw new Test262Error('#81: 65535 >> 2 === 16383. Actual: ' + (65535 >> 2)); +} + + +if (131071 >> 2 !== 32767) { + throw new Test262Error('#82: 131071 >> 2 === 32767. Actual: ' + (131071 >> 2)); +} + + +if (262143 >> 2 !== 65535) { + throw new Test262Error('#83: 262143 >> 2 === 65535. Actual: ' + (262143 >> 2)); +} + + +if (524287 >> 2 !== 131071) { + throw new Test262Error('#84: 524287 >> 2 === 131071. Actual: ' + (524287 >> 2)); +} + + +if (1048575 >> 2 !== 262143) { + throw new Test262Error('#85: 1048575 >> 2 === 262143. Actual: ' + (1048575 >> 2)); +} + + +if (2097151 >> 2 !== 524287) { + throw new Test262Error('#86: 2097151 >> 2 === 524287. Actual: ' + (2097151 >> 2)); +} + + +if (4194303 >> 2 !== 1048575) { + throw new Test262Error('#87: 4194303 >> 2 === 1048575. Actual: ' + (4194303 >> 2)); +} + + +if (8388607 >> 2 !== 2097151) { + throw new Test262Error('#88: 8388607 >> 2 === 2097151. Actual: ' + (8388607 >> 2)); +} + + +if (16777215 >> 2 !== 4194303) { + throw new Test262Error('#89: 16777215 >> 2 === 4194303. Actual: ' + (16777215 >> 2)); +} + + +if (33554431 >> 2 !== 8388607) { + throw new Test262Error('#90: 33554431 >> 2 === 8388607. Actual: ' + (33554431 >> 2)); +} + + +if (67108863 >> 2 !== 16777215) { + throw new Test262Error('#91: 67108863 >> 2 === 16777215. Actual: ' + (67108863 >> 2)); +} + + +if (134217727 >> 2 !== 33554431) { + throw new Test262Error('#92: 134217727 >> 2 === 33554431. Actual: ' + (134217727 >> 2)); +} + + +if (268435455 >> 2 !== 67108863) { + throw new Test262Error('#93: 268435455 >> 2 === 67108863. Actual: ' + (268435455 >> 2)); +} + + +if (536870911 >> 2 !== 134217727) { + throw new Test262Error('#94: 536870911 >> 2 === 134217727. Actual: ' + (536870911 >> 2)); +} + + +if (1073741823 >> 2 !== 268435455) { + throw new Test262Error('#95: 1073741823 >> 2 === 268435455. Actual: ' + (1073741823 >> 2)); +} + + +if (2147483647 >> 2 !== 536870911) { + throw new Test262Error('#96: 2147483647 >> 2 === 536870911. Actual: ' + (2147483647 >> 2)); +} + + +if (0 >> 3 !== 0) { + throw new Test262Error('#97: 0 >> 3 === 0. Actual: ' + (0 >> 3)); +} + + +if (1 >> 3 !== 0) { + throw new Test262Error('#98: 1 >> 3 === 0. Actual: ' + (1 >> 3)); +} + + +if (3 >> 3 !== 0) { + throw new Test262Error('#99: 3 >> 3 === 0. Actual: ' + (3 >> 3)); +} + + +if (7 >> 3 !== 0) { + throw new Test262Error('#100: 7 >> 3 === 0. Actual: ' + (7 >> 3)); +} + + +if (15 >> 3 !== 1) { + throw new Test262Error('#101: 15 >> 3 === 1. Actual: ' + (15 >> 3)); +} + + +if (31 >> 3 !== 3) { + throw new Test262Error('#102: 31 >> 3 === 3. Actual: ' + (31 >> 3)); +} + + +if (63 >> 3 !== 7) { + throw new Test262Error('#103: 63 >> 3 === 7. Actual: ' + (63 >> 3)); +} + + +if (127 >> 3 !== 15) { + throw new Test262Error('#104: 127 >> 3 === 15. Actual: ' + (127 >> 3)); +} + + +if (255 >> 3 !== 31) { + throw new Test262Error('#105: 255 >> 3 === 31. Actual: ' + (255 >> 3)); +} + + +if (511 >> 3 !== 63) { + throw new Test262Error('#106: 511 >> 3 === 63. Actual: ' + (511 >> 3)); +} + + +if (1023 >> 3 !== 127) { + throw new Test262Error('#107: 1023 >> 3 === 127. Actual: ' + (1023 >> 3)); +} + + +if (2047 >> 3 !== 255) { + throw new Test262Error('#108: 2047 >> 3 === 255. Actual: ' + (2047 >> 3)); +} + + +if (4095 >> 3 !== 511) { + throw new Test262Error('#109: 4095 >> 3 === 511. Actual: ' + (4095 >> 3)); +} + + +if (8191 >> 3 !== 1023) { + throw new Test262Error('#110: 8191 >> 3 === 1023. Actual: ' + (8191 >> 3)); +} + + +if (16383 >> 3 !== 2047) { + throw new Test262Error('#111: 16383 >> 3 === 2047. Actual: ' + (16383 >> 3)); +} + + +if (32767 >> 3 !== 4095) { + throw new Test262Error('#112: 32767 >> 3 === 4095. Actual: ' + (32767 >> 3)); +} + + +if (65535 >> 3 !== 8191) { + throw new Test262Error('#113: 65535 >> 3 === 8191. Actual: ' + (65535 >> 3)); +} + + +if (131071 >> 3 !== 16383) { + throw new Test262Error('#114: 131071 >> 3 === 16383. Actual: ' + (131071 >> 3)); +} + + +if (262143 >> 3 !== 32767) { + throw new Test262Error('#115: 262143 >> 3 === 32767. Actual: ' + (262143 >> 3)); +} + + +if (524287 >> 3 !== 65535) { + throw new Test262Error('#116: 524287 >> 3 === 65535. Actual: ' + (524287 >> 3)); +} + + +if (1048575 >> 3 !== 131071) { + throw new Test262Error('#117: 1048575 >> 3 === 131071. Actual: ' + (1048575 >> 3)); +} + + +if (2097151 >> 3 !== 262143) { + throw new Test262Error('#118: 2097151 >> 3 === 262143. Actual: ' + (2097151 >> 3)); +} + + +if (4194303 >> 3 !== 524287) { + throw new Test262Error('#119: 4194303 >> 3 === 524287. Actual: ' + (4194303 >> 3)); +} + + +if (8388607 >> 3 !== 1048575) { + throw new Test262Error('#120: 8388607 >> 3 === 1048575. Actual: ' + (8388607 >> 3)); +} + + +if (16777215 >> 3 !== 2097151) { + throw new Test262Error('#121: 16777215 >> 3 === 2097151. Actual: ' + (16777215 >> 3)); +} + + +if (33554431 >> 3 !== 4194303) { + throw new Test262Error('#122: 33554431 >> 3 === 4194303. Actual: ' + (33554431 >> 3)); +} + + +if (67108863 >> 3 !== 8388607) { + throw new Test262Error('#123: 67108863 >> 3 === 8388607. Actual: ' + (67108863 >> 3)); +} + + +if (134217727 >> 3 !== 16777215) { + throw new Test262Error('#124: 134217727 >> 3 === 16777215. Actual: ' + (134217727 >> 3)); +} + + +if (268435455 >> 3 !== 33554431) { + throw new Test262Error('#125: 268435455 >> 3 === 33554431. Actual: ' + (268435455 >> 3)); +} + + +if (536870911 >> 3 !== 67108863) { + throw new Test262Error('#126: 536870911 >> 3 === 67108863. Actual: ' + (536870911 >> 3)); +} + + +if (1073741823 >> 3 !== 134217727) { + throw new Test262Error('#127: 1073741823 >> 3 === 134217727. Actual: ' + (1073741823 >> 3)); +} + + +if (2147483647 >> 3 !== 268435455) { + throw new Test262Error('#128: 2147483647 >> 3 === 268435455. Actual: ' + (2147483647 >> 3)); +} + + +if (0 >> 4 !== 0) { + throw new Test262Error('#129: 0 >> 4 === 0. Actual: ' + (0 >> 4)); +} + + +if (1 >> 4 !== 0) { + throw new Test262Error('#130: 1 >> 4 === 0. Actual: ' + (1 >> 4)); +} + + +if (3 >> 4 !== 0) { + throw new Test262Error('#131: 3 >> 4 === 0. Actual: ' + (3 >> 4)); +} + + +if (7 >> 4 !== 0) { + throw new Test262Error('#132: 7 >> 4 === 0. Actual: ' + (7 >> 4)); +} + + +if (15 >> 4 !== 0) { + throw new Test262Error('#133: 15 >> 4 === 0. Actual: ' + (15 >> 4)); +} + + +if (31 >> 4 !== 1) { + throw new Test262Error('#134: 31 >> 4 === 1. Actual: ' + (31 >> 4)); +} + + +if (63 >> 4 !== 3) { + throw new Test262Error('#135: 63 >> 4 === 3. Actual: ' + (63 >> 4)); +} + + +if (127 >> 4 !== 7) { + throw new Test262Error('#136: 127 >> 4 === 7. Actual: ' + (127 >> 4)); +} + + +if (255 >> 4 !== 15) { + throw new Test262Error('#137: 255 >> 4 === 15. Actual: ' + (255 >> 4)); +} + + +if (511 >> 4 !== 31) { + throw new Test262Error('#138: 511 >> 4 === 31. Actual: ' + (511 >> 4)); +} + + +if (1023 >> 4 !== 63) { + throw new Test262Error('#139: 1023 >> 4 === 63. Actual: ' + (1023 >> 4)); +} + + +if (2047 >> 4 !== 127) { + throw new Test262Error('#140: 2047 >> 4 === 127. Actual: ' + (2047 >> 4)); +} + + +if (4095 >> 4 !== 255) { + throw new Test262Error('#141: 4095 >> 4 === 255. Actual: ' + (4095 >> 4)); +} + + +if (8191 >> 4 !== 511) { + throw new Test262Error('#142: 8191 >> 4 === 511. Actual: ' + (8191 >> 4)); +} + + +if (16383 >> 4 !== 1023) { + throw new Test262Error('#143: 16383 >> 4 === 1023. Actual: ' + (16383 >> 4)); +} + + +if (32767 >> 4 !== 2047) { + throw new Test262Error('#144: 32767 >> 4 === 2047. Actual: ' + (32767 >> 4)); +} + + +if (65535 >> 4 !== 4095) { + throw new Test262Error('#145: 65535 >> 4 === 4095. Actual: ' + (65535 >> 4)); +} + + +if (131071 >> 4 !== 8191) { + throw new Test262Error('#146: 131071 >> 4 === 8191. Actual: ' + (131071 >> 4)); +} + + +if (262143 >> 4 !== 16383) { + throw new Test262Error('#147: 262143 >> 4 === 16383. Actual: ' + (262143 >> 4)); +} + + +if (524287 >> 4 !== 32767) { + throw new Test262Error('#148: 524287 >> 4 === 32767. Actual: ' + (524287 >> 4)); +} + + +if (1048575 >> 4 !== 65535) { + throw new Test262Error('#149: 1048575 >> 4 === 65535. Actual: ' + (1048575 >> 4)); +} + + +if (2097151 >> 4 !== 131071) { + throw new Test262Error('#150: 2097151 >> 4 === 131071. Actual: ' + (2097151 >> 4)); +} + + +if (4194303 >> 4 !== 262143) { + throw new Test262Error('#151: 4194303 >> 4 === 262143. Actual: ' + (4194303 >> 4)); +} + + +if (8388607 >> 4 !== 524287) { + throw new Test262Error('#152: 8388607 >> 4 === 524287. Actual: ' + (8388607 >> 4)); +} + + +if (16777215 >> 4 !== 1048575) { + throw new Test262Error('#153: 16777215 >> 4 === 1048575. Actual: ' + (16777215 >> 4)); +} + + +if (33554431 >> 4 !== 2097151) { + throw new Test262Error('#154: 33554431 >> 4 === 2097151. Actual: ' + (33554431 >> 4)); +} + + +if (67108863 >> 4 !== 4194303) { + throw new Test262Error('#155: 67108863 >> 4 === 4194303. Actual: ' + (67108863 >> 4)); +} + + +if (134217727 >> 4 !== 8388607) { + throw new Test262Error('#156: 134217727 >> 4 === 8388607. Actual: ' + (134217727 >> 4)); +} + + +if (268435455 >> 4 !== 16777215) { + throw new Test262Error('#157: 268435455 >> 4 === 16777215. Actual: ' + (268435455 >> 4)); +} + + +if (536870911 >> 4 !== 33554431) { + throw new Test262Error('#158: 536870911 >> 4 === 33554431. Actual: ' + (536870911 >> 4)); +} + + +if (1073741823 >> 4 !== 67108863) { + throw new Test262Error('#159: 1073741823 >> 4 === 67108863. Actual: ' + (1073741823 >> 4)); +} + + +if (2147483647 >> 4 !== 134217727) { + throw new Test262Error('#160: 2147483647 >> 4 === 134217727. Actual: ' + (2147483647 >> 4)); +} + + +if (0 >> 5 !== 0) { + throw new Test262Error('#161: 0 >> 5 === 0. Actual: ' + (0 >> 5)); +} + + +if (1 >> 5 !== 0) { + throw new Test262Error('#162: 1 >> 5 === 0. Actual: ' + (1 >> 5)); +} + + +if (3 >> 5 !== 0) { + throw new Test262Error('#163: 3 >> 5 === 0. Actual: ' + (3 >> 5)); +} + + +if (7 >> 5 !== 0) { + throw new Test262Error('#164: 7 >> 5 === 0. Actual: ' + (7 >> 5)); +} + + +if (15 >> 5 !== 0) { + throw new Test262Error('#165: 15 >> 5 === 0. Actual: ' + (15 >> 5)); +} + + +if (31 >> 5 !== 0) { + throw new Test262Error('#166: 31 >> 5 === 0. Actual: ' + (31 >> 5)); +} + + +if (63 >> 5 !== 1) { + throw new Test262Error('#167: 63 >> 5 === 1. Actual: ' + (63 >> 5)); +} + + +if (127 >> 5 !== 3) { + throw new Test262Error('#168: 127 >> 5 === 3. Actual: ' + (127 >> 5)); +} + + +if (255 >> 5 !== 7) { + throw new Test262Error('#169: 255 >> 5 === 7. Actual: ' + (255 >> 5)); +} + + +if (511 >> 5 !== 15) { + throw new Test262Error('#170: 511 >> 5 === 15. Actual: ' + (511 >> 5)); +} + + +if (1023 >> 5 !== 31) { + throw new Test262Error('#171: 1023 >> 5 === 31. Actual: ' + (1023 >> 5)); +} + + +if (2047 >> 5 !== 63) { + throw new Test262Error('#172: 2047 >> 5 === 63. Actual: ' + (2047 >> 5)); +} + + +if (4095 >> 5 !== 127) { + throw new Test262Error('#173: 4095 >> 5 === 127. Actual: ' + (4095 >> 5)); +} + + +if (8191 >> 5 !== 255) { + throw new Test262Error('#174: 8191 >> 5 === 255. Actual: ' + (8191 >> 5)); +} + + +if (16383 >> 5 !== 511) { + throw new Test262Error('#175: 16383 >> 5 === 511. Actual: ' + (16383 >> 5)); +} + + +if (32767 >> 5 !== 1023) { + throw new Test262Error('#176: 32767 >> 5 === 1023. Actual: ' + (32767 >> 5)); +} + + +if (65535 >> 5 !== 2047) { + throw new Test262Error('#177: 65535 >> 5 === 2047. Actual: ' + (65535 >> 5)); +} + + +if (131071 >> 5 !== 4095) { + throw new Test262Error('#178: 131071 >> 5 === 4095. Actual: ' + (131071 >> 5)); +} + + +if (262143 >> 5 !== 8191) { + throw new Test262Error('#179: 262143 >> 5 === 8191. Actual: ' + (262143 >> 5)); +} + + +if (524287 >> 5 !== 16383) { + throw new Test262Error('#180: 524287 >> 5 === 16383. Actual: ' + (524287 >> 5)); +} + + +if (1048575 >> 5 !== 32767) { + throw new Test262Error('#181: 1048575 >> 5 === 32767. Actual: ' + (1048575 >> 5)); +} + + +if (2097151 >> 5 !== 65535) { + throw new Test262Error('#182: 2097151 >> 5 === 65535. Actual: ' + (2097151 >> 5)); +} + + +if (4194303 >> 5 !== 131071) { + throw new Test262Error('#183: 4194303 >> 5 === 131071. Actual: ' + (4194303 >> 5)); +} + + +if (8388607 >> 5 !== 262143) { + throw new Test262Error('#184: 8388607 >> 5 === 262143. Actual: ' + (8388607 >> 5)); +} + + +if (16777215 >> 5 !== 524287) { + throw new Test262Error('#185: 16777215 >> 5 === 524287. Actual: ' + (16777215 >> 5)); +} + + +if (33554431 >> 5 !== 1048575) { + throw new Test262Error('#186: 33554431 >> 5 === 1048575. Actual: ' + (33554431 >> 5)); +} + + +if (67108863 >> 5 !== 2097151) { + throw new Test262Error('#187: 67108863 >> 5 === 2097151. Actual: ' + (67108863 >> 5)); +} + + +if (134217727 >> 5 !== 4194303) { + throw new Test262Error('#188: 134217727 >> 5 === 4194303. Actual: ' + (134217727 >> 5)); +} + + +if (268435455 >> 5 !== 8388607) { + throw new Test262Error('#189: 268435455 >> 5 === 8388607. Actual: ' + (268435455 >> 5)); +} + + +if (536870911 >> 5 !== 16777215) { + throw new Test262Error('#190: 536870911 >> 5 === 16777215. Actual: ' + (536870911 >> 5)); +} + + +if (1073741823 >> 5 !== 33554431) { + throw new Test262Error('#191: 1073741823 >> 5 === 33554431. Actual: ' + (1073741823 >> 5)); +} + + +if (2147483647 >> 5 !== 67108863) { + throw new Test262Error('#192: 2147483647 >> 5 === 67108863. Actual: ' + (2147483647 >> 5)); +} + + +if (0 >> 6 !== 0) { + throw new Test262Error('#193: 0 >> 6 === 0. Actual: ' + (0 >> 6)); +} + + +if (1 >> 6 !== 0) { + throw new Test262Error('#194: 1 >> 6 === 0. Actual: ' + (1 >> 6)); +} + + +if (3 >> 6 !== 0) { + throw new Test262Error('#195: 3 >> 6 === 0. Actual: ' + (3 >> 6)); +} + + +if (7 >> 6 !== 0) { + throw new Test262Error('#196: 7 >> 6 === 0. Actual: ' + (7 >> 6)); +} + + +if (15 >> 6 !== 0) { + throw new Test262Error('#197: 15 >> 6 === 0. Actual: ' + (15 >> 6)); +} + + +if (31 >> 6 !== 0) { + throw new Test262Error('#198: 31 >> 6 === 0. Actual: ' + (31 >> 6)); +} + + +if (63 >> 6 !== 0) { + throw new Test262Error('#199: 63 >> 6 === 0. Actual: ' + (63 >> 6)); +} + + +if (127 >> 6 !== 1) { + throw new Test262Error('#200: 127 >> 6 === 1. Actual: ' + (127 >> 6)); +} + + +if (255 >> 6 !== 3) { + throw new Test262Error('#201: 255 >> 6 === 3. Actual: ' + (255 >> 6)); +} + + +if (511 >> 6 !== 7) { + throw new Test262Error('#202: 511 >> 6 === 7. Actual: ' + (511 >> 6)); +} + + +if (1023 >> 6 !== 15) { + throw new Test262Error('#203: 1023 >> 6 === 15. Actual: ' + (1023 >> 6)); +} + + +if (2047 >> 6 !== 31) { + throw new Test262Error('#204: 2047 >> 6 === 31. Actual: ' + (2047 >> 6)); +} + + +if (4095 >> 6 !== 63) { + throw new Test262Error('#205: 4095 >> 6 === 63. Actual: ' + (4095 >> 6)); +} + + +if (8191 >> 6 !== 127) { + throw new Test262Error('#206: 8191 >> 6 === 127. Actual: ' + (8191 >> 6)); +} + + +if (16383 >> 6 !== 255) { + throw new Test262Error('#207: 16383 >> 6 === 255. Actual: ' + (16383 >> 6)); +} + + +if (32767 >> 6 !== 511) { + throw new Test262Error('#208: 32767 >> 6 === 511. Actual: ' + (32767 >> 6)); +} + + +if (65535 >> 6 !== 1023) { + throw new Test262Error('#209: 65535 >> 6 === 1023. Actual: ' + (65535 >> 6)); +} + + +if (131071 >> 6 !== 2047) { + throw new Test262Error('#210: 131071 >> 6 === 2047. Actual: ' + (131071 >> 6)); +} + + +if (262143 >> 6 !== 4095) { + throw new Test262Error('#211: 262143 >> 6 === 4095. Actual: ' + (262143 >> 6)); +} + + +if (524287 >> 6 !== 8191) { + throw new Test262Error('#212: 524287 >> 6 === 8191. Actual: ' + (524287 >> 6)); +} + + +if (1048575 >> 6 !== 16383) { + throw new Test262Error('#213: 1048575 >> 6 === 16383. Actual: ' + (1048575 >> 6)); +} + + +if (2097151 >> 6 !== 32767) { + throw new Test262Error('#214: 2097151 >> 6 === 32767. Actual: ' + (2097151 >> 6)); +} + + +if (4194303 >> 6 !== 65535) { + throw new Test262Error('#215: 4194303 >> 6 === 65535. Actual: ' + (4194303 >> 6)); +} + + +if (8388607 >> 6 !== 131071) { + throw new Test262Error('#216: 8388607 >> 6 === 131071. Actual: ' + (8388607 >> 6)); +} + + +if (16777215 >> 6 !== 262143) { + throw new Test262Error('#217: 16777215 >> 6 === 262143. Actual: ' + (16777215 >> 6)); +} + + +if (33554431 >> 6 !== 524287) { + throw new Test262Error('#218: 33554431 >> 6 === 524287. Actual: ' + (33554431 >> 6)); +} + + +if (67108863 >> 6 !== 1048575) { + throw new Test262Error('#219: 67108863 >> 6 === 1048575. Actual: ' + (67108863 >> 6)); +} + + +if (134217727 >> 6 !== 2097151) { + throw new Test262Error('#220: 134217727 >> 6 === 2097151. Actual: ' + (134217727 >> 6)); +} + + +if (268435455 >> 6 !== 4194303) { + throw new Test262Error('#221: 268435455 >> 6 === 4194303. Actual: ' + (268435455 >> 6)); +} + + +if (536870911 >> 6 !== 8388607) { + throw new Test262Error('#222: 536870911 >> 6 === 8388607. Actual: ' + (536870911 >> 6)); +} + + +if (1073741823 >> 6 !== 16777215) { + throw new Test262Error('#223: 1073741823 >> 6 === 16777215. Actual: ' + (1073741823 >> 6)); +} + + +if (2147483647 >> 6 !== 33554431) { + throw new Test262Error('#224: 2147483647 >> 6 === 33554431. Actual: ' + (2147483647 >> 6)); +} + + +if (0 >> 7 !== 0) { + throw new Test262Error('#225: 0 >> 7 === 0. Actual: ' + (0 >> 7)); +} + + +if (1 >> 7 !== 0) { + throw new Test262Error('#226: 1 >> 7 === 0. Actual: ' + (1 >> 7)); +} + + +if (3 >> 7 !== 0) { + throw new Test262Error('#227: 3 >> 7 === 0. Actual: ' + (3 >> 7)); +} + + +if (7 >> 7 !== 0) { + throw new Test262Error('#228: 7 >> 7 === 0. Actual: ' + (7 >> 7)); +} + + +if (15 >> 7 !== 0) { + throw new Test262Error('#229: 15 >> 7 === 0. Actual: ' + (15 >> 7)); +} + + +if (31 >> 7 !== 0) { + throw new Test262Error('#230: 31 >> 7 === 0. Actual: ' + (31 >> 7)); +} + + +if (63 >> 7 !== 0) { + throw new Test262Error('#231: 63 >> 7 === 0. Actual: ' + (63 >> 7)); +} + + +if (127 >> 7 !== 0) { + throw new Test262Error('#232: 127 >> 7 === 0. Actual: ' + (127 >> 7)); +} + + +if (255 >> 7 !== 1) { + throw new Test262Error('#233: 255 >> 7 === 1. Actual: ' + (255 >> 7)); +} + + +if (511 >> 7 !== 3) { + throw new Test262Error('#234: 511 >> 7 === 3. Actual: ' + (511 >> 7)); +} + + +if (1023 >> 7 !== 7) { + throw new Test262Error('#235: 1023 >> 7 === 7. Actual: ' + (1023 >> 7)); +} + + +if (2047 >> 7 !== 15) { + throw new Test262Error('#236: 2047 >> 7 === 15. Actual: ' + (2047 >> 7)); +} + + +if (4095 >> 7 !== 31) { + throw new Test262Error('#237: 4095 >> 7 === 31. Actual: ' + (4095 >> 7)); +} + + +if (8191 >> 7 !== 63) { + throw new Test262Error('#238: 8191 >> 7 === 63. Actual: ' + (8191 >> 7)); +} + + +if (16383 >> 7 !== 127) { + throw new Test262Error('#239: 16383 >> 7 === 127. Actual: ' + (16383 >> 7)); +} + + +if (32767 >> 7 !== 255) { + throw new Test262Error('#240: 32767 >> 7 === 255. Actual: ' + (32767 >> 7)); +} + + +if (65535 >> 7 !== 511) { + throw new Test262Error('#241: 65535 >> 7 === 511. Actual: ' + (65535 >> 7)); +} + + +if (131071 >> 7 !== 1023) { + throw new Test262Error('#242: 131071 >> 7 === 1023. Actual: ' + (131071 >> 7)); +} + + +if (262143 >> 7 !== 2047) { + throw new Test262Error('#243: 262143 >> 7 === 2047. Actual: ' + (262143 >> 7)); +} + + +if (524287 >> 7 !== 4095) { + throw new Test262Error('#244: 524287 >> 7 === 4095. Actual: ' + (524287 >> 7)); +} + + +if (1048575 >> 7 !== 8191) { + throw new Test262Error('#245: 1048575 >> 7 === 8191. Actual: ' + (1048575 >> 7)); +} + + +if (2097151 >> 7 !== 16383) { + throw new Test262Error('#246: 2097151 >> 7 === 16383. Actual: ' + (2097151 >> 7)); +} + + +if (4194303 >> 7 !== 32767) { + throw new Test262Error('#247: 4194303 >> 7 === 32767. Actual: ' + (4194303 >> 7)); +} + + +if (8388607 >> 7 !== 65535) { + throw new Test262Error('#248: 8388607 >> 7 === 65535. Actual: ' + (8388607 >> 7)); +} + + +if (16777215 >> 7 !== 131071) { + throw new Test262Error('#249: 16777215 >> 7 === 131071. Actual: ' + (16777215 >> 7)); +} + + +if (33554431 >> 7 !== 262143) { + throw new Test262Error('#250: 33554431 >> 7 === 262143. Actual: ' + (33554431 >> 7)); +} + + +if (67108863 >> 7 !== 524287) { + throw new Test262Error('#251: 67108863 >> 7 === 524287. Actual: ' + (67108863 >> 7)); +} + + +if (134217727 >> 7 !== 1048575) { + throw new Test262Error('#252: 134217727 >> 7 === 1048575. Actual: ' + (134217727 >> 7)); +} + + +if (268435455 >> 7 !== 2097151) { + throw new Test262Error('#253: 268435455 >> 7 === 2097151. Actual: ' + (268435455 >> 7)); +} + + +if (536870911 >> 7 !== 4194303) { + throw new Test262Error('#254: 536870911 >> 7 === 4194303. Actual: ' + (536870911 >> 7)); +} + + +if (1073741823 >> 7 !== 8388607) { + throw new Test262Error('#255: 1073741823 >> 7 === 8388607. Actual: ' + (1073741823 >> 7)); +} + + +if (2147483647 >> 7 !== 16777215) { + throw new Test262Error('#256: 2147483647 >> 7 === 16777215. Actual: ' + (2147483647 >> 7)); +} + + +if (0 >> 8 !== 0) { + throw new Test262Error('#257: 0 >> 8 === 0. Actual: ' + (0 >> 8)); +} + + +if (1 >> 8 !== 0) { + throw new Test262Error('#258: 1 >> 8 === 0. Actual: ' + (1 >> 8)); +} + + +if (3 >> 8 !== 0) { + throw new Test262Error('#259: 3 >> 8 === 0. Actual: ' + (3 >> 8)); +} + + +if (7 >> 8 !== 0) { + throw new Test262Error('#260: 7 >> 8 === 0. Actual: ' + (7 >> 8)); +} + + +if (15 >> 8 !== 0) { + throw new Test262Error('#261: 15 >> 8 === 0. Actual: ' + (15 >> 8)); +} + + +if (31 >> 8 !== 0) { + throw new Test262Error('#262: 31 >> 8 === 0. Actual: ' + (31 >> 8)); +} + + +if (63 >> 8 !== 0) { + throw new Test262Error('#263: 63 >> 8 === 0. Actual: ' + (63 >> 8)); +} + + +if (127 >> 8 !== 0) { + throw new Test262Error('#264: 127 >> 8 === 0. Actual: ' + (127 >> 8)); +} + + +if (255 >> 8 !== 0) { + throw new Test262Error('#265: 255 >> 8 === 0. Actual: ' + (255 >> 8)); +} + + +if (511 >> 8 !== 1) { + throw new Test262Error('#266: 511 >> 8 === 1. Actual: ' + (511 >> 8)); +} + + +if (1023 >> 8 !== 3) { + throw new Test262Error('#267: 1023 >> 8 === 3. Actual: ' + (1023 >> 8)); +} + + +if (2047 >> 8 !== 7) { + throw new Test262Error('#268: 2047 >> 8 === 7. Actual: ' + (2047 >> 8)); +} + + +if (4095 >> 8 !== 15) { + throw new Test262Error('#269: 4095 >> 8 === 15. Actual: ' + (4095 >> 8)); +} + + +if (8191 >> 8 !== 31) { + throw new Test262Error('#270: 8191 >> 8 === 31. Actual: ' + (8191 >> 8)); +} + + +if (16383 >> 8 !== 63) { + throw new Test262Error('#271: 16383 >> 8 === 63. Actual: ' + (16383 >> 8)); +} + + +if (32767 >> 8 !== 127) { + throw new Test262Error('#272: 32767 >> 8 === 127. Actual: ' + (32767 >> 8)); +} + + +if (65535 >> 8 !== 255) { + throw new Test262Error('#273: 65535 >> 8 === 255. Actual: ' + (65535 >> 8)); +} + + +if (131071 >> 8 !== 511) { + throw new Test262Error('#274: 131071 >> 8 === 511. Actual: ' + (131071 >> 8)); +} + + +if (262143 >> 8 !== 1023) { + throw new Test262Error('#275: 262143 >> 8 === 1023. Actual: ' + (262143 >> 8)); +} + + +if (524287 >> 8 !== 2047) { + throw new Test262Error('#276: 524287 >> 8 === 2047. Actual: ' + (524287 >> 8)); +} + + +if (1048575 >> 8 !== 4095) { + throw new Test262Error('#277: 1048575 >> 8 === 4095. Actual: ' + (1048575 >> 8)); +} + + +if (2097151 >> 8 !== 8191) { + throw new Test262Error('#278: 2097151 >> 8 === 8191. Actual: ' + (2097151 >> 8)); +} + + +if (4194303 >> 8 !== 16383) { + throw new Test262Error('#279: 4194303 >> 8 === 16383. Actual: ' + (4194303 >> 8)); +} + + +if (8388607 >> 8 !== 32767) { + throw new Test262Error('#280: 8388607 >> 8 === 32767. Actual: ' + (8388607 >> 8)); +} + + +if (16777215 >> 8 !== 65535) { + throw new Test262Error('#281: 16777215 >> 8 === 65535. Actual: ' + (16777215 >> 8)); +} + + +if (33554431 >> 8 !== 131071) { + throw new Test262Error('#282: 33554431 >> 8 === 131071. Actual: ' + (33554431 >> 8)); +} + + +if (67108863 >> 8 !== 262143) { + throw new Test262Error('#283: 67108863 >> 8 === 262143. Actual: ' + (67108863 >> 8)); +} + + +if (134217727 >> 8 !== 524287) { + throw new Test262Error('#284: 134217727 >> 8 === 524287. Actual: ' + (134217727 >> 8)); +} + + +if (268435455 >> 8 !== 1048575) { + throw new Test262Error('#285: 268435455 >> 8 === 1048575. Actual: ' + (268435455 >> 8)); +} + + +if (536870911 >> 8 !== 2097151) { + throw new Test262Error('#286: 536870911 >> 8 === 2097151. Actual: ' + (536870911 >> 8)); +} + + +if (1073741823 >> 8 !== 4194303) { + throw new Test262Error('#287: 1073741823 >> 8 === 4194303. Actual: ' + (1073741823 >> 8)); +} + + +if (2147483647 >> 8 !== 8388607) { + throw new Test262Error('#288: 2147483647 >> 8 === 8388607. Actual: ' + (2147483647 >> 8)); +} + + +if (0 >> 9 !== 0) { + throw new Test262Error('#289: 0 >> 9 === 0. Actual: ' + (0 >> 9)); +} + + +if (1 >> 9 !== 0) { + throw new Test262Error('#290: 1 >> 9 === 0. Actual: ' + (1 >> 9)); +} + + +if (3 >> 9 !== 0) { + throw new Test262Error('#291: 3 >> 9 === 0. Actual: ' + (3 >> 9)); +} + + +if (7 >> 9 !== 0) { + throw new Test262Error('#292: 7 >> 9 === 0. Actual: ' + (7 >> 9)); +} + + +if (15 >> 9 !== 0) { + throw new Test262Error('#293: 15 >> 9 === 0. Actual: ' + (15 >> 9)); +} + + +if (31 >> 9 !== 0) { + throw new Test262Error('#294: 31 >> 9 === 0. Actual: ' + (31 >> 9)); +} + + +if (63 >> 9 !== 0) { + throw new Test262Error('#295: 63 >> 9 === 0. Actual: ' + (63 >> 9)); +} + + +if (127 >> 9 !== 0) { + throw new Test262Error('#296: 127 >> 9 === 0. Actual: ' + (127 >> 9)); +} + + +if (255 >> 9 !== 0) { + throw new Test262Error('#297: 255 >> 9 === 0. Actual: ' + (255 >> 9)); +} + + +if (511 >> 9 !== 0) { + throw new Test262Error('#298: 511 >> 9 === 0. Actual: ' + (511 >> 9)); +} + + +if (1023 >> 9 !== 1) { + throw new Test262Error('#299: 1023 >> 9 === 1. Actual: ' + (1023 >> 9)); +} + + +if (2047 >> 9 !== 3) { + throw new Test262Error('#300: 2047 >> 9 === 3. Actual: ' + (2047 >> 9)); +} + + +if (4095 >> 9 !== 7) { + throw new Test262Error('#301: 4095 >> 9 === 7. Actual: ' + (4095 >> 9)); +} + + +if (8191 >> 9 !== 15) { + throw new Test262Error('#302: 8191 >> 9 === 15. Actual: ' + (8191 >> 9)); +} + + +if (16383 >> 9 !== 31) { + throw new Test262Error('#303: 16383 >> 9 === 31. Actual: ' + (16383 >> 9)); +} + + +if (32767 >> 9 !== 63) { + throw new Test262Error('#304: 32767 >> 9 === 63. Actual: ' + (32767 >> 9)); +} + + +if (65535 >> 9 !== 127) { + throw new Test262Error('#305: 65535 >> 9 === 127. Actual: ' + (65535 >> 9)); +} + + +if (131071 >> 9 !== 255) { + throw new Test262Error('#306: 131071 >> 9 === 255. Actual: ' + (131071 >> 9)); +} + + +if (262143 >> 9 !== 511) { + throw new Test262Error('#307: 262143 >> 9 === 511. Actual: ' + (262143 >> 9)); +} + + +if (524287 >> 9 !== 1023) { + throw new Test262Error('#308: 524287 >> 9 === 1023. Actual: ' + (524287 >> 9)); +} + + +if (1048575 >> 9 !== 2047) { + throw new Test262Error('#309: 1048575 >> 9 === 2047. Actual: ' + (1048575 >> 9)); +} + + +if (2097151 >> 9 !== 4095) { + throw new Test262Error('#310: 2097151 >> 9 === 4095. Actual: ' + (2097151 >> 9)); +} + + +if (4194303 >> 9 !== 8191) { + throw new Test262Error('#311: 4194303 >> 9 === 8191. Actual: ' + (4194303 >> 9)); +} + + +if (8388607 >> 9 !== 16383) { + throw new Test262Error('#312: 8388607 >> 9 === 16383. Actual: ' + (8388607 >> 9)); +} + + +if (16777215 >> 9 !== 32767) { + throw new Test262Error('#313: 16777215 >> 9 === 32767. Actual: ' + (16777215 >> 9)); +} + + +if (33554431 >> 9 !== 65535) { + throw new Test262Error('#314: 33554431 >> 9 === 65535. Actual: ' + (33554431 >> 9)); +} + + +if (67108863 >> 9 !== 131071) { + throw new Test262Error('#315: 67108863 >> 9 === 131071. Actual: ' + (67108863 >> 9)); +} + + +if (134217727 >> 9 !== 262143) { + throw new Test262Error('#316: 134217727 >> 9 === 262143. Actual: ' + (134217727 >> 9)); +} + + +if (268435455 >> 9 !== 524287) { + throw new Test262Error('#317: 268435455 >> 9 === 524287. Actual: ' + (268435455 >> 9)); +} + + +if (536870911 >> 9 !== 1048575) { + throw new Test262Error('#318: 536870911 >> 9 === 1048575. Actual: ' + (536870911 >> 9)); +} + + +if (1073741823 >> 9 !== 2097151) { + throw new Test262Error('#319: 1073741823 >> 9 === 2097151. Actual: ' + (1073741823 >> 9)); +} + + +if (2147483647 >> 9 !== 4194303) { + throw new Test262Error('#320: 2147483647 >> 9 === 4194303. Actual: ' + (2147483647 >> 9)); +} + + +if (0 >> 10 !== 0) { + throw new Test262Error('#321: 0 >> 10 === 0. Actual: ' + (0 >> 10)); +} + + +if (1 >> 10 !== 0) { + throw new Test262Error('#322: 1 >> 10 === 0. Actual: ' + (1 >> 10)); +} + + +if (3 >> 10 !== 0) { + throw new Test262Error('#323: 3 >> 10 === 0. Actual: ' + (3 >> 10)); +} + + +if (7 >> 10 !== 0) { + throw new Test262Error('#324: 7 >> 10 === 0. Actual: ' + (7 >> 10)); +} + + +if (15 >> 10 !== 0) { + throw new Test262Error('#325: 15 >> 10 === 0. Actual: ' + (15 >> 10)); +} + + +if (31 >> 10 !== 0) { + throw new Test262Error('#326: 31 >> 10 === 0. Actual: ' + (31 >> 10)); +} + + +if (63 >> 10 !== 0) { + throw new Test262Error('#327: 63 >> 10 === 0. Actual: ' + (63 >> 10)); +} + + +if (127 >> 10 !== 0) { + throw new Test262Error('#328: 127 >> 10 === 0. Actual: ' + (127 >> 10)); +} + + +if (255 >> 10 !== 0) { + throw new Test262Error('#329: 255 >> 10 === 0. Actual: ' + (255 >> 10)); +} + + +if (511 >> 10 !== 0) { + throw new Test262Error('#330: 511 >> 10 === 0. Actual: ' + (511 >> 10)); +} + + +if (1023 >> 10 !== 0) { + throw new Test262Error('#331: 1023 >> 10 === 0. Actual: ' + (1023 >> 10)); +} + + +if (2047 >> 10 !== 1) { + throw new Test262Error('#332: 2047 >> 10 === 1. Actual: ' + (2047 >> 10)); +} + + +if (4095 >> 10 !== 3) { + throw new Test262Error('#333: 4095 >> 10 === 3. Actual: ' + (4095 >> 10)); +} + + +if (8191 >> 10 !== 7) { + throw new Test262Error('#334: 8191 >> 10 === 7. Actual: ' + (8191 >> 10)); +} + + +if (16383 >> 10 !== 15) { + throw new Test262Error('#335: 16383 >> 10 === 15. Actual: ' + (16383 >> 10)); +} + + +if (32767 >> 10 !== 31) { + throw new Test262Error('#336: 32767 >> 10 === 31. Actual: ' + (32767 >> 10)); +} + + +if (65535 >> 10 !== 63) { + throw new Test262Error('#337: 65535 >> 10 === 63. Actual: ' + (65535 >> 10)); +} + + +if (131071 >> 10 !== 127) { + throw new Test262Error('#338: 131071 >> 10 === 127. Actual: ' + (131071 >> 10)); +} + + +if (262143 >> 10 !== 255) { + throw new Test262Error('#339: 262143 >> 10 === 255. Actual: ' + (262143 >> 10)); +} + + +if (524287 >> 10 !== 511) { + throw new Test262Error('#340: 524287 >> 10 === 511. Actual: ' + (524287 >> 10)); +} + + +if (1048575 >> 10 !== 1023) { + throw new Test262Error('#341: 1048575 >> 10 === 1023. Actual: ' + (1048575 >> 10)); +} + + +if (2097151 >> 10 !== 2047) { + throw new Test262Error('#342: 2097151 >> 10 === 2047. Actual: ' + (2097151 >> 10)); +} + + +if (4194303 >> 10 !== 4095) { + throw new Test262Error('#343: 4194303 >> 10 === 4095. Actual: ' + (4194303 >> 10)); +} + + +if (8388607 >> 10 !== 8191) { + throw new Test262Error('#344: 8388607 >> 10 === 8191. Actual: ' + (8388607 >> 10)); +} + + +if (16777215 >> 10 !== 16383) { + throw new Test262Error('#345: 16777215 >> 10 === 16383. Actual: ' + (16777215 >> 10)); +} + + +if (33554431 >> 10 !== 32767) { + throw new Test262Error('#346: 33554431 >> 10 === 32767. Actual: ' + (33554431 >> 10)); +} + + +if (67108863 >> 10 !== 65535) { + throw new Test262Error('#347: 67108863 >> 10 === 65535. Actual: ' + (67108863 >> 10)); +} + + +if (134217727 >> 10 !== 131071) { + throw new Test262Error('#348: 134217727 >> 10 === 131071. Actual: ' + (134217727 >> 10)); +} + + +if (268435455 >> 10 !== 262143) { + throw new Test262Error('#349: 268435455 >> 10 === 262143. Actual: ' + (268435455 >> 10)); +} + + +if (536870911 >> 10 !== 524287) { + throw new Test262Error('#350: 536870911 >> 10 === 524287. Actual: ' + (536870911 >> 10)); +} + + +if (1073741823 >> 10 !== 1048575) { + throw new Test262Error('#351: 1073741823 >> 10 === 1048575. Actual: ' + (1073741823 >> 10)); +} + + +if (2147483647 >> 10 !== 2097151) { + throw new Test262Error('#352: 2147483647 >> 10 === 2097151. Actual: ' + (2147483647 >> 10)); +} + + +if (0 >> 11 !== 0) { + throw new Test262Error('#353: 0 >> 11 === 0. Actual: ' + (0 >> 11)); +} + + +if (1 >> 11 !== 0) { + throw new Test262Error('#354: 1 >> 11 === 0. Actual: ' + (1 >> 11)); +} + + +if (3 >> 11 !== 0) { + throw new Test262Error('#355: 3 >> 11 === 0. Actual: ' + (3 >> 11)); +} + + +if (7 >> 11 !== 0) { + throw new Test262Error('#356: 7 >> 11 === 0. Actual: ' + (7 >> 11)); +} + + +if (15 >> 11 !== 0) { + throw new Test262Error('#357: 15 >> 11 === 0. Actual: ' + (15 >> 11)); +} + + +if (31 >> 11 !== 0) { + throw new Test262Error('#358: 31 >> 11 === 0. Actual: ' + (31 >> 11)); +} + + +if (63 >> 11 !== 0) { + throw new Test262Error('#359: 63 >> 11 === 0. Actual: ' + (63 >> 11)); +} + + +if (127 >> 11 !== 0) { + throw new Test262Error('#360: 127 >> 11 === 0. Actual: ' + (127 >> 11)); +} + + +if (255 >> 11 !== 0) { + throw new Test262Error('#361: 255 >> 11 === 0. Actual: ' + (255 >> 11)); +} + + +if (511 >> 11 !== 0) { + throw new Test262Error('#362: 511 >> 11 === 0. Actual: ' + (511 >> 11)); +} + + +if (1023 >> 11 !== 0) { + throw new Test262Error('#363: 1023 >> 11 === 0. Actual: ' + (1023 >> 11)); +} + + +if (2047 >> 11 !== 0) { + throw new Test262Error('#364: 2047 >> 11 === 0. Actual: ' + (2047 >> 11)); +} + + +if (4095 >> 11 !== 1) { + throw new Test262Error('#365: 4095 >> 11 === 1. Actual: ' + (4095 >> 11)); +} + + +if (8191 >> 11 !== 3) { + throw new Test262Error('#366: 8191 >> 11 === 3. Actual: ' + (8191 >> 11)); +} + + +if (16383 >> 11 !== 7) { + throw new Test262Error('#367: 16383 >> 11 === 7. Actual: ' + (16383 >> 11)); +} + + +if (32767 >> 11 !== 15) { + throw new Test262Error('#368: 32767 >> 11 === 15. Actual: ' + (32767 >> 11)); +} + + +if (65535 >> 11 !== 31) { + throw new Test262Error('#369: 65535 >> 11 === 31. Actual: ' + (65535 >> 11)); +} + + +if (131071 >> 11 !== 63) { + throw new Test262Error('#370: 131071 >> 11 === 63. Actual: ' + (131071 >> 11)); +} + + +if (262143 >> 11 !== 127) { + throw new Test262Error('#371: 262143 >> 11 === 127. Actual: ' + (262143 >> 11)); +} + + +if (524287 >> 11 !== 255) { + throw new Test262Error('#372: 524287 >> 11 === 255. Actual: ' + (524287 >> 11)); +} + + +if (1048575 >> 11 !== 511) { + throw new Test262Error('#373: 1048575 >> 11 === 511. Actual: ' + (1048575 >> 11)); +} + + +if (2097151 >> 11 !== 1023) { + throw new Test262Error('#374: 2097151 >> 11 === 1023. Actual: ' + (2097151 >> 11)); +} + + +if (4194303 >> 11 !== 2047) { + throw new Test262Error('#375: 4194303 >> 11 === 2047. Actual: ' + (4194303 >> 11)); +} + + +if (8388607 >> 11 !== 4095) { + throw new Test262Error('#376: 8388607 >> 11 === 4095. Actual: ' + (8388607 >> 11)); +} + + +if (16777215 >> 11 !== 8191) { + throw new Test262Error('#377: 16777215 >> 11 === 8191. Actual: ' + (16777215 >> 11)); +} + + +if (33554431 >> 11 !== 16383) { + throw new Test262Error('#378: 33554431 >> 11 === 16383. Actual: ' + (33554431 >> 11)); +} + + +if (67108863 >> 11 !== 32767) { + throw new Test262Error('#379: 67108863 >> 11 === 32767. Actual: ' + (67108863 >> 11)); +} + + +if (134217727 >> 11 !== 65535) { + throw new Test262Error('#380: 134217727 >> 11 === 65535. Actual: ' + (134217727 >> 11)); +} + + +if (268435455 >> 11 !== 131071) { + throw new Test262Error('#381: 268435455 >> 11 === 131071. Actual: ' + (268435455 >> 11)); +} + + +if (536870911 >> 11 !== 262143) { + throw new Test262Error('#382: 536870911 >> 11 === 262143. Actual: ' + (536870911 >> 11)); +} + + +if (1073741823 >> 11 !== 524287) { + throw new Test262Error('#383: 1073741823 >> 11 === 524287. Actual: ' + (1073741823 >> 11)); +} + + +if (2147483647 >> 11 !== 1048575) { + throw new Test262Error('#384: 2147483647 >> 11 === 1048575. Actual: ' + (2147483647 >> 11)); +} + + +if (0 >> 12 !== 0) { + throw new Test262Error('#385: 0 >> 12 === 0. Actual: ' + (0 >> 12)); +} + + +if (1 >> 12 !== 0) { + throw new Test262Error('#386: 1 >> 12 === 0. Actual: ' + (1 >> 12)); +} + + +if (3 >> 12 !== 0) { + throw new Test262Error('#387: 3 >> 12 === 0. Actual: ' + (3 >> 12)); +} + + +if (7 >> 12 !== 0) { + throw new Test262Error('#388: 7 >> 12 === 0. Actual: ' + (7 >> 12)); +} + + +if (15 >> 12 !== 0) { + throw new Test262Error('#389: 15 >> 12 === 0. Actual: ' + (15 >> 12)); +} + + +if (31 >> 12 !== 0) { + throw new Test262Error('#390: 31 >> 12 === 0. Actual: ' + (31 >> 12)); +} + + +if (63 >> 12 !== 0) { + throw new Test262Error('#391: 63 >> 12 === 0. Actual: ' + (63 >> 12)); +} + + +if (127 >> 12 !== 0) { + throw new Test262Error('#392: 127 >> 12 === 0. Actual: ' + (127 >> 12)); +} + + +if (255 >> 12 !== 0) { + throw new Test262Error('#393: 255 >> 12 === 0. Actual: ' + (255 >> 12)); +} + + +if (511 >> 12 !== 0) { + throw new Test262Error('#394: 511 >> 12 === 0. Actual: ' + (511 >> 12)); +} + + +if (1023 >> 12 !== 0) { + throw new Test262Error('#395: 1023 >> 12 === 0. Actual: ' + (1023 >> 12)); +} + + +if (2047 >> 12 !== 0) { + throw new Test262Error('#396: 2047 >> 12 === 0. Actual: ' + (2047 >> 12)); +} + + +if (4095 >> 12 !== 0) { + throw new Test262Error('#397: 4095 >> 12 === 0. Actual: ' + (4095 >> 12)); +} + + +if (8191 >> 12 !== 1) { + throw new Test262Error('#398: 8191 >> 12 === 1. Actual: ' + (8191 >> 12)); +} + + +if (16383 >> 12 !== 3) { + throw new Test262Error('#399: 16383 >> 12 === 3. Actual: ' + (16383 >> 12)); +} + + +if (32767 >> 12 !== 7) { + throw new Test262Error('#400: 32767 >> 12 === 7. Actual: ' + (32767 >> 12)); +} + + +if (65535 >> 12 !== 15) { + throw new Test262Error('#401: 65535 >> 12 === 15. Actual: ' + (65535 >> 12)); +} + + +if (131071 >> 12 !== 31) { + throw new Test262Error('#402: 131071 >> 12 === 31. Actual: ' + (131071 >> 12)); +} + + +if (262143 >> 12 !== 63) { + throw new Test262Error('#403: 262143 >> 12 === 63. Actual: ' + (262143 >> 12)); +} + + +if (524287 >> 12 !== 127) { + throw new Test262Error('#404: 524287 >> 12 === 127. Actual: ' + (524287 >> 12)); +} + + +if (1048575 >> 12 !== 255) { + throw new Test262Error('#405: 1048575 >> 12 === 255. Actual: ' + (1048575 >> 12)); +} + + +if (2097151 >> 12 !== 511) { + throw new Test262Error('#406: 2097151 >> 12 === 511. Actual: ' + (2097151 >> 12)); +} + + +if (4194303 >> 12 !== 1023) { + throw new Test262Error('#407: 4194303 >> 12 === 1023. Actual: ' + (4194303 >> 12)); +} + + +if (8388607 >> 12 !== 2047) { + throw new Test262Error('#408: 8388607 >> 12 === 2047. Actual: ' + (8388607 >> 12)); +} + + +if (16777215 >> 12 !== 4095) { + throw new Test262Error('#409: 16777215 >> 12 === 4095. Actual: ' + (16777215 >> 12)); +} + + +if (33554431 >> 12 !== 8191) { + throw new Test262Error('#410: 33554431 >> 12 === 8191. Actual: ' + (33554431 >> 12)); +} + + +if (67108863 >> 12 !== 16383) { + throw new Test262Error('#411: 67108863 >> 12 === 16383. Actual: ' + (67108863 >> 12)); +} + + +if (134217727 >> 12 !== 32767) { + throw new Test262Error('#412: 134217727 >> 12 === 32767. Actual: ' + (134217727 >> 12)); +} + + +if (268435455 >> 12 !== 65535) { + throw new Test262Error('#413: 268435455 >> 12 === 65535. Actual: ' + (268435455 >> 12)); +} + + +if (536870911 >> 12 !== 131071) { + throw new Test262Error('#414: 536870911 >> 12 === 131071. Actual: ' + (536870911 >> 12)); +} + + +if (1073741823 >> 12 !== 262143) { + throw new Test262Error('#415: 1073741823 >> 12 === 262143. Actual: ' + (1073741823 >> 12)); +} + + +if (2147483647 >> 12 !== 524287) { + throw new Test262Error('#416: 2147483647 >> 12 === 524287. Actual: ' + (2147483647 >> 12)); +} + + +if (0 >> 13 !== 0) { + throw new Test262Error('#417: 0 >> 13 === 0. Actual: ' + (0 >> 13)); +} + + +if (1 >> 13 !== 0) { + throw new Test262Error('#418: 1 >> 13 === 0. Actual: ' + (1 >> 13)); +} + + +if (3 >> 13 !== 0) { + throw new Test262Error('#419: 3 >> 13 === 0. Actual: ' + (3 >> 13)); +} + + +if (7 >> 13 !== 0) { + throw new Test262Error('#420: 7 >> 13 === 0. Actual: ' + (7 >> 13)); +} + + +if (15 >> 13 !== 0) { + throw new Test262Error('#421: 15 >> 13 === 0. Actual: ' + (15 >> 13)); +} + + +if (31 >> 13 !== 0) { + throw new Test262Error('#422: 31 >> 13 === 0. Actual: ' + (31 >> 13)); +} + + +if (63 >> 13 !== 0) { + throw new Test262Error('#423: 63 >> 13 === 0. Actual: ' + (63 >> 13)); +} + + +if (127 >> 13 !== 0) { + throw new Test262Error('#424: 127 >> 13 === 0. Actual: ' + (127 >> 13)); +} + + +if (255 >> 13 !== 0) { + throw new Test262Error('#425: 255 >> 13 === 0. Actual: ' + (255 >> 13)); +} + + +if (511 >> 13 !== 0) { + throw new Test262Error('#426: 511 >> 13 === 0. Actual: ' + (511 >> 13)); +} + + +if (1023 >> 13 !== 0) { + throw new Test262Error('#427: 1023 >> 13 === 0. Actual: ' + (1023 >> 13)); +} + + +if (2047 >> 13 !== 0) { + throw new Test262Error('#428: 2047 >> 13 === 0. Actual: ' + (2047 >> 13)); +} + + +if (4095 >> 13 !== 0) { + throw new Test262Error('#429: 4095 >> 13 === 0. Actual: ' + (4095 >> 13)); +} + + +if (8191 >> 13 !== 0) { + throw new Test262Error('#430: 8191 >> 13 === 0. Actual: ' + (8191 >> 13)); +} + + +if (16383 >> 13 !== 1) { + throw new Test262Error('#431: 16383 >> 13 === 1. Actual: ' + (16383 >> 13)); +} + + +if (32767 >> 13 !== 3) { + throw new Test262Error('#432: 32767 >> 13 === 3. Actual: ' + (32767 >> 13)); +} + + +if (65535 >> 13 !== 7) { + throw new Test262Error('#433: 65535 >> 13 === 7. Actual: ' + (65535 >> 13)); +} + + +if (131071 >> 13 !== 15) { + throw new Test262Error('#434: 131071 >> 13 === 15. Actual: ' + (131071 >> 13)); +} + + +if (262143 >> 13 !== 31) { + throw new Test262Error('#435: 262143 >> 13 === 31. Actual: ' + (262143 >> 13)); +} + + +if (524287 >> 13 !== 63) { + throw new Test262Error('#436: 524287 >> 13 === 63. Actual: ' + (524287 >> 13)); +} + + +if (1048575 >> 13 !== 127) { + throw new Test262Error('#437: 1048575 >> 13 === 127. Actual: ' + (1048575 >> 13)); +} + + +if (2097151 >> 13 !== 255) { + throw new Test262Error('#438: 2097151 >> 13 === 255. Actual: ' + (2097151 >> 13)); +} + + +if (4194303 >> 13 !== 511) { + throw new Test262Error('#439: 4194303 >> 13 === 511. Actual: ' + (4194303 >> 13)); +} + + +if (8388607 >> 13 !== 1023) { + throw new Test262Error('#440: 8388607 >> 13 === 1023. Actual: ' + (8388607 >> 13)); +} + + +if (16777215 >> 13 !== 2047) { + throw new Test262Error('#441: 16777215 >> 13 === 2047. Actual: ' + (16777215 >> 13)); +} + + +if (33554431 >> 13 !== 4095) { + throw new Test262Error('#442: 33554431 >> 13 === 4095. Actual: ' + (33554431 >> 13)); +} + + +if (67108863 >> 13 !== 8191) { + throw new Test262Error('#443: 67108863 >> 13 === 8191. Actual: ' + (67108863 >> 13)); +} + + +if (134217727 >> 13 !== 16383) { + throw new Test262Error('#444: 134217727 >> 13 === 16383. Actual: ' + (134217727 >> 13)); +} + + +if (268435455 >> 13 !== 32767) { + throw new Test262Error('#445: 268435455 >> 13 === 32767. Actual: ' + (268435455 >> 13)); +} + + +if (536870911 >> 13 !== 65535) { + throw new Test262Error('#446: 536870911 >> 13 === 65535. Actual: ' + (536870911 >> 13)); +} + + +if (1073741823 >> 13 !== 131071) { + throw new Test262Error('#447: 1073741823 >> 13 === 131071. Actual: ' + (1073741823 >> 13)); +} + + +if (2147483647 >> 13 !== 262143) { + throw new Test262Error('#448: 2147483647 >> 13 === 262143. Actual: ' + (2147483647 >> 13)); +} + + +if (0 >> 14 !== 0) { + throw new Test262Error('#449: 0 >> 14 === 0. Actual: ' + (0 >> 14)); +} + + +if (1 >> 14 !== 0) { + throw new Test262Error('#450: 1 >> 14 === 0. Actual: ' + (1 >> 14)); +} + + +if (3 >> 14 !== 0) { + throw new Test262Error('#451: 3 >> 14 === 0. Actual: ' + (3 >> 14)); +} + + +if (7 >> 14 !== 0) { + throw new Test262Error('#452: 7 >> 14 === 0. Actual: ' + (7 >> 14)); +} + + +if (15 >> 14 !== 0) { + throw new Test262Error('#453: 15 >> 14 === 0. Actual: ' + (15 >> 14)); +} + + +if (31 >> 14 !== 0) { + throw new Test262Error('#454: 31 >> 14 === 0. Actual: ' + (31 >> 14)); +} + + +if (63 >> 14 !== 0) { + throw new Test262Error('#455: 63 >> 14 === 0. Actual: ' + (63 >> 14)); +} + + +if (127 >> 14 !== 0) { + throw new Test262Error('#456: 127 >> 14 === 0. Actual: ' + (127 >> 14)); +} + + +if (255 >> 14 !== 0) { + throw new Test262Error('#457: 255 >> 14 === 0. Actual: ' + (255 >> 14)); +} + + +if (511 >> 14 !== 0) { + throw new Test262Error('#458: 511 >> 14 === 0. Actual: ' + (511 >> 14)); +} + + +if (1023 >> 14 !== 0) { + throw new Test262Error('#459: 1023 >> 14 === 0. Actual: ' + (1023 >> 14)); +} + + +if (2047 >> 14 !== 0) { + throw new Test262Error('#460: 2047 >> 14 === 0. Actual: ' + (2047 >> 14)); +} + + +if (4095 >> 14 !== 0) { + throw new Test262Error('#461: 4095 >> 14 === 0. Actual: ' + (4095 >> 14)); +} + + +if (8191 >> 14 !== 0) { + throw new Test262Error('#462: 8191 >> 14 === 0. Actual: ' + (8191 >> 14)); +} + + +if (16383 >> 14 !== 0) { + throw new Test262Error('#463: 16383 >> 14 === 0. Actual: ' + (16383 >> 14)); +} + + +if (32767 >> 14 !== 1) { + throw new Test262Error('#464: 32767 >> 14 === 1. Actual: ' + (32767 >> 14)); +} + + +if (65535 >> 14 !== 3) { + throw new Test262Error('#465: 65535 >> 14 === 3. Actual: ' + (65535 >> 14)); +} + + +if (131071 >> 14 !== 7) { + throw new Test262Error('#466: 131071 >> 14 === 7. Actual: ' + (131071 >> 14)); +} + + +if (262143 >> 14 !== 15) { + throw new Test262Error('#467: 262143 >> 14 === 15. Actual: ' + (262143 >> 14)); +} + + +if (524287 >> 14 !== 31) { + throw new Test262Error('#468: 524287 >> 14 === 31. Actual: ' + (524287 >> 14)); +} + + +if (1048575 >> 14 !== 63) { + throw new Test262Error('#469: 1048575 >> 14 === 63. Actual: ' + (1048575 >> 14)); +} + + +if (2097151 >> 14 !== 127) { + throw new Test262Error('#470: 2097151 >> 14 === 127. Actual: ' + (2097151 >> 14)); +} + + +if (4194303 >> 14 !== 255) { + throw new Test262Error('#471: 4194303 >> 14 === 255. Actual: ' + (4194303 >> 14)); +} + + +if (8388607 >> 14 !== 511) { + throw new Test262Error('#472: 8388607 >> 14 === 511. Actual: ' + (8388607 >> 14)); +} + + +if (16777215 >> 14 !== 1023) { + throw new Test262Error('#473: 16777215 >> 14 === 1023. Actual: ' + (16777215 >> 14)); +} + + +if (33554431 >> 14 !== 2047) { + throw new Test262Error('#474: 33554431 >> 14 === 2047. Actual: ' + (33554431 >> 14)); +} + + +if (67108863 >> 14 !== 4095) { + throw new Test262Error('#475: 67108863 >> 14 === 4095. Actual: ' + (67108863 >> 14)); +} + + +if (134217727 >> 14 !== 8191) { + throw new Test262Error('#476: 134217727 >> 14 === 8191. Actual: ' + (134217727 >> 14)); +} + + +if (268435455 >> 14 !== 16383) { + throw new Test262Error('#477: 268435455 >> 14 === 16383. Actual: ' + (268435455 >> 14)); +} + + +if (536870911 >> 14 !== 32767) { + throw new Test262Error('#478: 536870911 >> 14 === 32767. Actual: ' + (536870911 >> 14)); +} + + +if (1073741823 >> 14 !== 65535) { + throw new Test262Error('#479: 1073741823 >> 14 === 65535. Actual: ' + (1073741823 >> 14)); +} + + +if (2147483647 >> 14 !== 131071) { + throw new Test262Error('#480: 2147483647 >> 14 === 131071. Actual: ' + (2147483647 >> 14)); +} + + +if (0 >> 15 !== 0) { + throw new Test262Error('#481: 0 >> 15 === 0. Actual: ' + (0 >> 15)); +} + + +if (1 >> 15 !== 0) { + throw new Test262Error('#482: 1 >> 15 === 0. Actual: ' + (1 >> 15)); +} + + +if (3 >> 15 !== 0) { + throw new Test262Error('#483: 3 >> 15 === 0. Actual: ' + (3 >> 15)); +} + + +if (7 >> 15 !== 0) { + throw new Test262Error('#484: 7 >> 15 === 0. Actual: ' + (7 >> 15)); +} + + +if (15 >> 15 !== 0) { + throw new Test262Error('#485: 15 >> 15 === 0. Actual: ' + (15 >> 15)); +} + + +if (31 >> 15 !== 0) { + throw new Test262Error('#486: 31 >> 15 === 0. Actual: ' + (31 >> 15)); +} + + +if (63 >> 15 !== 0) { + throw new Test262Error('#487: 63 >> 15 === 0. Actual: ' + (63 >> 15)); +} + + +if (127 >> 15 !== 0) { + throw new Test262Error('#488: 127 >> 15 === 0. Actual: ' + (127 >> 15)); +} + + +if (255 >> 15 !== 0) { + throw new Test262Error('#489: 255 >> 15 === 0. Actual: ' + (255 >> 15)); +} + + +if (511 >> 15 !== 0) { + throw new Test262Error('#490: 511 >> 15 === 0. Actual: ' + (511 >> 15)); +} + + +if (1023 >> 15 !== 0) { + throw new Test262Error('#491: 1023 >> 15 === 0. Actual: ' + (1023 >> 15)); +} + + +if (2047 >> 15 !== 0) { + throw new Test262Error('#492: 2047 >> 15 === 0. Actual: ' + (2047 >> 15)); +} + + +if (4095 >> 15 !== 0) { + throw new Test262Error('#493: 4095 >> 15 === 0. Actual: ' + (4095 >> 15)); +} + + +if (8191 >> 15 !== 0) { + throw new Test262Error('#494: 8191 >> 15 === 0. Actual: ' + (8191 >> 15)); +} + + +if (16383 >> 15 !== 0) { + throw new Test262Error('#495: 16383 >> 15 === 0. Actual: ' + (16383 >> 15)); +} + + +if (32767 >> 15 !== 0) { + throw new Test262Error('#496: 32767 >> 15 === 0. Actual: ' + (32767 >> 15)); +} + + +if (65535 >> 15 !== 1) { + throw new Test262Error('#497: 65535 >> 15 === 1. Actual: ' + (65535 >> 15)); +} + + +if (131071 >> 15 !== 3) { + throw new Test262Error('#498: 131071 >> 15 === 3. Actual: ' + (131071 >> 15)); +} + + +if (262143 >> 15 !== 7) { + throw new Test262Error('#499: 262143 >> 15 === 7. Actual: ' + (262143 >> 15)); +} + + +if (524287 >> 15 !== 15) { + throw new Test262Error('#500: 524287 >> 15 === 15. Actual: ' + (524287 >> 15)); +} + + +if (1048575 >> 15 !== 31) { + throw new Test262Error('#501: 1048575 >> 15 === 31. Actual: ' + (1048575 >> 15)); +} + + +if (2097151 >> 15 !== 63) { + throw new Test262Error('#502: 2097151 >> 15 === 63. Actual: ' + (2097151 >> 15)); +} + + +if (4194303 >> 15 !== 127) { + throw new Test262Error('#503: 4194303 >> 15 === 127. Actual: ' + (4194303 >> 15)); +} + + +if (8388607 >> 15 !== 255) { + throw new Test262Error('#504: 8388607 >> 15 === 255. Actual: ' + (8388607 >> 15)); +} + + +if (16777215 >> 15 !== 511) { + throw new Test262Error('#505: 16777215 >> 15 === 511. Actual: ' + (16777215 >> 15)); +} + + +if (33554431 >> 15 !== 1023) { + throw new Test262Error('#506: 33554431 >> 15 === 1023. Actual: ' + (33554431 >> 15)); +} + + +if (67108863 >> 15 !== 2047) { + throw new Test262Error('#507: 67108863 >> 15 === 2047. Actual: ' + (67108863 >> 15)); +} + + +if (134217727 >> 15 !== 4095) { + throw new Test262Error('#508: 134217727 >> 15 === 4095. Actual: ' + (134217727 >> 15)); +} + + +if (268435455 >> 15 !== 8191) { + throw new Test262Error('#509: 268435455 >> 15 === 8191. Actual: ' + (268435455 >> 15)); +} + + +if (536870911 >> 15 !== 16383) { + throw new Test262Error('#510: 536870911 >> 15 === 16383. Actual: ' + (536870911 >> 15)); +} + + +if (1073741823 >> 15 !== 32767) { + throw new Test262Error('#511: 1073741823 >> 15 === 32767. Actual: ' + (1073741823 >> 15)); +} + + +if (2147483647 >> 15 !== 65535) { + throw new Test262Error('#512: 2147483647 >> 15 === 65535. Actual: ' + (2147483647 >> 15)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T4.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T4.js new file mode 100644 index 0000000000..32a9925a12 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A4_T4.js @@ -0,0 +1,2566 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check x >> y operator in distinct points +es5id: 11.7.2_A4_T4 +description: ShiftExpression = 2^n - 1, n = 16...31 +---*/ + +//CHECK + +if (0 >> 16 !== 0) { + throw new Test262Error('#513: 0 >> 16 === 0. Actual: ' + (0 >> 16)); +} + + +if (1 >> 16 !== 0) { + throw new Test262Error('#514: 1 >> 16 === 0. Actual: ' + (1 >> 16)); +} + + +if (3 >> 16 !== 0) { + throw new Test262Error('#515: 3 >> 16 === 0. Actual: ' + (3 >> 16)); +} + + +if (7 >> 16 !== 0) { + throw new Test262Error('#516: 7 >> 16 === 0. Actual: ' + (7 >> 16)); +} + + +if (15 >> 16 !== 0) { + throw new Test262Error('#517: 15 >> 16 === 0. Actual: ' + (15 >> 16)); +} + + +if (31 >> 16 !== 0) { + throw new Test262Error('#518: 31 >> 16 === 0. Actual: ' + (31 >> 16)); +} + + +if (63 >> 16 !== 0) { + throw new Test262Error('#519: 63 >> 16 === 0. Actual: ' + (63 >> 16)); +} + + +if (127 >> 16 !== 0) { + throw new Test262Error('#520: 127 >> 16 === 0. Actual: ' + (127 >> 16)); +} + + +if (255 >> 16 !== 0) { + throw new Test262Error('#521: 255 >> 16 === 0. Actual: ' + (255 >> 16)); +} + + +if (511 >> 16 !== 0) { + throw new Test262Error('#522: 511 >> 16 === 0. Actual: ' + (511 >> 16)); +} + + +if (1023 >> 16 !== 0) { + throw new Test262Error('#523: 1023 >> 16 === 0. Actual: ' + (1023 >> 16)); +} + + +if (2047 >> 16 !== 0) { + throw new Test262Error('#524: 2047 >> 16 === 0. Actual: ' + (2047 >> 16)); +} + + +if (4095 >> 16 !== 0) { + throw new Test262Error('#525: 4095 >> 16 === 0. Actual: ' + (4095 >> 16)); +} + + +if (8191 >> 16 !== 0) { + throw new Test262Error('#526: 8191 >> 16 === 0. Actual: ' + (8191 >> 16)); +} + + +if (16383 >> 16 !== 0) { + throw new Test262Error('#527: 16383 >> 16 === 0. Actual: ' + (16383 >> 16)); +} + + +if (32767 >> 16 !== 0) { + throw new Test262Error('#528: 32767 >> 16 === 0. Actual: ' + (32767 >> 16)); +} + + +if (65535 >> 16 !== 0) { + throw new Test262Error('#529: 65535 >> 16 === 0. Actual: ' + (65535 >> 16)); +} + + +if (131071 >> 16 !== 1) { + throw new Test262Error('#530: 131071 >> 16 === 1. Actual: ' + (131071 >> 16)); +} + + +if (262143 >> 16 !== 3) { + throw new Test262Error('#531: 262143 >> 16 === 3. Actual: ' + (262143 >> 16)); +} + + +if (524287 >> 16 !== 7) { + throw new Test262Error('#532: 524287 >> 16 === 7. Actual: ' + (524287 >> 16)); +} + + +if (1048575 >> 16 !== 15) { + throw new Test262Error('#533: 1048575 >> 16 === 15. Actual: ' + (1048575 >> 16)); +} + + +if (2097151 >> 16 !== 31) { + throw new Test262Error('#534: 2097151 >> 16 === 31. Actual: ' + (2097151 >> 16)); +} + + +if (4194303 >> 16 !== 63) { + throw new Test262Error('#535: 4194303 >> 16 === 63. Actual: ' + (4194303 >> 16)); +} + + +if (8388607 >> 16 !== 127) { + throw new Test262Error('#536: 8388607 >> 16 === 127. Actual: ' + (8388607 >> 16)); +} + + +if (16777215 >> 16 !== 255) { + throw new Test262Error('#537: 16777215 >> 16 === 255. Actual: ' + (16777215 >> 16)); +} + + +if (33554431 >> 16 !== 511) { + throw new Test262Error('#538: 33554431 >> 16 === 511. Actual: ' + (33554431 >> 16)); +} + + +if (67108863 >> 16 !== 1023) { + throw new Test262Error('#539: 67108863 >> 16 === 1023. Actual: ' + (67108863 >> 16)); +} + + +if (134217727 >> 16 !== 2047) { + throw new Test262Error('#540: 134217727 >> 16 === 2047. Actual: ' + (134217727 >> 16)); +} + + +if (268435455 >> 16 !== 4095) { + throw new Test262Error('#541: 268435455 >> 16 === 4095. Actual: ' + (268435455 >> 16)); +} + + +if (536870911 >> 16 !== 8191) { + throw new Test262Error('#542: 536870911 >> 16 === 8191. Actual: ' + (536870911 >> 16)); +} + + +if (1073741823 >> 16 !== 16383) { + throw new Test262Error('#543: 1073741823 >> 16 === 16383. Actual: ' + (1073741823 >> 16)); +} + + +if (2147483647 >> 16 !== 32767) { + throw new Test262Error('#544: 2147483647 >> 16 === 32767. Actual: ' + (2147483647 >> 16)); +} + + +if (0 >> 17 !== 0) { + throw new Test262Error('#545: 0 >> 17 === 0. Actual: ' + (0 >> 17)); +} + + +if (1 >> 17 !== 0) { + throw new Test262Error('#546: 1 >> 17 === 0. Actual: ' + (1 >> 17)); +} + + +if (3 >> 17 !== 0) { + throw new Test262Error('#547: 3 >> 17 === 0. Actual: ' + (3 >> 17)); +} + + +if (7 >> 17 !== 0) { + throw new Test262Error('#548: 7 >> 17 === 0. Actual: ' + (7 >> 17)); +} + + +if (15 >> 17 !== 0) { + throw new Test262Error('#549: 15 >> 17 === 0. Actual: ' + (15 >> 17)); +} + + +if (31 >> 17 !== 0) { + throw new Test262Error('#550: 31 >> 17 === 0. Actual: ' + (31 >> 17)); +} + + +if (63 >> 17 !== 0) { + throw new Test262Error('#551: 63 >> 17 === 0. Actual: ' + (63 >> 17)); +} + + +if (127 >> 17 !== 0) { + throw new Test262Error('#552: 127 >> 17 === 0. Actual: ' + (127 >> 17)); +} + + +if (255 >> 17 !== 0) { + throw new Test262Error('#553: 255 >> 17 === 0. Actual: ' + (255 >> 17)); +} + + +if (511 >> 17 !== 0) { + throw new Test262Error('#554: 511 >> 17 === 0. Actual: ' + (511 >> 17)); +} + + +if (1023 >> 17 !== 0) { + throw new Test262Error('#555: 1023 >> 17 === 0. Actual: ' + (1023 >> 17)); +} + + +if (2047 >> 17 !== 0) { + throw new Test262Error('#556: 2047 >> 17 === 0. Actual: ' + (2047 >> 17)); +} + + +if (4095 >> 17 !== 0) { + throw new Test262Error('#557: 4095 >> 17 === 0. Actual: ' + (4095 >> 17)); +} + + +if (8191 >> 17 !== 0) { + throw new Test262Error('#558: 8191 >> 17 === 0. Actual: ' + (8191 >> 17)); +} + + +if (16383 >> 17 !== 0) { + throw new Test262Error('#559: 16383 >> 17 === 0. Actual: ' + (16383 >> 17)); +} + + +if (32767 >> 17 !== 0) { + throw new Test262Error('#560: 32767 >> 17 === 0. Actual: ' + (32767 >> 17)); +} + + +if (65535 >> 17 !== 0) { + throw new Test262Error('#561: 65535 >> 17 === 0. Actual: ' + (65535 >> 17)); +} + + +if (131071 >> 17 !== 0) { + throw new Test262Error('#562: 131071 >> 17 === 0. Actual: ' + (131071 >> 17)); +} + + +if (262143 >> 17 !== 1) { + throw new Test262Error('#563: 262143 >> 17 === 1. Actual: ' + (262143 >> 17)); +} + + +if (524287 >> 17 !== 3) { + throw new Test262Error('#564: 524287 >> 17 === 3. Actual: ' + (524287 >> 17)); +} + + +if (1048575 >> 17 !== 7) { + throw new Test262Error('#565: 1048575 >> 17 === 7. Actual: ' + (1048575 >> 17)); +} + + +if (2097151 >> 17 !== 15) { + throw new Test262Error('#566: 2097151 >> 17 === 15. Actual: ' + (2097151 >> 17)); +} + + +if (4194303 >> 17 !== 31) { + throw new Test262Error('#567: 4194303 >> 17 === 31. Actual: ' + (4194303 >> 17)); +} + + +if (8388607 >> 17 !== 63) { + throw new Test262Error('#568: 8388607 >> 17 === 63. Actual: ' + (8388607 >> 17)); +} + + +if (16777215 >> 17 !== 127) { + throw new Test262Error('#569: 16777215 >> 17 === 127. Actual: ' + (16777215 >> 17)); +} + + +if (33554431 >> 17 !== 255) { + throw new Test262Error('#570: 33554431 >> 17 === 255. Actual: ' + (33554431 >> 17)); +} + + +if (67108863 >> 17 !== 511) { + throw new Test262Error('#571: 67108863 >> 17 === 511. Actual: ' + (67108863 >> 17)); +} + + +if (134217727 >> 17 !== 1023) { + throw new Test262Error('#572: 134217727 >> 17 === 1023. Actual: ' + (134217727 >> 17)); +} + + +if (268435455 >> 17 !== 2047) { + throw new Test262Error('#573: 268435455 >> 17 === 2047. Actual: ' + (268435455 >> 17)); +} + + +if (536870911 >> 17 !== 4095) { + throw new Test262Error('#574: 536870911 >> 17 === 4095. Actual: ' + (536870911 >> 17)); +} + + +if (1073741823 >> 17 !== 8191) { + throw new Test262Error('#575: 1073741823 >> 17 === 8191. Actual: ' + (1073741823 >> 17)); +} + + +if (2147483647 >> 17 !== 16383) { + throw new Test262Error('#576: 2147483647 >> 17 === 16383. Actual: ' + (2147483647 >> 17)); +} + + +if (0 >> 18 !== 0) { + throw new Test262Error('#577: 0 >> 18 === 0. Actual: ' + (0 >> 18)); +} + + +if (1 >> 18 !== 0) { + throw new Test262Error('#578: 1 >> 18 === 0. Actual: ' + (1 >> 18)); +} + + +if (3 >> 18 !== 0) { + throw new Test262Error('#579: 3 >> 18 === 0. Actual: ' + (3 >> 18)); +} + + +if (7 >> 18 !== 0) { + throw new Test262Error('#580: 7 >> 18 === 0. Actual: ' + (7 >> 18)); +} + + +if (15 >> 18 !== 0) { + throw new Test262Error('#581: 15 >> 18 === 0. Actual: ' + (15 >> 18)); +} + + +if (31 >> 18 !== 0) { + throw new Test262Error('#582: 31 >> 18 === 0. Actual: ' + (31 >> 18)); +} + + +if (63 >> 18 !== 0) { + throw new Test262Error('#583: 63 >> 18 === 0. Actual: ' + (63 >> 18)); +} + + +if (127 >> 18 !== 0) { + throw new Test262Error('#584: 127 >> 18 === 0. Actual: ' + (127 >> 18)); +} + + +if (255 >> 18 !== 0) { + throw new Test262Error('#585: 255 >> 18 === 0. Actual: ' + (255 >> 18)); +} + + +if (511 >> 18 !== 0) { + throw new Test262Error('#586: 511 >> 18 === 0. Actual: ' + (511 >> 18)); +} + + +if (1023 >> 18 !== 0) { + throw new Test262Error('#587: 1023 >> 18 === 0. Actual: ' + (1023 >> 18)); +} + + +if (2047 >> 18 !== 0) { + throw new Test262Error('#588: 2047 >> 18 === 0. Actual: ' + (2047 >> 18)); +} + + +if (4095 >> 18 !== 0) { + throw new Test262Error('#589: 4095 >> 18 === 0. Actual: ' + (4095 >> 18)); +} + + +if (8191 >> 18 !== 0) { + throw new Test262Error('#590: 8191 >> 18 === 0. Actual: ' + (8191 >> 18)); +} + + +if (16383 >> 18 !== 0) { + throw new Test262Error('#591: 16383 >> 18 === 0. Actual: ' + (16383 >> 18)); +} + + +if (32767 >> 18 !== 0) { + throw new Test262Error('#592: 32767 >> 18 === 0. Actual: ' + (32767 >> 18)); +} + + +if (65535 >> 18 !== 0) { + throw new Test262Error('#593: 65535 >> 18 === 0. Actual: ' + (65535 >> 18)); +} + + +if (131071 >> 18 !== 0) { + throw new Test262Error('#594: 131071 >> 18 === 0. Actual: ' + (131071 >> 18)); +} + + +if (262143 >> 18 !== 0) { + throw new Test262Error('#595: 262143 >> 18 === 0. Actual: ' + (262143 >> 18)); +} + + +if (524287 >> 18 !== 1) { + throw new Test262Error('#596: 524287 >> 18 === 1. Actual: ' + (524287 >> 18)); +} + + +if (1048575 >> 18 !== 3) { + throw new Test262Error('#597: 1048575 >> 18 === 3. Actual: ' + (1048575 >> 18)); +} + + +if (2097151 >> 18 !== 7) { + throw new Test262Error('#598: 2097151 >> 18 === 7. Actual: ' + (2097151 >> 18)); +} + + +if (4194303 >> 18 !== 15) { + throw new Test262Error('#599: 4194303 >> 18 === 15. Actual: ' + (4194303 >> 18)); +} + + +if (8388607 >> 18 !== 31) { + throw new Test262Error('#600: 8388607 >> 18 === 31. Actual: ' + (8388607 >> 18)); +} + + +if (16777215 >> 18 !== 63) { + throw new Test262Error('#601: 16777215 >> 18 === 63. Actual: ' + (16777215 >> 18)); +} + + +if (33554431 >> 18 !== 127) { + throw new Test262Error('#602: 33554431 >> 18 === 127. Actual: ' + (33554431 >> 18)); +} + + +if (67108863 >> 18 !== 255) { + throw new Test262Error('#603: 67108863 >> 18 === 255. Actual: ' + (67108863 >> 18)); +} + + +if (134217727 >> 18 !== 511) { + throw new Test262Error('#604: 134217727 >> 18 === 511. Actual: ' + (134217727 >> 18)); +} + + +if (268435455 >> 18 !== 1023) { + throw new Test262Error('#605: 268435455 >> 18 === 1023. Actual: ' + (268435455 >> 18)); +} + + +if (536870911 >> 18 !== 2047) { + throw new Test262Error('#606: 536870911 >> 18 === 2047. Actual: ' + (536870911 >> 18)); +} + + +if (1073741823 >> 18 !== 4095) { + throw new Test262Error('#607: 1073741823 >> 18 === 4095. Actual: ' + (1073741823 >> 18)); +} + + +if (2147483647 >> 18 !== 8191) { + throw new Test262Error('#608: 2147483647 >> 18 === 8191. Actual: ' + (2147483647 >> 18)); +} + + +if (0 >> 19 !== 0) { + throw new Test262Error('#609: 0 >> 19 === 0. Actual: ' + (0 >> 19)); +} + + +if (1 >> 19 !== 0) { + throw new Test262Error('#610: 1 >> 19 === 0. Actual: ' + (1 >> 19)); +} + + +if (3 >> 19 !== 0) { + throw new Test262Error('#611: 3 >> 19 === 0. Actual: ' + (3 >> 19)); +} + + +if (7 >> 19 !== 0) { + throw new Test262Error('#612: 7 >> 19 === 0. Actual: ' + (7 >> 19)); +} + + +if (15 >> 19 !== 0) { + throw new Test262Error('#613: 15 >> 19 === 0. Actual: ' + (15 >> 19)); +} + + +if (31 >> 19 !== 0) { + throw new Test262Error('#614: 31 >> 19 === 0. Actual: ' + (31 >> 19)); +} + + +if (63 >> 19 !== 0) { + throw new Test262Error('#615: 63 >> 19 === 0. Actual: ' + (63 >> 19)); +} + + +if (127 >> 19 !== 0) { + throw new Test262Error('#616: 127 >> 19 === 0. Actual: ' + (127 >> 19)); +} + + +if (255 >> 19 !== 0) { + throw new Test262Error('#617: 255 >> 19 === 0. Actual: ' + (255 >> 19)); +} + + +if (511 >> 19 !== 0) { + throw new Test262Error('#618: 511 >> 19 === 0. Actual: ' + (511 >> 19)); +} + + +if (1023 >> 19 !== 0) { + throw new Test262Error('#619: 1023 >> 19 === 0. Actual: ' + (1023 >> 19)); +} + + +if (2047 >> 19 !== 0) { + throw new Test262Error('#620: 2047 >> 19 === 0. Actual: ' + (2047 >> 19)); +} + + +if (4095 >> 19 !== 0) { + throw new Test262Error('#621: 4095 >> 19 === 0. Actual: ' + (4095 >> 19)); +} + + +if (8191 >> 19 !== 0) { + throw new Test262Error('#622: 8191 >> 19 === 0. Actual: ' + (8191 >> 19)); +} + + +if (16383 >> 19 !== 0) { + throw new Test262Error('#623: 16383 >> 19 === 0. Actual: ' + (16383 >> 19)); +} + + +if (32767 >> 19 !== 0) { + throw new Test262Error('#624: 32767 >> 19 === 0. Actual: ' + (32767 >> 19)); +} + + +if (65535 >> 19 !== 0) { + throw new Test262Error('#625: 65535 >> 19 === 0. Actual: ' + (65535 >> 19)); +} + + +if (131071 >> 19 !== 0) { + throw new Test262Error('#626: 131071 >> 19 === 0. Actual: ' + (131071 >> 19)); +} + + +if (262143 >> 19 !== 0) { + throw new Test262Error('#627: 262143 >> 19 === 0. Actual: ' + (262143 >> 19)); +} + + +if (524287 >> 19 !== 0) { + throw new Test262Error('#628: 524287 >> 19 === 0. Actual: ' + (524287 >> 19)); +} + + +if (1048575 >> 19 !== 1) { + throw new Test262Error('#629: 1048575 >> 19 === 1. Actual: ' + (1048575 >> 19)); +} + + +if (2097151 >> 19 !== 3) { + throw new Test262Error('#630: 2097151 >> 19 === 3. Actual: ' + (2097151 >> 19)); +} + + +if (4194303 >> 19 !== 7) { + throw new Test262Error('#631: 4194303 >> 19 === 7. Actual: ' + (4194303 >> 19)); +} + + +if (8388607 >> 19 !== 15) { + throw new Test262Error('#632: 8388607 >> 19 === 15. Actual: ' + (8388607 >> 19)); +} + + +if (16777215 >> 19 !== 31) { + throw new Test262Error('#633: 16777215 >> 19 === 31. Actual: ' + (16777215 >> 19)); +} + + +if (33554431 >> 19 !== 63) { + throw new Test262Error('#634: 33554431 >> 19 === 63. Actual: ' + (33554431 >> 19)); +} + + +if (67108863 >> 19 !== 127) { + throw new Test262Error('#635: 67108863 >> 19 === 127. Actual: ' + (67108863 >> 19)); +} + + +if (134217727 >> 19 !== 255) { + throw new Test262Error('#636: 134217727 >> 19 === 255. Actual: ' + (134217727 >> 19)); +} + + +if (268435455 >> 19 !== 511) { + throw new Test262Error('#637: 268435455 >> 19 === 511. Actual: ' + (268435455 >> 19)); +} + + +if (536870911 >> 19 !== 1023) { + throw new Test262Error('#638: 536870911 >> 19 === 1023. Actual: ' + (536870911 >> 19)); +} + + +if (1073741823 >> 19 !== 2047) { + throw new Test262Error('#639: 1073741823 >> 19 === 2047. Actual: ' + (1073741823 >> 19)); +} + + +if (2147483647 >> 19 !== 4095) { + throw new Test262Error('#640: 2147483647 >> 19 === 4095. Actual: ' + (2147483647 >> 19)); +} + + +if (0 >> 20 !== 0) { + throw new Test262Error('#641: 0 >> 20 === 0. Actual: ' + (0 >> 20)); +} + + +if (1 >> 20 !== 0) { + throw new Test262Error('#642: 1 >> 20 === 0. Actual: ' + (1 >> 20)); +} + + +if (3 >> 20 !== 0) { + throw new Test262Error('#643: 3 >> 20 === 0. Actual: ' + (3 >> 20)); +} + + +if (7 >> 20 !== 0) { + throw new Test262Error('#644: 7 >> 20 === 0. Actual: ' + (7 >> 20)); +} + + +if (15 >> 20 !== 0) { + throw new Test262Error('#645: 15 >> 20 === 0. Actual: ' + (15 >> 20)); +} + + +if (31 >> 20 !== 0) { + throw new Test262Error('#646: 31 >> 20 === 0. Actual: ' + (31 >> 20)); +} + + +if (63 >> 20 !== 0) { + throw new Test262Error('#647: 63 >> 20 === 0. Actual: ' + (63 >> 20)); +} + + +if (127 >> 20 !== 0) { + throw new Test262Error('#648: 127 >> 20 === 0. Actual: ' + (127 >> 20)); +} + + +if (255 >> 20 !== 0) { + throw new Test262Error('#649: 255 >> 20 === 0. Actual: ' + (255 >> 20)); +} + + +if (511 >> 20 !== 0) { + throw new Test262Error('#650: 511 >> 20 === 0. Actual: ' + (511 >> 20)); +} + + +if (1023 >> 20 !== 0) { + throw new Test262Error('#651: 1023 >> 20 === 0. Actual: ' + (1023 >> 20)); +} + + +if (2047 >> 20 !== 0) { + throw new Test262Error('#652: 2047 >> 20 === 0. Actual: ' + (2047 >> 20)); +} + + +if (4095 >> 20 !== 0) { + throw new Test262Error('#653: 4095 >> 20 === 0. Actual: ' + (4095 >> 20)); +} + + +if (8191 >> 20 !== 0) { + throw new Test262Error('#654: 8191 >> 20 === 0. Actual: ' + (8191 >> 20)); +} + + +if (16383 >> 20 !== 0) { + throw new Test262Error('#655: 16383 >> 20 === 0. Actual: ' + (16383 >> 20)); +} + + +if (32767 >> 20 !== 0) { + throw new Test262Error('#656: 32767 >> 20 === 0. Actual: ' + (32767 >> 20)); +} + + +if (65535 >> 20 !== 0) { + throw new Test262Error('#657: 65535 >> 20 === 0. Actual: ' + (65535 >> 20)); +} + + +if (131071 >> 20 !== 0) { + throw new Test262Error('#658: 131071 >> 20 === 0. Actual: ' + (131071 >> 20)); +} + + +if (262143 >> 20 !== 0) { + throw new Test262Error('#659: 262143 >> 20 === 0. Actual: ' + (262143 >> 20)); +} + + +if (524287 >> 20 !== 0) { + throw new Test262Error('#660: 524287 >> 20 === 0. Actual: ' + (524287 >> 20)); +} + + +if (1048575 >> 20 !== 0) { + throw new Test262Error('#661: 1048575 >> 20 === 0. Actual: ' + (1048575 >> 20)); +} + + +if (2097151 >> 20 !== 1) { + throw new Test262Error('#662: 2097151 >> 20 === 1. Actual: ' + (2097151 >> 20)); +} + + +if (4194303 >> 20 !== 3) { + throw new Test262Error('#663: 4194303 >> 20 === 3. Actual: ' + (4194303 >> 20)); +} + + +if (8388607 >> 20 !== 7) { + throw new Test262Error('#664: 8388607 >> 20 === 7. Actual: ' + (8388607 >> 20)); +} + + +if (16777215 >> 20 !== 15) { + throw new Test262Error('#665: 16777215 >> 20 === 15. Actual: ' + (16777215 >> 20)); +} + + +if (33554431 >> 20 !== 31) { + throw new Test262Error('#666: 33554431 >> 20 === 31. Actual: ' + (33554431 >> 20)); +} + + +if (67108863 >> 20 !== 63) { + throw new Test262Error('#667: 67108863 >> 20 === 63. Actual: ' + (67108863 >> 20)); +} + + +if (134217727 >> 20 !== 127) { + throw new Test262Error('#668: 134217727 >> 20 === 127. Actual: ' + (134217727 >> 20)); +} + + +if (268435455 >> 20 !== 255) { + throw new Test262Error('#669: 268435455 >> 20 === 255. Actual: ' + (268435455 >> 20)); +} + + +if (536870911 >> 20 !== 511) { + throw new Test262Error('#670: 536870911 >> 20 === 511. Actual: ' + (536870911 >> 20)); +} + + +if (1073741823 >> 20 !== 1023) { + throw new Test262Error('#671: 1073741823 >> 20 === 1023. Actual: ' + (1073741823 >> 20)); +} + + +if (2147483647 >> 20 !== 2047) { + throw new Test262Error('#672: 2147483647 >> 20 === 2047. Actual: ' + (2147483647 >> 20)); +} + + +if (0 >> 21 !== 0) { + throw new Test262Error('#673: 0 >> 21 === 0. Actual: ' + (0 >> 21)); +} + + +if (1 >> 21 !== 0) { + throw new Test262Error('#674: 1 >> 21 === 0. Actual: ' + (1 >> 21)); +} + + +if (3 >> 21 !== 0) { + throw new Test262Error('#675: 3 >> 21 === 0. Actual: ' + (3 >> 21)); +} + + +if (7 >> 21 !== 0) { + throw new Test262Error('#676: 7 >> 21 === 0. Actual: ' + (7 >> 21)); +} + + +if (15 >> 21 !== 0) { + throw new Test262Error('#677: 15 >> 21 === 0. Actual: ' + (15 >> 21)); +} + + +if (31 >> 21 !== 0) { + throw new Test262Error('#678: 31 >> 21 === 0. Actual: ' + (31 >> 21)); +} + + +if (63 >> 21 !== 0) { + throw new Test262Error('#679: 63 >> 21 === 0. Actual: ' + (63 >> 21)); +} + + +if (127 >> 21 !== 0) { + throw new Test262Error('#680: 127 >> 21 === 0. Actual: ' + (127 >> 21)); +} + + +if (255 >> 21 !== 0) { + throw new Test262Error('#681: 255 >> 21 === 0. Actual: ' + (255 >> 21)); +} + + +if (511 >> 21 !== 0) { + throw new Test262Error('#682: 511 >> 21 === 0. Actual: ' + (511 >> 21)); +} + + +if (1023 >> 21 !== 0) { + throw new Test262Error('#683: 1023 >> 21 === 0. Actual: ' + (1023 >> 21)); +} + + +if (2047 >> 21 !== 0) { + throw new Test262Error('#684: 2047 >> 21 === 0. Actual: ' + (2047 >> 21)); +} + + +if (4095 >> 21 !== 0) { + throw new Test262Error('#685: 4095 >> 21 === 0. Actual: ' + (4095 >> 21)); +} + + +if (8191 >> 21 !== 0) { + throw new Test262Error('#686: 8191 >> 21 === 0. Actual: ' + (8191 >> 21)); +} + + +if (16383 >> 21 !== 0) { + throw new Test262Error('#687: 16383 >> 21 === 0. Actual: ' + (16383 >> 21)); +} + + +if (32767 >> 21 !== 0) { + throw new Test262Error('#688: 32767 >> 21 === 0. Actual: ' + (32767 >> 21)); +} + + +if (65535 >> 21 !== 0) { + throw new Test262Error('#689: 65535 >> 21 === 0. Actual: ' + (65535 >> 21)); +} + + +if (131071 >> 21 !== 0) { + throw new Test262Error('#690: 131071 >> 21 === 0. Actual: ' + (131071 >> 21)); +} + + +if (262143 >> 21 !== 0) { + throw new Test262Error('#691: 262143 >> 21 === 0. Actual: ' + (262143 >> 21)); +} + + +if (524287 >> 21 !== 0) { + throw new Test262Error('#692: 524287 >> 21 === 0. Actual: ' + (524287 >> 21)); +} + + +if (1048575 >> 21 !== 0) { + throw new Test262Error('#693: 1048575 >> 21 === 0. Actual: ' + (1048575 >> 21)); +} + + +if (2097151 >> 21 !== 0) { + throw new Test262Error('#694: 2097151 >> 21 === 0. Actual: ' + (2097151 >> 21)); +} + + +if (4194303 >> 21 !== 1) { + throw new Test262Error('#695: 4194303 >> 21 === 1. Actual: ' + (4194303 >> 21)); +} + + +if (8388607 >> 21 !== 3) { + throw new Test262Error('#696: 8388607 >> 21 === 3. Actual: ' + (8388607 >> 21)); +} + + +if (16777215 >> 21 !== 7) { + throw new Test262Error('#697: 16777215 >> 21 === 7. Actual: ' + (16777215 >> 21)); +} + + +if (33554431 >> 21 !== 15) { + throw new Test262Error('#698: 33554431 >> 21 === 15. Actual: ' + (33554431 >> 21)); +} + + +if (67108863 >> 21 !== 31) { + throw new Test262Error('#699: 67108863 >> 21 === 31. Actual: ' + (67108863 >> 21)); +} + + +if (134217727 >> 21 !== 63) { + throw new Test262Error('#700: 134217727 >> 21 === 63. Actual: ' + (134217727 >> 21)); +} + + +if (268435455 >> 21 !== 127) { + throw new Test262Error('#701: 268435455 >> 21 === 127. Actual: ' + (268435455 >> 21)); +} + + +if (536870911 >> 21 !== 255) { + throw new Test262Error('#702: 536870911 >> 21 === 255. Actual: ' + (536870911 >> 21)); +} + + +if (1073741823 >> 21 !== 511) { + throw new Test262Error('#703: 1073741823 >> 21 === 511. Actual: ' + (1073741823 >> 21)); +} + + +if (2147483647 >> 21 !== 1023) { + throw new Test262Error('#704: 2147483647 >> 21 === 1023. Actual: ' + (2147483647 >> 21)); +} + + +if (0 >> 22 !== 0) { + throw new Test262Error('#705: 0 >> 22 === 0. Actual: ' + (0 >> 22)); +} + + +if (1 >> 22 !== 0) { + throw new Test262Error('#706: 1 >> 22 === 0. Actual: ' + (1 >> 22)); +} + + +if (3 >> 22 !== 0) { + throw new Test262Error('#707: 3 >> 22 === 0. Actual: ' + (3 >> 22)); +} + + +if (7 >> 22 !== 0) { + throw new Test262Error('#708: 7 >> 22 === 0. Actual: ' + (7 >> 22)); +} + + +if (15 >> 22 !== 0) { + throw new Test262Error('#709: 15 >> 22 === 0. Actual: ' + (15 >> 22)); +} + + +if (31 >> 22 !== 0) { + throw new Test262Error('#710: 31 >> 22 === 0. Actual: ' + (31 >> 22)); +} + + +if (63 >> 22 !== 0) { + throw new Test262Error('#711: 63 >> 22 === 0. Actual: ' + (63 >> 22)); +} + + +if (127 >> 22 !== 0) { + throw new Test262Error('#712: 127 >> 22 === 0. Actual: ' + (127 >> 22)); +} + + +if (255 >> 22 !== 0) { + throw new Test262Error('#713: 255 >> 22 === 0. Actual: ' + (255 >> 22)); +} + + +if (511 >> 22 !== 0) { + throw new Test262Error('#714: 511 >> 22 === 0. Actual: ' + (511 >> 22)); +} + + +if (1023 >> 22 !== 0) { + throw new Test262Error('#715: 1023 >> 22 === 0. Actual: ' + (1023 >> 22)); +} + + +if (2047 >> 22 !== 0) { + throw new Test262Error('#716: 2047 >> 22 === 0. Actual: ' + (2047 >> 22)); +} + + +if (4095 >> 22 !== 0) { + throw new Test262Error('#717: 4095 >> 22 === 0. Actual: ' + (4095 >> 22)); +} + + +if (8191 >> 22 !== 0) { + throw new Test262Error('#718: 8191 >> 22 === 0. Actual: ' + (8191 >> 22)); +} + + +if (16383 >> 22 !== 0) { + throw new Test262Error('#719: 16383 >> 22 === 0. Actual: ' + (16383 >> 22)); +} + + +if (32767 >> 22 !== 0) { + throw new Test262Error('#720: 32767 >> 22 === 0. Actual: ' + (32767 >> 22)); +} + + +if (65535 >> 22 !== 0) { + throw new Test262Error('#721: 65535 >> 22 === 0. Actual: ' + (65535 >> 22)); +} + + +if (131071 >> 22 !== 0) { + throw new Test262Error('#722: 131071 >> 22 === 0. Actual: ' + (131071 >> 22)); +} + + +if (262143 >> 22 !== 0) { + throw new Test262Error('#723: 262143 >> 22 === 0. Actual: ' + (262143 >> 22)); +} + + +if (524287 >> 22 !== 0) { + throw new Test262Error('#724: 524287 >> 22 === 0. Actual: ' + (524287 >> 22)); +} + + +if (1048575 >> 22 !== 0) { + throw new Test262Error('#725: 1048575 >> 22 === 0. Actual: ' + (1048575 >> 22)); +} + + +if (2097151 >> 22 !== 0) { + throw new Test262Error('#726: 2097151 >> 22 === 0. Actual: ' + (2097151 >> 22)); +} + + +if (4194303 >> 22 !== 0) { + throw new Test262Error('#727: 4194303 >> 22 === 0. Actual: ' + (4194303 >> 22)); +} + + +if (8388607 >> 22 !== 1) { + throw new Test262Error('#728: 8388607 >> 22 === 1. Actual: ' + (8388607 >> 22)); +} + + +if (16777215 >> 22 !== 3) { + throw new Test262Error('#729: 16777215 >> 22 === 3. Actual: ' + (16777215 >> 22)); +} + + +if (33554431 >> 22 !== 7) { + throw new Test262Error('#730: 33554431 >> 22 === 7. Actual: ' + (33554431 >> 22)); +} + + +if (67108863 >> 22 !== 15) { + throw new Test262Error('#731: 67108863 >> 22 === 15. Actual: ' + (67108863 >> 22)); +} + + +if (134217727 >> 22 !== 31) { + throw new Test262Error('#732: 134217727 >> 22 === 31. Actual: ' + (134217727 >> 22)); +} + + +if (268435455 >> 22 !== 63) { + throw new Test262Error('#733: 268435455 >> 22 === 63. Actual: ' + (268435455 >> 22)); +} + + +if (536870911 >> 22 !== 127) { + throw new Test262Error('#734: 536870911 >> 22 === 127. Actual: ' + (536870911 >> 22)); +} + + +if (1073741823 >> 22 !== 255) { + throw new Test262Error('#735: 1073741823 >> 22 === 255. Actual: ' + (1073741823 >> 22)); +} + + +if (2147483647 >> 22 !== 511) { + throw new Test262Error('#736: 2147483647 >> 22 === 511. Actual: ' + (2147483647 >> 22)); +} + + +if (0 >> 23 !== 0) { + throw new Test262Error('#737: 0 >> 23 === 0. Actual: ' + (0 >> 23)); +} + + +if (1 >> 23 !== 0) { + throw new Test262Error('#738: 1 >> 23 === 0. Actual: ' + (1 >> 23)); +} + + +if (3 >> 23 !== 0) { + throw new Test262Error('#739: 3 >> 23 === 0. Actual: ' + (3 >> 23)); +} + + +if (7 >> 23 !== 0) { + throw new Test262Error('#740: 7 >> 23 === 0. Actual: ' + (7 >> 23)); +} + + +if (15 >> 23 !== 0) { + throw new Test262Error('#741: 15 >> 23 === 0. Actual: ' + (15 >> 23)); +} + + +if (31 >> 23 !== 0) { + throw new Test262Error('#742: 31 >> 23 === 0. Actual: ' + (31 >> 23)); +} + + +if (63 >> 23 !== 0) { + throw new Test262Error('#743: 63 >> 23 === 0. Actual: ' + (63 >> 23)); +} + + +if (127 >> 23 !== 0) { + throw new Test262Error('#744: 127 >> 23 === 0. Actual: ' + (127 >> 23)); +} + + +if (255 >> 23 !== 0) { + throw new Test262Error('#745: 255 >> 23 === 0. Actual: ' + (255 >> 23)); +} + + +if (511 >> 23 !== 0) { + throw new Test262Error('#746: 511 >> 23 === 0. Actual: ' + (511 >> 23)); +} + + +if (1023 >> 23 !== 0) { + throw new Test262Error('#747: 1023 >> 23 === 0. Actual: ' + (1023 >> 23)); +} + + +if (2047 >> 23 !== 0) { + throw new Test262Error('#748: 2047 >> 23 === 0. Actual: ' + (2047 >> 23)); +} + + +if (4095 >> 23 !== 0) { + throw new Test262Error('#749: 4095 >> 23 === 0. Actual: ' + (4095 >> 23)); +} + + +if (8191 >> 23 !== 0) { + throw new Test262Error('#750: 8191 >> 23 === 0. Actual: ' + (8191 >> 23)); +} + + +if (16383 >> 23 !== 0) { + throw new Test262Error('#751: 16383 >> 23 === 0. Actual: ' + (16383 >> 23)); +} + + +if (32767 >> 23 !== 0) { + throw new Test262Error('#752: 32767 >> 23 === 0. Actual: ' + (32767 >> 23)); +} + + +if (65535 >> 23 !== 0) { + throw new Test262Error('#753: 65535 >> 23 === 0. Actual: ' + (65535 >> 23)); +} + + +if (131071 >> 23 !== 0) { + throw new Test262Error('#754: 131071 >> 23 === 0. Actual: ' + (131071 >> 23)); +} + + +if (262143 >> 23 !== 0) { + throw new Test262Error('#755: 262143 >> 23 === 0. Actual: ' + (262143 >> 23)); +} + + +if (524287 >> 23 !== 0) { + throw new Test262Error('#756: 524287 >> 23 === 0. Actual: ' + (524287 >> 23)); +} + + +if (1048575 >> 23 !== 0) { + throw new Test262Error('#757: 1048575 >> 23 === 0. Actual: ' + (1048575 >> 23)); +} + + +if (2097151 >> 23 !== 0) { + throw new Test262Error('#758: 2097151 >> 23 === 0. Actual: ' + (2097151 >> 23)); +} + + +if (4194303 >> 23 !== 0) { + throw new Test262Error('#759: 4194303 >> 23 === 0. Actual: ' + (4194303 >> 23)); +} + + +if (8388607 >> 23 !== 0) { + throw new Test262Error('#760: 8388607 >> 23 === 0. Actual: ' + (8388607 >> 23)); +} + + +if (16777215 >> 23 !== 1) { + throw new Test262Error('#761: 16777215 >> 23 === 1. Actual: ' + (16777215 >> 23)); +} + + +if (33554431 >> 23 !== 3) { + throw new Test262Error('#762: 33554431 >> 23 === 3. Actual: ' + (33554431 >> 23)); +} + + +if (67108863 >> 23 !== 7) { + throw new Test262Error('#763: 67108863 >> 23 === 7. Actual: ' + (67108863 >> 23)); +} + + +if (134217727 >> 23 !== 15) { + throw new Test262Error('#764: 134217727 >> 23 === 15. Actual: ' + (134217727 >> 23)); +} + + +if (268435455 >> 23 !== 31) { + throw new Test262Error('#765: 268435455 >> 23 === 31. Actual: ' + (268435455 >> 23)); +} + + +if (536870911 >> 23 !== 63) { + throw new Test262Error('#766: 536870911 >> 23 === 63. Actual: ' + (536870911 >> 23)); +} + + +if (1073741823 >> 23 !== 127) { + throw new Test262Error('#767: 1073741823 >> 23 === 127. Actual: ' + (1073741823 >> 23)); +} + + +if (2147483647 >> 23 !== 255) { + throw new Test262Error('#768: 2147483647 >> 23 === 255. Actual: ' + (2147483647 >> 23)); +} + + +if (0 >> 24 !== 0) { + throw new Test262Error('#769: 0 >> 24 === 0. Actual: ' + (0 >> 24)); +} + + +if (1 >> 24 !== 0) { + throw new Test262Error('#770: 1 >> 24 === 0. Actual: ' + (1 >> 24)); +} + + +if (3 >> 24 !== 0) { + throw new Test262Error('#771: 3 >> 24 === 0. Actual: ' + (3 >> 24)); +} + + +if (7 >> 24 !== 0) { + throw new Test262Error('#772: 7 >> 24 === 0. Actual: ' + (7 >> 24)); +} + + +if (15 >> 24 !== 0) { + throw new Test262Error('#773: 15 >> 24 === 0. Actual: ' + (15 >> 24)); +} + + +if (31 >> 24 !== 0) { + throw new Test262Error('#774: 31 >> 24 === 0. Actual: ' + (31 >> 24)); +} + + +if (63 >> 24 !== 0) { + throw new Test262Error('#775: 63 >> 24 === 0. Actual: ' + (63 >> 24)); +} + + +if (127 >> 24 !== 0) { + throw new Test262Error('#776: 127 >> 24 === 0. Actual: ' + (127 >> 24)); +} + + +if (255 >> 24 !== 0) { + throw new Test262Error('#777: 255 >> 24 === 0. Actual: ' + (255 >> 24)); +} + + +if (511 >> 24 !== 0) { + throw new Test262Error('#778: 511 >> 24 === 0. Actual: ' + (511 >> 24)); +} + + +if (1023 >> 24 !== 0) { + throw new Test262Error('#779: 1023 >> 24 === 0. Actual: ' + (1023 >> 24)); +} + + +if (2047 >> 24 !== 0) { + throw new Test262Error('#780: 2047 >> 24 === 0. Actual: ' + (2047 >> 24)); +} + + +if (4095 >> 24 !== 0) { + throw new Test262Error('#781: 4095 >> 24 === 0. Actual: ' + (4095 >> 24)); +} + + +if (8191 >> 24 !== 0) { + throw new Test262Error('#782: 8191 >> 24 === 0. Actual: ' + (8191 >> 24)); +} + + +if (16383 >> 24 !== 0) { + throw new Test262Error('#783: 16383 >> 24 === 0. Actual: ' + (16383 >> 24)); +} + + +if (32767 >> 24 !== 0) { + throw new Test262Error('#784: 32767 >> 24 === 0. Actual: ' + (32767 >> 24)); +} + + +if (65535 >> 24 !== 0) { + throw new Test262Error('#785: 65535 >> 24 === 0. Actual: ' + (65535 >> 24)); +} + + +if (131071 >> 24 !== 0) { + throw new Test262Error('#786: 131071 >> 24 === 0. Actual: ' + (131071 >> 24)); +} + + +if (262143 >> 24 !== 0) { + throw new Test262Error('#787: 262143 >> 24 === 0. Actual: ' + (262143 >> 24)); +} + + +if (524287 >> 24 !== 0) { + throw new Test262Error('#788: 524287 >> 24 === 0. Actual: ' + (524287 >> 24)); +} + + +if (1048575 >> 24 !== 0) { + throw new Test262Error('#789: 1048575 >> 24 === 0. Actual: ' + (1048575 >> 24)); +} + + +if (2097151 >> 24 !== 0) { + throw new Test262Error('#790: 2097151 >> 24 === 0. Actual: ' + (2097151 >> 24)); +} + + +if (4194303 >> 24 !== 0) { + throw new Test262Error('#791: 4194303 >> 24 === 0. Actual: ' + (4194303 >> 24)); +} + + +if (8388607 >> 24 !== 0) { + throw new Test262Error('#792: 8388607 >> 24 === 0. Actual: ' + (8388607 >> 24)); +} + + +if (16777215 >> 24 !== 0) { + throw new Test262Error('#793: 16777215 >> 24 === 0. Actual: ' + (16777215 >> 24)); +} + + +if (33554431 >> 24 !== 1) { + throw new Test262Error('#794: 33554431 >> 24 === 1. Actual: ' + (33554431 >> 24)); +} + + +if (67108863 >> 24 !== 3) { + throw new Test262Error('#795: 67108863 >> 24 === 3. Actual: ' + (67108863 >> 24)); +} + + +if (134217727 >> 24 !== 7) { + throw new Test262Error('#796: 134217727 >> 24 === 7. Actual: ' + (134217727 >> 24)); +} + + +if (268435455 >> 24 !== 15) { + throw new Test262Error('#797: 268435455 >> 24 === 15. Actual: ' + (268435455 >> 24)); +} + + +if (536870911 >> 24 !== 31) { + throw new Test262Error('#798: 536870911 >> 24 === 31. Actual: ' + (536870911 >> 24)); +} + + +if (1073741823 >> 24 !== 63) { + throw new Test262Error('#799: 1073741823 >> 24 === 63. Actual: ' + (1073741823 >> 24)); +} + + +if (2147483647 >> 24 !== 127) { + throw new Test262Error('#800: 2147483647 >> 24 === 127. Actual: ' + (2147483647 >> 24)); +} + + +if (0 >> 25 !== 0) { + throw new Test262Error('#801: 0 >> 25 === 0. Actual: ' + (0 >> 25)); +} + + +if (1 >> 25 !== 0) { + throw new Test262Error('#802: 1 >> 25 === 0. Actual: ' + (1 >> 25)); +} + + +if (3 >> 25 !== 0) { + throw new Test262Error('#803: 3 >> 25 === 0. Actual: ' + (3 >> 25)); +} + + +if (7 >> 25 !== 0) { + throw new Test262Error('#804: 7 >> 25 === 0. Actual: ' + (7 >> 25)); +} + + +if (15 >> 25 !== 0) { + throw new Test262Error('#805: 15 >> 25 === 0. Actual: ' + (15 >> 25)); +} + + +if (31 >> 25 !== 0) { + throw new Test262Error('#806: 31 >> 25 === 0. Actual: ' + (31 >> 25)); +} + + +if (63 >> 25 !== 0) { + throw new Test262Error('#807: 63 >> 25 === 0. Actual: ' + (63 >> 25)); +} + + +if (127 >> 25 !== 0) { + throw new Test262Error('#808: 127 >> 25 === 0. Actual: ' + (127 >> 25)); +} + + +if (255 >> 25 !== 0) { + throw new Test262Error('#809: 255 >> 25 === 0. Actual: ' + (255 >> 25)); +} + + +if (511 >> 25 !== 0) { + throw new Test262Error('#810: 511 >> 25 === 0. Actual: ' + (511 >> 25)); +} + + +if (1023 >> 25 !== 0) { + throw new Test262Error('#811: 1023 >> 25 === 0. Actual: ' + (1023 >> 25)); +} + + +if (2047 >> 25 !== 0) { + throw new Test262Error('#812: 2047 >> 25 === 0. Actual: ' + (2047 >> 25)); +} + + +if (4095 >> 25 !== 0) { + throw new Test262Error('#813: 4095 >> 25 === 0. Actual: ' + (4095 >> 25)); +} + + +if (8191 >> 25 !== 0) { + throw new Test262Error('#814: 8191 >> 25 === 0. Actual: ' + (8191 >> 25)); +} + + +if (16383 >> 25 !== 0) { + throw new Test262Error('#815: 16383 >> 25 === 0. Actual: ' + (16383 >> 25)); +} + + +if (32767 >> 25 !== 0) { + throw new Test262Error('#816: 32767 >> 25 === 0. Actual: ' + (32767 >> 25)); +} + + +if (65535 >> 25 !== 0) { + throw new Test262Error('#817: 65535 >> 25 === 0. Actual: ' + (65535 >> 25)); +} + + +if (131071 >> 25 !== 0) { + throw new Test262Error('#818: 131071 >> 25 === 0. Actual: ' + (131071 >> 25)); +} + + +if (262143 >> 25 !== 0) { + throw new Test262Error('#819: 262143 >> 25 === 0. Actual: ' + (262143 >> 25)); +} + + +if (524287 >> 25 !== 0) { + throw new Test262Error('#820: 524287 >> 25 === 0. Actual: ' + (524287 >> 25)); +} + + +if (1048575 >> 25 !== 0) { + throw new Test262Error('#821: 1048575 >> 25 === 0. Actual: ' + (1048575 >> 25)); +} + + +if (2097151 >> 25 !== 0) { + throw new Test262Error('#822: 2097151 >> 25 === 0. Actual: ' + (2097151 >> 25)); +} + + +if (4194303 >> 25 !== 0) { + throw new Test262Error('#823: 4194303 >> 25 === 0. Actual: ' + (4194303 >> 25)); +} + + +if (8388607 >> 25 !== 0) { + throw new Test262Error('#824: 8388607 >> 25 === 0. Actual: ' + (8388607 >> 25)); +} + + +if (16777215 >> 25 !== 0) { + throw new Test262Error('#825: 16777215 >> 25 === 0. Actual: ' + (16777215 >> 25)); +} + + +if (33554431 >> 25 !== 0) { + throw new Test262Error('#826: 33554431 >> 25 === 0. Actual: ' + (33554431 >> 25)); +} + + +if (67108863 >> 25 !== 1) { + throw new Test262Error('#827: 67108863 >> 25 === 1. Actual: ' + (67108863 >> 25)); +} + + +if (134217727 >> 25 !== 3) { + throw new Test262Error('#828: 134217727 >> 25 === 3. Actual: ' + (134217727 >> 25)); +} + + +if (268435455 >> 25 !== 7) { + throw new Test262Error('#829: 268435455 >> 25 === 7. Actual: ' + (268435455 >> 25)); +} + + +if (536870911 >> 25 !== 15) { + throw new Test262Error('#830: 536870911 >> 25 === 15. Actual: ' + (536870911 >> 25)); +} + + +if (1073741823 >> 25 !== 31) { + throw new Test262Error('#831: 1073741823 >> 25 === 31. Actual: ' + (1073741823 >> 25)); +} + + +if (2147483647 >> 25 !== 63) { + throw new Test262Error('#832: 2147483647 >> 25 === 63. Actual: ' + (2147483647 >> 25)); +} + + +if (0 >> 26 !== 0) { + throw new Test262Error('#833: 0 >> 26 === 0. Actual: ' + (0 >> 26)); +} + + +if (1 >> 26 !== 0) { + throw new Test262Error('#834: 1 >> 26 === 0. Actual: ' + (1 >> 26)); +} + + +if (3 >> 26 !== 0) { + throw new Test262Error('#835: 3 >> 26 === 0. Actual: ' + (3 >> 26)); +} + + +if (7 >> 26 !== 0) { + throw new Test262Error('#836: 7 >> 26 === 0. Actual: ' + (7 >> 26)); +} + + +if (15 >> 26 !== 0) { + throw new Test262Error('#837: 15 >> 26 === 0. Actual: ' + (15 >> 26)); +} + + +if (31 >> 26 !== 0) { + throw new Test262Error('#838: 31 >> 26 === 0. Actual: ' + (31 >> 26)); +} + + +if (63 >> 26 !== 0) { + throw new Test262Error('#839: 63 >> 26 === 0. Actual: ' + (63 >> 26)); +} + + +if (127 >> 26 !== 0) { + throw new Test262Error('#840: 127 >> 26 === 0. Actual: ' + (127 >> 26)); +} + + +if (255 >> 26 !== 0) { + throw new Test262Error('#841: 255 >> 26 === 0. Actual: ' + (255 >> 26)); +} + + +if (511 >> 26 !== 0) { + throw new Test262Error('#842: 511 >> 26 === 0. Actual: ' + (511 >> 26)); +} + + +if (1023 >> 26 !== 0) { + throw new Test262Error('#843: 1023 >> 26 === 0. Actual: ' + (1023 >> 26)); +} + + +if (2047 >> 26 !== 0) { + throw new Test262Error('#844: 2047 >> 26 === 0. Actual: ' + (2047 >> 26)); +} + + +if (4095 >> 26 !== 0) { + throw new Test262Error('#845: 4095 >> 26 === 0. Actual: ' + (4095 >> 26)); +} + + +if (8191 >> 26 !== 0) { + throw new Test262Error('#846: 8191 >> 26 === 0. Actual: ' + (8191 >> 26)); +} + + +if (16383 >> 26 !== 0) { + throw new Test262Error('#847: 16383 >> 26 === 0. Actual: ' + (16383 >> 26)); +} + + +if (32767 >> 26 !== 0) { + throw new Test262Error('#848: 32767 >> 26 === 0. Actual: ' + (32767 >> 26)); +} + + +if (65535 >> 26 !== 0) { + throw new Test262Error('#849: 65535 >> 26 === 0. Actual: ' + (65535 >> 26)); +} + + +if (131071 >> 26 !== 0) { + throw new Test262Error('#850: 131071 >> 26 === 0. Actual: ' + (131071 >> 26)); +} + + +if (262143 >> 26 !== 0) { + throw new Test262Error('#851: 262143 >> 26 === 0. Actual: ' + (262143 >> 26)); +} + + +if (524287 >> 26 !== 0) { + throw new Test262Error('#852: 524287 >> 26 === 0. Actual: ' + (524287 >> 26)); +} + + +if (1048575 >> 26 !== 0) { + throw new Test262Error('#853: 1048575 >> 26 === 0. Actual: ' + (1048575 >> 26)); +} + + +if (2097151 >> 26 !== 0) { + throw new Test262Error('#854: 2097151 >> 26 === 0. Actual: ' + (2097151 >> 26)); +} + + +if (4194303 >> 26 !== 0) { + throw new Test262Error('#855: 4194303 >> 26 === 0. Actual: ' + (4194303 >> 26)); +} + + +if (8388607 >> 26 !== 0) { + throw new Test262Error('#856: 8388607 >> 26 === 0. Actual: ' + (8388607 >> 26)); +} + + +if (16777215 >> 26 !== 0) { + throw new Test262Error('#857: 16777215 >> 26 === 0. Actual: ' + (16777215 >> 26)); +} + + +if (33554431 >> 26 !== 0) { + throw new Test262Error('#858: 33554431 >> 26 === 0. Actual: ' + (33554431 >> 26)); +} + + +if (67108863 >> 26 !== 0) { + throw new Test262Error('#859: 67108863 >> 26 === 0. Actual: ' + (67108863 >> 26)); +} + + +if (134217727 >> 26 !== 1) { + throw new Test262Error('#860: 134217727 >> 26 === 1. Actual: ' + (134217727 >> 26)); +} + + +if (268435455 >> 26 !== 3) { + throw new Test262Error('#861: 268435455 >> 26 === 3. Actual: ' + (268435455 >> 26)); +} + + +if (536870911 >> 26 !== 7) { + throw new Test262Error('#862: 536870911 >> 26 === 7. Actual: ' + (536870911 >> 26)); +} + + +if (1073741823 >> 26 !== 15) { + throw new Test262Error('#863: 1073741823 >> 26 === 15. Actual: ' + (1073741823 >> 26)); +} + + +if (2147483647 >> 26 !== 31) { + throw new Test262Error('#864: 2147483647 >> 26 === 31. Actual: ' + (2147483647 >> 26)); +} + + +if (0 >> 27 !== 0) { + throw new Test262Error('#865: 0 >> 27 === 0. Actual: ' + (0 >> 27)); +} + + +if (1 >> 27 !== 0) { + throw new Test262Error('#866: 1 >> 27 === 0. Actual: ' + (1 >> 27)); +} + + +if (3 >> 27 !== 0) { + throw new Test262Error('#867: 3 >> 27 === 0. Actual: ' + (3 >> 27)); +} + + +if (7 >> 27 !== 0) { + throw new Test262Error('#868: 7 >> 27 === 0. Actual: ' + (7 >> 27)); +} + + +if (15 >> 27 !== 0) { + throw new Test262Error('#869: 15 >> 27 === 0. Actual: ' + (15 >> 27)); +} + + +if (31 >> 27 !== 0) { + throw new Test262Error('#870: 31 >> 27 === 0. Actual: ' + (31 >> 27)); +} + + +if (63 >> 27 !== 0) { + throw new Test262Error('#871: 63 >> 27 === 0. Actual: ' + (63 >> 27)); +} + + +if (127 >> 27 !== 0) { + throw new Test262Error('#872: 127 >> 27 === 0. Actual: ' + (127 >> 27)); +} + + +if (255 >> 27 !== 0) { + throw new Test262Error('#873: 255 >> 27 === 0. Actual: ' + (255 >> 27)); +} + + +if (511 >> 27 !== 0) { + throw new Test262Error('#874: 511 >> 27 === 0. Actual: ' + (511 >> 27)); +} + + +if (1023 >> 27 !== 0) { + throw new Test262Error('#875: 1023 >> 27 === 0. Actual: ' + (1023 >> 27)); +} + + +if (2047 >> 27 !== 0) { + throw new Test262Error('#876: 2047 >> 27 === 0. Actual: ' + (2047 >> 27)); +} + + +if (4095 >> 27 !== 0) { + throw new Test262Error('#877: 4095 >> 27 === 0. Actual: ' + (4095 >> 27)); +} + + +if (8191 >> 27 !== 0) { + throw new Test262Error('#878: 8191 >> 27 === 0. Actual: ' + (8191 >> 27)); +} + + +if (16383 >> 27 !== 0) { + throw new Test262Error('#879: 16383 >> 27 === 0. Actual: ' + (16383 >> 27)); +} + + +if (32767 >> 27 !== 0) { + throw new Test262Error('#880: 32767 >> 27 === 0. Actual: ' + (32767 >> 27)); +} + + +if (65535 >> 27 !== 0) { + throw new Test262Error('#881: 65535 >> 27 === 0. Actual: ' + (65535 >> 27)); +} + + +if (131071 >> 27 !== 0) { + throw new Test262Error('#882: 131071 >> 27 === 0. Actual: ' + (131071 >> 27)); +} + + +if (262143 >> 27 !== 0) { + throw new Test262Error('#883: 262143 >> 27 === 0. Actual: ' + (262143 >> 27)); +} + + +if (524287 >> 27 !== 0) { + throw new Test262Error('#884: 524287 >> 27 === 0. Actual: ' + (524287 >> 27)); +} + + +if (1048575 >> 27 !== 0) { + throw new Test262Error('#885: 1048575 >> 27 === 0. Actual: ' + (1048575 >> 27)); +} + + +if (2097151 >> 27 !== 0) { + throw new Test262Error('#886: 2097151 >> 27 === 0. Actual: ' + (2097151 >> 27)); +} + + +if (4194303 >> 27 !== 0) { + throw new Test262Error('#887: 4194303 >> 27 === 0. Actual: ' + (4194303 >> 27)); +} + + +if (8388607 >> 27 !== 0) { + throw new Test262Error('#888: 8388607 >> 27 === 0. Actual: ' + (8388607 >> 27)); +} + + +if (16777215 >> 27 !== 0) { + throw new Test262Error('#889: 16777215 >> 27 === 0. Actual: ' + (16777215 >> 27)); +} + + +if (33554431 >> 27 !== 0) { + throw new Test262Error('#890: 33554431 >> 27 === 0. Actual: ' + (33554431 >> 27)); +} + + +if (67108863 >> 27 !== 0) { + throw new Test262Error('#891: 67108863 >> 27 === 0. Actual: ' + (67108863 >> 27)); +} + + +if (134217727 >> 27 !== 0) { + throw new Test262Error('#892: 134217727 >> 27 === 0. Actual: ' + (134217727 >> 27)); +} + + +if (268435455 >> 27 !== 1) { + throw new Test262Error('#893: 268435455 >> 27 === 1. Actual: ' + (268435455 >> 27)); +} + + +if (536870911 >> 27 !== 3) { + throw new Test262Error('#894: 536870911 >> 27 === 3. Actual: ' + (536870911 >> 27)); +} + + +if (1073741823 >> 27 !== 7) { + throw new Test262Error('#895: 1073741823 >> 27 === 7. Actual: ' + (1073741823 >> 27)); +} + + +if (2147483647 >> 27 !== 15) { + throw new Test262Error('#896: 2147483647 >> 27 === 15. Actual: ' + (2147483647 >> 27)); +} + + +if (0 >> 28 !== 0) { + throw new Test262Error('#897: 0 >> 28 === 0. Actual: ' + (0 >> 28)); +} + + +if (1 >> 28 !== 0) { + throw new Test262Error('#898: 1 >> 28 === 0. Actual: ' + (1 >> 28)); +} + + +if (3 >> 28 !== 0) { + throw new Test262Error('#899: 3 >> 28 === 0. Actual: ' + (3 >> 28)); +} + + +if (7 >> 28 !== 0) { + throw new Test262Error('#900: 7 >> 28 === 0. Actual: ' + (7 >> 28)); +} + + +if (15 >> 28 !== 0) { + throw new Test262Error('#901: 15 >> 28 === 0. Actual: ' + (15 >> 28)); +} + + +if (31 >> 28 !== 0) { + throw new Test262Error('#902: 31 >> 28 === 0. Actual: ' + (31 >> 28)); +} + + +if (63 >> 28 !== 0) { + throw new Test262Error('#903: 63 >> 28 === 0. Actual: ' + (63 >> 28)); +} + + +if (127 >> 28 !== 0) { + throw new Test262Error('#904: 127 >> 28 === 0. Actual: ' + (127 >> 28)); +} + + +if (255 >> 28 !== 0) { + throw new Test262Error('#905: 255 >> 28 === 0. Actual: ' + (255 >> 28)); +} + + +if (511 >> 28 !== 0) { + throw new Test262Error('#906: 511 >> 28 === 0. Actual: ' + (511 >> 28)); +} + + +if (1023 >> 28 !== 0) { + throw new Test262Error('#907: 1023 >> 28 === 0. Actual: ' + (1023 >> 28)); +} + + +if (2047 >> 28 !== 0) { + throw new Test262Error('#908: 2047 >> 28 === 0. Actual: ' + (2047 >> 28)); +} + + +if (4095 >> 28 !== 0) { + throw new Test262Error('#909: 4095 >> 28 === 0. Actual: ' + (4095 >> 28)); +} + + +if (8191 >> 28 !== 0) { + throw new Test262Error('#910: 8191 >> 28 === 0. Actual: ' + (8191 >> 28)); +} + + +if (16383 >> 28 !== 0) { + throw new Test262Error('#911: 16383 >> 28 === 0. Actual: ' + (16383 >> 28)); +} + + +if (32767 >> 28 !== 0) { + throw new Test262Error('#912: 32767 >> 28 === 0. Actual: ' + (32767 >> 28)); +} + + +if (65535 >> 28 !== 0) { + throw new Test262Error('#913: 65535 >> 28 === 0. Actual: ' + (65535 >> 28)); +} + + +if (131071 >> 28 !== 0) { + throw new Test262Error('#914: 131071 >> 28 === 0. Actual: ' + (131071 >> 28)); +} + + +if (262143 >> 28 !== 0) { + throw new Test262Error('#915: 262143 >> 28 === 0. Actual: ' + (262143 >> 28)); +} + + +if (524287 >> 28 !== 0) { + throw new Test262Error('#916: 524287 >> 28 === 0. Actual: ' + (524287 >> 28)); +} + + +if (1048575 >> 28 !== 0) { + throw new Test262Error('#917: 1048575 >> 28 === 0. Actual: ' + (1048575 >> 28)); +} + + +if (2097151 >> 28 !== 0) { + throw new Test262Error('#918: 2097151 >> 28 === 0. Actual: ' + (2097151 >> 28)); +} + + +if (4194303 >> 28 !== 0) { + throw new Test262Error('#919: 4194303 >> 28 === 0. Actual: ' + (4194303 >> 28)); +} + + +if (8388607 >> 28 !== 0) { + throw new Test262Error('#920: 8388607 >> 28 === 0. Actual: ' + (8388607 >> 28)); +} + + +if (16777215 >> 28 !== 0) { + throw new Test262Error('#921: 16777215 >> 28 === 0. Actual: ' + (16777215 >> 28)); +} + + +if (33554431 >> 28 !== 0) { + throw new Test262Error('#922: 33554431 >> 28 === 0. Actual: ' + (33554431 >> 28)); +} + + +if (67108863 >> 28 !== 0) { + throw new Test262Error('#923: 67108863 >> 28 === 0. Actual: ' + (67108863 >> 28)); +} + + +if (134217727 >> 28 !== 0) { + throw new Test262Error('#924: 134217727 >> 28 === 0. Actual: ' + (134217727 >> 28)); +} + + +if (268435455 >> 28 !== 0) { + throw new Test262Error('#925: 268435455 >> 28 === 0. Actual: ' + (268435455 >> 28)); +} + + +if (536870911 >> 28 !== 1) { + throw new Test262Error('#926: 536870911 >> 28 === 1. Actual: ' + (536870911 >> 28)); +} + + +if (1073741823 >> 28 !== 3) { + throw new Test262Error('#927: 1073741823 >> 28 === 3. Actual: ' + (1073741823 >> 28)); +} + + +if (2147483647 >> 28 !== 7) { + throw new Test262Error('#928: 2147483647 >> 28 === 7. Actual: ' + (2147483647 >> 28)); +} + + +if (0 >> 29 !== 0) { + throw new Test262Error('#929: 0 >> 29 === 0. Actual: ' + (0 >> 29)); +} + + +if (1 >> 29 !== 0) { + throw new Test262Error('#930: 1 >> 29 === 0. Actual: ' + (1 >> 29)); +} + + +if (3 >> 29 !== 0) { + throw new Test262Error('#931: 3 >> 29 === 0. Actual: ' + (3 >> 29)); +} + + +if (7 >> 29 !== 0) { + throw new Test262Error('#932: 7 >> 29 === 0. Actual: ' + (7 >> 29)); +} + + +if (15 >> 29 !== 0) { + throw new Test262Error('#933: 15 >> 29 === 0. Actual: ' + (15 >> 29)); +} + + +if (31 >> 29 !== 0) { + throw new Test262Error('#934: 31 >> 29 === 0. Actual: ' + (31 >> 29)); +} + + +if (63 >> 29 !== 0) { + throw new Test262Error('#935: 63 >> 29 === 0. Actual: ' + (63 >> 29)); +} + + +if (127 >> 29 !== 0) { + throw new Test262Error('#936: 127 >> 29 === 0. Actual: ' + (127 >> 29)); +} + + +if (255 >> 29 !== 0) { + throw new Test262Error('#937: 255 >> 29 === 0. Actual: ' + (255 >> 29)); +} + + +if (511 >> 29 !== 0) { + throw new Test262Error('#938: 511 >> 29 === 0. Actual: ' + (511 >> 29)); +} + + +if (1023 >> 29 !== 0) { + throw new Test262Error('#939: 1023 >> 29 === 0. Actual: ' + (1023 >> 29)); +} + + +if (2047 >> 29 !== 0) { + throw new Test262Error('#940: 2047 >> 29 === 0. Actual: ' + (2047 >> 29)); +} + + +if (4095 >> 29 !== 0) { + throw new Test262Error('#941: 4095 >> 29 === 0. Actual: ' + (4095 >> 29)); +} + + +if (8191 >> 29 !== 0) { + throw new Test262Error('#942: 8191 >> 29 === 0. Actual: ' + (8191 >> 29)); +} + + +if (16383 >> 29 !== 0) { + throw new Test262Error('#943: 16383 >> 29 === 0. Actual: ' + (16383 >> 29)); +} + + +if (32767 >> 29 !== 0) { + throw new Test262Error('#944: 32767 >> 29 === 0. Actual: ' + (32767 >> 29)); +} + + +if (65535 >> 29 !== 0) { + throw new Test262Error('#945: 65535 >> 29 === 0. Actual: ' + (65535 >> 29)); +} + + +if (131071 >> 29 !== 0) { + throw new Test262Error('#946: 131071 >> 29 === 0. Actual: ' + (131071 >> 29)); +} + + +if (262143 >> 29 !== 0) { + throw new Test262Error('#947: 262143 >> 29 === 0. Actual: ' + (262143 >> 29)); +} + + +if (524287 >> 29 !== 0) { + throw new Test262Error('#948: 524287 >> 29 === 0. Actual: ' + (524287 >> 29)); +} + + +if (1048575 >> 29 !== 0) { + throw new Test262Error('#949: 1048575 >> 29 === 0. Actual: ' + (1048575 >> 29)); +} + + +if (2097151 >> 29 !== 0) { + throw new Test262Error('#950: 2097151 >> 29 === 0. Actual: ' + (2097151 >> 29)); +} + + +if (4194303 >> 29 !== 0) { + throw new Test262Error('#951: 4194303 >> 29 === 0. Actual: ' + (4194303 >> 29)); +} + + +if (8388607 >> 29 !== 0) { + throw new Test262Error('#952: 8388607 >> 29 === 0. Actual: ' + (8388607 >> 29)); +} + + +if (16777215 >> 29 !== 0) { + throw new Test262Error('#953: 16777215 >> 29 === 0. Actual: ' + (16777215 >> 29)); +} + + +if (33554431 >> 29 !== 0) { + throw new Test262Error('#954: 33554431 >> 29 === 0. Actual: ' + (33554431 >> 29)); +} + + +if (67108863 >> 29 !== 0) { + throw new Test262Error('#955: 67108863 >> 29 === 0. Actual: ' + (67108863 >> 29)); +} + + +if (134217727 >> 29 !== 0) { + throw new Test262Error('#956: 134217727 >> 29 === 0. Actual: ' + (134217727 >> 29)); +} + + +if (268435455 >> 29 !== 0) { + throw new Test262Error('#957: 268435455 >> 29 === 0. Actual: ' + (268435455 >> 29)); +} + + +if (536870911 >> 29 !== 0) { + throw new Test262Error('#958: 536870911 >> 29 === 0. Actual: ' + (536870911 >> 29)); +} + + +if (1073741823 >> 29 !== 1) { + throw new Test262Error('#959: 1073741823 >> 29 === 1. Actual: ' + (1073741823 >> 29)); +} + + +if (2147483647 >> 29 !== 3) { + throw new Test262Error('#960: 2147483647 >> 29 === 3. Actual: ' + (2147483647 >> 29)); +} + + +if (0 >> 30 !== 0) { + throw new Test262Error('#961: 0 >> 30 === 0. Actual: ' + (0 >> 30)); +} + + +if (1 >> 30 !== 0) { + throw new Test262Error('#962: 1 >> 30 === 0. Actual: ' + (1 >> 30)); +} + + +if (3 >> 30 !== 0) { + throw new Test262Error('#963: 3 >> 30 === 0. Actual: ' + (3 >> 30)); +} + + +if (7 >> 30 !== 0) { + throw new Test262Error('#964: 7 >> 30 === 0. Actual: ' + (7 >> 30)); +} + + +if (15 >> 30 !== 0) { + throw new Test262Error('#965: 15 >> 30 === 0. Actual: ' + (15 >> 30)); +} + + +if (31 >> 30 !== 0) { + throw new Test262Error('#966: 31 >> 30 === 0. Actual: ' + (31 >> 30)); +} + + +if (63 >> 30 !== 0) { + throw new Test262Error('#967: 63 >> 30 === 0. Actual: ' + (63 >> 30)); +} + + +if (127 >> 30 !== 0) { + throw new Test262Error('#968: 127 >> 30 === 0. Actual: ' + (127 >> 30)); +} + + +if (255 >> 30 !== 0) { + throw new Test262Error('#969: 255 >> 30 === 0. Actual: ' + (255 >> 30)); +} + + +if (511 >> 30 !== 0) { + throw new Test262Error('#970: 511 >> 30 === 0. Actual: ' + (511 >> 30)); +} + + +if (1023 >> 30 !== 0) { + throw new Test262Error('#971: 1023 >> 30 === 0. Actual: ' + (1023 >> 30)); +} + + +if (2047 >> 30 !== 0) { + throw new Test262Error('#972: 2047 >> 30 === 0. Actual: ' + (2047 >> 30)); +} + + +if (4095 >> 30 !== 0) { + throw new Test262Error('#973: 4095 >> 30 === 0. Actual: ' + (4095 >> 30)); +} + + +if (8191 >> 30 !== 0) { + throw new Test262Error('#974: 8191 >> 30 === 0. Actual: ' + (8191 >> 30)); +} + + +if (16383 >> 30 !== 0) { + throw new Test262Error('#975: 16383 >> 30 === 0. Actual: ' + (16383 >> 30)); +} + + +if (32767 >> 30 !== 0) { + throw new Test262Error('#976: 32767 >> 30 === 0. Actual: ' + (32767 >> 30)); +} + + +if (65535 >> 30 !== 0) { + throw new Test262Error('#977: 65535 >> 30 === 0. Actual: ' + (65535 >> 30)); +} + + +if (131071 >> 30 !== 0) { + throw new Test262Error('#978: 131071 >> 30 === 0. Actual: ' + (131071 >> 30)); +} + + +if (262143 >> 30 !== 0) { + throw new Test262Error('#979: 262143 >> 30 === 0. Actual: ' + (262143 >> 30)); +} + + +if (524287 >> 30 !== 0) { + throw new Test262Error('#980: 524287 >> 30 === 0. Actual: ' + (524287 >> 30)); +} + + +if (1048575 >> 30 !== 0) { + throw new Test262Error('#981: 1048575 >> 30 === 0. Actual: ' + (1048575 >> 30)); +} + + +if (2097151 >> 30 !== 0) { + throw new Test262Error('#982: 2097151 >> 30 === 0. Actual: ' + (2097151 >> 30)); +} + + +if (4194303 >> 30 !== 0) { + throw new Test262Error('#983: 4194303 >> 30 === 0. Actual: ' + (4194303 >> 30)); +} + + +if (8388607 >> 30 !== 0) { + throw new Test262Error('#984: 8388607 >> 30 === 0. Actual: ' + (8388607 >> 30)); +} + + +if (16777215 >> 30 !== 0) { + throw new Test262Error('#985: 16777215 >> 30 === 0. Actual: ' + (16777215 >> 30)); +} + + +if (33554431 >> 30 !== 0) { + throw new Test262Error('#986: 33554431 >> 30 === 0. Actual: ' + (33554431 >> 30)); +} + + +if (67108863 >> 30 !== 0) { + throw new Test262Error('#987: 67108863 >> 30 === 0. Actual: ' + (67108863 >> 30)); +} + + +if (134217727 >> 30 !== 0) { + throw new Test262Error('#988: 134217727 >> 30 === 0. Actual: ' + (134217727 >> 30)); +} + + +if (268435455 >> 30 !== 0) { + throw new Test262Error('#989: 268435455 >> 30 === 0. Actual: ' + (268435455 >> 30)); +} + + +if (536870911 >> 30 !== 0) { + throw new Test262Error('#990: 536870911 >> 30 === 0. Actual: ' + (536870911 >> 30)); +} + + +if (1073741823 >> 30 !== 0) { + throw new Test262Error('#991: 1073741823 >> 30 === 0. Actual: ' + (1073741823 >> 30)); +} + + +if (2147483647 >> 30 !== 1) { + throw new Test262Error('#992: 2147483647 >> 30 === 1. Actual: ' + (2147483647 >> 30)); +} + + +if (0 >> 31 !== 0) { + throw new Test262Error('#993: 0 >> 31 === 0. Actual: ' + (0 >> 31)); +} + + +if (1 >> 31 !== 0) { + throw new Test262Error('#994: 1 >> 31 === 0. Actual: ' + (1 >> 31)); +} + + +if (3 >> 31 !== 0) { + throw new Test262Error('#995: 3 >> 31 === 0. Actual: ' + (3 >> 31)); +} + + +if (7 >> 31 !== 0) { + throw new Test262Error('#996: 7 >> 31 === 0. Actual: ' + (7 >> 31)); +} + + +if (15 >> 31 !== 0) { + throw new Test262Error('#997: 15 >> 31 === 0. Actual: ' + (15 >> 31)); +} + + +if (31 >> 31 !== 0) { + throw new Test262Error('#998: 31 >> 31 === 0. Actual: ' + (31 >> 31)); +} + + +if (63 >> 31 !== 0) { + throw new Test262Error('#999: 63 >> 31 === 0. Actual: ' + (63 >> 31)); +} + + +if (127 >> 31 !== 0) { + throw new Test262Error('#1000: 127 >> 31 === 0. Actual: ' + (127 >> 31)); +} + + +if (255 >> 31 !== 0) { + throw new Test262Error('#1001: 255 >> 31 === 0. Actual: ' + (255 >> 31)); +} + + +if (511 >> 31 !== 0) { + throw new Test262Error('#1002: 511 >> 31 === 0. Actual: ' + (511 >> 31)); +} + + +if (1023 >> 31 !== 0) { + throw new Test262Error('#1003: 1023 >> 31 === 0. Actual: ' + (1023 >> 31)); +} + + +if (2047 >> 31 !== 0) { + throw new Test262Error('#1004: 2047 >> 31 === 0. Actual: ' + (2047 >> 31)); +} + + +if (4095 >> 31 !== 0) { + throw new Test262Error('#1005: 4095 >> 31 === 0. Actual: ' + (4095 >> 31)); +} + + +if (8191 >> 31 !== 0) { + throw new Test262Error('#1006: 8191 >> 31 === 0. Actual: ' + (8191 >> 31)); +} + + +if (16383 >> 31 !== 0) { + throw new Test262Error('#1007: 16383 >> 31 === 0. Actual: ' + (16383 >> 31)); +} + + +if (32767 >> 31 !== 0) { + throw new Test262Error('#1008: 32767 >> 31 === 0. Actual: ' + (32767 >> 31)); +} + + +if (65535 >> 31 !== 0) { + throw new Test262Error('#1009: 65535 >> 31 === 0. Actual: ' + (65535 >> 31)); +} + + +if (131071 >> 31 !== 0) { + throw new Test262Error('#1010: 131071 >> 31 === 0. Actual: ' + (131071 >> 31)); +} + + +if (262143 >> 31 !== 0) { + throw new Test262Error('#1011: 262143 >> 31 === 0. Actual: ' + (262143 >> 31)); +} + + +if (524287 >> 31 !== 0) { + throw new Test262Error('#1012: 524287 >> 31 === 0. Actual: ' + (524287 >> 31)); +} + + +if (1048575 >> 31 !== 0) { + throw new Test262Error('#1013: 1048575 >> 31 === 0. Actual: ' + (1048575 >> 31)); +} + + +if (2097151 >> 31 !== 0) { + throw new Test262Error('#1014: 2097151 >> 31 === 0. Actual: ' + (2097151 >> 31)); +} + + +if (4194303 >> 31 !== 0) { + throw new Test262Error('#1015: 4194303 >> 31 === 0. Actual: ' + (4194303 >> 31)); +} + + +if (8388607 >> 31 !== 0) { + throw new Test262Error('#1016: 8388607 >> 31 === 0. Actual: ' + (8388607 >> 31)); +} + + +if (16777215 >> 31 !== 0) { + throw new Test262Error('#1017: 16777215 >> 31 === 0. Actual: ' + (16777215 >> 31)); +} + + +if (33554431 >> 31 !== 0) { + throw new Test262Error('#1018: 33554431 >> 31 === 0. Actual: ' + (33554431 >> 31)); +} + + +if (67108863 >> 31 !== 0) { + throw new Test262Error('#1019: 67108863 >> 31 === 0. Actual: ' + (67108863 >> 31)); +} + + +if (134217727 >> 31 !== 0) { + throw new Test262Error('#1020: 134217727 >> 31 === 0. Actual: ' + (134217727 >> 31)); +} + + +if (268435455 >> 31 !== 0) { + throw new Test262Error('#1021: 268435455 >> 31 === 0. Actual: ' + (268435455 >> 31)); +} + + +if (536870911 >> 31 !== 0) { + throw new Test262Error('#1022: 536870911 >> 31 === 0. Actual: ' + (536870911 >> 31)); +} + + +if (1073741823 >> 31 !== 0) { + throw new Test262Error('#1023: 1073741823 >> 31 === 0. Actual: ' + (1073741823 >> 31)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.1_T1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.1_T1.js new file mode 100644 index 0000000000..3b9df21238 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.1_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y uses ToInt32(ShiftExpression) +es5id: 11.7.2_A5.1_T1 +description: Checking boundary points +---*/ + +//CHECK#1 +if (2147483648.1 >> 0 !== -2147483648) { + throw new Test262Error('#1: 2147483648.1 >> 0 === -2147483648. Actual: ' + (2147483648.1 >> 0)); +} + +//CHECK#2 +if (4294967296.1 >> 0 !== 0) { + throw new Test262Error('#2: 4294967296.1 >> 0 === 0. Actual: ' + (4294967296.1 >> 0)); +} + +//CHECK#3 +if (6442450944.1 >> 0 !== -2147483648) { + throw new Test262Error('#3: 6442450944.1 >> 0 === -2147483648. Actual: ' + (6442450944.1 >> 0)); +} + +//CHECK#4 +if (4294967295.1 >> 0 !== -1) { + throw new Test262Error('#4: 4294967295.1 >> 0 === -1. Actual: ' + (4294967295.1 >> 0)); +} + +//CHECK#5 +if (6442450943.1 >> 0 !== 2147483647) { + throw new Test262Error('#5: 6442450943.1 >> 0 === 2147483647. Actual: ' + (6442450943.1 >> 0)); +} + +//CHECK#6 +if (-2147483649.1 >> 0 !== 2147483647) { + throw new Test262Error('#6: -2147483649.1 >> 0 === 2147483647. Actual: ' + (-2147483649.1 >> 0)); +} + +//CHECK#7 +if (-4294967297.1 >> 0 !== -1) { + throw new Test262Error('#7: -4294967297.1 >> 0 === -1. Actual: ' + (-4294967297.1 >> 0)); +} + +//CHECK#8 +if (-6442450945.1 >> 0 !== 2147483647) { + throw new Test262Error('#8: -6442450945.1 >> 0 === 2147483647. Actual: ' + (-6442450945.1 >> 0)); +} + +//CHECK#9 +if (-4294967296.1 >> 0 !== 0) { + throw new Test262Error('#9: -4294967296.1 >> 0 === 0 . Actual: ' + (-4294967296.1 >> 0)); +} + +//CHECK#10 +if (-6442450944.1 >> 0 !== -2147483648) { + throw new Test262Error('#10: -6442450944.1 >> 0 === -2147483648. Actual: ' + (-6442450944.1 >> 0)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.2_T1.js b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.2_T1.js new file mode 100644 index 0000000000..0272f6930a --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/S11.7.2_A5.2_T1.js @@ -0,0 +1,330 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >> y uses ToUint32(AdditiveExpression) & 31 +es5id: 11.7.2_A5.2_T1 +description: Checking distinct points +---*/ + +//CHECK#1 +if (2147483647 >> -32.1 !== 2147483647) { + throw new Test262Error('#1: 2147483647 >> -32.1 === 2147483647. Actual: ' + (2147483647 >> -32.1)); +} + +//CHECK#2 +if (2147483647 >> -31.1 !== 1073741823) { + throw new Test262Error('#2: 2147483647 >> -31.1 === 1073741823. Actual: ' + (2147483647 >> -31.1)); +} + +//CHECK#3 +if (2147483647 >> -30.1 !== 536870911) { + throw new Test262Error('#3: 2147483647 >> -30.1 === 536870911. Actual: ' + (2147483647 >> -30.1)); +} + +//CHECK#4 +if (2147483647 >> -29.1 !== 268435455) { + throw new Test262Error('#4: 2147483647 >> -29.1 === 268435455. Actual: ' + (2147483647 >> -29.1)); +} + +//CHECK#5 +if (2147483647 >> -28.1 !== 134217727) { + throw new Test262Error('#5: 2147483647 >> -28.1 === 134217727. Actual: ' + (2147483647 >> -28.1)); +} + +//CHECK#6 +if (2147483647 >> -27.1 !== 67108863) { + throw new Test262Error('#6: 2147483647 >> -27.1 === 67108863. Actual: ' + (2147483647 >> -27.1)); +} + +//CHECK#7 +if (2147483647 >> -26.1 !== 33554431) { + throw new Test262Error('#7: 2147483647 >> -26.1 === 33554431. Actual: ' + (2147483647 >> -26.1)); +} + +//CHECK#8 +if (2147483647 >> -25.1 !== 16777215) { + throw new Test262Error('#8: 2147483647 >> -25.1 === 16777215. Actual: ' + (2147483647 >> -25.1)); +} + +//CHECK#9 +if (2147483647 >> -24.1 !== 8388607) { + throw new Test262Error('#9: 2147483647 >> -24.1 === 8388607. Actual: ' + (2147483647 >> -24.1)); +} + +//CHECK#10 +if (2147483647 >> -23.1 !== 4194303) { + throw new Test262Error('#10: 2147483647 >> -23.1 === 4194303. Actual: ' + (2147483647 >> -23.1)); +} + +//CHECK#11 +if (2147483647 >> -22.1 !== 2097151) { + throw new Test262Error('#11: 2147483647 >> -22.1 === 2097151. Actual: ' + (2147483647 >> -22.1)); +} + +//CHECK#12 +if (2147483647 >> -21.1 !== 1048575) { + throw new Test262Error('#12: 2147483647 >> -21.1 === 1048575. Actual: ' + (2147483647 >> -21.1)); +} + +//CHECK#13 +if (2147483647 >> -20.1 !== 524287) { + throw new Test262Error('#13: 2147483647 >> -20.1 === 524287. Actual: ' + (2147483647 >> -20.1)); +} + +//CHECK#14 +if (2147483647 >> -19.1 !== 262143) { + throw new Test262Error('#14: 2147483647 >> -19.1 === 262143. Actual: ' + (2147483647 >> -19.1)); +} + +//CHECK#15 +if (2147483647 >> -18.1 !== 131071) { + throw new Test262Error('#15: 2147483647 >> -18.1 === 131071. Actual: ' + (2147483647 >> -18.1)); +} + +//CHECK#16 +if (2147483647 >> -17.1 !== 65535) { + throw new Test262Error('#16: 2147483647 >> -17.1 === 65535. Actual: ' + (2147483647 >> -17.1)); +} + +//CHECK#17 +if (2147483647 >> -16.1 !== 32767) { + throw new Test262Error('#17: 2147483647 >> -16.1 === 32767. Actual: ' + (2147483647 >> -16.1)); +} + +//CHECK#18 +if (2147483647 >> -15.1 !== 16383) { + throw new Test262Error('#18: 2147483647 >> -15.1 === 16383. Actual: ' + (2147483647 >> -15.1)); +} + +//CHECK#19 +if (2147483647 >> -14.1 !== 8191) { + throw new Test262Error('#19: 2147483647 >> -14.1 === 8191. Actual: ' + (2147483647 >> -14.1)); +} + +//CHECK#20 +if (2147483647 >> -13.1 !== 4095) { + throw new Test262Error('#20: 2147483647 >> -13.1 === 4095. Actual: ' + (2147483647 >> -13.1)); +} + +//CHECK#21 +if (2147483647 >> -12.1 !== 2047) { + throw new Test262Error('#21: 2147483647 >> -12.1 === 2047. Actual: ' + (2147483647 >> -12.1)); +} + +//CHECK#22 +if (2147483647 >> -11.1 !== 1023) { + throw new Test262Error('#22: 2147483647 >> -11.1 === 1023. Actual: ' + (2147483647 >> -11.1)); +} + +//CHECK#23 +if (2147483647 >> -10.1 !== 511) { + throw new Test262Error('#23: 2147483647 >> -10.1 === 511. Actual: ' + (2147483647 >> -10.1)); +} + +//CHECK#24 +if (2147483647 >> -9.1 !== 255) { + throw new Test262Error('#24: 2147483647 >> -9.1 === 255. Actual: ' + (2147483647 >> -9.1)); +} + +//CHECK#25 +if (2147483647 >> -8.1 !== 127) { + throw new Test262Error('#25: 2147483647 >> -8.1 === 127. Actual: ' + (2147483647 >> -8.1)); +} + +//CHECK#26 +if (2147483647 >> -7.1 !== 63) { + throw new Test262Error('#26: 2147483647 >> -7.1 === 63. Actual: ' + (2147483647 >> -7.1)); +} + +//CHECK#27 +if (2147483647 >> -6.1 !== 31) { + throw new Test262Error('#27: 2147483647 >> -6.1 === 31. Actual: ' + (2147483647 >> -6.1)); +} + +//CHECK#28 +if (2147483647 >> -5.1 !== 15) { + throw new Test262Error('#28: 2147483647 >> -5.1 === 15. Actual: ' + (2147483647 >> -5.1)); +} + +//CHECK#29 +if (2147483647 >> -4.1 !== 7) { + throw new Test262Error('#29: 2147483647 >> -4.1 === 7. Actual: ' + (2147483647 >> -4.1)); +} + +//CHECK#30 +if (2147483647 >> -3.1 !== 3) { + throw new Test262Error('#30: 2147483647 >> -3.1 === 3. Actual: ' + (2147483647 >> -3.1)); +} + +//CHECK#31 +if (2147483647 >> -2.1 !== 1) { + throw new Test262Error('#31: 2147483647 >> -2.1 === 1. Actual: ' + (2147483647 >> -2.1)); +} + +//CHECK#32 +if (2147483647 >> -1.1 !== 0) { + throw new Test262Error('#32: 2147483647 >> -1.1 === 0. Actual: ' + (2147483647 >> -1.1)); +} + +//CHECK#33 +if (2147483647 >> 32.1 !== 2147483647) { + throw new Test262Error('#33: 2147483647 >> 32.1 === 2147483647. Actual: ' + (2147483647 >> 32.1)); +} + +//CHECK#34 +if (2147483647 >> 33.1 !== 1073741823) { + throw new Test262Error('#34: 2147483647 >> 33.1 === 1073741823. Actual: ' + (2147483647 >> 33.1)); +} + +//CHECK#35 +if (2147483647 >> 34.1 !== 536870911) { + throw new Test262Error('#35: 2147483647 >> 34.1 === 536870911. Actual: ' + (2147483647 >> 34.1)); +} + +//CHECK#36 +if (2147483647 >> 35.1 !== 268435455) { + throw new Test262Error('#36: 2147483647 >> 35.1 === 268435455. Actual: ' + (2147483647 >> 35.1)); +} + +//CHECK#37 +if (2147483647 >> 36.1 !== 134217727) { + throw new Test262Error('#37: 2147483647 >> 36.1 === 134217727. Actual: ' + (2147483647 >> 36.1)); +} + +//CHECK#38 +if (2147483647 >> 37.1 !== 67108863) { + throw new Test262Error('#38: 2147483647 >> 37.1 === 67108863. Actual: ' + (2147483647 >> 37.1)); +} + +//CHECK#39 +if (2147483647 >> 38.1 !== 33554431) { + throw new Test262Error('#39: 2147483647 >> 38.1 === 33554431. Actual: ' + (2147483647 >> 38.1)); +} + +//CHECK#40 +if (2147483647 >> 39.1 !== 16777215) { + throw new Test262Error('#40: 2147483647 >> 39.1 === 16777215. Actual: ' + (2147483647 >> 39.1)); +} + +//CHECK#41 +if (2147483647 >> 40.1 !== 8388607) { + throw new Test262Error('#41: 2147483647 >> 40.1 === 8388607. Actual: ' + (2147483647 >> 40.1)); +} + +//CHECK#42 +if (2147483647 >> 41.1 !== 4194303) { + throw new Test262Error('#42: 2147483647 >> 41.1 === 4194303. Actual: ' + (2147483647 >> 41.1)); +} + +//CHECK#43 +if (2147483647 >> 42.1 !== 2097151) { + throw new Test262Error('#43: 2147483647 >> 42.1 === 2097151. Actual: ' + (2147483647 >> 42.1)); +} + +//CHECK#44 +if (2147483647 >> 43.1 !== 1048575) { + throw new Test262Error('#44: 2147483647 >> 43.1 === 1048575. Actual: ' + (2147483647 >> 43.1)); +} + +//CHECK#45 +if (2147483647 >> 44.1 !== 524287) { + throw new Test262Error('#45: 2147483647 >> 44.1 === 524287. Actual: ' + (2147483647 >> 44.1)); +} + +//CHECK#46 +if (2147483647 >> 45.1 !== 262143) { + throw new Test262Error('#46: 2147483647 >> 45.1 === 262143. Actual: ' + (2147483647 >> 45.1)); +} + +//CHECK#47 +if (2147483647 >> 46.1 !== 131071) { + throw new Test262Error('#47: 2147483647 >> 46.1 === 131071. Actual: ' + (2147483647 >> 46.1)); +} + +//CHECK#48 +if (2147483647 >> 47.1 !== 65535) { + throw new Test262Error('#48: 2147483647 >> 47.1 === 65535. Actual: ' + (2147483647 >> 47.1)); +} + +//CHECK#49 +if (2147483647 >> 48.1 !== 32767) { + throw new Test262Error('#49: 2147483647 >> 48.1 === 32767. Actual: ' + (2147483647 >> 48.1)); +} + +//CHECK#50 +if (2147483647 >> 49.1 !== 16383) { + throw new Test262Error('#50: 2147483647 >> 49.1 === 16383. Actual: ' + (2147483647 >> 49.1)); +} + +//CHECK#51 +if (2147483647 >> 50.1 !== 8191) { + throw new Test262Error('#51: 2147483647 >> 50.1 === 8191. Actual: ' + (2147483647 >> 50.1)); +} + +//CHECK#52 +if (2147483647 >> 51.1 !== 4095) { + throw new Test262Error('#52: 2147483647 >> 51.1 === 4095. Actual: ' + (2147483647 >> 51.1)); +} + +//CHECK#53 +if (2147483647 >> 52.1 !== 2047) { + throw new Test262Error('#53: 2147483647 >> 52.1 === 2047. Actual: ' + (2147483647 >> 52.1)); +} + +//CHECK#54 +if (2147483647 >> 53.1 !== 1023) { + throw new Test262Error('#54: 2147483647 >> 53.1 === 1023. Actual: ' + (2147483647 >> 53.1)); +} + +//CHECK#55 +if (2147483647 >> 54.1 !== 511) { + throw new Test262Error('#55: 2147483647 >> 54.1 === 511. Actual: ' + (2147483647 >> 54.1)); +} + +//CHECK#56 +if (2147483647 >> 55.1 !== 255) { + throw new Test262Error('#56: 2147483647 >> 55.1 === 255. Actual: ' + (2147483647 >> 55.1)); +} + +//CHECK#57 +if (2147483647 >> 56.1 !== 127) { + throw new Test262Error('#57: 2147483647 >> 56.1 === 127. Actual: ' + (2147483647 >> 56.1)); +} + +//CHECK#58 +if (2147483647 >> 57.1 !== 63) { + throw new Test262Error('#58: 2147483647 >> 57.1 === 63. Actual: ' + (2147483647 >> 57.1)); +} + +//CHECK#59 +if (2147483647 >> 58.1 !== 31) { + throw new Test262Error('#59: 2147483647 >> 58.1 === 31. Actual: ' + (2147483647 >> 58.1)); +} + +//CHECK#60 +if (2147483647 >> 59.1 !== 15) { + throw new Test262Error('#60: 2147483647 >> 59.1 === 15. Actual: ' + (2147483647 >> 59.1)); +} + +//CHECK#61 +if (2147483647 >> 60.1 !== 7) { + throw new Test262Error('#61: 2147483647 >> 60.1 === 7. Actual: ' + (2147483647 >> 60.1)); +} + +//CHECK#62 +if (2147483647 >> 61.1 !== 3) { + throw new Test262Error('#62: 2147483647 >> 61.1 === 3. Actual: ' + (2147483647 >> 61.1)); +} + +//CHECK#63 +if (2147483647 >> 62.1 !== 1) { + throw new Test262Error('#63: 2147483647 >> 62.1 === 1. Actual: ' + (2147483647 >> 62.1)); +} + +//CHECK#64 +if (2147483647 >> 63.1 !== 0) { + throw new Test262Error('#64: 2147483647 >> 63.1 === 0. Actual: ' + (2147483647 >> 63.1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/bigint-and-number.js b/js/src/tests/test262/language/expressions/right-shift/bigint-and-number.js new file mode 100644 index 0000000000..168f94f226 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-signed-right-shift-operator-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for right-shift operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n >> 1; +}, '1n >> 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 >> 1n; +}, '1 >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >> 1; +}, 'Object(1n) >> 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 >> Object(1n); +}, '1 >> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> Object(1); +}, '1n >> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >> 1n; +}, 'Object(1) >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >> Object(1); +}, 'Object(1n) >> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >> Object(1n); +}, 'Object(1) >> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> NaN; +}, '1n >> NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN >> 1n; +}, 'NaN >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> Infinity; +}, '1n >> Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity >> 1n; +}, 'Infinity >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> true; +}, '1n >> true throws TypeError'); + +assert.throws(TypeError, function() { + true >> 1n; +}, 'true >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> '1'; +}, '1n >> "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' >> 1n; +}, '"1" >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> null; +}, '1n >> null throws TypeError'); + +assert.throws(TypeError, function() { + null >> 1n; +}, 'null >> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >> undefined; +}, '1n >> undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined >> 1n; +}, 'undefined >> 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/bigint-errors.js b/js/src/tests/test262/language/expressions/right-shift/bigint-errors.js new file mode 100644 index 0000000000..f4f5288e9c --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: right-shift operator ToNumeric with BigInt operands +esid: sec-signed-right-shift-operator-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') >> 0n; +}, 'Symbol("1") >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> Symbol('1'); +}, '0n >> Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) >> 0n; +}, 'Object(Symbol("1")) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> Object(Symbol('1')); +}, '0n >> Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) >> 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n >> {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) >> 0n; +}, '({valueOf: function() {return Symbol("1");}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n >> {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) >> 0n; +}, '({toString: function() {return Symbol("1");}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + toString: function() { + return Symbol('1'); + } + }; +}, '0n >> {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/right-shift/bigint-non-primitive.js new file mode 100644 index 0000000000..ab23a7d55e --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/bigint-non-primitive.js @@ -0,0 +1,89 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Right shift for non-primitive BigInt values +esid: sec-signed-right-shift-operator-runtime-semantics-evaluation +info: | + ShiftExpression : ShiftExpression >> AdditiveExpression + + 1. Let lref be the result of evaluating ShiftExpression. + 2. Let lval be ? GetValue(lref). + 3. Let rref be the result of evaluating AdditiveExpression. + 4. Let rval be ? GetValue(rref). + 5. Let lnum be ? ToNumeric(lval). + 6. Let rnum be ? ToNumeric(rval). + 7. If Type(lnum) does not equal Type(rnum), throw a TypeError exception. + 8. Let T be Type(lnum). + 9. Return T::signedRightShift(lnum, rnum). + +features: [BigInt, Symbol.toPrimitive] +---*/ +assert.sameValue(Object(0b101n) >> 1n, 0b10n, 'The result of (Object(0b101n) >> 1n) is 0b10n'); + +assert.sameValue( + Object(0b101n) >> Object(1n), + 0b10n, + 'The result of (Object(0b101n) >> Object(1n)) is 0b10n' +); + +function err() { + throw new Test262Error(); +} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err +} >> 1n, 0b10n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) >> 1n) is 0b10n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + }, + + toString: err +} >> 1n, 0b10n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) >> 1n) is 0b10n'); + +assert.sameValue({ + toString: function() { + return 0b101n; + } +} >> 1n, 0b10n, 'The result of (({toString: function() {return 0b101n;}}) >> 1n) is 0b10n'); + +assert.sameValue(0b101n >> { + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err +}, 0b10n, 'The result of (0b101n >> {[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err}) is 0b10n'); + +assert.sameValue(0b101n >> { + valueOf: function() { + return 1n; + }, + + toString: err +}, 0b10n, 'The result of (0b101n >> {valueOf: function() {return 1n;}, toString: err}) is 0b10n'); + +assert.sameValue(0b101n >> { + toString: function() { + return 1n; + } +}, 0b10n, 'The result of (0b101n >> {toString: function() {return 1n;}}) is 0b10n'); + +assert.sameValue({ + valueOf: function() { + return 0b101n; + } +} >> { + valueOf: function() { + return 1n; + } +}, 0b10n, 'The result of (({valueOf: function() {return 0b101n;}}) >> {valueOf: function() {return 1n;}}) is 0b10n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/right-shift/bigint-toprimitive.js new file mode 100644 index 0000000000..10f8a36e43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: right-shift operator ToNumeric with BigInt operands +esid: sec-signed-right-shift-operator-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} >> 1n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + valueOf: function() { + return 2n; + }, + + toString: err +}, 1n, 'The result of (4n >> {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({toString: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + toString: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + valueOf: null, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) >> 0n; +}, '({[Symbol.toPrimitive]: 1}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + [Symbol.toPrimitive]: 1 + }; +}, '0n >> {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) >> 0n; +}, '({[Symbol.toPrimitive]: {}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + [Symbol.toPrimitive]: {} + }; +}, '0n >> {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) >> 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n >> {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) >> 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n >> {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) >> 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) >> 0n throws MyError'); + +assert.throws(MyError, function() { + 0n >> { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n >> {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) >> 0n; +}, '({valueOf: function() {throw new MyError();}}) >> 0n throws MyError'); + +assert.throws(MyError, function() { + 0n >> { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n >> {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) >> 0n; +}, '({toString: function() {throw new MyError();}}) >> 0n throws MyError'); + +assert.throws(MyError, function() { + 0n >> { + toString: function() { + throw new MyError(); + } + }; +}, '0n >> {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) >> 0n; +}, '({valueOf: null, toString: null}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + valueOf: null, + toString: null + }; +}, '0n >> {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) >> 0n; +}, '({valueOf: 1, toString: 1}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + valueOf: 1, + toString: 1 + }; +}, '0n >> {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) >> 0n; +}, '({valueOf: {}, toString: {}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + valueOf: {}, + toString: {} + }; +}, '0n >> {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) >> 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n >> {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) >> 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) >> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >> { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n >> {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/right-shift/bigint-wrapped-values.js new file mode 100644 index 0000000000..d3d0b732d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: right-shift operator ToNumeric with BigInt operands +esid: sec-signed-right-shift-operator-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) >> 1n, 1n, 'The result of (Object(2n) >> 1n) is 1n'); +assert.sameValue(4n >> Object(2n), 1n, 'The result of (4n >> Object(2n)) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({valueOf: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} >> 1n, 1n, 'The result of (({toString: function() {return 2n;}}) >> 1n) is 1n'); + +assert.sameValue(4n >> { + toString: function() { + return 2n; + } +}, 1n, 'The result of (4n >> {toString: function() {return 2n;}}) is 1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/bigint.js b/js/src/tests/test262/language/expressions/right-shift/bigint.js new file mode 100644 index 0000000000..74a4392621 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/bigint.js @@ -0,0 +1,117 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Right shift for BigInt values +esid: sec-numeric-types-bigint-signedRightShift +info: | + BigInt::signedRightShift (x, y) + + The abstract operation BigInt::signedRightShift with arguments x and y of type BigInt: + + 1. Return BigInt::leftShift(x, -y). + + sec-numeric-types-bigint-leftShift + BigInt::leftShift (x, y) + + The abstract operation BigInt::leftShift with two arguments x and y of BigInt: + + 1. If y < 0, + a. Return a BigInt representing x divided by 2-y, rounding down to the nearest integer, including for negative numbers. + 2. Return a BigInt representing x multiplied by 2y. + + NOTE: Semantics here should be equivalent to a bitwise shift, treating the BigInt as an infinite length string of binary two's complement digits. + +features: [BigInt] +---*/ + +assert.sameValue(0n >> 0n, 0n, "0n >> 0n === 0n"); +assert.sameValue(0b101n >> -1n, 0b1010n, "0b101n >> -1n === 0b1010n"); +assert.sameValue(0b101n >> -2n, 0b10100n, "0b101n >> -2n === 0b10100n"); +assert.sameValue(0b101n >> -3n, 0b101000n, "0b101n >> -3n === 0b101000n"); +assert.sameValue(0b101n >> 1n, 0b10n, "0b101n >> 1n === 0b10n"); +assert.sameValue(0b101n >> 2n, 1n, "0b101n >> 2n === 1n"); +assert.sameValue(0b101n >> 3n, 0n, "0b101n >> 3n === 0n"); +assert.sameValue(0n >> -128n, 0n, "0n >> -128n === 0n"); +assert.sameValue(0n >> 128n, 0n, "0n >> 128n === 0n"); +assert.sameValue(0x246n >> 0n, 0x246n, "0x246n >> 0n === 0x246n"); +assert.sameValue(0x246n >> -127n, 0x12300000000000000000000000000000000n, "0x246n >> -127n === 0x12300000000000000000000000000000000n"); +assert.sameValue(0x246n >> -128n, 0x24600000000000000000000000000000000n, "0x246n >> -128n === 0x24600000000000000000000000000000000n"); +assert.sameValue(0x246n >> -129n, 0x48c00000000000000000000000000000000n, "0x246n >> -129n === 0x48c00000000000000000000000000000000n"); +assert.sameValue(0x246n >> 128n, 0n, "0x246n >> 128n === 0n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> -64n, 0x123456789abcdef0fedcba98765432123456780000000000000000n, + "0x123456789abcdef0fedcba9876543212345678n >> -64n === 0x123456789abcdef0fedcba98765432123456780000000000000000n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> -32n, 0x123456789abcdef0fedcba987654321234567800000000n, + "0x123456789abcdef0fedcba9876543212345678n >> -32n === 0x123456789abcdef0fedcba987654321234567800000000n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> -16n, 0x123456789abcdef0fedcba98765432123456780000n, + "0x123456789abcdef0fedcba9876543212345678n >> -16n === 0x123456789abcdef0fedcba98765432123456780000n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> 0n, 0x123456789abcdef0fedcba9876543212345678n, + "0x123456789abcdef0fedcba9876543212345678n >> 0n === 0x123456789abcdef0fedcba9876543212345678n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> 16n, 0x123456789abcdef0fedcba987654321234n, + "0x123456789abcdef0fedcba9876543212345678n >> 16n === 0x123456789abcdef0fedcba987654321234n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> 32n, 0x123456789abcdef0fedcba98765432n, + "0x123456789abcdef0fedcba9876543212345678n >> 32n === 0x123456789abcdef0fedcba98765432n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> 64n, 0x123456789abcdef0fedcban, + "0x123456789abcdef0fedcba9876543212345678n >> 64n === 0x123456789abcdef0fedcban"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> 127n, 0x2468acn, + "0x123456789abcdef0fedcba9876543212345678n >> 127n === 0x2468acn"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> 128n, 0x123456n, + "0x123456789abcdef0fedcba9876543212345678n >> 128n === 0x123456n"); +assert.sameValue( + 0x123456789abcdef0fedcba9876543212345678n >> 129n, 0x91a2bn, + "0x123456789abcdef0fedcba9876543212345678n >> 129n === 0x91a2bn"); +assert.sameValue(-5n >> -1n, -0xan, "-5n >> -1n === -0xan"); +assert.sameValue(-5n >> -2n, -0x14n, "-5n >> -2n === -0x14n"); +assert.sameValue(-5n >> -3n, -0x28n, "-5n >> -3n === -0x28n"); +assert.sameValue(-5n >> 1n, -3n, "-5n >> 1n === -3n"); +assert.sameValue(-5n >> 2n, -2n, "-5n >> 2n === -2n"); +assert.sameValue(-5n >> 3n, -1n, "-5n >> 3n === -1n"); +assert.sameValue(-1n >> -128n, -0x100000000000000000000000000000000n, "-1n >> -128n === -0x100000000000000000000000000000000n"); +assert.sameValue(-1n >> 0n, -1n, "-1n >> 0n === -1n"); +assert.sameValue(-1n >> 128n, -1n, "-1n >> 128n === -1n"); +assert.sameValue(-0x246n >> 0n, -0x246n, "-0x246n >> 0n === -0x246n"); +assert.sameValue(-0x246n >> -127n, -0x12300000000000000000000000000000000n, "-0x246n >> -127n === -0x12300000000000000000000000000000000n"); +assert.sameValue(-0x246n >> -128n, -0x24600000000000000000000000000000000n, "-0x246n >> -128n === -0x24600000000000000000000000000000000n"); +assert.sameValue(-0x246n >> -129n, -0x48c00000000000000000000000000000000n, "-0x246n >> -129n === -0x48c00000000000000000000000000000000n"); +assert.sameValue(-0x246n >> 128n, -1n, "-0x246n >> 128n === -1n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> -64n, -0x123456789abcdef0fedcba98765432123456780000000000000000n, + "-0x123456789abcdef0fedcba9876543212345678n >> -64n === -0x123456789abcdef0fedcba98765432123456780000000000000000n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> -32n, -0x123456789abcdef0fedcba987654321234567800000000n, + "-0x123456789abcdef0fedcba9876543212345678n >> -32n === -0x123456789abcdef0fedcba987654321234567800000000n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> -16n, -0x123456789abcdef0fedcba98765432123456780000n, + "-0x123456789abcdef0fedcba9876543212345678n >> -16n === -0x123456789abcdef0fedcba98765432123456780000n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> 0n, -0x123456789abcdef0fedcba9876543212345678n, + "-0x123456789abcdef0fedcba9876543212345678n >> 0n === -0x123456789abcdef0fedcba9876543212345678n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> 16n, -0x123456789abcdef0fedcba987654321235n, + "-0x123456789abcdef0fedcba9876543212345678n >> 16n === -0x123456789abcdef0fedcba987654321235n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> 32n, -0x123456789abcdef0fedcba98765433n, + "-0x123456789abcdef0fedcba9876543212345678n >> 32n === -0x123456789abcdef0fedcba98765433n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> 64n, -0x123456789abcdef0fedcbbn, + "-0x123456789abcdef0fedcba9876543212345678n >> 64n === -0x123456789abcdef0fedcbbn"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> 127n, -0x2468adn, + "-0x123456789abcdef0fedcba9876543212345678n >> 127n === -0x2468adn"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> 128n, -0x123457n, + "-0x123456789abcdef0fedcba9876543212345678n >> 128n === -0x123457n"); +assert.sameValue( + -0x123456789abcdef0fedcba9876543212345678n >> 129n, -0x91a2cn, + "-0x123456789abcdef0fedcba9876543212345678n >> 129n === -0x91a2cn"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/browser.js b/js/src/tests/test262/language/expressions/right-shift/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/right-shift/order-of-evaluation.js b/js/src/tests/test262/language/expressions/right-shift/order-of-evaluation.js new file mode 100644 index 0000000000..97deea3460 --- /dev/null +++ b/js/src/tests/test262/language/expressions/right-shift/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-signed-right-shift-operator-runtime-semantics-evaluation +description: Type coercion order of operations for right-shift operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() >> (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() >> (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() >> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() >> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() >> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() >> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/right-shift/shell.js b/js/src/tests/test262/language/expressions/right-shift/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/shell.js b/js/src/tests/test262/language/expressions/shell.js new file mode 100644 index 0000000000..43295587f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/shell.js @@ -0,0 +1,16 @@ +// GENERATED, DO NOT EDIT +// file: tcoHelper.js +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: | + This defines the number of consecutive recursive function calls that must be + made in order to prove that stack frames are properly destroyed according to + ES2015 tail call optimization semantics. +defines: [$MAX_ITERATIONS] +---*/ + + + + +var $MAX_ITERATIONS = 100000; diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A1.js new file mode 100644 index 0000000000..32d6948769 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between EqualityExpression and "!==" or + between "!==" and RelationalExpression are allowed +es5id: 11.9.5_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009!==\u00091")) { + throw new Test262Error('#1: 1\\u0009!==\\u00091'); +} + +//CHECK#2 +if (eval("1\u000B!==\u000B1")) { + throw new Test262Error('#2: 1\\u000B!==\\u000B1'); +} + +//CHECK#3 +if (eval("1\u000C!==\u000C1")) { + throw new Test262Error('#3: 1\\u000C!==\\u000C1'); +} + +//CHECK#4 +if (eval("1\u0020!==\u00201")) { + throw new Test262Error('#4: 1\\u0020!==\\u00201'); +} + +//CHECK#5 +if (eval("1\u00A0!==\u00A01")) { + throw new Test262Error('#5: 1\\u00A0!==\\u00A01'); +} + +//CHECK#6 +if (eval("1\u000A!==\u000A1")) { + throw new Test262Error('#6: 1\\u000A!==\\u000A1'); +} + +//CHECK#7 +if (eval("1\u000D!==\u000D1")) { + throw new Test262Error('#7: 1\\u000D!==\\u000D1'); +} + +//CHECK#8 +if (eval("1\u2028!==\u20281")) { + throw new Test262Error('#8: 1\\u2028!==\\u20281'); +} + +//CHECK#9 +if (eval("1\u2029!==\u20291")) { + throw new Test262Error('#9: 1\\u2029!==\\u20291'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029!==\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029!==\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T1.js new file mode 100644 index 0000000000..9d674f6251 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x !== y uses GetValue +es5id: 11.9.5_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 !== 1) { + throw new Test262Error('#1: 1 === 1'); +} + +//CHECK#2 +var x = 1; +if (x !== 1) { + throw new Test262Error('#2: var x = 1; x === 1'); +} + +//CHECK#3 +var y = 1; +if (1 !== y) { + throw new Test262Error('#3: var y = 1; 1 === y'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x !== y) { + throw new Test262Error('#4: var x = 1; var y = 1; x === y'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop !== objecty.prop) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop === objecty.prop'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T2.js new file mode 100644 index 0000000000..9b4ef38fc9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x !== y uses GetValue +es5id: 11.9.5_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x !== 1; + throw new Test262Error('#1.1: x !== 1 throw ReferenceError. Actual: ' + (x !== 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x !== 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T3.js new file mode 100644 index 0000000000..0adf4326da --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x !== y uses GetValue +es5id: 11.9.5_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 !== y; + throw new Test262Error('#1.1: 1 !== y throw ReferenceError. Actual: ' + (1 !== y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 !== y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T1.js new file mode 100644 index 0000000000..d0f71c4bae --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) !== x) { + throw new Test262Error('#1: var x = 0; (x = 1) === x'); +} + +//CHECK#2 +var x = 0; +if (!(x !== (x = 1))) { + throw new Test262Error('#2: var x = 0; x !== (x = 1)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T2.js new file mode 100644 index 0000000000..7b96d6d698 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() !== y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() !== y() throw "x". Actual: ' + (x() !== y())); +} catch (e) { + if (!(e !== "y")) { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() !== y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T3.js new file mode 100644 index 0000000000..9481cd25bf --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T3 +description: Checking undeclarated variables +---*/ + +//CHECK#1 +try { + x !== (x = 1); + throw new Test262Error('#1.1: x !== (x = 1) throw ReferenceError. Actual: ' + (x !== (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x !== (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T4.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T4.js new file mode 100644 index 0000000000..4e57a9b5cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.5_A2.4_T4 +description: Checking undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) !== y) { + throw new Test262Error('#1: (y = 1) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A3.js new file mode 100644 index 0000000000..f1e7a1cc4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Boolean-s. + Return false, if x and y are both true or both false; otherwise, return true +es5id: 11.9.5_A3 +description: x and y are primitive booleans +---*/ + +//CHECK#1 +if (true !== true) { + throw new Test262Error('#1: true === true'); +} + +//CHECK#2 +if (false !== false) { + throw new Test262Error('#2: false === false'); +} + +//CHECK#3 +if (!(true !== false)) { + throw new Test262Error('#3: true !== false'); +} + +//CHECK#4 +if (!(false !== true)) { + throw new Test262Error('#4: false !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T1.js new file mode 100644 index 0000000000..b8e5038443 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return true +es5id: 11.9.5_A4.1_T1 +description: x is NaN +---*/ + +//CHECK#1 +if (!(Number.NaN !== true)) { + throw new Test262Error('#1: NaN !== true'); +} + +//CHECK#2 +if (!(Number.NaN !== 1)) { + throw new Test262Error('#2: NaN !== 1'); +} + +//CHECK#3 +if (!(Number.NaN !== Number.NaN)) { + throw new Test262Error('#3: NaN !== NaN'); +} + +//CHECK#4 +if (!(Number.NaN !== Number.POSITIVE_INFINITY)) { + throw new Test262Error('#4: NaN !== +Infinity'); +} + +//CHECK#5 +if (!(Number.NaN !== Number.NEGATIVE_INFINITY)) { + throw new Test262Error('#5: NaN !== -Infinity'); +} + +//CHECK#6 +if (!(Number.NaN !== Number.MAX_VALUE)) { + throw new Test262Error('#6: NaN !== Number.MAX_VALUE'); +} + +//CHECK#7 +if (!(Number.NaN !== Number.MIN_VALUE)) { + throw new Test262Error('#7: NaN !== Number.MIN_VALUE'); +} + +//CHECK#8 +if (!(Number.NaN !== "string")) { + throw new Test262Error('#8: NaN !== "string"'); +} + +//CHECK#9 +if (!(Number.NaN !== new Object())) { + throw new Test262Error('#9: NaN !== new Object()'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T2.js new file mode 100644 index 0000000000..6e989f4d5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.1_T2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return true +es5id: 11.9.5_A4.1_T2 +description: y is NaN +---*/ + +//CHECK#1 +if (!(true !== Number.NaN)) { + throw new Test262Error('#1: true !== NaN'); +} + +//CHECK#2 +if (!(-1 !== Number.NaN)) { + throw new Test262Error('#2: -1 !== NaN'); +} + +//CHECK#3 +if (!(Number.NaN !== Number.NaN)) { + throw new Test262Error('#3: NaN !== NaN'); +} + +//CHECK#4 +if (!(Number.POSITIVE_INFINITY !== Number.NaN)) { + throw new Test262Error('#4: +Infinity !== NaN'); +} + +//CHECK#5 +if (!(Number.NEGATIVE_INFINITY !== Number.NaN)) { + throw new Test262Error('#5: -Infinity !== NaN'); +} + +//CHECK#6 +if (!(Number.MAX_VALUE !== Number.NaN)) { + throw new Test262Error('#6: Number.MAX_VALUE !== NaN'); +} + +//CHECK#7 +if (!(Number.MIN_VALUE !== Number.NaN)) { + throw new Test262Error('#7: Number.MIN_VALUE !== NaN'); +} + +//CHECK#8 +if (!("string" !== Number.NaN)) { + throw new Test262Error('#8: "string" !== NaN'); +} + +//CHECK#9 +if (!(new Object() !== Number.NaN)) { + throw new Test262Error('#9: new Object() !== NaN'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.2.js new file mode 100644 index 0000000000..93dc5bd2b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0(-0) and y is -0(+0), return false +es5id: 11.9.5_A4.2 +description: Checking all combinations +---*/ + +//CHECK#1 +if (+0 !== -0) { + throw new Test262Error('#1: +0 === -0'); +} + +//CHECK#2 +if (-0 !== +0) { + throw new Test262Error('#2: -0 === +0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.3.js new file mode 100644 index 0000000000..27109a7967 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A4.3.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Number-s minus NaN, +0, -0. + Return false, if x is the same number value as y; otherwise, return true +es5id: 11.9.5_A4.3 +description: x and y are primitive numbers +---*/ + +//CHECK#1 +if (Number.POSITIVE_INFINITY !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: +Infinity === +Infinity'); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2: -Infinity === -Infinity'); +} + +//CHECK#3 +if (13 !== 13) { + throw new Test262Error('#3: 13 === 13'); +} + +//CHECK#4 +if (-13 !== -13) { + throw new Test262Error('#4: -13 === -13'); +} + +//CHECK#5 +if (1.3 !== 1.3) { + throw new Test262Error('#5: 1.3 === 1.3'); +} + +//CHECK#6 +if (-1.3 !== -1.3) { + throw new Test262Error('#6: -1.3 === -1.3'); +} + +//CHECK#7 +if (Number.POSITIVE_INFINITY !== -Number.NEGATIVE_INFINITY) { + throw new Test262Error('#7: +Infinity === -(-Infinity)'); +} + +//CHECK#8 +if (!(1 !== 0.999999999999)) { + throw new Test262Error('#8: 1 !== 0.999999999999'); +} + +//CHECK#9 +if (1.0 !== 1) { + throw new Test262Error('#9: 1.0 === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A5.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A5.js new file mode 100644 index 0000000000..9a2dfe6971 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A5.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are String-s. + Return false, if x and y are exactly the same sequence of characters; otherwise, return true +es5id: 11.9.5_A5 +description: x and y are primitive strings +---*/ + +//CHECK#1 +if ("" !== "") { + throw new Test262Error('#1: "" === ""'); +} + +//CHECK#2 +if (" " !== " ") { + throw new Test262Error('#2: " " === " "'); +} + +//CHECK#3 +if ("string" !== "string") { + throw new Test262Error('#3: "string" === "string"'); +} + +//CHECK#4 +if (!(" string" !== "string ")) { + throw new Test262Error('#4: " string" !== "string "'); +} + +//CHECK#5 +if (!("1.0" !== "1")) { + throw new Test262Error('#5: "1.0" !== "1"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.1.js new file mode 100644 index 0000000000..5e8de33750 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) and Type(y) are Undefined-s, return false +es5id: 11.9.5_A6.1 +description: void 0, eval("var x") is undefined +---*/ + +//CHECK#1 +if (undefined !== undefined) { + throw new Test262Error('#1: undefined === undefined'); +} + +//CHECK#2 +if (void 0 !== undefined) { + throw new Test262Error('#2: void 0 === undefined'); +} + +//CHECK#3 +if (undefined !== eval("var x")) { + throw new Test262Error('#3: undefined === eval("var x")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.2.js new file mode 100644 index 0000000000..853b7a007e --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A6.2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) and Type(y) are Null-s, return false +es5id: 11.9.5_A6.2 +description: null === null +---*/ + +//CHECK#1 +if (null !== null) { + throw new Test262Error('#1: null === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A7.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A7.js new file mode 100644 index 0000000000..6e208ee023 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A7.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Object-s. + Return false, if x and y are references to the same Object; otherwise, return true +es5id: 11.9.5_A7 +description: > + Checking Boolean object, Number object, String object, Object + object +---*/ + +//CHECK#1 +if (!(new Object() !== new Object())) { + throw new Test262Error('#1: new Object() !== new Object()'); +} + +//CHECK#2 +if (!(new Object(true) !== new Object(true))) { + throw new Test262Error('#2: new Object() !== new Object()'); +} + +//CHECK#3 +if (!(new Object(false) !== new Object(false))) { + throw new Test262Error('#3: new Object() !== new Object()'); +} + +//CHECK#4 +if (!(new Object(+0) !== new Object(-0))) { + throw new Test262Error('#4: new Object(+0) !== new Object(-0)'); +} + +//CHECK#5 +var x, y; +x = {}; +y = x; +if (x !== y) { + throw new Test262Error('#5: x = {}; y = x; x === y'); +} + +//CHECK#6 +if (!(new Boolean(true) !== new Number(1))) { + throw new Test262Error('#6 new Boolean(true) !== new Number(1)'); +} + +//CHECK#7 +if (!(new Number(1) !== new String("1"))) { + throw new Test262Error('#7: new Number(1) !== new String("1")'); +} + +//CHECK#8 +if (!(new String("1") !== new Boolean(true))) { + throw new Test262Error('#8: new String("x") !== new Boolean(true)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T1.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T1.js new file mode 100644 index 0000000000..925350c668 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T1.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T1 +description: x or y is primitive boolean +---*/ + +//CHECK#1 +if (!(true !== new Boolean(true))) { + throw new Test262Error('#1: true !== new Number(true)'); +} + +//CHECK#2 +if (!(true !== 1)) { + throw new Test262Error('#2: true !== 1'); +} + +//CHECK#3 +if (!(true !== new Number(true))) { + throw new Test262Error('#3: true !== new Number(true)'); +} + +//CHECK#4 +if (!(true !== "1")) { + throw new Test262Error('#4: true !== "1"'); +} + +//CHECK#5 +if (!(true !== new String(true))) { + throw new Test262Error('#5: true !== new String(true)'); +} + +//CHECK#6 +if (!(new Boolean(false) !== false)) { + throw new Test262Error('#6: new Number(false) !== false'); +} + +//CHECK#7 +if (!(0 !== false)) { + throw new Test262Error('#7: 0 !== false'); +} + +//CHECK#8 +if (!(new Number(false) !== false)) { + throw new Test262Error('#8: new Number(false) !== false'); +} + +//CHECK#9 +if (!("0" !== false)) { + throw new Test262Error('#9: "0" !== false'); +} + +//CHECK#10 +if (!(false !== new String(false))) { + throw new Test262Error('#10: false !== new String(false)'); +} + +//CHECK#11 +if (!(true !== {valueOf: function () {return true}})) { + throw new Test262Error('#11: true !== {valueOf: function () {return true}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T2.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T2.js new file mode 100644 index 0000000000..f2e7ac3cfe --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T2 +description: x or y is primitive number +---*/ + +//CHECK#1 +if (!(1 !== new Number(1))) { + throw new Test262Error('#1: 1 !== new Number(1)'); +} + +//CHECK#2 +if (!(1 !== true)) { + throw new Test262Error('#2: 1 !== true'); +} + +//CHECK#3 +if (!(1 !== new Boolean(1))) { + throw new Test262Error('#3: 1 !== new Boolean(1)'); +} + +//CHECK#4 +if (!(1 !== "1")) { + throw new Test262Error('#4: 1 !== "1"'); +} + +//CHECK#5 +if (!(1 !== new String(1))) { + throw new Test262Error('#5: 1 !== new String(1)'); +} + +//CHECK#6 +if (!(new Number(0) !== 0)) { + throw new Test262Error('#6: new Number(0) !== 0'); +} + +//CHECK#7 +if (!(false !== 0)) { + throw new Test262Error('#7: false !== 0'); +} + +//CHECK#8 +if (!(new Boolean(0) !== 0)) { + throw new Test262Error('#8: new Boolean(0) !== 0'); +} + +//CHECK#9 +if (!("0" !== 0)) { + throw new Test262Error('#9: "0" !== 0'); +} + +//CHECK#10 +if (!(new String(0) !== 0)) { + throw new Test262Error('#10: new String(0) !== 0'); +} + +//CHECK#11 +if (!(1 !== {valueOf: function () {return 1}})) { + throw new Test262Error('#11: 1 !== {valueOf: function () {return 1}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T3.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T3.js new file mode 100644 index 0000000000..fd84fe711f --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T3.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T3 +description: x or y is primitive string +---*/ + +//CHECK#1 +if (!("1" !== new String("1"))) { + throw new Test262Error('#1: "1" !== new String("1")'); +} + +//CHECK#2 +if (!("1" !== true)) { + throw new Test262Error('#2: "1" !== true'); +} + +//CHECK#3 +if (!("1" !== new Boolean("1"))) { + throw new Test262Error('#3: "1" !== new Boolean("1")'); +} + +//CHECK#4 +if (!("1" !== 1)) { + throw new Test262Error('#4: "1" === 1'); +} + +//CHECK#5 +if (!("1" !== new Number("1"))) { + throw new Test262Error('#5: "1" === new Number("1")'); +} + +//CHECK#6 +if (!(new String(false) !== false)) { + throw new Test262Error('#6: new Number(false) !== false'); +} + +//CHECK#7 +if (!(false !== "0")) { + throw new Test262Error('#7: false !== "0"'); +} + +//CHECK#8 +if (!("0" !== new Boolean("0"))) { + throw new Test262Error('#8: "0" !== new Boolean("0")'); +} + +//CHECK#9 +if (!(false !== 0)) { + throw new Test262Error('#9: false !== 0'); +} + +//CHECK#10 +if (!(false !== new Number(false))) { + throw new Test262Error('#10: false !== new Number(false)'); +} + +//CHECK#11 +if (!("1" !== {valueOf: function () {return "1"}})) { + throw new Test262Error('#11: "1" !== {valueOf: function () {return "1"}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T4.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T4.js new file mode 100644 index 0000000000..ccfb0fa966 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T4.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T4 +description: x or y is null or undefined +---*/ + +//CHECK#1 +if (!(undefined !== null)) { + throw new Test262Error('#1: undefined !== null'); +} + +//CHECK#2 +if (!(null !== undefined)) { + throw new Test262Error('#2: null !== undefined'); +} + +//CHECK#3 +if (!(null !== 0)) { + throw new Test262Error('#3: null !== 0'); +} + +//CHECK#4 +if (!(0 !== null)) { + throw new Test262Error('#4: 0 !== null'); +} + +//CHECK#5 +if (!(null !== false)) { + throw new Test262Error('#5: null !== false'); +} + +//CHECK#6 +if (!(false !== null)) { + throw new Test262Error('#6: false !== null'); +} + +//CHECK#7 +if (!(undefined !== false)) { + throw new Test262Error('#7: undefined !== false'); +} + +//CHECK#8 +if (!(false !== undefined)) { + throw new Test262Error('#8: false !== undefined'); +} + +//CHECK#9 +if (!(null !== new Object())) { + throw new Test262Error('#9: null !== new Object()'); +} + +//CHECK#10 +if (!(new Object() !== null)) { + throw new Test262Error('#10: new Object() !== null'); +} + +//CHECK#11 +if (!(null !== "null")) { + throw new Test262Error('#11: null !== "null"'); +} + +//CHECK#12 +if (!("null" !== null)) { + throw new Test262Error('#12: "null" !== null'); +} + +//CHECK#13 +if (!(undefined !== "undefined")) { + throw new Test262Error('#13: undefined !== "undefined"'); +} + +//CHECK#14 +if (!("undefined" !== undefined)) { + throw new Test262Error('#14: "undefined" !== undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T5.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T5.js new file mode 100644 index 0000000000..4f5dd4f96a --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/S11.9.5_A8_T5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return true +es5id: 11.9.5_A8_T5 +description: > + Checking such x and y that either x or y is primitive string and + the other is primitive number +---*/ + +//CHECK#1 +try { + throw 1; +} catch(e) { + if (!(e !== "1")) { + throw new Test262Error('#1: throw 1 !== "1"'); + } +} + +//CHECK#2 +try { + throw "1"; +} catch(e) { + if (!(1 !== e)) { + throw new Test262Error('#2: 1 !== throw "1"'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-bigint.js new file mode 100644 index 0000000000..7aad2a21d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-bigint.js @@ -0,0 +1,174 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + 2. If Type(x) is Number or BigInt, then + a. Return ! Type(x)::equal(x, y). + + sec-numeric-types-bigint-equal + BigInt::equal (x, y) + + The abstract operation BigInt::equal with two arguments x and y of BigInt type returns true if x and y have the same mathematical integer value and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n !== 0n, false, 'The result of (0n !== 0n) is false'); +assert.sameValue(1n !== 1n, false, 'The result of (1n !== 1n) is false'); +assert.sameValue(-1n !== -1n, false, 'The result of (-1n !== -1n) is false'); +assert.sameValue(0n !== -0n, false, 'The result of (0n !== -0n) is false'); +assert.sameValue(-0n !== 0n, false, 'The result of (-0n !== 0n) is false'); +assert.sameValue(0n !== 1n, true, 'The result of (0n !== 1n) is true'); +assert.sameValue(1n !== 0n, true, 'The result of (1n !== 0n) is true'); +assert.sameValue(0n !== -1n, true, 'The result of (0n !== -1n) is true'); +assert.sameValue(-1n !== 0n, true, 'The result of (-1n !== 0n) is true'); +assert.sameValue(1n !== -1n, true, 'The result of (1n !== -1n) is true'); +assert.sameValue(-1n !== 1n, true, 'The result of (-1n !== 1n) is true'); + +assert.sameValue( + 0x1fffffffffffff01n !== 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x1fffffffffffff01n !== 0x1fffffffffffff02n, + true, + 'The result of (0x1fffffffffffff01n !== 0x1fffffffffffff02n) is true' +); + +assert.sameValue( + 0x1fffffffffffff02n !== 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff02n !== 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n !== -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n !== -0x1fffffffffffff02n, + true, + 'The result of (-0x1fffffffffffff01n !== -0x1fffffffffffff02n) is true' +); + +assert.sameValue( + -0x1fffffffffffff02n !== -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff02n !== -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 0n, + true, + 'The result of (0x10000000000000000n !== 0n) is true' +); + +assert.sameValue( + 0n !== 0x10000000000000000n, + true, + 'The result of (0n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 1n, + true, + 'The result of (0x10000000000000000n !== 1n) is true' +); + +assert.sameValue( + 1n !== 0x10000000000000000n, + true, + 'The result of (1n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== -1n, + true, + 'The result of (0x10000000000000000n !== -1n) is true' +); + +assert.sameValue( + -1n !== 0x10000000000000000n, + true, + 'The result of (-1n !== 0x10000000000000000n) is true' +); + +assert.sameValue( + 0x10000000000000001n !== 0n, + true, + 'The result of (0x10000000000000001n !== 0n) is true' +); + +assert.sameValue( + 0n !== 0x10000000000000001n, + true, + 'The result of (0n !== 0x10000000000000001n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== 0n, + true, + 'The result of (-0x10000000000000000n !== 0n) is true' +); + +assert.sameValue( + 0n !== -0x10000000000000000n, + true, + 'The result of (0n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== 1n, + true, + 'The result of (-0x10000000000000000n !== 1n) is true' +); + +assert.sameValue( + 1n !== -0x10000000000000000n, + true, + 'The result of (1n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000000n !== -1n, + true, + 'The result of (-0x10000000000000000n !== -1n) is true' +); + +assert.sameValue( + -1n !== -0x10000000000000000n, + true, + 'The result of (-1n !== -0x10000000000000000n) is true' +); + +assert.sameValue( + -0x10000000000000001n !== 0n, + true, + 'The result of (-0x10000000000000001n !== 0n) is true' +); + +assert.sameValue( + 0n !== -0x10000000000000001n, + true, + 'The result of (0n !== -0x10000000000000001n) is true' +); + +assert.sameValue( + 0x10000000000000000n !== 0x100000000n, + true, + 'The result of (0x10000000000000000n !== 0x100000000n) is true' +); + +assert.sameValue( + 0x100000000n !== 0x10000000000000000n, + true, + 'The result of (0x100000000n !== 0x10000000000000000n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-boolean.js new file mode 100644 index 0000000000..ff251f8e5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-boolean.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and Boolean values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(-1n !== false, true, 'The result of (-1n !== false) is true'); +assert.sameValue(false !== -1n, true, 'The result of (false !== -1n) is true'); +assert.sameValue(-1n !== true, true, 'The result of (-1n !== true) is true'); +assert.sameValue(true !== -1n, true, 'The result of (true !== -1n) is true'); +assert.sameValue(0n !== false, true, 'The result of (0n !== false) is true'); +assert.sameValue(false !== 0n, true, 'The result of (false !== 0n) is true'); +assert.sameValue(0n !== true, true, 'The result of (0n !== true) is true'); +assert.sameValue(true !== 0n, true, 'The result of (true !== 0n) is true'); +assert.sameValue(1n !== false, true, 'The result of (1n !== false) is true'); +assert.sameValue(false !== 1n, true, 'The result of (false !== 1n) is true'); +assert.sameValue(1n !== true, true, 'The result of (1n !== true) is true'); +assert.sameValue(true !== 1n, true, 'The result of (true !== 1n) is true'); +assert.sameValue(2n !== false, true, 'The result of (2n !== false) is true'); +assert.sameValue(false !== 2n, true, 'The result of (false !== 2n) is true'); +assert.sameValue(2n !== true, true, 'The result of (2n !== true) is true'); +assert.sameValue(true !== 2n, true, 'The result of (true !== 2n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js new file mode 100644 index 0000000000..12f2b4cdd4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-incomparable-primitive.js @@ -0,0 +1,24 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and miscellaneous primitive values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt, Symbol] +---*/ +assert.sameValue(0n !== undefined, true, 'The result of (0n !== undefined) is true'); +assert.sameValue(undefined !== 0n, true, 'The result of (undefined !== 0n) is true'); +assert.sameValue(1n !== undefined, true, 'The result of (1n !== undefined) is true'); +assert.sameValue(undefined !== 1n, true, 'The result of (undefined !== 1n) is true'); +assert.sameValue(0n !== null, true, 'The result of (0n !== null) is true'); +assert.sameValue(null !== 0n, true, 'The result of (null !== 0n) is true'); +assert.sameValue(1n !== null, true, 'The result of (1n !== null) is true'); +assert.sameValue(null !== 1n, true, 'The result of (null !== 1n) is true'); +assert.sameValue(0n !== Symbol('1'), true, 'The result of (0n !== Symbol("1")) is true'); +assert.sameValue(Symbol('1') !== 0n, true, 'The result of (Symbol("1") !== 0n) is true'); +assert.sameValue(1n !== Symbol('1'), true, 'The result of (1n !== Symbol("1")) is true'); +assert.sameValue(Symbol('1') !== 1n, true, 'The result of (Symbol("1") !== 1n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-non-finite.js new file mode 100644 index 0000000000..4822a94f7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-non-finite.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and non-finite Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== Infinity, true, 'The result of (0n !== Infinity) is true'); +assert.sameValue(Infinity !== 0n, true, 'The result of (Infinity !== 0n) is true'); +assert.sameValue(1n !== Infinity, true, 'The result of (1n !== Infinity) is true'); +assert.sameValue(Infinity !== 1n, true, 'The result of (Infinity !== 1n) is true'); +assert.sameValue(-1n !== Infinity, true, 'The result of (-1n !== Infinity) is true'); +assert.sameValue(Infinity !== -1n, true, 'The result of (Infinity !== -1n) is true'); +assert.sameValue(0n !== -Infinity, true, 'The result of (0n !== -Infinity) is true'); +assert.sameValue(-Infinity !== 0n, true, 'The result of (-Infinity !== 0n) is true'); +assert.sameValue(1n !== -Infinity, true, 'The result of (1n !== -Infinity) is true'); +assert.sameValue(-Infinity !== 1n, true, 'The result of (-Infinity !== 1n) is true'); +assert.sameValue(-1n !== -Infinity, true, 'The result of (-1n !== -Infinity) is true'); +assert.sameValue(-Infinity !== -1n, true, 'The result of (-Infinity !== -1n) is true'); +assert.sameValue(0n !== NaN, true, 'The result of (0n !== NaN) is true'); +assert.sameValue(NaN !== 0n, true, 'The result of (NaN !== 0n) is true'); +assert.sameValue(1n !== NaN, true, 'The result of (1n !== NaN) is true'); +assert.sameValue(NaN !== 1n, true, 'The result of (NaN !== 1n) is true'); +assert.sameValue(-1n !== NaN, true, 'The result of (-1n !== NaN) is true'); +assert.sameValue(NaN !== -1n, true, 'The result of (NaN !== -1n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js new file mode 100644 index 0000000000..5fc465a5f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number-extremes.js @@ -0,0 +1,62 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and large Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(1n !== Number.MAX_VALUE, true, 'The result of (1n !== Number.MAX_VALUE) is true'); +assert.sameValue(Number.MAX_VALUE !== 1n, true, 'The result of (Number.MAX_VALUE !== 1n) is true'); + +assert.sameValue( + 1n !== -Number.MAX_VALUE, + true, + 'The result of (1n !== -Number.MAX_VALUE) is true' +); + +assert.sameValue( + -Number.MAX_VALUE !== 1n, + true, + 'The result of (-Number.MAX_VALUE !== 1n) is true' +); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn !== Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + true, + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n !== Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + true, + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is true' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE, + true, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n !== Number.MAX_VALUE) is true' +); + +assert.sameValue( + Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + true, + 'The result of (Number.MAX_VALUE !== 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number.js new file mode 100644 index 0000000000..48c2979a7c --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-number.js @@ -0,0 +1,52 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== 0, true, 'The result of (0n !== 0) is true'); +assert.sameValue(0 !== 0n, true, 'The result of (0 !== 0n) is true'); +assert.sameValue(0n !== -0, true, 'The result of (0n !== -0) is true'); +assert.sameValue(-0 !== 0n, true, 'The result of (-0 !== 0n) is true'); +assert.sameValue(0n !== 0.000000000001, true, 'The result of (0n !== 0.000000000001) is true'); +assert.sameValue(0.000000000001 !== 0n, true, 'The result of (0.000000000001 !== 0n) is true'); +assert.sameValue(0n !== 1, true, 'The result of (0n !== 1) is true'); +assert.sameValue(1 !== 0n, true, 'The result of (1 !== 0n) is true'); +assert.sameValue(1n !== 0, true, 'The result of (1n !== 0) is true'); +assert.sameValue(0 !== 1n, true, 'The result of (0 !== 1n) is true'); +assert.sameValue(1n !== 0.999999999999, true, 'The result of (1n !== 0.999999999999) is true'); +assert.sameValue(0.999999999999 !== 1n, true, 'The result of (0.999999999999 !== 1n) is true'); +assert.sameValue(1n !== 1, true, 'The result of (1n !== 1) is true'); +assert.sameValue(1 !== 1n, true, 'The result of (1 !== 1n) is true'); +assert.sameValue(0n !== Number.MIN_VALUE, true, 'The result of (0n !== Number.MIN_VALUE) is true'); +assert.sameValue(Number.MIN_VALUE !== 0n, true, 'The result of (Number.MIN_VALUE !== 0n) is true'); + +assert.sameValue( + 0n !== -Number.MIN_VALUE, + true, + 'The result of (0n !== -Number.MIN_VALUE) is true' +); + +assert.sameValue( + -Number.MIN_VALUE !== 0n, + true, + 'The result of (-Number.MIN_VALUE !== 0n) is true' +); + +assert.sameValue( + -10n !== Number.MIN_VALUE, + true, + 'The result of (-10n !== Number.MIN_VALUE) is true' +); + +assert.sameValue( + Number.MIN_VALUE !== -10n, + true, + 'The result of (Number.MIN_VALUE !== -10n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-object.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-object.js new file mode 100644 index 0000000000..e273cc7d7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-object.js @@ -0,0 +1,124 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt values and non-primitive objects +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== Object(0n), true, 'The result of (0n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 0n, true, 'The result of (Object(0n) !== 0n) is true'); +assert.sameValue(0n !== Object(1n), true, 'The result of (0n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 0n, true, 'The result of (Object(1n) !== 0n) is true'); +assert.sameValue(1n !== Object(0n), true, 'The result of (1n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 1n, true, 'The result of (Object(0n) !== 1n) is true'); +assert.sameValue(1n !== Object(1n), true, 'The result of (1n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 1n, true, 'The result of (Object(1n) !== 1n) is true'); +assert.sameValue(2n !== Object(0n), true, 'The result of (2n !== Object(0n)) is true'); +assert.sameValue(Object(0n) !== 2n, true, 'The result of (Object(0n) !== 2n) is true'); +assert.sameValue(2n !== Object(1n), true, 'The result of (2n !== Object(1n)) is true'); +assert.sameValue(Object(1n) !== 2n, true, 'The result of (Object(1n) !== 2n) is true'); +assert.sameValue(2n !== Object(2n), true, 'The result of (2n !== Object(2n)) is true'); +assert.sameValue(Object(2n) !== 2n, true, 'The result of (Object(2n) !== 2n) is true'); +assert.sameValue(0n !== {}, true, 'The result of (0n !== {}) is true'); +assert.sameValue({} !== 0n, true, 'The result of (({}) !== 0n) is true'); + +assert.sameValue(0n !== { + valueOf: function() { + return 0n; + } +}, true, 'The result of (0n !== {valueOf: function() {return 0n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} !== 0n, true, 'The result of (({valueOf: function() {return 0n;}}) !== 0n) is true'); + +assert.sameValue(0n !== { + valueOf: function() { + return 1n; + } +}, true, 'The result of (0n !== {valueOf: function() {return 1n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} !== 0n, true, 'The result of (({valueOf: function() {return 1n;}}) !== 0n) is true'); + +assert.sameValue(0n !== { + toString: function() { + return '0'; + } +}, true, 'The result of (0n !== {toString: function() {return "0";}}) is true'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} !== 0n, true, 'The result of (({toString: function() {return "0";}}) !== 0n) is true'); + +assert.sameValue(0n !== { + toString: function() { + return '1'; + } +}, true, 'The result of (0n !== {toString: function() {return "1";}}) is true'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} !== 0n, true, 'The result of (({toString: function() {return "1";}}) !== 0n) is true'); + +assert.sameValue(900719925474099101n !== { + valueOf: function() { + return 900719925474099101n; + } +}, true, 'The result of (900719925474099101n !== {valueOf: function() {return 900719925474099101n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} !== 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099101n;}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + valueOf: function() { + return 900719925474099102n; + } +}, true, 'The result of (900719925474099101n !== {valueOf: function() {return 900719925474099102n;}}) is true'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} !== 900719925474099101n, true, 'The result of (({valueOf: function() {return 900719925474099102n;}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + toString: function() { + return '900719925474099101'; + } +}, true, 'The result of (900719925474099101n !== {toString: function() {return "900719925474099101";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} !== 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099101";}}) !== 900719925474099101n) is true'); + +assert.sameValue(900719925474099101n !== { + toString: function() { + return '900719925474099102'; + } +}, true, 'The result of (900719925474099101n !== {toString: function() {return "900719925474099102";}}) is true'); + +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} !== 900719925474099101n, true, 'The result of (({toString: function() {return "900719925474099102";}}) !== 900719925474099101n) is true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-string.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-string.js new file mode 100644 index 0000000000..d2562ff7a1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-does-not-equals/bigint-and-string.js @@ -0,0 +1,68 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict inequality comparison of BigInt and String values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n !== '', true, 'The result of (0n !== "") is true'); +assert.sameValue('' !== 0n, true, 'The result of ("" !== 0n) is true'); +assert.sameValue(0n !== '-0', true, 'The result of (0n !== "-0") is true'); +assert.sameValue('-0' !== 0n, true, 'The result of ("-0" !== 0n) is true'); +assert.sameValue(0n !== '0', true, 'The result of (0n !== "0") is true'); +assert.sameValue('0' !== 0n, true, 'The result of ("0" !== 0n) is true'); +assert.sameValue(0n !== '-1', true, 'The result of (0n !== "-1") is true'); +assert.sameValue('-1' !== 0n, true, 'The result of ("-1" !== 0n) is true'); +assert.sameValue(0n !== '1', true, 'The result of (0n !== "1") is true'); +assert.sameValue('1' !== 0n, true, 'The result of ("1" !== 0n) is true'); +assert.sameValue(0n !== 'foo', true, 'The result of (0n !== "foo") is true'); +assert.sameValue('foo' !== 0n, true, 'The result of ("foo" !== 0n) is true'); +assert.sameValue(1n !== '', true, 'The result of (1n !== "") is true'); +assert.sameValue('' !== 1n, true, 'The result of ("" !== 1n) is true'); +assert.sameValue(1n !== '-0', true, 'The result of (1n !== "-0") is true'); +assert.sameValue('-0' !== 1n, true, 'The result of ("-0" !== 1n) is true'); +assert.sameValue(1n !== '0', true, 'The result of (1n !== "0") is true'); +assert.sameValue('0' !== 1n, true, 'The result of ("0" !== 1n) is true'); +assert.sameValue(1n !== '-1', true, 'The result of (1n !== "-1") is true'); +assert.sameValue('-1' !== 1n, true, 'The result of ("-1" !== 1n) is true'); +assert.sameValue(1n !== '1', true, 'The result of (1n !== "1") is true'); +assert.sameValue('1' !== 1n, true, 'The result of ("1" !== 1n) is true'); +assert.sameValue(1n !== 'foo', true, 'The result of (1n !== "foo") is true'); +assert.sameValue('foo' !== 1n, true, 'The result of ("foo" !== 1n) is true'); +assert.sameValue(-1n !== '-', true, 'The result of (-1n !== "-") is true'); +assert.sameValue('-' !== -1n, true, 'The result of ("-" !== -1n) is true'); +assert.sameValue(-1n !== '-0', true, 'The result of (-1n !== "-0") is true'); +assert.sameValue('-0' !== -1n, true, 'The result of ("-0" !== -1n) is true'); +assert.sameValue(-1n !== '-1', true, 'The result of (-1n !== "-1") is true'); +assert.sameValue('-1' !== -1n, true, 'The result of ("-1" !== -1n) is true'); +assert.sameValue(-1n !== '-foo', true, 'The result of (-1n !== "-foo") is true'); +assert.sameValue('-foo' !== -1n, true, 'The result of ("-foo" !== -1n) is true'); + +assert.sameValue( + 900719925474099101n !== '900719925474099101', + true, + 'The result of (900719925474099101n !== "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' !== 900719925474099101n, + true, + 'The result of ("900719925474099101" !== 900719925474099101n) is true' +); + +assert.sameValue( + 900719925474099102n !== '900719925474099101', + true, + 'The result of (900719925474099102n !== "900719925474099101") is true' +); + +assert.sameValue( + '900719925474099101' !== 900719925474099102n, + true, + 'The result of ("900719925474099101" !== 900719925474099102n) is true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/browser.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/strict-does-not-equals/shell.js b/js/src/tests/test262/language/expressions/strict-does-not-equals/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A1.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A1.js new file mode 100644 index 0000000000..081b35c1ee --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between EqualityExpression and "===" or + between "===" and RelationalExpression are allowed +es5id: 11.9.4_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (!(eval("1\u0009===\u00091"))) { + throw new Test262Error('#1: 1\\u0009===\\u00091'); +} + +//CHECK#2 +if (!(eval("1\u000B===\u000B1"))) { + throw new Test262Error('#2: 1\\u000B===\\u000B1'); +} + +//CHECK#3 +if (!(eval("1\u000C===\u000C1"))) { + throw new Test262Error('#3: 1\\u000C===\\u000C1'); +} + +//CHECK#4 +if (!(eval("1\u0020===\u00201"))) { + throw new Test262Error('#4: 1\\u0020===\\u00201'); +} + +//CHECK#5 +if (!(eval("1\u00A0===\u00A01"))) { + throw new Test262Error('#5: 1\\u00A0===\\u00A01'); +} + +//CHECK#6 +if (!(eval("1\u000A===\u000A1"))) { + throw new Test262Error('#6: 1\\u000A===\\u000A1'); +} + +//CHECK#7 +if (!(eval("1\u000D===\u000D1"))) { + throw new Test262Error('#7: 1\\u000D===\\u000D1'); +} + +//CHECK#8 +if (!(eval("1\u2028===\u20281"))) { + throw new Test262Error('#8: 1\\u2028===\\u20281'); +} + +//CHECK#9 +if (!(eval("1\u2029===\u20291"))) { + throw new Test262Error('#9: 1\\u2029===\\u20291'); +} + +//CHECK#10 +if (!(eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029===\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291"))) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029===\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T1.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T1.js new file mode 100644 index 0000000000..10919e7acf --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x === y uses GetValue +es5id: 11.9.4_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (!(1 === 1)) { + throw new Test262Error('#1: 1 === 1'); +} + +//CHECK#2 +var x = 1; +if (!(x === 1)) { + throw new Test262Error('#2: var x = 1; x === 1'); +} + +//CHECK#3 +var y = 1; +if (!(1 === y)) { + throw new Test262Error('#3: var y = 1; 1 === y'); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (!(x === y)) { + throw new Test262Error('#4: var x = 1; var y = 1; x === y'); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (!(objectx.prop === objecty.prop)) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop === objecty.prop'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T2.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T2.js new file mode 100644 index 0000000000..ee6341dfca --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x === y uses GetValue +es5id: 11.9.4_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x === 1; + throw new Test262Error('#1.1: x === 1 throw ReferenceError. Actual: ' + (x === 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x === 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T3.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T3.js new file mode 100644 index 0000000000..c9df9bd6b3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x === y uses GetValue +es5id: 11.9.4_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 === y; + throw new Test262Error('#1.1: 1 === y throw ReferenceError. Actual: ' + (1 === y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 === y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T1.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T1.js new file mode 100644 index 0000000000..f3f3eeea5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.4_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if (!((x = 1) === x)) { + throw new Test262Error('#1: var x = 0; (x = 1) === x'); +} + +//CHECK#2 +var x = 0; +if (x === (x = 1)) { + throw new Test262Error('#2: var x = 0; x !== (x = 1)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T2.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T2.js new file mode 100644 index 0000000000..71e1d8553f --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.4_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() === y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() === y() throw "x". Actual: ' + (x() === y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (!(e === "x")) { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() === y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T3.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T3.js new file mode 100644 index 0000000000..13c7a074be --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.4_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x === (x = 1); + throw new Test262Error('#1.1: x === (x = 1) throw ReferenceError. Actual: ' + (x === (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x === (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T4.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T4.js new file mode 100644 index 0000000000..7482c27750 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.9.4_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if (!((y = 1) === y)) { + throw new Test262Error('#1: (y = 1) === y'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A3.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A3.js new file mode 100644 index 0000000000..f21a96c5e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Boolean-s. + Return true, if x and y are both true and both false; otherwise, return false +es5id: 11.9.4_A3 +description: x and y are primitive booleans +---*/ + +//CHECK#1 +if (!(true === true)) { + throw new Test262Error('#1: true === true'); +} + +//CHECK#2 +if (!(false === false)) { + throw new Test262Error('#2: false === false'); +} + +//CHECK#3 +if (true === false) { + throw new Test262Error('#3: true !== false'); +} + +//CHECK#4 +if (false === true) { + throw new Test262Error('#4: false !== true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T1.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T1.js new file mode 100644 index 0000000000..f106c9c5da --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T1.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return false +es5id: 11.9.4_A4.1_T1 +description: x is NaN +---*/ + +//CHECK#1 +if (Number.NaN === true) { + throw new Test262Error('#1: NaN !== true'); +} + +//CHECK#2 +if (Number.NaN === 1) { + throw new Test262Error('#2: NaN !== 1'); +} + +//CHECK#3 +if (Number.NaN === Number.NaN) { + throw new Test262Error('#3: NaN !== NaN'); +} + +//CHECK#4 +if (Number.NaN === Number.POSITIVE_INFINITY) { + throw new Test262Error('#4: NaN !== +Infinity'); +} + +//CHECK#5 +if (Number.NaN === Number.NEGATIVE_INFINITY) { + throw new Test262Error('#5: NaN !== -Infinity'); +} + +//CHECK#6 +if (Number.NaN === Number.MAX_VALUE) { + throw new Test262Error('#6: NaN !== Number.MAX_VALUE'); +} + +//CHECK#7 +if (Number.NaN === Number.MIN_VALUE) { + throw new Test262Error('#7: NaN !== Number.MIN_VALUE'); +} + +//CHECK#8 +if (Number.NaN === "string") { + throw new Test262Error('#8: NaN !== "string"'); +} + +//CHECK#9 +if (Number.NaN === new Object()) { + throw new Test262Error('#9: NaN !== new Object()'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T2.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T2.js new file mode 100644 index 0000000000..ed54c3e466 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.1_T2.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x or y is NaN, return false +es5id: 11.9.4_A4.1_T2 +description: y is NaN +---*/ + +//CHECK#1 +if (true === Number.NaN) { + throw new Test262Error('#1: true !== NaN'); +} + +//CHECK#2 +if (-1 === Number.NaN) { + throw new Test262Error('#2: -1 !== NaN'); +} + +//CHECK#3 +if (Number.NaN === Number.NaN) { + throw new Test262Error('#3: NaN !== NaN'); +} + +//CHECK#4 +if (Number.POSITIVE_INFINITY === Number.NaN) { + throw new Test262Error('#4: +Infinity !== NaN'); +} + +//CHECK#5 +if (Number.NEGATIVE_INFINITY === Number.NaN) { + throw new Test262Error('#5: -Infinity !== NaN'); +} + +//CHECK#6 +if (Number.MAX_VALUE === Number.NaN) { + throw new Test262Error('#6: Number.MAX_VALUE !== NaN'); +} + +//CHECK#7 +if (Number.MIN_VALUE === Number.NaN) { + throw new Test262Error('#7: Number.MIN_VALUE !== NaN'); +} + +//CHECK#8 +if ("string" === Number.NaN) { + throw new Test262Error('#8: "string" !== NaN'); +} + +//CHECK#9 +if (new Object() === Number.NaN) { + throw new Test262Error('#9: new Object() !== NaN'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.2.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.2.js new file mode 100644 index 0000000000..545f25c6eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is +0(-0) and y is -0(+0), return true +es5id: 11.9.4_A4.2 +description: Checking all combinations +---*/ + +//CHECK#1 +if (!(+0 === -0)) { + throw new Test262Error('#1: +0 === -0'); +} + +//CHECK#2 +if (!(-0 === +0)) { + throw new Test262Error('#2: -0 === +0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.3.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.3.js new file mode 100644 index 0000000000..d13ef1e47b --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A4.3.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Number-s minus NaN, +0, -0. + Return true, if x is the same number value as y; otherwise, return false +es5id: 11.9.4_A4.3 +description: x and y are primitive numbers +---*/ + +//CHECK#1 +if (!(Number.POSITIVE_INFINITY === Number.POSITIVE_INFINITY)) { + throw new Test262Error('#1: +Infinity === +Infinity'); +} + +//CHECK#2 +if (!(Number.NEGATIVE_INFINITY === Number.NEGATIVE_INFINITY)) { + throw new Test262Error('#2: -Infinity === -Infinity'); +} + +//CHECK#3 +if (!(13 === 13)) { + throw new Test262Error('#3: 13 === 13'); +} + +//CHECK#4 +if (!(-13 === -13)) { + throw new Test262Error('#4: -13 === -13'); +} + +//CHECK#5 +if (!(1.3 === 1.3)) { + throw new Test262Error('#5: 1.3 === 1.3'); +} + +//CHECK#6 +if (!(-1.3 === -1.3)) { + throw new Test262Error('#6: -1.3 === -1.3'); +} + +//CHECK#7 +if (!(Number.POSITIVE_INFINITY === -Number.NEGATIVE_INFINITY)) { + throw new Test262Error('#7: +Infinity === -(-Infinity)'); +} + +//CHECK#8 +if (1 === 0.999999999999) { + throw new Test262Error('#8: 1 !== 0.999999999999'); +} + +//CHECK#9 +if (!(1.0 === 1)) { + throw new Test262Error('#9: 1.0 === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A5.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A5.js new file mode 100644 index 0000000000..f2149a646e --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A5.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are String-s. + Return true, if x and y are exactly the same sequence of characters; otherwise, return false +es5id: 11.9.4_A5 +description: x and y are primitive strings +---*/ + +//CHECK#1 +if (!("" === "")) { + throw new Test262Error('#1: "" === ""'); +} + +//CHECK#2 +if (!(" " === " ")) { + throw new Test262Error('#2: " " === " "'); +} + +//CHECK#3 +if (!("string" === "string")) { + throw new Test262Error('#3: "string" === "string"'); +} + +//CHECK#4 +if (" string" === "string ") { + throw new Test262Error('#4: " string" !== "string "'); +} + +//CHECK#5 +if ("1.0" === "1") { + throw new Test262Error('#5: "1.0" !== "1"'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.1.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.1.js new file mode 100644 index 0000000000..bab1dcaa5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) and Type(y) are Undefined-s, return true +es5id: 11.9.4_A6.1 +description: void 0, eval("var x") is undefined +---*/ + +//CHECK#1 +if (!(undefined === undefined)) { + throw new Test262Error('#1: undefined === undefined'); +} + +//CHECK#2 +if (!(void 0 === undefined)) { + throw new Test262Error('#2: void 0 === undefined'); +} + +//CHECK#3 +if (!(undefined === eval("var x"))) { + throw new Test262Error('#3: undefined === eval("var x")'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.2.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.2.js new file mode 100644 index 0000000000..755d8bfa9d --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A6.2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) and Type(y) are Null-s, return true +es5id: 11.9.4_A6.2 +description: null === null +---*/ + +//CHECK#1 +if (!(null === null)) { + throw new Test262Error('#1: null === null'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A7.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A7.js new file mode 100644 index 0000000000..bf62eda236 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A7.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Type(x) and Type(y) are Object-s. + Return true, if x and y are references to the same Object; otherwise, return false +es5id: 11.9.4_A7 +description: > + Checking Boolean object, Number object, String object, Object + object +---*/ + +//CHECK#1 +if (new Object() === new Object()) { + throw new Test262Error('#1: new Object() !== new Object()'); +} + +//CHECK#2 +if (new Object(true) === new Object(true)) { + throw new Test262Error('#2: new Object() !== new Object()'); +} + +//CHECK#3 +if (new Object(false) === new Object(false)) { + throw new Test262Error('#3: new Object() !== new Object()'); +} + +//CHECK#4 +if (new Object(+0) === new Object(-0)) { + throw new Test262Error('#4: new Object(+0) !== new Object(-0)'); +} + +//CHECK#5 +var x, y; +x = {}; +y = x; +if (!(x === y)) { + throw new Test262Error('#5: x = {}; y = x; x === y'); +} + +//CHECK#6 +if (new Boolean(true) === new Number(1)) { + throw new Test262Error('#6 new Boolean(true) === new Number(1)'); +} + +//CHECK#7 +if (new Number(1) === new String("1")) { + throw new Test262Error('#7: new Number(1) === new String("1")'); +} + +//CHECK#8 +if (new String("1") === new Boolean(true)) { + throw new Test262Error('#8: new String("x") === new Boolean(true)'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T1.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T1.js new file mode 100644 index 0000000000..37b5824145 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T1.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return false +es5id: 11.9.4_A8_T1 +description: x or y is primitive boolean +---*/ + +//CHECK#1 +if (true === new Boolean(true)) { + throw new Test262Error('#1: true !== new Number(true)'); +} + +//CHECK#2 +if (true === 1) { + throw new Test262Error('#2: true !== 1'); +} + +//CHECK#3 +if (true === new Number(true)) { + throw new Test262Error('#3: true !== new Number(true)'); +} + +//CHECK#4 +if (true === "1") { + throw new Test262Error('#4: true !== "1"'); +} + +//CHECK#5 +if (true === new String(true)) { + throw new Test262Error('#5: true !== new String(true)'); +} + +//CHECK#6 +if (new Boolean(false) === false) { + throw new Test262Error('#6: new Number(false) !== false'); +} + +//CHECK#7 +if (0 === false) { + throw new Test262Error('#7: 0 !== false'); +} + +//CHECK#8 +if (new Number(false) === false) { + throw new Test262Error('#8: new Number(false) !== false'); +} + +//CHECK#9 +if ("0" === false) { + throw new Test262Error('#9: "0" !== false'); +} + +//CHECK#10 +if (false === new String(false)) { + throw new Test262Error('#10: false !== new String(false)'); +} + +//CHECK#11 +if (true === {valueOf: function () {return true}}) { + throw new Test262Error('#11: true === {valueOf: function () {return true}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T2.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T2.js new file mode 100644 index 0000000000..4f9f7f515c --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T2.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return false +es5id: 11.9.4_A8_T2 +description: x or y is primitive number +---*/ + +//CHECK#1 +if (1 === new Number(1)) { + throw new Test262Error('#1: 1 !== new Number(1)'); +} + +//CHECK#2 +if (1 === true) { + throw new Test262Error('#2: 1 !== true'); +} + +//CHECK#3 +if (1 === new Boolean(1)) { + throw new Test262Error('#3: 1 !== new Boolean(1)'); +} + +//CHECK#4 +if (1 === "1") { + throw new Test262Error('#4: 1 !== "1"'); +} + +//CHECK#5 +if (1 === new String(1)) { + throw new Test262Error('#5: 1 !== new String(1)'); +} + +//CHECK#6 +if (new Number(0) === 0) { + throw new Test262Error('#6: new Number(0) !== 0'); +} + +//CHECK#7 +if (false === 0) { + throw new Test262Error('#7: false !== 0'); +} + +//CHECK#8 +if (new Boolean(0) === 0) { + throw new Test262Error('#8: new Boolean(0) !== 0'); +} + +//CHECK#9 +if ("0" === 0) { + throw new Test262Error('#9: "0" !== 0'); +} + +//CHECK#10 +if (new String(0) === 0) { + throw new Test262Error('#10: new String(0) !== 0'); +} + +//CHECK#11 +if (1 === {valueOf: function () {return 1}}) { + throw new Test262Error('#11: 1 === {valueOf: function () {return 1}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T3.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T3.js new file mode 100644 index 0000000000..2440120987 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T3.js @@ -0,0 +1,65 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return false +es5id: 11.9.4_A8_T3 +description: x or y is primitive string +---*/ + +//CHECK#1 +if ("1" === new String("1")) { + throw new Test262Error('#1: "1" !== new String("1")'); +} + +//CHECK#2 +if ("1" === true) { + throw new Test262Error('#2: "1" !== true'); +} + +//CHECK#3 +if ("1" === new Boolean("1")) { + throw new Test262Error('#3: "1" !== new Boolean("1")'); +} + +//CHECK#4 +if ("1" === 1) { + throw new Test262Error('#4: "1" === 1'); +} + +//CHECK#5 +if ("1" === new Number("1")) { + throw new Test262Error('#5: "1" === new Number("1")'); +} + +//CHECK#6 +if (new String(false) === false) { + throw new Test262Error('#6: new Number(false) !== false'); +} + +//CHECK#7 +if (false === "0") { + throw new Test262Error('#7: false !== "0"'); +} + +//CHECK#8 +if ("0" === new Boolean("0")) { + throw new Test262Error('#8: "0" !== new Boolean("0")'); +} + +//CHECK#9 +if (false === 0) { + throw new Test262Error('#9: false !== 0'); +} + +//CHECK#10 +if (false === new Number(false)) { + throw new Test262Error('#10: false !== new Number(false)'); +} + +//CHECK#11 +if ("1" === {valueOf: function () {return "1"}}) { + throw new Test262Error('#11: "1" === {valueOf: function () {return "1"}}'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T4.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T4.js new file mode 100644 index 0000000000..e135ce2a20 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T4.js @@ -0,0 +1,80 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return false +es5id: 11.9.4_A8_T4 +description: x or y is null or undefined +---*/ + +//CHECK#1 +if (undefined === null) { + throw new Test262Error('#1: undefined !== null'); +} + +//CHECK#2 +if (null === undefined) { + throw new Test262Error('#2: null !== undefined'); +} + +//CHECK#3 +if (null === 0) { + throw new Test262Error('#3: null !== 0'); +} + +//CHECK#4 +if (0 === null) { + throw new Test262Error('#4: 0 !== null'); +} + +//CHECK#5 +if (null === false) { + throw new Test262Error('#5: null !== false'); +} + +//CHECK#6 +if (false === null) { + throw new Test262Error('#6: false !== null'); +} + +//CHECK#7 +if (undefined === false) { + throw new Test262Error('#7: undefined !== false'); +} + +//CHECK#8 +if (false === undefined) { + throw new Test262Error('#8: false !== undefined'); +} + +//CHECK#9 +if (null === new Object()) { + throw new Test262Error('#9: null !== new Object()'); +} + +//CHECK#10 +if (new Object() === null) { + throw new Test262Error('#10: new Object() !== null'); +} + +//CHECK#11 +if (null === "null") { + throw new Test262Error('#11: null !== "null"'); +} + +//CHECK#12 +if ("null" === null) { + throw new Test262Error('#12: "null" !== null'); +} + +//CHECK#13 +if (undefined === "undefined") { + throw new Test262Error('#13: undefined !== "undefined"'); +} + +//CHECK#14 +if ("undefined" === undefined) { + throw new Test262Error('#14: "undefined" !== undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T5.js b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T5.js new file mode 100644 index 0000000000..7c21b6a10c --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/S11.9.4_A8_T5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If Type(x) is different from Type(y), return false +es5id: 11.9.4_A8_T5 +description: > + Checking with such x and y that either x or y is primitive string + and the other is primitive number +---*/ + +//CHECK#1 +try { + throw 1; +} catch(e) { + if (e === "1") { + throw new Test262Error('#1: throw 1 !== "1"'); + } +} + +//CHECK#2 +try { + throw "1"; +} catch(e) { + if (1 === e) { + throw new Test262Error('#2: 1 !== throw "1"'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-bigint.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-bigint.js new file mode 100644 index 0000000000..86f028ca79 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-bigint.js @@ -0,0 +1,174 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + 2. If Type(x) is Number or BigInt, then + a. Return ! Type(x)::equal(x, y). + + sec-numeric-types-bigint-equal + BigInt::equal (x, y) + + The abstract operation BigInt::equal with two arguments x and y of BigInt type returns true if x and y have the same mathematical integer value and false otherwise. + +features: [BigInt] +---*/ +assert.sameValue(0n === 0n, true, 'The result of (0n === 0n) is true'); +assert.sameValue(1n === 1n, true, 'The result of (1n === 1n) is true'); +assert.sameValue(-1n === -1n, true, 'The result of (-1n === -1n) is true'); +assert.sameValue(0n === -0n, true, 'The result of (0n === -0n) is true'); +assert.sameValue(-0n === 0n, true, 'The result of (-0n === 0n) is true'); +assert.sameValue(0n === 1n, false, 'The result of (0n === 1n) is false'); +assert.sameValue(1n === 0n, false, 'The result of (1n === 0n) is false'); +assert.sameValue(0n === -1n, false, 'The result of (0n === -1n) is false'); +assert.sameValue(-1n === 0n, false, 'The result of (-1n === 0n) is false'); +assert.sameValue(1n === -1n, false, 'The result of (1n === -1n) is false'); +assert.sameValue(-1n === 1n, false, 'The result of (-1n === 1n) is false'); + +assert.sameValue( + 0x1fffffffffffff01n === 0x1fffffffffffff01n, + true, + 'The result of (0x1fffffffffffff01n === 0x1fffffffffffff01n) is true' +); + +assert.sameValue( + 0x1fffffffffffff01n === 0x1fffffffffffff02n, + false, + 'The result of (0x1fffffffffffff01n === 0x1fffffffffffff02n) is false' +); + +assert.sameValue( + 0x1fffffffffffff02n === 0x1fffffffffffff01n, + false, + 'The result of (0x1fffffffffffff02n === 0x1fffffffffffff01n) is false' +); + +assert.sameValue( + -0x1fffffffffffff01n === -0x1fffffffffffff01n, + true, + 'The result of (-0x1fffffffffffff01n === -0x1fffffffffffff01n) is true' +); + +assert.sameValue( + -0x1fffffffffffff01n === -0x1fffffffffffff02n, + false, + 'The result of (-0x1fffffffffffff01n === -0x1fffffffffffff02n) is false' +); + +assert.sameValue( + -0x1fffffffffffff02n === -0x1fffffffffffff01n, + false, + 'The result of (-0x1fffffffffffff02n === -0x1fffffffffffff01n) is false' +); + +assert.sameValue( + 0x10000000000000000n === 0n, + false, + 'The result of (0x10000000000000000n === 0n) is false' +); + +assert.sameValue( + 0n === 0x10000000000000000n, + false, + 'The result of (0n === 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n === 1n, + false, + 'The result of (0x10000000000000000n === 1n) is false' +); + +assert.sameValue( + 1n === 0x10000000000000000n, + false, + 'The result of (1n === 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000000n === -1n, + false, + 'The result of (0x10000000000000000n === -1n) is false' +); + +assert.sameValue( + -1n === 0x10000000000000000n, + false, + 'The result of (-1n === 0x10000000000000000n) is false' +); + +assert.sameValue( + 0x10000000000000001n === 0n, + false, + 'The result of (0x10000000000000001n === 0n) is false' +); + +assert.sameValue( + 0n === 0x10000000000000001n, + false, + 'The result of (0n === 0x10000000000000001n) is false' +); + +assert.sameValue( + -0x10000000000000000n === 0n, + false, + 'The result of (-0x10000000000000000n === 0n) is false' +); + +assert.sameValue( + 0n === -0x10000000000000000n, + false, + 'The result of (0n === -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n === 1n, + false, + 'The result of (-0x10000000000000000n === 1n) is false' +); + +assert.sameValue( + 1n === -0x10000000000000000n, + false, + 'The result of (1n === -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000000n === -1n, + false, + 'The result of (-0x10000000000000000n === -1n) is false' +); + +assert.sameValue( + -1n === -0x10000000000000000n, + false, + 'The result of (-1n === -0x10000000000000000n) is false' +); + +assert.sameValue( + -0x10000000000000001n === 0n, + false, + 'The result of (-0x10000000000000001n === 0n) is false' +); + +assert.sameValue( + 0n === -0x10000000000000001n, + false, + 'The result of (0n === -0x10000000000000001n) is false' +); + +assert.sameValue( + 0x10000000000000000n === 0x100000000n, + false, + 'The result of (0x10000000000000000n === 0x100000000n) is false' +); + +assert.sameValue( + 0x100000000n === 0x10000000000000000n, + false, + 'The result of (0x100000000n === 0x10000000000000000n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-boolean.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-boolean.js new file mode 100644 index 0000000000..dd0104bd69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-boolean.js @@ -0,0 +1,28 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt and Boolean values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(-1n === false, false, 'The result of (-1n === false) is false'); +assert.sameValue(false === -1n, false, 'The result of (false === -1n) is false'); +assert.sameValue(-1n === true, false, 'The result of (-1n === true) is false'); +assert.sameValue(true === -1n, false, 'The result of (true === -1n) is false'); +assert.sameValue(0n === false, false, 'The result of (0n === false) is false'); +assert.sameValue(false === 0n, false, 'The result of (false === 0n) is false'); +assert.sameValue(0n === true, false, 'The result of (0n === true) is false'); +assert.sameValue(true === 0n, false, 'The result of (true === 0n) is false'); +assert.sameValue(1n === false, false, 'The result of (1n === false) is false'); +assert.sameValue(false === 1n, false, 'The result of (false === 1n) is false'); +assert.sameValue(1n === true, false, 'The result of (1n === true) is false'); +assert.sameValue(true === 1n, false, 'The result of (true === 1n) is false'); +assert.sameValue(2n === false, false, 'The result of (2n === false) is false'); +assert.sameValue(false === 2n, false, 'The result of (false === 2n) is false'); +assert.sameValue(2n === true, false, 'The result of (2n === true) is false'); +assert.sameValue(true === 2n, false, 'The result of (true === 2n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-incomparable-primitive.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-incomparable-primitive.js new file mode 100644 index 0000000000..cd87be7685 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-incomparable-primitive.js @@ -0,0 +1,24 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt and miscellaneous primitive values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt, Symbol] +---*/ +assert.sameValue(0n === undefined, false, 'The result of (0n === undefined) is false'); +assert.sameValue(undefined === 0n, false, 'The result of (undefined === 0n) is false'); +assert.sameValue(1n === undefined, false, 'The result of (1n === undefined) is false'); +assert.sameValue(undefined === 1n, false, 'The result of (undefined === 1n) is false'); +assert.sameValue(0n === null, false, 'The result of (0n === null) is false'); +assert.sameValue(null === 0n, false, 'The result of (null === 0n) is false'); +assert.sameValue(1n === null, false, 'The result of (1n === null) is false'); +assert.sameValue(null === 1n, false, 'The result of (null === 1n) is false'); +assert.sameValue(0n === Symbol('1'), false, 'The result of (0n === Symbol("1")) is false'); +assert.sameValue(Symbol('1') === 0n, false, 'The result of (Symbol("1") === 0n) is false'); +assert.sameValue(1n === Symbol('1'), false, 'The result of (1n === Symbol("1")) is false'); +assert.sameValue(Symbol('1') === 1n, false, 'The result of (Symbol("1") === 1n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-non-finite.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-non-finite.js new file mode 100644 index 0000000000..e7ddbb51af --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-non-finite.js @@ -0,0 +1,30 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt and non-finite Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n === Infinity, false, 'The result of (0n === Infinity) is false'); +assert.sameValue(Infinity === 0n, false, 'The result of (Infinity === 0n) is false'); +assert.sameValue(1n === Infinity, false, 'The result of (1n === Infinity) is false'); +assert.sameValue(Infinity === 1n, false, 'The result of (Infinity === 1n) is false'); +assert.sameValue(-1n === Infinity, false, 'The result of (-1n === Infinity) is false'); +assert.sameValue(Infinity === -1n, false, 'The result of (Infinity === -1n) is false'); +assert.sameValue(0n === -Infinity, false, 'The result of (0n === -Infinity) is false'); +assert.sameValue(-Infinity === 0n, false, 'The result of (-Infinity === 0n) is false'); +assert.sameValue(1n === -Infinity, false, 'The result of (1n === -Infinity) is false'); +assert.sameValue(-Infinity === 1n, false, 'The result of (-Infinity === 1n) is false'); +assert.sameValue(-1n === -Infinity, false, 'The result of (-1n === -Infinity) is false'); +assert.sameValue(-Infinity === -1n, false, 'The result of (-Infinity === -1n) is false'); +assert.sameValue(0n === NaN, false, 'The result of (0n === NaN) is false'); +assert.sameValue(NaN === 0n, false, 'The result of (NaN === 0n) is false'); +assert.sameValue(1n === NaN, false, 'The result of (1n === NaN) is false'); +assert.sameValue(NaN === 1n, false, 'The result of (NaN === 1n) is false'); +assert.sameValue(-1n === NaN, false, 'The result of (-1n === NaN) is false'); +assert.sameValue(NaN === -1n, false, 'The result of (NaN === -1n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-number-extremes.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-number-extremes.js new file mode 100644 index 0000000000..9d3441811e --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-number-extremes.js @@ -0,0 +1,71 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt and large Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue( + 1n === Number.MAX_VALUE, + false, + 'The result of (1n === Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE === 1n, + false, + 'The result of (Number.MAX_VALUE === 1n) is false' +); + +assert.sameValue( + 1n === -Number.MAX_VALUE, + false, + 'The result of (1n === -Number.MAX_VALUE) is false' +); + +assert.sameValue( + -Number.MAX_VALUE === 1n, + false, + 'The result of (-Number.MAX_VALUE === 1n) is false' +); + +assert.sameValue( + 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn === Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn === Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE === 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn, + false, + 'The result of (Number.MAX_VALUE === 0xfffffffffffff7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn) is false' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n === Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n, + false, + 'The result of (Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000n) is false' +); + +assert.sameValue( + 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n === Number.MAX_VALUE, + false, + 'The result of (0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n === Number.MAX_VALUE) is false' +); + +assert.sameValue( + Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n, + false, + 'The result of (Number.MAX_VALUE === 0xfffffffffffff800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-number.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-number.js new file mode 100644 index 0000000000..5a726137cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-number.js @@ -0,0 +1,62 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt and Number values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n === 0, false, 'The result of (0n === 0) is false'); +assert.sameValue(0 === 0n, false, 'The result of (0 === 0n) is false'); +assert.sameValue(0n === -0, false, 'The result of (0n === -0) is false'); +assert.sameValue(-0 === 0n, false, 'The result of (-0 === 0n) is false'); +assert.sameValue(0n === 0.000000000001, false, 'The result of (0n === 0.000000000001) is false'); +assert.sameValue(0.000000000001 === 0n, false, 'The result of (0.000000000001 === 0n) is false'); +assert.sameValue(0n === 1, false, 'The result of (0n === 1) is false'); +assert.sameValue(1 === 0n, false, 'The result of (1 === 0n) is false'); +assert.sameValue(1n === 0, false, 'The result of (1n === 0) is false'); +assert.sameValue(0 === 1n, false, 'The result of (0 === 1n) is false'); +assert.sameValue(1n === 0.999999999999, false, 'The result of (1n === 0.999999999999) is false'); +assert.sameValue(0.999999999999 === 1n, false, 'The result of (0.999999999999 === 1n) is false'); +assert.sameValue(1n === 1, false, 'The result of (1n === 1) is false'); +assert.sameValue(1 === 1n, false, 'The result of (1 === 1n) is false'); + +assert.sameValue( + 0n === Number.MIN_VALUE, + false, + 'The result of (0n === Number.MIN_VALUE) is false' +); + +assert.sameValue( + Number.MIN_VALUE === 0n, + false, + 'The result of (Number.MIN_VALUE === 0n) is false' +); + +assert.sameValue( + 0n === -Number.MIN_VALUE, + false, + 'The result of (0n === -Number.MIN_VALUE) is false' +); + +assert.sameValue( + -Number.MIN_VALUE === 0n, + false, + 'The result of (-Number.MIN_VALUE === 0n) is false' +); + +assert.sameValue( + -10n === Number.MIN_VALUE, + false, + 'The result of (-10n === Number.MIN_VALUE) is false' +); + +assert.sameValue( + Number.MIN_VALUE === -10n, + false, + 'The result of (Number.MIN_VALUE === -10n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-object.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-object.js new file mode 100644 index 0000000000..fe3fdca7d9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-object.js @@ -0,0 +1,124 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt values and non-primitive objects +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n === Object(0n), false, 'The result of (0n === Object(0n)) is false'); +assert.sameValue(Object(0n) === 0n, false, 'The result of (Object(0n) === 0n) is false'); +assert.sameValue(0n === Object(1n), false, 'The result of (0n === Object(1n)) is false'); +assert.sameValue(Object(1n) === 0n, false, 'The result of (Object(1n) === 0n) is false'); +assert.sameValue(1n === Object(0n), false, 'The result of (1n === Object(0n)) is false'); +assert.sameValue(Object(0n) === 1n, false, 'The result of (Object(0n) === 1n) is false'); +assert.sameValue(1n === Object(1n), false, 'The result of (1n === Object(1n)) is false'); +assert.sameValue(Object(1n) === 1n, false, 'The result of (Object(1n) === 1n) is false'); +assert.sameValue(2n === Object(0n), false, 'The result of (2n === Object(0n)) is false'); +assert.sameValue(Object(0n) === 2n, false, 'The result of (Object(0n) === 2n) is false'); +assert.sameValue(2n === Object(1n), false, 'The result of (2n === Object(1n)) is false'); +assert.sameValue(Object(1n) === 2n, false, 'The result of (Object(1n) === 2n) is false'); +assert.sameValue(2n === Object(2n), false, 'The result of (2n === Object(2n)) is false'); +assert.sameValue(Object(2n) === 2n, false, 'The result of (Object(2n) === 2n) is false'); +assert.sameValue(0n === {}, false, 'The result of (0n === {}) is false'); +assert.sameValue({} === 0n, false, 'The result of (({}) === 0n) is false'); + +assert.sameValue(0n === { + valueOf: function() { + return 0n; + } +}, false, 'The result of (0n === {valueOf: function() {return 0n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 0n; + } +} === 0n, false, 'The result of (({valueOf: function() {return 0n;}}) === 0n) is false'); + +assert.sameValue(0n === { + valueOf: function() { + return 1n; + } +}, false, 'The result of (0n === {valueOf: function() {return 1n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 1n; + } +} === 0n, false, 'The result of (({valueOf: function() {return 1n;}}) === 0n) is false'); + +assert.sameValue(0n === { + toString: function() { + return '0'; + } +}, false, 'The result of (0n === {toString: function() {return "0";}}) is false'); + +assert.sameValue({ + toString: function() { + return '0'; + } +} === 0n, false, 'The result of (({toString: function() {return "0";}}) === 0n) is false'); + +assert.sameValue(0n === { + toString: function() { + return '1'; + } +}, false, 'The result of (0n === {toString: function() {return "1";}}) is false'); + +assert.sameValue({ + toString: function() { + return '1'; + } +} === 0n, false, 'The result of (({toString: function() {return "1";}}) === 0n) is false'); + +assert.sameValue(900719925474099101n === { + valueOf: function() { + return 900719925474099101n; + } +}, false, 'The result of (900719925474099101n === {valueOf: function() {return 900719925474099101n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099101n; + } +} === 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099101n;}}) === 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n === { + valueOf: function() { + return 900719925474099102n; + } +}, false, 'The result of (900719925474099101n === {valueOf: function() {return 900719925474099102n;}}) is false'); + +assert.sameValue({ + valueOf: function() { + return 900719925474099102n; + } +} === 900719925474099101n, false, 'The result of (({valueOf: function() {return 900719925474099102n;}}) === 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n === { + toString: function() { + return '900719925474099101'; + } +}, false, 'The result of (900719925474099101n === {toString: function() {return "900719925474099101";}}) is false'); + +assert.sameValue({ + toString: function() { + return '900719925474099101'; + } +} === 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099101";}}) === 900719925474099101n) is false'); + +assert.sameValue(900719925474099101n === { + toString: function() { + return '900719925474099102'; + } +}, false, 'The result of (900719925474099101n === {toString: function() {return "900719925474099102";}}) is false'); + +assert.sameValue({ + toString: function() { + return '900719925474099102'; + } +} === 900719925474099101n, false, 'The result of (({toString: function() {return "900719925474099102";}}) === 900719925474099101n) is false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/bigint-and-string.js b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-string.js new file mode 100644 index 0000000000..826da77466 --- /dev/null +++ b/js/src/tests/test262/language/expressions/strict-equals/bigint-and-string.js @@ -0,0 +1,68 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Strict equality comparison of BigInt and String values +esid: sec-strict-equality-comparison +info: | + 1. If Type(x) is different from Type(y), return false. + +features: [BigInt] +---*/ +assert.sameValue(0n === '', false, 'The result of (0n === "") is false'); +assert.sameValue('' === 0n, false, 'The result of ("" === 0n) is false'); +assert.sameValue(0n === '-0', false, 'The result of (0n === "-0") is false'); +assert.sameValue('-0' === 0n, false, 'The result of ("-0" === 0n) is false'); +assert.sameValue(0n === '0', false, 'The result of (0n === "0") is false'); +assert.sameValue('0' === 0n, false, 'The result of ("0" === 0n) is false'); +assert.sameValue(0n === '-1', false, 'The result of (0n === "-1") is false'); +assert.sameValue('-1' === 0n, false, 'The result of ("-1" === 0n) is false'); +assert.sameValue(0n === '1', false, 'The result of (0n === "1") is false'); +assert.sameValue('1' === 0n, false, 'The result of ("1" === 0n) is false'); +assert.sameValue(0n === 'foo', false, 'The result of (0n === "foo") is false'); +assert.sameValue('foo' === 0n, false, 'The result of ("foo" === 0n) is false'); +assert.sameValue(1n === '', false, 'The result of (1n === "") is false'); +assert.sameValue('' === 1n, false, 'The result of ("" === 1n) is false'); +assert.sameValue(1n === '-0', false, 'The result of (1n === "-0") is false'); +assert.sameValue('-0' === 1n, false, 'The result of ("-0" === 1n) is false'); +assert.sameValue(1n === '0', false, 'The result of (1n === "0") is false'); +assert.sameValue('0' === 1n, false, 'The result of ("0" === 1n) is false'); +assert.sameValue(1n === '-1', false, 'The result of (1n === "-1") is false'); +assert.sameValue('-1' === 1n, false, 'The result of ("-1" === 1n) is false'); +assert.sameValue(1n === '1', false, 'The result of (1n === "1") is false'); +assert.sameValue('1' === 1n, false, 'The result of ("1" === 1n) is false'); +assert.sameValue(1n === 'foo', false, 'The result of (1n === "foo") is false'); +assert.sameValue('foo' === 1n, false, 'The result of ("foo" === 1n) is false'); +assert.sameValue(-1n === '-', false, 'The result of (-1n === "-") is false'); +assert.sameValue('-' === -1n, false, 'The result of ("-" === -1n) is false'); +assert.sameValue(-1n === '-0', false, 'The result of (-1n === "-0") is false'); +assert.sameValue('-0' === -1n, false, 'The result of ("-0" === -1n) is false'); +assert.sameValue(-1n === '-1', false, 'The result of (-1n === "-1") is false'); +assert.sameValue('-1' === -1n, false, 'The result of ("-1" === -1n) is false'); +assert.sameValue(-1n === '-foo', false, 'The result of (-1n === "-foo") is false'); +assert.sameValue('-foo' === -1n, false, 'The result of ("-foo" === -1n) is false'); + +assert.sameValue( + 900719925474099101n === '900719925474099101', + false, + 'The result of (900719925474099101n === "900719925474099101") is false' +); + +assert.sameValue( + '900719925474099101' === 900719925474099101n, + false, + 'The result of ("900719925474099101" === 900719925474099101n) is false' +); + +assert.sameValue( + 900719925474099102n === '900719925474099101', + false, + 'The result of (900719925474099102n === "900719925474099101") is false' +); + +assert.sameValue( + '900719925474099101' === 900719925474099102n, + false, + 'The result of ("900719925474099101" === 900719925474099102n) is false' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/strict-equals/browser.js b/js/src/tests/test262/language/expressions/strict-equals/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/strict-equals/shell.js b/js/src/tests/test262/language/expressions/strict-equals/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A1.js new file mode 100644 index 0000000000..1aeaf562ae --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between AdditiveExpression and "-" or + between "-" and MultiplicativeExpression are allowed +es5id: 11.6.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("1\u0009-\u00091") !== 0) { + throw new Test262Error('#1: 1\\u0009-\\u00091 === 0'); +} + +//CHECK#2 +if (eval("1\u000B-\u000B1") !== 0) { + throw new Test262Error('#2: 1\\u000B-\\u000B1 === 0'); +} + +//CHECK#3 +if (eval("1\u000C-\u000C1") !== 0) { + throw new Test262Error('#3: 1\\u000C-\\u000C1 === 0'); +} + +//CHECK#4 +if (eval("1\u0020-\u00201") !== 0) { + throw new Test262Error('#4: 1\\u0020-\\u00201 === 0'); +} + +//CHECK#5 +if (eval("1\u00A0-\u00A01") !== 0) { + throw new Test262Error('#5: 1\\u00A0-\\u00A01 === 0'); +} + +//CHECK#6 +if (eval("1\u000A-\u000A1") !== 0) { + throw new Test262Error('#6: 1\\u000A-\\u000A1 === 0'); +} + +//CHECK#7 +if (eval("1\u000D-\u000D1") !== 0) { + throw new Test262Error('#7: 1\\u000D-\\u000D1 === 0'); +} + +//CHECK#8 +if (eval("1\u2028-\u20281") !== 0) { + throw new Test262Error('#8: 1\\u2028-\\u20281 === 0'); +} + +//CHECK#9 +if (eval("1\u2029-\u20291") !== 0) { + throw new Test262Error('#9: 1\\u2029-\\u20291 === 0'); +} + +//CHECK#10 +if (eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029-\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 0) { + throw new Test262Error('#10: 1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029-\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 0'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T1.js new file mode 100644 index 0000000000..7a0a4ab02a --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y uses GetValue +es5id: 11.6.2_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (1 - 1 !== 0) { + throw new Test262Error('#1: 1 - 1 === 0. Actual: ' + (1 - 1)); +} + +//CHECK#2 +var x = 1; +if (x - 1 !== 0) { + throw new Test262Error('#2: var x = 1; x - 1 === 0. Actual: ' + (x - 1)); +} + +//CHECK#3 +var y = 1; +if (1 - y !== 0) { + throw new Test262Error('#3: var y = 1; 1 - y === 0. Actual: ' + (1 - y)); +} + +//CHECK#4 +var x = 1; +var y = 1; +if (x - y !== 0) { + throw new Test262Error('#4: var x = 1; var y = 1; x - y === 0. Actual: ' + (x - y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = 1; +objecty.prop = 1; +if (objectx.prop - objecty.prop !== 0) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; objectx.prop - objecty.prop === 0. Actual: ' + (objectx.prop - objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T2.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T2.js new file mode 100644 index 0000000000..dbcd536628 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y uses GetValue +es5id: 11.6.2_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x - 1; + throw new Test262Error('#1.1: x - 1 throw ReferenceError. Actual: ' + (x - 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x - 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T3.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T3.js new file mode 100644 index 0000000000..2bd003ac0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y uses GetValue +es5id: 11.6.2_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 - y; + throw new Test262Error('#1.1: 1 - y throw ReferenceError. Actual: ' + (1 - y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 - y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.2_T1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.2_T1.js new file mode 100644 index 0000000000..eb50a7fce0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y uses [[Default Value]] +es5id: 11.6.2_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return 1}} - 1 !== 0) { + throw new Test262Error('#1: {valueOf: function() {return 1}} - 1 === 0. Actual: ' + ({valueOf: function() {return 1}} - 1)); +} + +//CHECK#2 +if ({valueOf: function() {return 1}, toString: function() {return 0}} - 1 !== 0) { + throw new Test262Error('#2: {valueOf: function() {return 1}, toString: function() {return 0}} - 1 === 0. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return 0}} - 1)); +} + +//CHECK#3 +if ({valueOf: function() {return 1}, toString: function() {return {}}} - 1 !== 0) { + throw new Test262Error('#3: {valueOf: function() {return 1}, toString: function() {return {}}} - 1 === 0. Actual: ' + ({valueOf: function() {return 1}, toString: function() {return {}}} - 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return 1}, toString: function() {throw "error"}} - 1 !== 0) { + throw new Test262Error('#4.1: {valueOf: function() {return 1}, toString: function() {throw "error"}} - 1 === 0. Actual: ' + ({valueOf: function() {return 1}, toString: function() {throw "error"}} - 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return 1}, toString: function() {throw "error"}} - 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return 1}, toString: function() {throw "error"}} - 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (1 - {toString: function() {return 1}} !== 0) { + throw new Test262Error('#5: 1 - {toString: function() {return 1}} === 0. Actual: ' + (1 - {toString: function() {return 1}})); +} + +//CHECK#6 +if (1 - {valueOf: function() {return {}}, toString: function() {return 1}} !== 0) { + throw new Test262Error('#6: 1 - {valueOf: function() {return {}}, toString: function() {return 1}} === 0. Actual: ' + (1 - {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + 1 - {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: 1 - {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 - {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: 1 - {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + 1 - {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: 1 - {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 - {valueOf: function() {return {}}, toString: function() {return {}}})); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: 1 - {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.3_T1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.3_T1.js new file mode 100644 index 0000000000..c47107a253 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.6.2_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x - y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x - y throw "x". Actual: ' + (x - y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x - y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T1.js new file mode 100644 index 0000000000..3282a26438 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.2_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) - x !== 0) { + throw new Test262Error('#1: var x = 0; (x = 1) - x === 0. Actual: ' + ((x = 1) - x)); +} + +//CHECK#2 +var x = 0; +if (x - (x = 1) !== -1) { + throw new Test262Error('#2: var x = 0; x - (x = 1) === -1. Actual: ' + (x - (x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T2.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T2.js new file mode 100644 index 0000000000..3858df8473 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.2_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() - y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() - y() throw "x". Actual: ' + (x() - y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() - y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T3.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T3.js new file mode 100644 index 0000000000..2d90acfee2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.2_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x - (x = 1); + throw new Test262Error('#1.1: x - (x = 1) throw ReferenceError. Actual: ' + (x - (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x - (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T4.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T4.js new file mode 100644 index 0000000000..8779fc45f4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.6.2_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) - y !== 0) { + throw new Test262Error('#1: (y = 1) - y === 0. Actual: ' + ((y = 1) - y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.1.js new file mode 100644 index 0000000000..4515274cfc --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (true - true !== 0) { + throw new Test262Error('#1: true - true === 0. Actual: ' + (true - true)); +} + +//CHECK#2 +if (new Boolean(true) - true !== 0) { + throw new Test262Error('#2: new Boolean(true) - true === 0. Actual: ' + (new Boolean(true) - true)); +} + +//CHECK#3 +if (true - new Boolean(true) !== 0) { + throw new Test262Error('#3: true - new Boolean(true) === 0. Actual: ' + (true - new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) - new Boolean(true) !== 0) { + throw new Test262Error('#4: new Boolean(true) - new Boolean(true) === 0. Actual: ' + (new Boolean(true) - new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.2.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.2.js new file mode 100644 index 0000000000..4a8c231561 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if (1 - 1 !== 0) { + throw new Test262Error('#1: 1 - 1 === 0. Actual: ' + (1 - 1)); +} + +//CHECK#2 +if (new Number(1) - 1 !== 0) { + throw new Test262Error('#2: new Number(1) - 1 === 0. Actual: ' + (new Number(1) - 1)); +} + +//CHECK#3 +if (1 - new Number(1) !== 0) { + throw new Test262Error('#3: 1 - new Number(1) === 0. Actual: ' + (1 - new Number(1))); +} + +//CHECK#4 +if (new Number(1) - new Number(1) !== 0) { + throw new Test262Error('#4: new Number(1) - new Number(1) === 0. Actual: ' + (new Number(1) - new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.3.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.3.js new file mode 100644 index 0000000000..28f6238821 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if ("1" - "1" !== 0) { + throw new Test262Error('#1: "1" - "1" === 0. Actual: ' + ("1" - "1")); +} + +//CHECK#2 +if (new String("1") - "1" !== 0) { + throw new Test262Error('#2: new String("1") - "1" === 0. Actual: ' + (new String("1") - "1")); +} + +//CHECK#3 +if ("1" - new String("1") !== 0) { + throw new Test262Error('#3: "1" - new String("1") === 0. Actual: ' + ("1" - new String("1"))); +} + +//CHECK#4 +if (new String("1") - new String("1") !== 0) { + throw new Test262Error('#4: new String("1") - new String("1") === 0. Actual: ' + (new String("1") - new String("1"))); +} + +//CHECK#5 +if (isNaN("x" - "1") !== true) { + throw new Test262Error('#5: "x" - "1" === Not-a-Number. Actual: ' + ("x" - "1")); +} + +//CHECK#6 +if (isNaN("1" - "x") !== true) { + throw new Test262Error('#6: "1" - "x" === Not-a-Number. Actual: ' + ("1" - "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.4.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.4.js new file mode 100644 index 0000000000..a45b6680b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if (isNaN(null - undefined) !== true) { + throw new Test262Error('#1: null - undefined === Not-a-Number. Actual: ' + (null - undefined)); +} + +//CHECK#2 +if (isNaN(undefined - null) !== true) { + throw new Test262Error('#2: undefined - null === Not-a-Number. Actual: ' + (undefined - null)); +} + +//CHECK#3 +if (isNaN(undefined - undefined) !== true) { + throw new Test262Error('#3: undefined - undefined === Not-a-Number. Actual: ' + (undefined - undefined)); +} + +//CHECK#4 +if (null - null !== 0) { + throw new Test262Error('#4: null - null === 0. Actual: ' + (null - null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.5.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.5.js new file mode 100644 index 0000000000..8ca8521f87 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (isNaN({} - function(){return 1}) !== true) { + throw new Test262Error('#1: {} - function(){return 1} === Not-a-Number. Actual: ' + ({} - function(){return 1})); +} + +//CHECK#2 +if (isNaN(function(){return 1} - {}) !== true) { + throw new Test262Error('#2: function(){return 1} - {} === Not-a-Number. Actual: ' + (function(){return 1} - {})); +} + +//CHECK#3 +if (isNaN(function(){return 1} - function(){return 1}) !== true) { + throw new Test262Error('#3: function(){return 1} - function(){return 1} === Not-a-Number. Actual: ' + (function(){return 1} - function(){return 1})); +} + +//CHECK#4 +if (isNaN({} - {}) !== true) { + throw new Test262Error('#4: {} - {} === Not-a-Number. Actual: ' + ({} - {})); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.1.js new file mode 100644 index 0000000000..ff2a927c5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true - 1 !== 0) { + throw new Test262Error('#1: true - 1 === 0. Actual: ' + (true - 1)); +} + +//CHECK#2 +if (1 - true !== 0) { + throw new Test262Error('#2: 1 - true === 0. Actual: ' + (1 - true)); +} + +//CHECK#3 +if (new Boolean(true) - 1 !== 0) { + throw new Test262Error('#3: new Boolean(true) - 1 === 0. Actual: ' + (new Boolean(true) - 1)); +} + +//CHECK#4 +if (1 - new Boolean(true) !== 0) { + throw new Test262Error('#4: 1 - new Boolean(true) === 0. Actual: ' + (1 - new Boolean(true))); +} + +//CHECK#5 +if (true - new Number(1) !== 0) { + throw new Test262Error('#5: true - new Number(1) === 0. Actual: ' + (true - new Number(1))); +} + +//CHECK#6 +if (new Number(1) - true !== 0) { + throw new Test262Error('#6: new Number(1) - true === 0. Actual: ' + (new Number(1) - true)); +} + +//CHECK#7 +if (new Boolean(true) - new Number(1) !== 0) { + throw new Test262Error('#7: new Boolean(true) - new Number(1) === 0. Actual: ' + (new Boolean(true) - new Number(1))); +} + +//CHECK#8 +if (new Number(1) - new Boolean(true) !== 0) { + throw new Test262Error('#8: new Number(1) - new Boolean(true) === 0. Actual: ' + (new Number(1) - new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.2.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.2.js new file mode 100644 index 0000000000..b58fa5dcd2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if ("1" - 1 !== 0) { + throw new Test262Error('#1: "1" - 1 === 0. Actual: ' + ("1" - 1)); +} + +//CHECK#2 +if (1 - "1" !== 0) { + throw new Test262Error('#2: 1 - "1" === 0. Actual: ' + (1 - "1")); +} + +//CHECK#3 +if (new String("1") - 1 !== 0) { + throw new Test262Error('#3: new String("1") - 1 === 0. Actual: ' + (new String("1") - 1)); +} + +//CHECK#4 +if (1 - new String("1") !== 0) { + throw new Test262Error('#4: 1 - new String("1") === 0. Actual: ' + (1 - new String("1"))); +} + +//CHECK#5 +if ("1" - new Number(1) !== 0) { + throw new Test262Error('#5: "1" - new Number(1) === 0. Actual: ' + ("1" - new Number(1))); +} + +//CHECK#6 +if (new Number(1) - "1" !== 0) { + throw new Test262Error('#6: new Number(1) - "1" === 0. Actual: ' + (new Number(1) - "1")); +} + +//CHECK#7 +if (new String("1") - new Number(1) !== 0) { + throw new Test262Error('#7: new String("1") - new Number(1) === 0. Actual: ' + (new String("1") - new Number(1))); +} + +//CHECK#8 +if (new Number(1) - new String("1") !== 0) { + throw new Test262Error('#8: new Number(1) - new String("1") === 0. Actual: ' + (new Number(1) - new String("1"))); +} + +//CHECK#9 +if (isNaN("x" - 1) !== true) { + throw new Test262Error('#9: "x" - 1 === Not-a-Number. Actual: ' + ("x" - 1)); +} + +//CHECK#10 +if (isNaN(1 - "x") !== true) { + throw new Test262Error('#10: 1 - "x" === Not-a-Number. Actual: ' + (1 - "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.3.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.3.js new file mode 100644 index 0000000000..eaddcd968f --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 - null !== 1) { + throw new Test262Error('#1: 1 - null === 1. Actual: ' + (1 - null)); +} + +//CHECK#2 +if (null - 1 !== -1) { + throw new Test262Error('#2: null - 1 === -1. Actual: ' + (null - 1)); +} + +//CHECK#3 +if (new Number(1) - null !== 1) { + throw new Test262Error('#3: new Number(1) - null === 1. Actual: ' + (new Number(1) - null)); +} + +//CHECK#4 +if (null - new Number(1) !== -1) { + throw new Test262Error('#4: null - new Number(1) === -1. Actual: ' + (null - new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.4.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.4.js new file mode 100644 index 0000000000..bd9e5d5f56 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(1 - undefined) !== true) { + throw new Test262Error('#1: 1 - undefined === Not-a-Number. Actual: ' + (1 - undefined)); +} + +//CHECK#2 +if (isNaN(undefined - 1) !== true) { + throw new Test262Error('#2: undefined - 1 === Not-a-Number. Actual: ' + (undefined - 1)); +} + +//CHECK#3 +if (isNaN(new Number(1) - undefined) !== true) { + throw new Test262Error('#3: new Number(1) - undefined === Not-a-Number. Actual: ' + (new Number(1) - undefined)); +} + +//CHECK#4 +if (isNaN(undefined - new Number(1)) !== true) { + throw new Test262Error('#4: undefined - new Number(1) === Not-a-Number. Actual: ' + (undefined - new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.5.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.5.js new file mode 100644 index 0000000000..ff45e29c7a --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true - "1" !== 0) { + throw new Test262Error('#1: true - "1" === 0. Actual: ' + (true - "1")); +} + +//CHECK#2 +if ("1" - true !== 0) { + throw new Test262Error('#2: "1" - true === 0. Actual: ' + ("1" - true)); +} + +//CHECK#3 +if (new Boolean(true) - "1" !== 0) { + throw new Test262Error('#3: new Boolean(true) - "1" === 0. Actual: ' + (new Boolean(true) - "1")); +} + +//CHECK#4 +if ("1" - new Boolean(true) !== 0) { + throw new Test262Error('#4: "1" - new Boolean(true) === 0. Actual: ' + ("1" - new Boolean(true))); +} + +//CHECK#5 +if (true - new String("1") !== 0) { + throw new Test262Error('#5: true - new String("1") === 0. Actual: ' + (true - new String("1"))); +} + +//CHECK#6 +if (new String("1") - true !== 0) { + throw new Test262Error('#6: new String("1") - true === 0. Actual: ' + (new String("1") - true)); +} + +//CHECK#7 +if (new Boolean(true) - new String("1") !== 0) { + throw new Test262Error('#7: new Boolean(true) - new String("1") === 0. Actual: ' + (new Boolean(true) - new String("1"))); +} + +//CHECK#8 +if (new String("1") - new Boolean(true) !== 0) { + throw new Test262Error('#8: new String("1") - new Boolean(true) === 0. Actual: ' + (new String("1") - new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.6.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.6.js new file mode 100644 index 0000000000..83ab9a7dda --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN("1" - undefined) !== true) { + throw new Test262Error('#1: "1" - undefined === Not-a-Number. Actual: ' + ("1" - undefined)); +} + +//CHECK#2 +if (isNaN(undefined - "1") !== true) { + throw new Test262Error('#2: undefined - "1" === Not-a-Number. Actual: ' + (undefined - "1")); +} + +//CHECK#3 +if (isNaN(new String("1") - undefined) !== true) { + throw new Test262Error('#3: new String("1") - undefined === Not-a-Number. Actual: ' + (new String("1") - undefined)); +} + +//CHECK#4 +if (isNaN(undefined - new String("1")) !== true) { + throw new Test262Error('#4: undefined - new String("1") === Not-a-Number. Actual: ' + (undefined - new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.7.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.7.js new file mode 100644 index 0000000000..cdaa13ad5b --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" - null !== 1) { + throw new Test262Error('#1: "1" - null === 1. Actual: ' + ("1" - null)); +} + +//CHECK#2 +if (null - "1" !== -1) { + throw new Test262Error('#2: null - "1" === -1. Actual: ' + (null - "1")); +} + +//CHECK#3 +if (new String("1") - null !== 1) { + throw new Test262Error('#3: new String("1") - null === 1. Actual: ' + (new String("1") - null)); +} + +//CHECK#4 +if (null - new String("1") !== -1) { + throw new Test262Error('#4: null - new String("1") === -1. Actual: ' + (null - new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.8.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.8.js new file mode 100644 index 0000000000..06722ab6c1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (isNaN(true - undefined) !== true) { + throw new Test262Error('#1: true - undefined === Not-a-Number. Actual: ' + (true - undefined)); +} + +//CHECK#2 +if (isNaN(undefined - true) !== true) { + throw new Test262Error('#2: undefined - true === Not-a-Number. Actual: ' + (undefined - true)); +} + +//CHECK#3 +if (isNaN(new Boolean(true) - undefined) !== true) { + throw new Test262Error('#3: new Boolean(true) - undefined === Not-a-Number. Actual: ' + (new Boolean(true) - undefined)); +} + +//CHECK#4 +if (isNaN(undefined - new Boolean(true)) !== true) { + throw new Test262Error('#4: undefined - new Boolean(true) === Not-a-Number. Actual: ' + (undefined - new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.9.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.9.js new file mode 100644 index 0000000000..e5d589f5a7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y returns ToNumber(x) - ToNumber(y) +es5id: 11.6.2_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true - null !== 1) { + throw new Test262Error('#1: true - null === 1. Actual: ' + (true - null)); +} + +//CHECK#2 +if (null - true !== -1) { + throw new Test262Error('#2: null - true === -1. Actual: ' + (null - true)); +} + +//CHECK#3 +if (new Boolean(true) - null !== 1) { + throw new Test262Error('#3: new Boolean(true) - null === 1. Actual: ' + (new Boolean(true) - null)); +} + +//CHECK#4 +if (null - new Boolean(true) !== -1) { + throw new Test262Error('#4: null - new Boolean(true) === -1. Actual: ' + (null - new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T1.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T1.js new file mode 100644 index 0000000000..909935057e --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T1 +description: If either operand is NaN, the result is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.NaN - 1) !== true ) { + throw new Test262Error('#1: NaN - 1 === Not-a-Number. Actual: ' + (NaN - 1)); +} + +//CHECK#2 +if (isNaN(1 - Number.NaN) !== true ) { + throw new Test262Error('#2: 1 - NaN === Not-a-Number. Actual: ' + (1 - NaN)); +} + +//CHECK#3 +if (isNaN(Number.NaN - Number.POSITIVE_INFINITY) !== true ) { + throw new Test262Error('#3: NaN - Infinity === Not-a-Number. Actual: ' + (NaN - Infinity)); +} + +//CHECK#4 +if (isNaN(Number.POSITIVE_INFINITY - Number.NaN) !== true ) { + throw new Test262Error('#4: Infinity - NaN === Not-a-Number. Actual: ' + (Infinity - NaN)); +} + +//CHECK#5 +if (isNaN(Number.NaN - Number.NEGATIVE_INFINITY) !== true ) { + throw new Test262Error('#5: NaN - Infinity === Not-a-Number. Actual: ' + (NaN - Infinity)); +} + +//CHECK#6 +if (isNaN(Number.NEGATIVE_INFINITY - Number.NaN) !== true ) { + throw new Test262Error('#6: Infinity - NaN === Not-a-Number. Actual: ' + (Infinity - NaN)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T2.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T2.js new file mode 100644 index 0000000000..264880a810 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T2 +description: > + The difference of two infinities of opposite sign is the infinity + of minuend sign +---*/ + +//CHECK#1 +if (Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#1: Infinity - -Infinity === Infinity. Actual: ' + (Infinity - -Infinity)); +} + +//CHECK#2 +if (Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#2: -Infinity - Infinity === -Infinity. Actual: ' + (-Infinity - Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T3.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T3.js new file mode 100644 index 0000000000..b9c2ef0063 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T3 +description: The difference of two infinities of the same sign is NaN +---*/ + +//CHECK#1 +if (isNaN(Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY) !== true ) { + throw new Test262Error('#1: Infinity - Infinity === Not-a-Number. Actual: ' + (Infinity - Infinity)); +} + +//CHECK#2 +if (isNaN(Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY) !== true ) { + throw new Test262Error('#2: -Infinity - -Infinity === Not-a-Number. Actual: ' + (-Infinity - -Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T4.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T4.js new file mode 100644 index 0000000000..36fc9efee3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T4.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T4 +description: > + The difference of an infinity and a finite value is equal to + infinity of appropriate sign +---*/ + +//CHECK#1 +if (Number.POSITIVE_INFINITY - 1 !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#1: Infinity - 1 === Infinity. Actual: ' + (Infinity - 1)); +} + +//CHECK#2 +if (-1 - Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#2: -1 - Infinity === -Infinity. Actual: ' + (-1 - Infinity)); +} + +//CHECK#3 +if (Number.NEGATIVE_INFINITY - 1 !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#3: -Infinity - 1 === -Infinity. Actual: ' + (-Infinity - 1)); +} + +//CHECK#4 +if (-1 - Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#4: -1 - -Infinity === Infinity. Actual: ' + (-1 - -Infinity)); +} + +//CHECK#5 +if (Number.POSITIVE_INFINITY - Number.MAX_VALUE !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#5: Infinity - Number.MAX_VALUE === Infinity. Actual: ' + (Infinity - Number.MAX_VALUE)); +} + +//CHECK#6 +if (-Number.MAX_VALUE - Number.POSITIVE_INFINITY !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#6: -Number.MAX_VALUE - Infinity === I-nfinity. Actual: ' + (-Number.MAX_VALUE - Infinity)); +} + +//CHECK#7 +if (Number.NEGATIVE_INFINITY - Number.MAX_VALUE !== Number.NEGATIVE_INFINITY ) { + throw new Test262Error('#7: -Infinity - Number.MAX_VALUE === -Infinity. Actual: ' + (-Infinity - Number.MAX_VALUE)); +} + +//CHECK#8 +if (-Number.MAX_VALUE - Number.NEGATIVE_INFINITY !== Number.POSITIVE_INFINITY ) { + throw new Test262Error('#8: -Number.MAX_VALUE - -Infinity === Infinity. Actual: ' + (-Number.MAX_VALUE - -Infinity)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T5.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T5.js new file mode 100644 index 0000000000..722f9a0d07 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T5.js @@ -0,0 +1,48 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T5 +description: > + Using the rule of sum of two zeroes and the fact that a - b = a + + (-b) +---*/ + +//CHECK#1 +if (-0 - -0 !== 0 ) { + throw new Test262Error('#1.1: -0 - -0 === 0. Actual: ' + (-0 - -0)); +} else { + if (1 / (-0 - -0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: -0 - -0 === + 0. Actual: -0'); + } +} + +//CHECK#2 +if (0 - -0 !== 0 ) { + throw new Test262Error('#2.1: 0 - -0 === 0. Actual: ' + (0 - -0)); +} else { + if (1 / (0 - -0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: 0 - -0 === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (-0 - 0 !== -0 ) { + throw new Test262Error('#3.1: -0 - 0 === 0. Actual: ' + (-0 - 0)); +} else { + if (1 / (-0 - 0) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#3.2: -0 - 0 === - 0. Actual: +0'); + } +} + +//CHECK#4 +if (0 - 0 !== 0 ) { + throw new Test262Error('#4.1: 0 - 0 === 0. Actual: ' + (0 - 0)); +} else { + if (1 / (0 - 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#4.2: 0 - 0 === + 0. Actual: -0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T6.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T6.js new file mode 100644 index 0000000000..adde00cede --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T6.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T6 +description: > + Using the rule of sum of a zero and a nonzero finite value and the + fact that a - b = a + (-b) +---*/ + +//CHECK#1 +if (1 - -0 !== 1 ) { + throw new Test262Error('#1: 1 - -0 === 1. Actual: ' + (1 - -0)); +} + +//CHECK#2 +if (1 - 0 !== 1 ) { + throw new Test262Error('#2: 1 - 0 === 1. Actual: ' + (1 - 0)); +} + +//CHECK#3 +if (-0 - 1 !== -1 ) { + throw new Test262Error('#3: -0 - 1 === -1. Actual: ' + (-0 - 1)); +} + +//CHECK#4 +if (0 - 1 !== -1 ) { + throw new Test262Error('#4: 0 - 1 === -1. Actual: ' + (0 - 1)); +} + +//CHECK#5 +if (Number.MAX_VALUE - -0 !== Number.MAX_VALUE ) { + throw new Test262Error('#5: Number.MAX_VALUE - -0 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE - -0)); +} + +//CHECK#6 +if (Number.MAX_VALUE - 0 !== Number.MAX_VALUE ) { + throw new Test262Error('#6: Number.MAX_VALUE - 0 === Number.MAX_VALUE. Actual: ' + (Number.MAX_VALUE - 0)); +} + +//CHECK#7 +if (-0 - Number.MIN_VALUE !== -Number.MIN_VALUE ) { + throw new Test262Error('#7: -0 - Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (-0 - Number.MIN_VALUE)); +} + +//CHECK#8 +if (0 - Number.MIN_VALUE !== -Number.MIN_VALUE ) { + throw new Test262Error('#8: 0 - Number.MIN_VALUE === -Number.MIN_VALUE. Actual: ' + (0 - Number.MIN_VALUE)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T7.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T7.js new file mode 100644 index 0000000000..fb045e524b --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T7.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T7 +description: > + The mathematical difference of two nonzero finite values of the + same magnitude and same sign is +0 +---*/ + +//CHECK#1 +if (Number.MIN_VALUE - Number.MIN_VALUE !== +0) { + throw new Test262Error('#1.1: Number.MIN_VALUE - Number.MIN_VALUE === 0. Actual: ' + (Number.MIN_VALUE - Number.MIN_VALUE)); +} else { + if (1 / (Number.MIN_VALUE - Number.MIN_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: Number.MIN_VALUE - Number.MIN_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#2 +if (-Number.MAX_VALUE - -Number.MAX_VALUE !== +0) { + throw new Test262Error('#2.2: -Number.MAX_VALUE - -Number.MAX_VALUE === 0. Actual: ' + (-Number.MAX_VALUE - -Number.MAX_VALUE)); +} else { + if (1 / (-Number.MAX_VALUE - -Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.1: -Number.MAX_VALUE - -Number.MAX_VALUE === + 0. Actual: -0'); + } +} + +//CHECK#3 +if (1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE !== +0) { + throw new Test262Error('#3.1: 1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE === 0. Actual: ' + (1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE)); +} else { + if (1 / (1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3.2: 1 / Number.MAX_VALUE - 1 / Number.MAX_VALUE === + 0. Actual: -0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T8.js b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T8.js new file mode 100644 index 0000000000..5d9b1eebb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/S11.6.2_A4_T8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x - y produces the same result as x + (-y) +es5id: 11.6.2_A4_T8 +description: > + If the magnitude is too large to represent, the operation + overflows and the result is then an infinity of appropriate sign +---*/ + +//CHECK#1 +if (Number.MAX_VALUE - -Number.MAX_VALUE !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1: Number.MAX_VALUE - -Number.MAX_VALUE === Number.POSITIVE_INFINITY. Actual: ' + (Number.MAX_VALUE - -Number.MAX_VALUE)); +} + +//CHECK#2 +if (-Number.MAX_VALUE - Number.MAX_VALUE !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#2: -Number.MAX_VALUE - umber.MAX_VALUE === Number.NEGATIVE_INFINITY. Actual: ' + (-Number.MAX_VALUE - Number.MAX_VALUE)); +} + +//CHECK#3 +if (1e+308 - -1e+308 !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3: 1e+308 - -1e+308 === Number.POSITIVE_INFINITY. Actual: ' + (1e+308 - -1e+308)); +} + +//CHECK#4 +if (-8.99e+307 - 8.99e+307 !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#4: -8.99e+307 - 8.99e+307 === Number.NEGATIVE_INFINITY. Actual: ' + (-8.99e+307 - 8.99e+307)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/bigint-and-number.js b/js/src/tests/test262/language/expressions/subtraction/bigint-and-number.js new file mode 100644 index 0000000000..a3b1ba8b8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-subtraction-operator-minus-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for subtraction operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n - 1; +}, '1n - 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 - 1n; +}, '1 - 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) - 1; +}, 'Object(1n) - 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 - Object(1n); +}, '1 - Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n - Object(1); +}, '1n - Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) - 1n; +}, 'Object(1) - 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) - Object(1); +}, 'Object(1n) - Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) - Object(1n); +}, 'Object(1) - Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n - NaN; +}, '1n - NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN - 1n; +}, 'NaN - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - Infinity; +}, '1n - Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity - 1n; +}, 'Infinity - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - true; +}, '1n - true throws TypeError'); + +assert.throws(TypeError, function() { + true - 1n; +}, 'true - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - '1'; +}, '1n - "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' - 1n; +}, '"1" - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - null; +}, '1n - null throws TypeError'); + +assert.throws(TypeError, function() { + null - 1n; +}, 'null - 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n - undefined; +}, '1n - undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined - 1n; +}, 'undefined - 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/bigint-arithmetic.js b/js/src/tests/test262/language/expressions/subtraction/bigint-arithmetic.js new file mode 100644 index 0000000000..fbed2aab5d --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/bigint-arithmetic.js @@ -0,0 +1,1346 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-subtraction-operator-minus-runtime-semantics-evaluation +description: BigInt subtraction arithmetic +features: [BigInt] +---*/ +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA9876543210n, + 0x0n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA9876543210n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA987654320Fn, + 0x1n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA987654320Fn) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA98n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA98n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0xFEDCBA97n, + 0xFEDCBA9777777779n, + 'The result of (0xFEDCBA9876543210n - 0xFEDCBA97n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x1234n, + 0xFEDCBA9876541FDCn, + 'The result of (0xFEDCBA9876543210n - 0x1234n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x3n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA9876543210n - 0x3n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x2n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA9876543210n - 0x2n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x1n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA9876543210n - 0x1n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - 0x0n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA9876543210n - 0x0n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x1n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA9876543210n - -0x1n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x2n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA9876543210n - -0x2n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x3n, + 0xFEDCBA9876543213n, + 'The result of (0xFEDCBA9876543210n - -0x3n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0x1234n, + 0xFEDCBA9876544444n, + 'The result of (0xFEDCBA9876543210n - -0x1234n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA97n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA97n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA98n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA98n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA9876543210n - -0xFEDCBA9876543210n, + 0x1FDB97530ECA86420n, + 'The result of (0xFEDCBA9876543210n - -0xFEDCBA9876543210n) is 0x1FDB97530ECA86420n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA9876543210n, + -0x1n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA9876543210n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn, + 0x0n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA98n, + 0xFEDCBA9777777777n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA98n) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0xFEDCBA97n, + 0xFEDCBA9777777778n, + 'The result of (0xFEDCBA987654320Fn - 0xFEDCBA97n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x1234n, + 0xFEDCBA9876541FDBn, + 'The result of (0xFEDCBA987654320Fn - 0x1234n) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x3n, + 0xFEDCBA987654320Cn, + 'The result of (0xFEDCBA987654320Fn - 0x3n) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x2n, + 0xFEDCBA987654320Dn, + 'The result of (0xFEDCBA987654320Fn - 0x2n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x1n, + 0xFEDCBA987654320En, + 'The result of (0xFEDCBA987654320Fn - 0x1n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - 0x0n, + 0xFEDCBA987654320Fn, + 'The result of (0xFEDCBA987654320Fn - 0x0n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x1n, + 0xFEDCBA9876543210n, + 'The result of (0xFEDCBA987654320Fn - -0x1n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x2n, + 0xFEDCBA9876543211n, + 'The result of (0xFEDCBA987654320Fn - -0x2n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x3n, + 0xFEDCBA9876543212n, + 'The result of (0xFEDCBA987654320Fn - -0x3n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0x1234n, + 0xFEDCBA9876544443n, + 'The result of (0xFEDCBA987654320Fn - -0x1234n) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA97n, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA97n) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA98n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA98n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn, + 0x1FDB97530ECA8641En, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn) is 0x1FDB97530ECA8641En' +); + +assert.sameValue( + 0xFEDCBA987654320Fn - -0xFEDCBA9876543210n, + 0x1FDB97530ECA8641Fn, + 'The result of (0xFEDCBA987654320Fn - -0xFEDCBA9876543210n) is 0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA9876543210n, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA98n - 0xFEDCBA9876543210n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA987654320Fn, + -0xFEDCBA9777777777n, + 'The result of (0xFEDCBA98n - 0xFEDCBA987654320Fn) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA98n, + 0x0n, + 'The result of (0xFEDCBA98n - 0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA98n - 0xFEDCBA97n, + 0x1n, + 'The result of (0xFEDCBA98n - 0xFEDCBA97n) is 0x1n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x1234n, + 0xFEDCA864n, + 'The result of (0xFEDCBA98n - 0x1234n) is 0xFEDCA864n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x3n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA98n - 0x3n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x2n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA98n - 0x2n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x1n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA98n - 0x1n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA98n - 0x0n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA98n - 0x0n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA98n - -0x1n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA98n - -0x1n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA98n - -0x2n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA98n - -0x2n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA98n - -0x3n, + 0xFEDCBA9Bn, + 'The result of (0xFEDCBA98n - -0x3n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0xFEDCBA98n - -0x1234n, + 0xFEDCCCCCn, + 'The result of (0xFEDCBA98n - -0x1234n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA97n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA98n - -0xFEDCBA97n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA98n, + 0x1FDB97530n, + 'The result of (0xFEDCBA98n - -0xFEDCBA98n) is 0x1FDB97530n' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA987654320Fn, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA98n - -0xFEDCBA987654320Fn) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0xFEDCBA98n - -0xFEDCBA9876543210n, + 0xFEDCBA997530ECA8n, + 'The result of (0xFEDCBA98n - -0xFEDCBA9876543210n) is 0xFEDCBA997530ECA8n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA9876543210n, + -0xFEDCBA9777777779n, + 'The result of (0xFEDCBA97n - 0xFEDCBA9876543210n) is -0xFEDCBA9777777779n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA987654320Fn, + -0xFEDCBA9777777778n, + 'The result of (0xFEDCBA97n - 0xFEDCBA987654320Fn) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA98n, + -0x1n, + 'The result of (0xFEDCBA97n - 0xFEDCBA98n) is -0x1n' +); + +assert.sameValue( + 0xFEDCBA97n - 0xFEDCBA97n, + 0x0n, + 'The result of (0xFEDCBA97n - 0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x1234n, + 0xFEDCA863n, + 'The result of (0xFEDCBA97n - 0x1234n) is 0xFEDCA863n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x3n, + 0xFEDCBA94n, + 'The result of (0xFEDCBA97n - 0x3n) is 0xFEDCBA94n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x2n, + 0xFEDCBA95n, + 'The result of (0xFEDCBA97n - 0x2n) is 0xFEDCBA95n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x1n, + 0xFEDCBA96n, + 'The result of (0xFEDCBA97n - 0x1n) is 0xFEDCBA96n' +); + +assert.sameValue( + 0xFEDCBA97n - 0x0n, + 0xFEDCBA97n, + 'The result of (0xFEDCBA97n - 0x0n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0xFEDCBA97n - -0x1n, + 0xFEDCBA98n, + 'The result of (0xFEDCBA97n - -0x1n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0xFEDCBA97n - -0x2n, + 0xFEDCBA99n, + 'The result of (0xFEDCBA97n - -0x2n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0xFEDCBA97n - -0x3n, + 0xFEDCBA9An, + 'The result of (0xFEDCBA97n - -0x3n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0xFEDCBA97n - -0x1234n, + 0xFEDCCCCBn, + 'The result of (0xFEDCBA97n - -0x1234n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA97n, + 0x1FDB9752En, + 'The result of (0xFEDCBA97n - -0xFEDCBA97n) is 0x1FDB9752En' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA98n, + 0x1FDB9752Fn, + 'The result of (0xFEDCBA97n - -0xFEDCBA98n) is 0x1FDB9752Fn' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA987654320Fn, + 0xFEDCBA997530ECA6n, + 'The result of (0xFEDCBA97n - -0xFEDCBA987654320Fn) is 0xFEDCBA997530ECA6n' +); + +assert.sameValue( + 0xFEDCBA97n - -0xFEDCBA9876543210n, + 0xFEDCBA997530ECA7n, + 'The result of (0xFEDCBA97n - -0xFEDCBA9876543210n) is 0xFEDCBA997530ECA7n' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA9876543210n, + -0xFEDCBA9876541FDCn, + 'The result of (0x1234n - 0xFEDCBA9876543210n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876541FDBn, + 'The result of (0x1234n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA98n, + -0xFEDCA864n, + 'The result of (0x1234n - 0xFEDCBA98n) is -0xFEDCA864n' +); + +assert.sameValue( + 0x1234n - 0xFEDCBA97n, + -0xFEDCA863n, + 'The result of (0x1234n - 0xFEDCBA97n) is -0xFEDCA863n' +); + +assert.sameValue(0x1234n - 0x1234n, 0x0n, 'The result of (0x1234n - 0x1234n) is 0x0n'); +assert.sameValue(0x1234n - 0x3n, 0x1231n, 'The result of (0x1234n - 0x3n) is 0x1231n'); +assert.sameValue(0x1234n - 0x2n, 0x1232n, 'The result of (0x1234n - 0x2n) is 0x1232n'); +assert.sameValue(0x1234n - 0x1n, 0x1233n, 'The result of (0x1234n - 0x1n) is 0x1233n'); +assert.sameValue(0x1234n - 0x0n, 0x1234n, 'The result of (0x1234n - 0x0n) is 0x1234n'); +assert.sameValue(0x1234n - -0x1n, 0x1235n, 'The result of (0x1234n - -0x1n) is 0x1235n'); +assert.sameValue(0x1234n - -0x2n, 0x1236n, 'The result of (0x1234n - -0x2n) is 0x1236n'); +assert.sameValue(0x1234n - -0x3n, 0x1237n, 'The result of (0x1234n - -0x3n) is 0x1237n'); +assert.sameValue(0x1234n - -0x1234n, 0x2468n, 'The result of (0x1234n - -0x1234n) is 0x2468n'); + +assert.sameValue( + 0x1234n - -0xFEDCBA97n, + 0xFEDCCCCBn, + 'The result of (0x1234n - -0xFEDCBA97n) is 0xFEDCCCCBn' +); + +assert.sameValue( + 0x1234n - -0xFEDCBA98n, + 0xFEDCCCCCn, + 'The result of (0x1234n - -0xFEDCBA98n) is 0xFEDCCCCCn' +); + +assert.sameValue( + 0x1234n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876544443n, + 'The result of (0x1234n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876544443n' +); + +assert.sameValue( + 0x1234n - -0xFEDCBA9876543210n, + 0xFEDCBA9876544444n, + 'The result of (0x1234n - -0xFEDCBA9876543210n) is 0xFEDCBA9876544444n' +); + +assert.sameValue( + 0x3n - 0xFEDCBA9876543210n, + -0xFEDCBA987654320Dn, + 'The result of (0x3n - 0xFEDCBA9876543210n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x3n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320Cn, + 'The result of (0x3n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + 0x3n - 0xFEDCBA98n, + -0xFEDCBA95n, + 'The result of (0x3n - 0xFEDCBA98n) is -0xFEDCBA95n' +); + +assert.sameValue( + 0x3n - 0xFEDCBA97n, + -0xFEDCBA94n, + 'The result of (0x3n - 0xFEDCBA97n) is -0xFEDCBA94n' +); + +assert.sameValue(0x3n - 0x1234n, -0x1231n, 'The result of (0x3n - 0x1234n) is -0x1231n'); +assert.sameValue(0x3n - 0x3n, 0x0n, 'The result of (0x3n - 0x3n) is 0x0n'); +assert.sameValue(0x3n - 0x2n, 0x1n, 'The result of (0x3n - 0x2n) is 0x1n'); +assert.sameValue(0x3n - 0x1n, 0x2n, 'The result of (0x3n - 0x1n) is 0x2n'); +assert.sameValue(0x3n - 0x0n, 0x3n, 'The result of (0x3n - 0x0n) is 0x3n'); +assert.sameValue(0x3n - -0x1n, 0x4n, 'The result of (0x3n - -0x1n) is 0x4n'); +assert.sameValue(0x3n - -0x2n, 0x5n, 'The result of (0x3n - -0x2n) is 0x5n'); +assert.sameValue(0x3n - -0x3n, 0x6n, 'The result of (0x3n - -0x3n) is 0x6n'); +assert.sameValue(0x3n - -0x1234n, 0x1237n, 'The result of (0x3n - -0x1234n) is 0x1237n'); + +assert.sameValue( + 0x3n - -0xFEDCBA97n, + 0xFEDCBA9An, + 'The result of (0x3n - -0xFEDCBA97n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0x3n - -0xFEDCBA98n, + 0xFEDCBA9Bn, + 'The result of (0x3n - -0xFEDCBA98n) is 0xFEDCBA9Bn' +); + +assert.sameValue( + 0x3n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876543212n, + 'The result of (0x3n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0x3n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543213n, + 'The result of (0x3n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543213n' +); + +assert.sameValue( + 0x2n - 0xFEDCBA9876543210n, + -0xFEDCBA987654320En, + 'The result of (0x2n - 0xFEDCBA9876543210n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x2n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320Dn, + 'The result of (0x2n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + 0x2n - 0xFEDCBA98n, + -0xFEDCBA96n, + 'The result of (0x2n - 0xFEDCBA98n) is -0xFEDCBA96n' +); + +assert.sameValue( + 0x2n - 0xFEDCBA97n, + -0xFEDCBA95n, + 'The result of (0x2n - 0xFEDCBA97n) is -0xFEDCBA95n' +); + +assert.sameValue(0x2n - 0x1234n, -0x1232n, 'The result of (0x2n - 0x1234n) is -0x1232n'); +assert.sameValue(0x2n - 0x3n, -0x1n, 'The result of (0x2n - 0x3n) is -0x1n'); +assert.sameValue(0x2n - 0x2n, 0x0n, 'The result of (0x2n - 0x2n) is 0x0n'); +assert.sameValue(0x2n - 0x1n, 0x1n, 'The result of (0x2n - 0x1n) is 0x1n'); +assert.sameValue(0x2n - 0x0n, 0x2n, 'The result of (0x2n - 0x0n) is 0x2n'); +assert.sameValue(0x2n - -0x1n, 0x3n, 'The result of (0x2n - -0x1n) is 0x3n'); +assert.sameValue(0x2n - -0x2n, 0x4n, 'The result of (0x2n - -0x2n) is 0x4n'); +assert.sameValue(0x2n - -0x3n, 0x5n, 'The result of (0x2n - -0x3n) is 0x5n'); +assert.sameValue(0x2n - -0x1234n, 0x1236n, 'The result of (0x2n - -0x1234n) is 0x1236n'); + +assert.sameValue( + 0x2n - -0xFEDCBA97n, + 0xFEDCBA99n, + 'The result of (0x2n - -0xFEDCBA97n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0x2n - -0xFEDCBA98n, + 0xFEDCBA9An, + 'The result of (0x2n - -0xFEDCBA98n) is 0xFEDCBA9An' +); + +assert.sameValue( + 0x2n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876543211n, + 'The result of (0x2n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0x2n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543212n, + 'The result of (0x2n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543212n' +); + +assert.sameValue( + 0x1n - 0xFEDCBA9876543210n, + -0xFEDCBA987654320Fn, + 'The result of (0x1n - 0xFEDCBA9876543210n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x1n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320En, + 'The result of (0x1n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320En' +); + +assert.sameValue( + 0x1n - 0xFEDCBA98n, + -0xFEDCBA97n, + 'The result of (0x1n - 0xFEDCBA98n) is -0xFEDCBA97n' +); + +assert.sameValue( + 0x1n - 0xFEDCBA97n, + -0xFEDCBA96n, + 'The result of (0x1n - 0xFEDCBA97n) is -0xFEDCBA96n' +); + +assert.sameValue(0x1n - 0x1234n, -0x1233n, 'The result of (0x1n - 0x1234n) is -0x1233n'); +assert.sameValue(0x1n - 0x3n, -0x2n, 'The result of (0x1n - 0x3n) is -0x2n'); +assert.sameValue(0x1n - 0x2n, -0x1n, 'The result of (0x1n - 0x2n) is -0x1n'); +assert.sameValue(0x1n - 0x1n, 0x0n, 'The result of (0x1n - 0x1n) is 0x0n'); +assert.sameValue(0x1n - 0x0n, 0x1n, 'The result of (0x1n - 0x0n) is 0x1n'); +assert.sameValue(0x1n - -0x1n, 0x2n, 'The result of (0x1n - -0x1n) is 0x2n'); +assert.sameValue(0x1n - -0x2n, 0x3n, 'The result of (0x1n - -0x2n) is 0x3n'); +assert.sameValue(0x1n - -0x3n, 0x4n, 'The result of (0x1n - -0x3n) is 0x4n'); +assert.sameValue(0x1n - -0x1234n, 0x1235n, 'The result of (0x1n - -0x1234n) is 0x1235n'); + +assert.sameValue( + 0x1n - -0xFEDCBA97n, + 0xFEDCBA98n, + 'The result of (0x1n - -0xFEDCBA97n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0x1n - -0xFEDCBA98n, + 0xFEDCBA99n, + 'The result of (0x1n - -0xFEDCBA98n) is 0xFEDCBA99n' +); + +assert.sameValue( + 0x1n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876543210n, + 'The result of (0x1n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + 0x1n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543211n, + 'The result of (0x1n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543211n' +); + +assert.sameValue( + 0x0n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543210n, + 'The result of (0x0n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + 0x0n - 0xFEDCBA987654320Fn, + -0xFEDCBA987654320Fn, + 'The result of (0x0n - 0xFEDCBA987654320Fn) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n - 0xFEDCBA98n, + -0xFEDCBA98n, + 'The result of (0x0n - 0xFEDCBA98n) is -0xFEDCBA98n' +); + +assert.sameValue( + 0x0n - 0xFEDCBA97n, + -0xFEDCBA97n, + 'The result of (0x0n - 0xFEDCBA97n) is -0xFEDCBA97n' +); + +assert.sameValue(0x0n - 0x1234n, -0x1234n, 'The result of (0x0n - 0x1234n) is -0x1234n'); +assert.sameValue(0x0n - 0x3n, -0x3n, 'The result of (0x0n - 0x3n) is -0x3n'); +assert.sameValue(0x0n - 0x2n, -0x2n, 'The result of (0x0n - 0x2n) is -0x2n'); +assert.sameValue(0x0n - 0x1n, -0x1n, 'The result of (0x0n - 0x1n) is -0x1n'); +assert.sameValue(0x0n - 0x0n, 0x0n, 'The result of (0x0n - 0x0n) is 0x0n'); +assert.sameValue(0x0n - -0x1n, 0x1n, 'The result of (0x0n - -0x1n) is 0x1n'); +assert.sameValue(0x0n - -0x2n, 0x2n, 'The result of (0x0n - -0x2n) is 0x2n'); +assert.sameValue(0x0n - -0x3n, 0x3n, 'The result of (0x0n - -0x3n) is 0x3n'); +assert.sameValue(0x0n - -0x1234n, 0x1234n, 'The result of (0x0n - -0x1234n) is 0x1234n'); + +assert.sameValue( + 0x0n - -0xFEDCBA97n, + 0xFEDCBA97n, + 'The result of (0x0n - -0xFEDCBA97n) is 0xFEDCBA97n' +); + +assert.sameValue( + 0x0n - -0xFEDCBA98n, + 0xFEDCBA98n, + 'The result of (0x0n - -0xFEDCBA98n) is 0xFEDCBA98n' +); + +assert.sameValue( + 0x0n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Fn, + 'The result of (0x0n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + 0x0n - -0xFEDCBA9876543210n, + 0xFEDCBA9876543210n, + 'The result of (0x0n - -0xFEDCBA9876543210n) is 0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543211n, + 'The result of (-0x1n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876543210n, + 'The result of (-0x1n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA98n, + -0xFEDCBA99n, + 'The result of (-0x1n - 0xFEDCBA98n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0x1n - 0xFEDCBA97n, + -0xFEDCBA98n, + 'The result of (-0x1n - 0xFEDCBA97n) is -0xFEDCBA98n' +); + +assert.sameValue(-0x1n - 0x1234n, -0x1235n, 'The result of (-0x1n - 0x1234n) is -0x1235n'); +assert.sameValue(-0x1n - 0x3n, -0x4n, 'The result of (-0x1n - 0x3n) is -0x4n'); +assert.sameValue(-0x1n - 0x2n, -0x3n, 'The result of (-0x1n - 0x2n) is -0x3n'); +assert.sameValue(-0x1n - 0x1n, -0x2n, 'The result of (-0x1n - 0x1n) is -0x2n'); +assert.sameValue(-0x1n - 0x0n, -0x1n, 'The result of (-0x1n - 0x0n) is -0x1n'); +assert.sameValue(-0x1n - -0x1n, 0x0n, 'The result of (-0x1n - -0x1n) is 0x0n'); +assert.sameValue(-0x1n - -0x2n, 0x1n, 'The result of (-0x1n - -0x2n) is 0x1n'); +assert.sameValue(-0x1n - -0x3n, 0x2n, 'The result of (-0x1n - -0x3n) is 0x2n'); +assert.sameValue(-0x1n - -0x1234n, 0x1233n, 'The result of (-0x1n - -0x1234n) is 0x1233n'); + +assert.sameValue( + -0x1n - -0xFEDCBA97n, + 0xFEDCBA96n, + 'The result of (-0x1n - -0xFEDCBA97n) is 0xFEDCBA96n' +); + +assert.sameValue( + -0x1n - -0xFEDCBA98n, + 0xFEDCBA97n, + 'The result of (-0x1n - -0xFEDCBA98n) is 0xFEDCBA97n' +); + +assert.sameValue( + -0x1n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320En, + 'The result of (-0x1n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320En' +); + +assert.sameValue( + -0x1n - -0xFEDCBA9876543210n, + 0xFEDCBA987654320Fn, + 'The result of (-0x1n - -0xFEDCBA9876543210n) is 0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0x2n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543212n, + 'The result of (-0x2n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x2n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876543211n, + 'The result of (-0x2n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0x2n - 0xFEDCBA98n, + -0xFEDCBA9An, + 'The result of (-0x2n - 0xFEDCBA98n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0x2n - 0xFEDCBA97n, + -0xFEDCBA99n, + 'The result of (-0x2n - 0xFEDCBA97n) is -0xFEDCBA99n' +); + +assert.sameValue(-0x2n - 0x1234n, -0x1236n, 'The result of (-0x2n - 0x1234n) is -0x1236n'); +assert.sameValue(-0x2n - 0x3n, -0x5n, 'The result of (-0x2n - 0x3n) is -0x5n'); +assert.sameValue(-0x2n - 0x2n, -0x4n, 'The result of (-0x2n - 0x2n) is -0x4n'); +assert.sameValue(-0x2n - 0x1n, -0x3n, 'The result of (-0x2n - 0x1n) is -0x3n'); +assert.sameValue(-0x2n - 0x0n, -0x2n, 'The result of (-0x2n - 0x0n) is -0x2n'); +assert.sameValue(-0x2n - -0x1n, -0x1n, 'The result of (-0x2n - -0x1n) is -0x1n'); +assert.sameValue(-0x2n - -0x2n, 0x0n, 'The result of (-0x2n - -0x2n) is 0x0n'); +assert.sameValue(-0x2n - -0x3n, 0x1n, 'The result of (-0x2n - -0x3n) is 0x1n'); +assert.sameValue(-0x2n - -0x1234n, 0x1232n, 'The result of (-0x2n - -0x1234n) is 0x1232n'); + +assert.sameValue( + -0x2n - -0xFEDCBA97n, + 0xFEDCBA95n, + 'The result of (-0x2n - -0xFEDCBA97n) is 0xFEDCBA95n' +); + +assert.sameValue( + -0x2n - -0xFEDCBA98n, + 0xFEDCBA96n, + 'The result of (-0x2n - -0xFEDCBA98n) is 0xFEDCBA96n' +); + +assert.sameValue( + -0x2n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Dn, + 'The result of (-0x2n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0x2n - -0xFEDCBA9876543210n, + 0xFEDCBA987654320En, + 'The result of (-0x2n - -0xFEDCBA9876543210n) is 0xFEDCBA987654320En' +); + +assert.sameValue( + -0x3n - 0xFEDCBA9876543210n, + -0xFEDCBA9876543213n, + 'The result of (-0x3n - 0xFEDCBA9876543210n) is -0xFEDCBA9876543213n' +); + +assert.sameValue( + -0x3n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876543212n, + 'The result of (-0x3n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0x3n - 0xFEDCBA98n, + -0xFEDCBA9Bn, + 'The result of (-0x3n - 0xFEDCBA98n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0x3n - 0xFEDCBA97n, + -0xFEDCBA9An, + 'The result of (-0x3n - 0xFEDCBA97n) is -0xFEDCBA9An' +); + +assert.sameValue(-0x3n - 0x1234n, -0x1237n, 'The result of (-0x3n - 0x1234n) is -0x1237n'); +assert.sameValue(-0x3n - 0x3n, -0x6n, 'The result of (-0x3n - 0x3n) is -0x6n'); +assert.sameValue(-0x3n - 0x2n, -0x5n, 'The result of (-0x3n - 0x2n) is -0x5n'); +assert.sameValue(-0x3n - 0x1n, -0x4n, 'The result of (-0x3n - 0x1n) is -0x4n'); +assert.sameValue(-0x3n - 0x0n, -0x3n, 'The result of (-0x3n - 0x0n) is -0x3n'); +assert.sameValue(-0x3n - -0x1n, -0x2n, 'The result of (-0x3n - -0x1n) is -0x2n'); +assert.sameValue(-0x3n - -0x2n, -0x1n, 'The result of (-0x3n - -0x2n) is -0x1n'); +assert.sameValue(-0x3n - -0x3n, 0x0n, 'The result of (-0x3n - -0x3n) is 0x0n'); +assert.sameValue(-0x3n - -0x1234n, 0x1231n, 'The result of (-0x3n - -0x1234n) is 0x1231n'); + +assert.sameValue( + -0x3n - -0xFEDCBA97n, + 0xFEDCBA94n, + 'The result of (-0x3n - -0xFEDCBA97n) is 0xFEDCBA94n' +); + +assert.sameValue( + -0x3n - -0xFEDCBA98n, + 0xFEDCBA95n, + 'The result of (-0x3n - -0xFEDCBA98n) is 0xFEDCBA95n' +); + +assert.sameValue( + -0x3n - -0xFEDCBA987654320Fn, + 0xFEDCBA987654320Cn, + 'The result of (-0x3n - -0xFEDCBA987654320Fn) is 0xFEDCBA987654320Cn' +); + +assert.sameValue( + -0x3n - -0xFEDCBA9876543210n, + 0xFEDCBA987654320Dn, + 'The result of (-0x3n - -0xFEDCBA9876543210n) is 0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA9876543210n, + -0xFEDCBA9876544444n, + 'The result of (-0x1234n - 0xFEDCBA9876543210n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA987654320Fn, + -0xFEDCBA9876544443n, + 'The result of (-0x1234n - 0xFEDCBA987654320Fn) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA98n, + -0xFEDCCCCCn, + 'The result of (-0x1234n - 0xFEDCBA98n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0x1234n - 0xFEDCBA97n, + -0xFEDCCCCBn, + 'The result of (-0x1234n - 0xFEDCBA97n) is -0xFEDCCCCBn' +); + +assert.sameValue(-0x1234n - 0x1234n, -0x2468n, 'The result of (-0x1234n - 0x1234n) is -0x2468n'); +assert.sameValue(-0x1234n - 0x3n, -0x1237n, 'The result of (-0x1234n - 0x3n) is -0x1237n'); +assert.sameValue(-0x1234n - 0x2n, -0x1236n, 'The result of (-0x1234n - 0x2n) is -0x1236n'); +assert.sameValue(-0x1234n - 0x1n, -0x1235n, 'The result of (-0x1234n - 0x1n) is -0x1235n'); +assert.sameValue(-0x1234n - 0x0n, -0x1234n, 'The result of (-0x1234n - 0x0n) is -0x1234n'); +assert.sameValue(-0x1234n - -0x1n, -0x1233n, 'The result of (-0x1234n - -0x1n) is -0x1233n'); +assert.sameValue(-0x1234n - -0x2n, -0x1232n, 'The result of (-0x1234n - -0x2n) is -0x1232n'); +assert.sameValue(-0x1234n - -0x3n, -0x1231n, 'The result of (-0x1234n - -0x3n) is -0x1231n'); +assert.sameValue(-0x1234n - -0x1234n, 0x0n, 'The result of (-0x1234n - -0x1234n) is 0x0n'); + +assert.sameValue( + -0x1234n - -0xFEDCBA97n, + 0xFEDCA863n, + 'The result of (-0x1234n - -0xFEDCBA97n) is 0xFEDCA863n' +); + +assert.sameValue( + -0x1234n - -0xFEDCBA98n, + 0xFEDCA864n, + 'The result of (-0x1234n - -0xFEDCBA98n) is 0xFEDCA864n' +); + +assert.sameValue( + -0x1234n - -0xFEDCBA987654320Fn, + 0xFEDCBA9876541FDBn, + 'The result of (-0x1234n - -0xFEDCBA987654320Fn) is 0xFEDCBA9876541FDBn' +); + +assert.sameValue( + -0x1234n - -0xFEDCBA9876543210n, + 0xFEDCBA9876541FDCn, + 'The result of (-0x1234n - -0xFEDCBA9876543210n) is 0xFEDCBA9876541FDCn' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA9876543210n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA97n - 0xFEDCBA9876543210n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA97n - 0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA98n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA97n - 0xFEDCBA98n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA97n - 0xFEDCBA97n, + -0x1FDB9752En, + 'The result of (-0xFEDCBA97n - 0xFEDCBA97n) is -0x1FDB9752En' +); + +assert.sameValue( + -0xFEDCBA97n - 0x1234n, + -0xFEDCCCCBn, + 'The result of (-0xFEDCBA97n - 0x1234n) is -0xFEDCCCCBn' +); + +assert.sameValue( + -0xFEDCBA97n - 0x3n, + -0xFEDCBA9An, + 'The result of (-0xFEDCBA97n - 0x3n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0xFEDCBA97n - 0x2n, + -0xFEDCBA99n, + 'The result of (-0xFEDCBA97n - 0x2n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0xFEDCBA97n - 0x1n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA97n - 0x1n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA97n - 0x0n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA97n - 0x0n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x1n, + -0xFEDCBA96n, + 'The result of (-0xFEDCBA97n - -0x1n) is -0xFEDCBA96n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x2n, + -0xFEDCBA95n, + 'The result of (-0xFEDCBA97n - -0x2n) is -0xFEDCBA95n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x3n, + -0xFEDCBA94n, + 'The result of (-0xFEDCBA97n - -0x3n) is -0xFEDCBA94n' +); + +assert.sameValue( + -0xFEDCBA97n - -0x1234n, + -0xFEDCA863n, + 'The result of (-0xFEDCBA97n - -0x1234n) is -0xFEDCA863n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA97n, + 0x0n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA97n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA98n, + 0x1n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA98n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA987654320Fn, + 0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA987654320Fn) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA97n - -0xFEDCBA9876543210n, + 0xFEDCBA9777777779n, + 'The result of (-0xFEDCBA97n - -0xFEDCBA9876543210n) is 0xFEDCBA9777777779n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA9876543210n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA98n - 0xFEDCBA9876543210n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA987654320Fn, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA98n - 0xFEDCBA987654320Fn) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA98n, + -0x1FDB97530n, + 'The result of (-0xFEDCBA98n - 0xFEDCBA98n) is -0x1FDB97530n' +); + +assert.sameValue( + -0xFEDCBA98n - 0xFEDCBA97n, + -0x1FDB9752Fn, + 'The result of (-0xFEDCBA98n - 0xFEDCBA97n) is -0x1FDB9752Fn' +); + +assert.sameValue( + -0xFEDCBA98n - 0x1234n, + -0xFEDCCCCCn, + 'The result of (-0xFEDCBA98n - 0x1234n) is -0xFEDCCCCCn' +); + +assert.sameValue( + -0xFEDCBA98n - 0x3n, + -0xFEDCBA9Bn, + 'The result of (-0xFEDCBA98n - 0x3n) is -0xFEDCBA9Bn' +); + +assert.sameValue( + -0xFEDCBA98n - 0x2n, + -0xFEDCBA9An, + 'The result of (-0xFEDCBA98n - 0x2n) is -0xFEDCBA9An' +); + +assert.sameValue( + -0xFEDCBA98n - 0x1n, + -0xFEDCBA99n, + 'The result of (-0xFEDCBA98n - 0x1n) is -0xFEDCBA99n' +); + +assert.sameValue( + -0xFEDCBA98n - 0x0n, + -0xFEDCBA98n, + 'The result of (-0xFEDCBA98n - 0x0n) is -0xFEDCBA98n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x1n, + -0xFEDCBA97n, + 'The result of (-0xFEDCBA98n - -0x1n) is -0xFEDCBA97n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x2n, + -0xFEDCBA96n, + 'The result of (-0xFEDCBA98n - -0x2n) is -0xFEDCBA96n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x3n, + -0xFEDCBA95n, + 'The result of (-0xFEDCBA98n - -0x3n) is -0xFEDCBA95n' +); + +assert.sameValue( + -0xFEDCBA98n - -0x1234n, + -0xFEDCA864n, + 'The result of (-0xFEDCBA98n - -0x1234n) is -0xFEDCA864n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA97n, + -0x1n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA97n) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA98n, + 0x0n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA98n) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA987654320Fn, + 0xFEDCBA9777777777n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA987654320Fn) is 0xFEDCBA9777777777n' +); + +assert.sameValue( + -0xFEDCBA98n - -0xFEDCBA9876543210n, + 0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA98n - -0xFEDCBA9876543210n) is 0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA9876543210n, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA9876543210n) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641En, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA98n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA98n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0xFEDCBA97n, + -0xFEDCBA997530ECA6n, + 'The result of (-0xFEDCBA987654320Fn - 0xFEDCBA97n) is -0xFEDCBA997530ECA6n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x1234n, + -0xFEDCBA9876544443n, + 'The result of (-0xFEDCBA987654320Fn - 0x1234n) is -0xFEDCBA9876544443n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x3n, + -0xFEDCBA9876543212n, + 'The result of (-0xFEDCBA987654320Fn - 0x3n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x2n, + -0xFEDCBA9876543211n, + 'The result of (-0xFEDCBA987654320Fn - 0x2n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x1n, + -0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA987654320Fn - 0x1n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - 0x0n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA987654320Fn - 0x0n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x1n, + -0xFEDCBA987654320En, + 'The result of (-0xFEDCBA987654320Fn - -0x1n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x2n, + -0xFEDCBA987654320Dn, + 'The result of (-0xFEDCBA987654320Fn - -0x2n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x3n, + -0xFEDCBA987654320Cn, + 'The result of (-0xFEDCBA987654320Fn - -0x3n) is -0xFEDCBA987654320Cn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0x1234n, + -0xFEDCBA9876541FDBn, + 'The result of (-0xFEDCBA987654320Fn - -0x1234n) is -0xFEDCBA9876541FDBn' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA97n, + -0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA97n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA98n, + -0xFEDCBA9777777777n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA98n) is -0xFEDCBA9777777777n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn, + 0x0n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA987654320Fn) is 0x0n' +); + +assert.sameValue( + -0xFEDCBA987654320Fn - -0xFEDCBA9876543210n, + 0x1n, + 'The result of (-0xFEDCBA987654320Fn - -0xFEDCBA9876543210n) is 0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA9876543210n, + -0x1FDB97530ECA86420n, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA9876543210n) is -0x1FDB97530ECA86420n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA987654320Fn, + -0x1FDB97530ECA8641Fn, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA987654320Fn) is -0x1FDB97530ECA8641Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA98n, + -0xFEDCBA997530ECA8n, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA98n) is -0xFEDCBA997530ECA8n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0xFEDCBA97n, + -0xFEDCBA997530ECA7n, + 'The result of (-0xFEDCBA9876543210n - 0xFEDCBA97n) is -0xFEDCBA997530ECA7n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x1234n, + -0xFEDCBA9876544444n, + 'The result of (-0xFEDCBA9876543210n - 0x1234n) is -0xFEDCBA9876544444n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x3n, + -0xFEDCBA9876543213n, + 'The result of (-0xFEDCBA9876543210n - 0x3n) is -0xFEDCBA9876543213n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x2n, + -0xFEDCBA9876543212n, + 'The result of (-0xFEDCBA9876543210n - 0x2n) is -0xFEDCBA9876543212n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x1n, + -0xFEDCBA9876543211n, + 'The result of (-0xFEDCBA9876543210n - 0x1n) is -0xFEDCBA9876543211n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - 0x0n, + -0xFEDCBA9876543210n, + 'The result of (-0xFEDCBA9876543210n - 0x0n) is -0xFEDCBA9876543210n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x1n, + -0xFEDCBA987654320Fn, + 'The result of (-0xFEDCBA9876543210n - -0x1n) is -0xFEDCBA987654320Fn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x2n, + -0xFEDCBA987654320En, + 'The result of (-0xFEDCBA9876543210n - -0x2n) is -0xFEDCBA987654320En' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x3n, + -0xFEDCBA987654320Dn, + 'The result of (-0xFEDCBA9876543210n - -0x3n) is -0xFEDCBA987654320Dn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0x1234n, + -0xFEDCBA9876541FDCn, + 'The result of (-0xFEDCBA9876543210n - -0x1234n) is -0xFEDCBA9876541FDCn' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA97n, + -0xFEDCBA9777777779n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA97n) is -0xFEDCBA9777777779n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA98n, + -0xFEDCBA9777777778n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA98n) is -0xFEDCBA9777777778n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA987654320Fn, + -0x1n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA987654320Fn) is -0x1n' +); + +assert.sameValue( + -0xFEDCBA9876543210n - -0xFEDCBA9876543210n, + 0x0n, + 'The result of (-0xFEDCBA9876543210n - -0xFEDCBA9876543210n) is 0x0n' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/bigint-errors.js b/js/src/tests/test262/language/expressions/subtraction/bigint-errors.js new file mode 100644 index 0000000000..34cd092679 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/bigint-errors.js @@ -0,0 +1,72 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: subtraction operator ToNumeric with BigInt operands +esid: sec-subtraction-operator-minus-runtime-semantics-evaluation +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') - 0n; +}, 'Symbol("1") - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - Symbol('1'); +}, '0n - Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) - 0n; +}, 'Object(Symbol("1")) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - Object(Symbol('1')); +}, '0n - Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) - 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n - {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) - 0n; +}, '({valueOf: function() {return Symbol("1");}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n - {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) - 0n; +}, '({toString: function() {return Symbol("1");}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + toString: function() { + return Symbol('1'); + } + }; +}, '0n - {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/subtraction/bigint-toprimitive.js new file mode 100644 index 0000000000..615f4156a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/bigint-toprimitive.js @@ -0,0 +1,374 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: subtraction operator ToNumeric with BigInt operands +esid: sec-subtraction-operator-minus-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) - 1n) is 1n'); + +assert.sameValue(3n - { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + }, + + toString: err +} - 1n, 1n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) - 1n) is 1n'); + +assert.sameValue(3n - { + valueOf: function() { + return 2n; + }, + + toString: err +}, 1n, 'The result of (3n - {valueOf: function() {return 2n;}, toString: err}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({toString: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n - {toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: null, + + toString: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + valueOf: null, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n - {valueOf: null, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: 1, + + toString: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + valueOf: 1, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n - {valueOf: 1, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: {}, + + toString: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + valueOf: {}, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n - {valueOf: {}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n - {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n - {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 1n'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) - 0n; +}, '({[Symbol.toPrimitive]: 1}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + [Symbol.toPrimitive]: 1 + }; +}, '0n - {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) - 0n; +}, '({[Symbol.toPrimitive]: {}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + [Symbol.toPrimitive]: {} + }; +}, '0n - {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) - 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n - {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) - 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n - {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) - 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) - 0n throws MyError'); + +assert.throws(MyError, function() { + 0n - { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n - {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) - 0n; +}, '({valueOf: function() {throw new MyError();}}) - 0n throws MyError'); + +assert.throws(MyError, function() { + 0n - { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n - {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) - 0n; +}, '({toString: function() {throw new MyError();}}) - 0n throws MyError'); + +assert.throws(MyError, function() { + 0n - { + toString: function() { + throw new MyError(); + } + }; +}, '0n - {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) - 0n; +}, '({valueOf: null, toString: null}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + valueOf: null, + toString: null + }; +}, '0n - {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) - 0n; +}, '({valueOf: 1, toString: 1}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + valueOf: 1, + toString: 1 + }; +}, '0n - {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) - 0n; +}, '({valueOf: {}, toString: {}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + valueOf: {}, + toString: {} + }; +}, '0n - {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) - 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n - {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) - 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) - 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n - { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n - {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/subtraction/bigint-wrapped-values.js new file mode 100644 index 0000000000..2807304e36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/bigint-wrapped-values.js @@ -0,0 +1,47 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: subtraction operator ToNumeric with BigInt operands +esid: sec-subtraction-operator-minus-runtime-semantics-evaluation +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.sameValue(Object(2n) - 1n, 1n, 'The result of (Object(2n) - 1n) is 1n'); +assert.sameValue(3n - Object(2n), 1n, 'The result of (3n - Object(2n)) is 1n'); + +assert.sameValue({ + [Symbol.toPrimitive]: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + [Symbol.toPrimitive]: function() { + return 2n; + } +}, 1n, 'The result of (3n - {[Symbol.toPrimitive]: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + valueOf: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({valueOf: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + valueOf: function() { + return 2n; + } +}, 1n, 'The result of (3n - {valueOf: function() {return 2n;}}) is 1n'); + +assert.sameValue({ + toString: function() { + return 2n; + } +} - 1n, 1n, 'The result of (({toString: function() {return 2n;}}) - 1n) is 1n'); + +assert.sameValue(3n - { + toString: function() { + return 2n; + } +}, 1n, 'The result of (3n - {toString: function() {return 2n;}}) is 1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/browser.js b/js/src/tests/test262/language/expressions/subtraction/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/subtraction/order-of-evaluation.js b/js/src/tests/test262/language/expressions/subtraction/order-of-evaluation.js new file mode 100644 index 0000000000..220a755786 --- /dev/null +++ b/js/src/tests/test262/language/expressions/subtraction/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-subtraction-operator-minus-runtime-semantics-evaluation +description: Type coercion order of operations for subtraction operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() - (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() - (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() - (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() - (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() - (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() - (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/subtraction/shell.js b/js/src/tests/test262/language/expressions/subtraction/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/super/browser.js b/js/src/tests/test262/language/expressions/super/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/super/call-arg-evaluation-err.js b/js/src/tests/test262/language/expressions/super/call-arg-evaluation-err.js new file mode 100644 index 0000000000..bcab7d1c76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-arg-evaluation-err.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Returns abrupt completion resulting from ArgumentListEvaluation +info: | + [...] + 4. Let argList be ArgumentListEvaluation of Arguments. + 5. ReturnIfAbrupt(argList). +features: [class] +---*/ + +var thrown = new Test262Error(); +var thrower = function() { + throw thrown; +}; +var caught; +class C extends Object { + constructor() { + try { + super(thrower()); + } catch (err) { + caught = err; + } + } +} + +// When the "construct" invocation completes and the "this" value is +// uninitialized, the specification dictates that a ReferenceError must be +// thrown. That behavior is tested elsewhere, so the error is ignored (if it is +// produced at all). +try { + new C(); +} catch (_) {} + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-bind-this-value-twice.js b/js/src/tests/test262/language/expressions/super/call-bind-this-value-twice.js new file mode 100644 index 0000000000..85fb75f893 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-bind-this-value-twice.js @@ -0,0 +1,42 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Abrupt completion from re-binding "this" value +info: | + [...] + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Return ? thisER.BindThisValue(result). + + 8.1.1.3.1 BindThisValue + + 1. Let envRec be the function Environment Record for which the method was + invoked. + 2. Assert: envRec.[[ThisBindingStatus]] is not "lexical". + 3. If envRec.[[ThisBindingStatus]] is "initialized", throw a ReferenceError + exception. +features: [class] +---*/ + +var caught; +function Parent() {} + +class Child extends Parent { + constructor() { + super(); + try { + super(); + } catch (err) { + caught = err; + } + } +} + +new Child(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-bind-this-value.js b/js/src/tests/test262/language/expressions/super/call-bind-this-value.js new file mode 100644 index 0000000000..95cfe951f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-bind-this-value.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Binds the "this" value to value returned by "parent" constructor +info: | + [...] + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Return ? thisER.BindThisValue(result). +features: [class] +---*/ + +var customThisValue = {}; +var boundThisValue; +function Parent() { + return customThisValue; +} + +class Child extends Parent { + constructor() { + super(); + boundThisValue = this; + } +} + +new Child(); + +assert.sameValue(boundThisValue, customThisValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-construct-error.js b/js/src/tests/test262/language/expressions/super/call-construct-error.js new file mode 100644 index 0000000000..2ee588447f --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-construct-error.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + Behavior when invocation of "parent" constructor returns an abrupt completion +info: | + [...] + 6. Let result be ? Construct(func, argList, newTarget). +features: [class] +---*/ + +var thrown = new Test262Error(); +var caught; +function Parent() { + throw thrown; +} + +class Child extends Parent { + constructor() { + try { + super(); + } catch (err) { + caught = err; + } + } +} + +// When the "construct" invocation completes and the "this" value is +// uninitialized, the specification dictates that a ReferenceError must be +// thrown. That behavior is tested elsewhere, so the error is ignored (if it is +// produced at all). +try { + new Child(); +} catch (_) {} + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-construct-invocation.js b/js/src/tests/test262/language/expressions/super/call-construct-invocation.js new file mode 100644 index 0000000000..36e72ccca7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-construct-invocation.js @@ -0,0 +1,37 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Invocation of "parent" constructor +info: | + [...] + 6. Let result be ? Construct(func, argList, newTarget). + [...] +features: [class, new.target, Reflect, Reflect.construct] +---*/ + +var expectedNewTarget = function() {}; +var thisValue, instance, args, actualNewTarget; +function Parent() { + thisValue = this; + args = arguments; + actualNewTarget = new.target; +} + +class Child extends Parent { + constructor() { + super(1, 2, 3); + } +} + +instance = Reflect.construct(Child, [4, 5, 6], expectedNewTarget); + +assert.sameValue(thisValue, instance); +assert.sameValue(args.length, 3, 'length of provided arguments object'); +assert.sameValue(args[0], 1, 'first argument'); +assert.sameValue(args[1], 2, 'second argument'); +assert.sameValue(args[2], 3, 'third argument'); +assert.sameValue(actualNewTarget, expectedNewTarget, 'new.target value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-expr-value.js b/js/src/tests/test262/language/expressions/super/call-expr-value.js new file mode 100644 index 0000000000..e868298f1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-expr-value.js @@ -0,0 +1,31 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Evaluates to the new "this" value +info: | + [...] + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Return ? thisER.BindThisValue(result). +features: [class] +---*/ + +var customThisValue = {}; +var value; +function Parent() { + return customThisValue; +} + +class Child extends Parent { + constructor() { + value = super(); + } +} + +new Child(); + +assert.sameValue(value, customThisValue); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-poisoned-underscore-proto.js b/js/src/tests/test262/language/expressions/super/call-poisoned-underscore-proto.js new file mode 100644 index 0000000000..61e68e3ed4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-poisoned-underscore-proto.js @@ -0,0 +1,25 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-SuperCall +description: > + SuperCall should directly invoke [[GetPrototypeOf]] internal method. +info: | + GetSuperConstructor ( ) + + [...] + 5. Let superConstructor be ! activeFunction.[[GetPrototypeOf]](). +features: [class] +---*/ + +Object.defineProperty(Object.prototype, '__proto__', { + get: function() { + throw new Test262Error('should not be called'); + }, +}); + +class A extends Array {} + +assert.sameValue(new A(1).length, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-proto-not-ctor.js b/js/src/tests/test262/language/expressions/super/call-proto-not-ctor.js new file mode 100644 index 0000000000..d7728be750 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-proto-not-ctor.js @@ -0,0 +1,43 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +description: SuperCall should evaluate Arguments prior to checking IsConstructor +info: | + SuperCall : `super` Arguments + + [...] + 3. Let _func_ be ! GetSuperConstructor(). + 4. Let _argList_ be ? ArgumentListEvaluation of |Arguments|. + 5. If IsConstructor(_func_) is *false*, throw a *TypeError* exception. + [...] +features: [class] +---*/ + +var evaluatedArg = false; +var caught; +class C extends Object { + constructor() { + try { + super(evaluatedArg = true); + } catch (err) { + caught = err; + } + } +} + +Object.setPrototypeOf(C, parseInt); + +// When the "construct" invocation completes and the "this" value is +// uninitialized, the specification dictates that a ReferenceError must be +// thrown. That behavior is tested elsewhere, so the error is ignored (if it is +// produced at all). +try { + new C(); +} catch (_) {} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); +assert(evaluatedArg, 'performs ArgumentsListEvaluation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-expr-throws.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-expr-throws.js new file mode 100644 index 0000000000..a446bea44e --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-expr-throws.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-expr-throws.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator following other arguments when evaluation throws (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [generators] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + +---*/ + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(0, ...function*() { throw new Test262Error(); }()); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-iter-get-value.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-iter-get-value.js new file mode 100644 index 0000000000..8e1a4b5f4e --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-iter-get-value.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-iter-get-value.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function return value) (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + return null; + } +}); + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(0, ...iter); + } +} + +assert.throws(TypeError, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-call.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-call.js new file mode 100644 index 0000000000..9e7104b9bc --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-call.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-call.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator function invocation) (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(0, ...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-get.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-get.js new file mode 100644 index 0000000000..3b46bf9f0a --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-get-get.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-get-get.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator following other arguments when GetIterator fails (@@iterator property access) (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(0, ...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-step.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-step.js new file mode 100644 index 0000000000..847d69883b --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-step.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-step.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator following other arguments when IteratorStep fails (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(0, ...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-value.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-value.js new file mode 100644 index 0000000000..4a258d936e --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-itr-value.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-itr-value.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator following other arguments when IteratorValue fails (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(0, ...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-obj-unresolvable.js new file mode 100644 index 0000000000..de3e33f950 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-obj-unresolvable.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-obj-unresolvable.case +// - src/spread/error/super-call.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({a: 0, ...unresolvableReference}); + } +} + +assert.throws(ReferenceError, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-unresolvable.js b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-unresolvable.js new file mode 100644 index 0000000000..63adc0ae05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-mult-err-unresolvable.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-err-unresolvable.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator following other arguments when reference is unresolvable (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(0, ...unresolvableReference); + } +} + +assert.throws(ReferenceError, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-expr-throws.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-expr-throws.js new file mode 100644 index 0000000000..f48d6c35c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-expr-throws.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-expr-throws.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator applied to the only argument when evaluation throws (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [generators] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). +---*/ + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...function*() { throw new Test262Error(); }()); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-call.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-call.js new file mode 100644 index 0000000000..33418a9429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-call.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-call.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function invocation) (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 3. Let iterator be Call(method,obj). + 4. ReturnIfAbrupt(iterator). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + throw new Test262Error(); +}; + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-get.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-get.js new file mode 100644 index 0000000000..5a88157c96 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-get.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-get.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator property access) (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +---*/ +var iter = {}; +Object.defineProperty(iter, Symbol.iterator, { + get: function() { + throw new Test262Error(); + } +}); + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-value.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-value.js new file mode 100644 index 0000000000..ae8b50e91b --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-get-value.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-get-value.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator applied to the only argument when GetIterator fails (@@iterator function return value) (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 7.4.1 GetIterator ( obj, method ) + + [...] + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return null; +}; + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...iter); + } +} + +assert.throws(TypeError, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-step.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-step.js new file mode 100644 index 0000000000..2c59552378 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-step.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-step.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator applied to the only argument when IteratorStep fails (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + + 7.4.5 IteratorStep ( iterator ) + + 1. Let result be IteratorNext(iterator). + 2. ReturnIfAbrupt(result). + + 7.4.2 IteratorNext ( iterator, value ) + + 1. If value was not passed, then + a. Let result be Invoke(iterator, "next", « »). + [...] + 3. ReturnIfAbrupt(result). +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + return { + next: function() { + throw new Test262Error(); + } + }; +}; + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-value.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-value.js new file mode 100644 index 0000000000..f4e39965bd --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-itr-value.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-itr-value.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator applied to the only argument when IteratorValue fails (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + + 7.4.4 IteratorValue ( iterResult ) + + 1. Assert: Type(iterResult) is Object. + 2. Return Get(iterResult, "value"). + + 7.3.1 Get (O, P) + + [...] + 3. Return O.[[Get]](P, O). +---*/ +var iter = {}; +var poisonedValue = Object.defineProperty({}, 'value', { + get: function() { + throw new Test262Error(); + } +}); +iter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...iter); + } +} + +assert.throws(Test262Error, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-obj-unresolvable.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-obj-unresolvable.js new file mode 100644 index 0000000000..d6775ec75d --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-obj-unresolvable.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-obj-unresolvable.case +// - src/spread/error/super-call.template +/*--- +description: Object Spread operator results in error when using an unresolvable reference (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...unresolvableReference}); + } +} + +assert.throws(ReferenceError, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-unresolvable.js b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-unresolvable.js new file mode 100644 index 0000000000..7e894853a4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-err-sngl-err-unresolvable.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-err-unresolvable.case +// - src/spread/error/super-call.template +/*--- +description: Spread operator applied to the only argument when reference is unresolvable (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + + 6.2.3.1 GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V), throw a ReferenceError exception. +---*/ + +class Test262ParentClass { + constructor() {} +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...unresolvableReference); + } +} + +assert.throws(ReferenceError, function() { + new Test262ChildClass(); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-mult-empty.js b/js/src/tests/test262/language/expressions/super/call-spread-mult-empty.js new file mode 100644 index 0000000000..dfd1c3b8e8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-mult-empty.js @@ -0,0 +1,53 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-empty.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator following other arguments when no iteration occurs (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(1, 2, 3, ...[]); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-mult-expr.js b/js/src/tests/test262/language/expressions/super/call-spread-mult-expr.js new file mode 100644 index 0000000000..d903182e81 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-mult-expr.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-expr.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ +var source = [3, 4, 5]; +var target; + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + assert.sameValue(target, source); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(1, 2, ...target = source); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-mult-iter.js b/js/src/tests/test262/language/expressions/super/call-spread-mult-iter.js new file mode 100644 index 0000000000..baff1fe32d --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-mult-iter.js @@ -0,0 +1,70 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-iter.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator following other arguments with a valid iterator (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 3; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 6, value: nextCount }; + } + }; +}; + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + assert.sameValue(arguments[2], 3); + assert.sameValue(arguments[3], 4); + assert.sameValue(arguments[4], 5); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(1, 2, 3, ...iter); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-mult-literal.js b/js/src/tests/test262/language/expressions/super/call-spread-mult-literal.js new file mode 100644 index 0000000000..81d08d39f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-mult-literal.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-literal.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator applied to AssignmentExpression following other elements (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ArgumentList , ... AssignmentExpression + + 1. Let precedingArgs be the result of evaluating ArgumentList. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let iterator be GetIterator(GetValue(spreadRef) ). + 4. ReturnIfAbrupt(iterator). + 5. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return precedingArgs. +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 5); + assert.sameValue(arguments[0], 5); + assert.sameValue(arguments[1], 6); + assert.sameValue(arguments[2], 7); + assert.sameValue(arguments[3], 8); + assert.sameValue(arguments[4], 9); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(5, ...[6, 7, 8], 9); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-ident.js b/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-ident.js new file mode 100644 index 0000000000..14de6b5f15 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-ident.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-ident.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread operator following other properties (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SuperCall : super Arguments + + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be GetSuperConstructor(). + 4. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(Object.keys(obj).length, 4); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 1 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({a: 1, b: 2, ...o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-null.js b/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-null.js new file mode 100644 index 0000000000..80f0811ed7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-null.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-null.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread operator following other arguments with null value (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({a: 1, b: 2, ...null}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-undefined.js b/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-undefined.js new file mode 100644 index 0000000000..5df75b971b --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-mult-obj-undefined.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/spread/mult-obj-undefined.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread operator following other arguments with undefined (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 2); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({a: 1, b: 2, ...undefined}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-getter-descriptor.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-getter-descriptor.js new file mode 100644 index 0000000000..08d905b547 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-getter-descriptor.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-descriptor.case +// - src/spread/default/super-call.template +/*--- +description: Spread operation with getter results in data property descriptor (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SuperCall : super Arguments + + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be GetSuperConstructor(). + 4. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = { + get a() { + return 42; + } +}; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 42 + }); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o, c: 4, d: 5}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-getter-init.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-getter-init.js new file mode 100644 index 0000000000..5c309d079e --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-getter-init.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-getter-init.case +// - src/spread/default/super-call.template +/*--- +description: Getter in object literal is not evaluated (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] +---*/ + +let o = {a: 2, b: 3}; +let executedGetter = false; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(executedGetter, false) + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o, get c() { executedGetter = true; }}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-manipulate-outter-obj-in-getter.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-manipulate-outter-obj-in-getter.js new file mode 100644 index 0000000000..a143f085b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-manipulate-outter-obj-in-getter.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-manipulate-outter-obj-in-getter.case +// - src/spread/default/super-call.template +/*--- +description: Getter manipulates outter object before it's spread operation (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var o = { a: 0, b: 1 }; +var cthulhu = { get x() { + delete o.a; + o.b = 42; + o.c = "ni"; +}}; + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.hasOwnProperty("a"), false); + assert.sameValue(obj.b, 42); + assert.sameValue(obj.c, "ni"); + assert(obj.hasOwnProperty("x")); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...cthulhu, ...o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread-getter.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread-getter.js new file mode 100644 index 0000000000..0e6a3bd43d --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread-getter.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread-getter.case +// - src/spread/default/super-call.template +/*--- +description: Multiple Object Spread usage calls getter multiple times (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let getterCallCount = 0; +let o = { + get a() { + return ++getterCallCount; + } +}; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o, c: 4, d: 5, a: 42, ...o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread.js new file mode 100644 index 0000000000..38429148f7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-mult-spread.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-mult-spread.case +// - src/spread/default/super-call.template +/*--- +description: Multiple Object Spread operation (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +let o = {a: 2, b: 3}; +let o2 = {c: 4, d: 5}; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 4); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o, ...o2}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-null.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-null.js new file mode 100644 index 0000000000..7f14e6d13b --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-null.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-null.case +// - src/spread/default/super-call.template +/*--- +description: Null Object Spread is ignored (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...null}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-override-immutable.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-override-immutable.js new file mode 100644 index 0000000000..86f52a61f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-override-immutable.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-override-immutable.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread overriding immutable properties (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SuperCall : super Arguments + + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be GetSuperConstructor(). + 4. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] +---*/ + +let o = {b: 2}; +Object.defineProperty(o, "a", {value: 1, enumerable: true, writable: false, configurable: true}); + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 3) + assert.sameValue(obj.b, 2); + + verifyProperty(obj, "a", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "b", { + enumerable: true, + writable: true, + configurable: true, + value: 2 + }); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o, a: 3}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-overrides-prev-properties.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-overrides-prev-properties.js new file mode 100644 index 0000000000..c42207485f --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-overrides-prev-properties.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-overrides-prev-properties.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread properties overrides previous definitions (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3}; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 2); + assert.sameValue(obj.b, 3); + assert.sameValue(Object.keys(obj).length, 2); + assert.sameValue(o.a, 2); + assert.sameValue(o.b, 3); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({a: 1, b: 7, ...o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-skip-non-enumerable.js new file mode 100644 index 0000000000..8993f3c57c --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-skip-non-enumerable.js @@ -0,0 +1,43 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-skip-non-enumerable.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread doesn't copy non-enumerable properties (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] +---*/ + +let o = {}; +Object.defineProperty(o, "b", {value: 3, enumerable: false}); + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.hasOwnProperty("b"), false) + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-spread-order.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-spread-order.js new file mode 100644 index 0000000000..096d65508b --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-spread-order.js @@ -0,0 +1,56 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-spread-order.case +// - src/spread/default/super-call.template +/*--- +description: Spread operation follows [[OwnPropertyKeys]] order (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol, object-spread] +flags: [generated] +includes: [compareArray.js] +info: | + SuperCall : super Arguments + + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be GetSuperConstructor(). + 4. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +var calls = []; +var o = { get z() { calls.push('z') }, get a() { calls.push('a') } }; +Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true }); +Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true }); + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.compareArray(calls, [1, 'z', 'a', "Symbol(foo)"]); + assert.sameValue(Object.keys(obj).length, 3); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-symbol-property.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-symbol-property.js new file mode 100644 index 0000000000..495d734229 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-symbol-property.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-symbol-property.case +// - src/spread/default/super-call.template +/*--- +description: Spread operation where source object contains Symbol properties (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol, object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let symbol = Symbol('foo'); +let o = {}; +o[symbol] = 1; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj[symbol], 1); + assert(Object.prototype.hasOwnProperty.call(obj, symbol), "symbol is an own property"); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert.sameValue(Object.keys(obj).length, 2); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o, c: 4, d: 5}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-undefined.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-undefined.js new file mode 100644 index 0000000000..c036ed1623 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-undefined.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-undefined.case +// - src/spread/default/super-call.template +/*--- +description: Undefined Object Spread is ignored (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(Object.keys(obj).length, 0); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...undefined}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-obj-with-overrides.js b/js/src/tests/test262/language/expressions/super/call-spread-obj-with-overrides.js new file mode 100644 index 0000000000..e6bc0b51e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-obj-with-overrides.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/spread/obj-with-overrides.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread properties being overriden (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol, object-spread] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {a: 2, b: 3, c: 4, e: undefined, f: null, g: false}; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(obj.a, 1); + assert.sameValue(obj.b, 7); + assert.sameValue(obj.c, 4); + assert.sameValue(obj.d, 5); + assert(obj.hasOwnProperty("e")); + assert.sameValue(obj.f, null); + assert.sameValue(obj.g, false); + assert.sameValue(obj.h, -0); + assert.sameValue(obj.i.toString(), "Symbol(foo)"); + assert(Object.is(obj.j, o)); + assert.sameValue(Object.keys(obj).length, 10); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o, a: 1, b: 7, d: 5, h: -0, i: Symbol("foo"), j: o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-sngl-empty.js b/js/src/tests/test262/language/expressions/super/call-spread-sngl-empty.js new file mode 100644 index 0000000000..01a01f0466 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-sngl-empty.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-empty.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator applied to the only argument when no iteration occurs (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + [...] +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 0); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...[]); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-sngl-expr.js b/js/src/tests/test262/language/expressions/super/call-spread-sngl-expr.js new file mode 100644 index 0000000000..2fa060ded9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-sngl-expr.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-expr.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator applied to AssignmentExpression as only element (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var source = [2, 3, 4]; +var target; + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 2); + assert.sameValue(arguments[1], 3); + assert.sameValue(arguments[2], 4); + assert.sameValue(target, source); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...target = source); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-sngl-iter.js b/js/src/tests/test262/language/expressions/super/call-spread-sngl-iter.js new file mode 100644 index 0000000000..48fa9301b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-sngl-iter.js @@ -0,0 +1,67 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-iter.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator applied to the only argument with a valid iterator (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [Symbol.iterator] +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ +var iter = {}; +iter[Symbol.iterator] = function() { + var nextCount = 0; + return { + next: function() { + nextCount += 1; + return { done: nextCount === 3, value: nextCount }; + } + }; +}; + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 2); + assert.sameValue(arguments[0], 1); + assert.sameValue(arguments[1], 2); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...iter); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-sngl-literal.js b/js/src/tests/test262/language/expressions/super/call-spread-sngl-literal.js new file mode 100644 index 0000000000..2f58ff416e --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-sngl-literal.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-literal.case +// - src/spread/default/super-call.template +/*--- +description: Spread operator applied to array literal as only element (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +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. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + 12.3.6.1 Runtime Semantics: ArgumentListEvaluation + + ArgumentList : ... AssignmentExpression + + 1. Let list be an empty List. + 2. Let spreadRef be the result of evaluating AssignmentExpression. + 3. Let spreadObj be GetValue(spreadRef). + 4. Let iterator be GetIterator(spreadObj). + 5. ReturnIfAbrupt(iterator). + 6. Repeat + a. Let next be IteratorStep(iterator). + b. ReturnIfAbrupt(next). + c. If next is false, return list. + d. Let nextArg be IteratorValue(next). + e. ReturnIfAbrupt(nextArg). + f. Append nextArg as the last element of list. +---*/ + +var callCount = 0; + +class Test262ParentClass { + constructor() { + assert.sameValue(arguments.length, 3); + assert.sameValue(arguments[0], 3); + assert.sameValue(arguments[1], 4); + assert.sameValue(arguments[2], 5); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super(...[3, 4, 5]); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/call-spread-sngl-obj-ident.js b/js/src/tests/test262/language/expressions/super/call-spread-sngl-obj-ident.js new file mode 100644 index 0000000000..1d59f891ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/call-spread-sngl-obj-ident.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/spread/sngl-obj-ident.case +// - src/spread/default/super-call.template +/*--- +description: Object Spread operator without other arguments (SuperCall) +esid: sec-super-keyword-runtime-semantics-evaluation +features: [object-spread] +flags: [generated] +includes: [propertyHelper.js] +info: | + SuperCall : super Arguments + + 1. Let newTarget be GetNewTarget(). + 2. If newTarget is undefined, throw a ReferenceError exception. + 3. Let func be GetSuperConstructor(). + 4. ReturnIfAbrupt(func). + 5. Let argList be ArgumentListEvaluation of Arguments. + [...] + + Pending Runtime Semantics: PropertyDefinitionEvaluation + + PropertyDefinition:...AssignmentExpression + + 1. Let exprValue be the result of evaluating AssignmentExpression. + 2. Let fromValue be GetValue(exprValue). + 3. ReturnIfAbrupt(fromValue). + 4. Let excludedNames be a new empty List. + 5. Return CopyDataProperties(object, fromValue, excludedNames). + +---*/ +let o = {c: 3, d: 4}; + + +var callCount = 0; + +class Test262ParentClass { + constructor(obj) { + assert.sameValue(Object.keys(obj).length, 2); + + verifyProperty(obj, "c", { + enumerable: true, + writable: true, + configurable: true, + value: 3 + }); + + verifyProperty(obj, "d", { + enumerable: true, + writable: true, + configurable: true, + value: 4 + }); + callCount += 1; + } +} + +class Test262ChildClass extends Test262ParentClass { + constructor() { + super({...o}); + } +} + +new Test262ChildClass(); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-cls-null-proto.js b/js/src/tests/test262/language/expressions/super/prop-dot-cls-null-proto.js new file mode 100644 index 0000000000..5ac418985d --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-cls-null-proto.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + SuperProperty evaluation when the "home" object's prototype is not + object-coercible. +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). +features: [class] +---*/ + +var caught; +class C extends null { + method() { + try { + super.x; + } catch (err) { + caught = err; + } + } +} + +C.prototype.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-strict.js b/js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-strict.js new file mode 100644 index 0000000000..9f01b7a429 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-strict.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's behavior as a strict reference +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + 6.2.3.2 PutValue + + [...] + 5. If IsUnresolvableReference(V) is true, then + [...] + 6. Else if IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + [...] + b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, + GetThisValue(V)). + c. If succeeded is false and IsStrictReference(V) is true, throw a + TypeError exception. +features: [class] +---*/ + +var caught; +class C { + method() { + super.x = 8; + Object.freeze(C.prototype); + try { + super.y = 9; + } catch (err) { + caught = err; + } + } +} + +C.prototype.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-this.js b/js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-this.js new file mode 100644 index 0000000000..04c073c60c --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-cls-ref-this.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's "this" value +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V) is true, throw a ReferenceError exception. + 5. If IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + i. Assert: In this case, base will never be null or undefined. + ii. Let base be ! ToObject(base). + b. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)). +---*/ + +var viaCall; +var viaMember; +class Parent { + getThis() { + return this; + } + get This() { + return this; + } +} +class C extends Parent { + method() { + viaCall = super.getThis(); + viaMember = super.This; + } +} + +C.prototype.method(); + +assert.sameValue(viaCall, C.prototype, 'via CallExpression'); +assert.sameValue(viaMember, C.prototype, 'via MemberExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-cls-this-uninit.js b/js/src/tests/test262/language/expressions/super/prop-dot-cls-this-uninit.js new file mode 100644 index 0000000000..9e539bd295 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-cls-this-uninit.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + SuperProperty evaluation when "this" binding has not been initialized +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + + 8.1.1.3.4 GetThisBinding + + 1. Let envRec be the function Environment Record for which the method was + invoked. + 2. Assert: envRec.[[ThisBindingStatus]] is not "lexical". + 3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError + exception. +features: [class] +---*/ + +var caught; +class C extends Object { + constructor() { + try { + super.x; + } catch (err) { + caught = err; + } + } +} + +// When the "construct" invocation completes and the "this" value is +// uninitialized, the specification dictates that a ReferenceError must be +// thrown. That behavior is tested elsewhere, so the error is ignored (if it is +// produced at all). +try { + new C(); +} catch (_) {} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-arrow.js b/js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-arrow.js new file mode 100644 index 0000000000..98608db201 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-arrow.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty (from arrow function) +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [class, arrow-function] +---*/ + +var fromA, fromB; +class A {} +class B extends A {} +class C extends B { + method() { + fromA = (() => { return super.fromA; })(); + fromB = (() => { return super.fromB; })(); + } +} + +A.prototype.fromA = 'a'; +A.prototype.fromB = 'a'; +B.prototype.fromB = 'b'; +C.prototype.fromA = 'c'; +C.prototype.fromB = 'c'; + +C.prototype.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-eval.js b/js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-eval.js new file mode 100644 index 0000000000..f24d975f83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-cls-val-from-eval.js @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + Value of reference returned by SuperProperty (from eval code) +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [class] +---*/ + +var fromA, fromB; +class A {} +class B extends A {} +class C extends B { + method() { + fromA = eval('super.fromA;'); + fromB = eval('super.fromB;'); + } +} + +A.prototype.fromA = 'a'; +A.prototype.fromB = 'a'; +B.prototype.fromB = 'b'; +C.prototype.fromA = 'c'; +C.prototype.fromB = 'c'; + +C.prototype.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-cls-val.js b/js/src/tests/test262/language/expressions/super/prop-dot-cls-val.js new file mode 100644 index 0000000000..5697c74129 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-cls-val.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [class] +---*/ + +var fromA, fromB; +class A {} +class B extends A {} +class C extends B { + method() { + fromA = super.fromA; + fromB = super.fromB; + } +} + +A.prototype.fromA = 'a'; +A.prototype.fromB = 'a'; +B.prototype.fromB = 'b'; +C.prototype.fromA = 'c'; +C.prototype.fromB = 'c'; + +C.prototype.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-obj-null-proto.js b/js/src/tests/test262/language/expressions/super/prop-dot-obj-null-proto.js new file mode 100644 index 0000000000..03094e0ab1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-obj-null-proto.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + SuperProperty evaluation when the "home" object's prototype is not + object-coercible. +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). +---*/ + +var caught; +var obj = { + method() { + try { + super.x; + } catch (err) { + caught = err; + } + } +}; +Object.setPrototypeOf(obj, null); + +obj.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-non-strict.js b/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-non-strict.js new file mode 100644 index 0000000000..ea3c3efd2c --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-non-strict.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's behavior as a non-strict reference +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + 6.2.3.2 PutValue + + [...] + 5. If IsUnresolvableReference(V) is true, then + [...] + 6. Else if IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + [...] + b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, + GetThisValue(V)). + c. If succeeded is false and IsStrictReference(V) is true, throw a + TypeError exception. + d. Return. +flags: [noStrict] +---*/ + +var obj = { + method() { + super.x = 8; + Object.freeze(obj); + super.y = 9; + } +}; + +obj.method(); + +assert( + Object.prototype.hasOwnProperty.call(obj, 'x'), + "x is defined as an own property" +); +assert( + !Object.prototype.hasOwnProperty.call(obj, 'y'), + "y is not defined as an own property after the object is frozen" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-strict-strict.js b/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-strict-strict.js new file mode 100644 index 0000000000..f4e8aef8cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-strict-strict.js @@ -0,0 +1,59 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's behavior as a strict reference +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + 6.2.3.2 PutValue + + [...] + 5. If IsUnresolvableReference(V) is true, then + [...] + 6. Else if IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + [...] + b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, + GetThisValue(V)). + c. If succeeded is false and IsStrictReference(V) is true, throw a + TypeError exception. +flags: [onlyStrict] +---*/ + +var caught; +var obj = { + method() { + super.x = 8; + Object.freeze(obj); + try { + super.y = 9; + } catch (err) { + caught = err; + } + } +}; + +obj.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-this.js b/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-this.js new file mode 100644 index 0000000000..8ecc3b278f --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-obj-ref-this.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's "this" value +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V) is true, throw a ReferenceError exception. + 5. If IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + i. Assert: In this case, base will never be null or undefined. + ii. Let base be ! ToObject(base). + b. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)). +---*/ + +var viaCall; +var viaMember; +var parent = { + getThis: function() { + return this; + }, + get This() { + return this; + } +}; +var obj = { + method() { + viaCall = super.getThis(); + viaMember = super.This; + } +}; +Object.setPrototypeOf(obj, parent); + +obj.method(); + +assert.sameValue(viaCall, obj, 'via CallExpression'); +assert.sameValue(viaMember, obj, 'via MemberExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-arrow.js b/js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-arrow.js new file mode 100644 index 0000000000..c7eee9f550 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-arrow.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty (from arrow function) +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [arrow-function] +---*/ + +var fromA, fromB; +var A = { fromA: 'a', fromB: 'a' }; +var B = { fromB: 'b' }; +Object.setPrototypeOf(B, A); + +var obj = { + fromA: 'c', + fromB: 'c', + method() { + fromA = (() => { return super.fromA; })(); + fromB = (() => { return super.fromB; })(); + } +}; + +Object.setPrototypeOf(obj, B); + +obj.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-eval.js b/js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-eval.js new file mode 100644 index 0000000000..ac5788d687 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-obj-val-from-eval.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty (from eval code) +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +---*/ + +var fromA, fromB; +var A = { fromA: 'a', fromB: 'a' }; +var B = { fromB: 'b' }; +Object.setPrototypeOf(B, A); + +var obj = { + fromA: 'c', + fromB: 'c', + method() { + fromA = eval('super.fromA;'); + fromB = eval('super.fromB;'); + } +}; + +Object.setPrototypeOf(obj, B); + +obj.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-dot-obj-val.js b/js/src/tests/test262/language/expressions/super/prop-dot-obj-val.js new file mode 100644 index 0000000000..429bb339ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-dot-obj-val.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty +info: | + 1. Let propertyKey be StringValue of IdentifierName. + 2. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 3. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +---*/ + +var fromA, fromB; +var A = { fromA: 'a', fromB: 'a' }; +var B = { fromB: 'b' }; +Object.setPrototypeOf(B, A); + +var obj = { + fromA: 'c', + fromB: 'c', + method() { + fromA = super.fromA; + fromB = super.fromB; + } +}; + +Object.setPrototypeOf(obj, B); + +obj.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-err.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-err.js new file mode 100644 index 0000000000..ddcec4c5f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-err.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Abrupt completion from Expression evaluation +info: | + 1. Let propertyNameReference be the result of evaluating Expression. + 2. Let propertyNameValue be ? GetValue(propertyNameReference). + + 6.2.3.1 GetValue + + 1. ReturnIfAbrupt(V). +features: [class] +---*/ + +var thrown = new Test262Error(); +var caught; +function thrower() { + throw thrown; +} +class C { + method() { + try { + super[thrower()]; + } catch (err) { + caught = err; + } + } +} + +C.prototype.method(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-key-err.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-key-err.js new file mode 100644 index 0000000000..fe1bc2b748 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-key-err.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Abrupt completion from type coercion of property key +info: | + 1. Let propertyNameReference be the result of evaluating Expression. + 2. Let propertyNameValue be ? GetValue(propertyNameReference). + 3. Let propertyKey be ? ToPropertyKey(propertyNameValue). + + 7.1.14 ToPropertyKey + + 1. Let key be ? ToPrimitive(argument, hint String). +features: [class] +---*/ + +var thrown = new Test262Error(); +var badToString = { + toString: function() { + throw thrown; + } +}; +var caught; +class C { + method() { + try { + super[badToString]; + } catch (err) { + caught = err; + } + } +} + +C.prototype.method(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-null-proto.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-null-proto.js new file mode 100644 index 0000000000..3bc2ef5db2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-null-proto.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + SuperProperty evaluation when the "home" object's prototype is not + object-coercible. +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). +features: [class] +---*/ + +var caught; +class C extends null { + method() { + try { + super['x']; + } catch (err) { + caught = err; + } + } +} + +C.prototype.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-strict.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-strict.js new file mode 100644 index 0000000000..2d98bdffc8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-strict.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's behavior as a strict reference +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + 6.2.3.2 PutValue + + [...] + 5. If IsUnresolvableReference(V) is true, then + [...] + 6. Else if IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + [...] + b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, + GetThisValue(V)). + c. If succeeded is false and IsStrictReference(V) is true, throw a + TypeError exception. +features: [class] +---*/ + +var caught; +class C { + method() { + super['x'] = 8; + Object.freeze(C.prototype); + try { + super['y'] = 9; + } catch (err) { + caught = err; + } + } +} + +C.prototype.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-this.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-this.js new file mode 100644 index 0000000000..ba90b3758c --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-ref-this.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's "this" value +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V) is true, throw a ReferenceError exception. + 5. If IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + i. Assert: In this case, base will never be null or undefined. + ii. Let base be ! ToObject(base). + b. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)). +---*/ + +var viaCall; +var viaMember; +class Parent { + getThis() { + return this; + } + get This() { + return this; + } +} +class C extends Parent { + method() { + viaCall = super['getThis'](); + viaMember = super['This']; + } +} + +C.prototype.method(); + +assert.sameValue(viaCall, C.prototype, 'via CallExpression'); +assert.sameValue(viaMember, C.prototype, 'via MemberExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-this-uninit.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-this-uninit.js new file mode 100644 index 0000000000..5e336cf3af --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-this-uninit.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + SuperProperty evaluation when "this" binding has not been initialized +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + + 8.1.1.3.4 GetThisBinding + + 1. Let envRec be the function Environment Record for which the method was + invoked. + 2. Assert: envRec.[[ThisBindingStatus]] is not "lexical". + 3. If envRec.[[ThisBindingStatus]] is "uninitialized", throw a ReferenceError + exception. +features: [class] +---*/ + +var caught; +class C extends Object { + constructor() { + try { + super['x']; + } catch (err) { + caught = err; + } + } +} + +// When the "construct" invocation completes and the "this" value is +// uninitialized, the specification dictates that a ReferenceError must be +// thrown. That behavior is tested elsewhere, so the error is ignored (if it is +// produced at all). +try { + new C(); +} catch (_) {} + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-unresolvable.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-unresolvable.js new file mode 100644 index 0000000000..b9f912d031 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-unresolvable.js @@ -0,0 +1,36 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Abrupt completion from Reference resolution +info: | + 1. Let propertyNameReference be the result of evaluating Expression. + 2. Let propertyNameValue be ? GetValue(propertyNameReference). + + 6.2.3.1 GetValue + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V) is true, throw a ReferenceError exception. +features: [class] +---*/ + +var caught; +class C { + method() { + try { + super[test262unresolvable]; + } catch (err) { + caught = err; + } + } +} + +C.prototype.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-arrow.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-arrow.js new file mode 100644 index 0000000000..7a4ef1840e --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-arrow.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty (from arrow function) +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [class, arrow-function] +---*/ + +var fromA, fromB; +class A {} +class B extends A {} +class C extends B { + method() { + fromA = (() => { return super['fromA']; })(); + fromB = (() => { return super['fromB']; })(); + } +} + +A.prototype.fromA = 'a'; +A.prototype.fromB = 'a'; +B.prototype.fromB = 'b'; +C.prototype.fromA = 'c'; +C.prototype.fromB = 'c'; + +C.prototype.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-eval.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-eval.js new file mode 100644 index 0000000000..ada830f3fb --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-val-from-eval.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty (from eval code) +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [class] +---*/ + +var fromA, fromB; +class A {} +class B extends A {} +class C extends B { + method() { + fromA = eval('super["fromA"];'); + fromB = eval('super["fromB"];'); + } +} + +A.prototype.fromA = 'a'; +A.prototype.fromB = 'a'; +B.prototype.fromB = 'b'; +C.prototype.fromA = 'c'; +C.prototype.fromB = 'c'; + +C.prototype.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-cls-val.js b/js/src/tests/test262/language/expressions/super/prop-expr-cls-val.js new file mode 100644 index 0000000000..0b29e92331 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-cls-val.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [class] +---*/ + +var fromA, fromB; +class A {} +class B extends A {} +class C extends B { + method() { + fromA = super['fromA']; + fromB = super['fromB']; + } +} + +A.prototype.fromA = 'a'; +A.prototype.fromB = 'a'; +B.prototype.fromB = 'b'; +C.prototype.fromA = 'c'; +C.prototype.fromB = 'c'; + +C.prototype.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-err.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-err.js new file mode 100644 index 0000000000..ea3402dcca --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-err.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Abrupt completion from Expression evaluation +info: | + 1. Let propertyNameReference be the result of evaluating Expression. + 2. Let propertyNameValue be ? GetValue(propertyNameReference). + + 6.2.3.1 GetValue + + 1. ReturnIfAbrupt(V). +---*/ + +var thrown = new Test262Error(); +var caught; +function thrower() { + throw thrown; +} +var obj = { + method() { + try { + super[thrower()]; + } catch (err) { + caught = err; + } + } +}; + +obj.method(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-key-err.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-key-err.js new file mode 100644 index 0000000000..1c70d642e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-key-err.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Abrupt completion from type coercion of property key +info: | + 1. Let propertyNameReference be the result of evaluating Expression. + 2. Let propertyNameValue be ? GetValue(propertyNameReference). + 3. Let propertyKey be ? ToPropertyKey(propertyNameValue). + + 7.1.14 ToPropertyKey + + 1. Let key be ? ToPrimitive(argument, hint String). +---*/ + +var thrown = new Test262Error(); +var badToString = { + toString: function() { + throw thrown; + } +}; +var caught; +var obj = { + method() { + try { + super[badToString]; + } catch (err) { + caught = err; + } + } +}; + +obj.method(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-null-proto.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-null-proto.js new file mode 100644 index 0000000000..885a98f2d4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-null-proto.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + SuperProperty evaluation when the "home" object's prototype is not + object-coercible. +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). +---*/ + +var caught; +var obj = { + method() { + try { + super['x']; + } catch (err) { + caught = err; + } + } +}; +Object.setPrototypeOf(obj, null); + +obj.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-non-strict.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-non-strict.js new file mode 100644 index 0000000000..eb8a13ec76 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-non-strict.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's behavior as a non-strict reference +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + 6.2.3.2 PutValue + + [...] + 5. If IsUnresolvableReference(V) is true, then + [...] + 6. Else if IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + [...] + b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, + GetThisValue(V)). + c. If succeeded is false and IsStrictReference(V) is true, throw a + TypeError exception. + d. Return. +flags: [noStrict] +---*/ + +var obj = { + method() { + super['x'] = 8; + Object.freeze(obj); + super['y'] = 9; + } +}; + +obj.method(); + +assert( + Object.prototype.hasOwnProperty.call(obj, 'x'), + "x is defined as an own property" +); +assert( + !Object.prototype.hasOwnProperty.call(obj, 'y'), + "y is not defined as an own property after the object is frozen" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-strict-strict.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-strict-strict.js new file mode 100644 index 0000000000..98a6123ee9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-strict-strict.js @@ -0,0 +1,59 @@ +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's behavior as a strict reference +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + 6.2.3.2 PutValue + + [...] + 5. If IsUnresolvableReference(V) is true, then + [...] + 6. Else if IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + [...] + b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, + GetThisValue(V)). + c. If succeeded is false and IsStrictReference(V) is true, throw a + TypeError exception. +flags: [onlyStrict] +---*/ + +var caught; +var obj = { + method() { + super['x'] = 8; + Object.freeze(obj); + try { + super['y'] = 9; + } catch (err) { + caught = err; + } + } +}; + +obj.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-this.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-this.js new file mode 100644 index 0000000000..a25a743037 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-ref-this.js @@ -0,0 +1,61 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: SuperProperty's "this" value +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. + + GetValue (V) + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V) is true, throw a ReferenceError exception. + 5. If IsPropertyReference(V) is true, then + a. If HasPrimitiveBase(V) is true, then + i. Assert: In this case, base will never be null or undefined. + ii. Let base be ! ToObject(base). + b. Return ? base.[[Get]](GetReferencedName(V), GetThisValue(V)). +---*/ + +var viaCall; +var viaMember; +var parent = { + getThis: function() { + return this; + }, + get This() { + return this; + } +}; +var obj = { + method() { + viaCall = super['getThis'](); + viaMember = super['This']; + } +}; +Object.setPrototypeOf(obj, parent); + +obj.method(); + +assert.sameValue(viaCall, obj, 'via CallExpression'); +assert.sameValue(viaMember, obj, 'via MemberExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-unresolvable.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-unresolvable.js new file mode 100644 index 0000000000..1c2dbc93cc --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-unresolvable.js @@ -0,0 +1,35 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Abrupt completion from Reference resolution +info: | + 1. Let propertyNameReference be the result of evaluating Expression. + 2. Let propertyNameValue be ? GetValue(propertyNameReference). + + 6.2.3.1 GetValue + + 1. ReturnIfAbrupt(V). + 2. If Type(V) is not Reference, return V. + 3. Let base be GetBase(V). + 4. If IsUnresolvableReference(V) is true, throw a ReferenceError exception. +---*/ + +var caught; +var obj = { + method() { + try { + super[test262unresolvable]; + } catch (err) { + caught = err; + } + } +}; + +obj.method(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-arrow.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-arrow.js new file mode 100644 index 0000000000..9d7087d80a --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-arrow.js @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty (from arrow function) +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +features: [arrow-function] +---*/ + +var fromA, fromB; +var A = { fromA: 'a', fromB: 'a' }; +var B = { fromB: 'b' }; +Object.setPrototypeOf(B, A); + +var obj = { + fromA: 'c', + fromB: 'c', + method() { + fromA = (() => { return super['fromA']; })(); + fromB = (() => { return super['fromB']; })(); + } +}; + +Object.setPrototypeOf(obj, B); + +obj.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-eval.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-eval.js new file mode 100644 index 0000000000..c7526febb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-val-from-eval.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty (from eval code) +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +---*/ + +var fromA, fromB; +var A = { fromA: 'a', fromB: 'a' }; +var B = { fromB: 'b' }; +Object.setPrototypeOf(B, A); + +var obj = { + fromA: 'c', + fromB: 'c', + method() { + fromA = eval('super["fromA"];'); + fromB = eval('super["fromB"];'); + } +}; + +Object.setPrototypeOf(obj, B); + +obj.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-expr-obj-val.js b/js/src/tests/test262/language/expressions/super/prop-expr-obj-val.js new file mode 100644 index 0000000000..b336e6ceae --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-expr-obj-val.js @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: Value of reference returned by SuperProperty +info: | + [...] + 4. If the code matched by the syntactic production that is being evaluated is + strict mode code, let strict be true, else let strict be false. + 5. Return ? MakeSuperPropertyReference(propertyKey, strict). + + 12.3.5.3 Runtime Semantics: MakeSuperPropertyReference + + 1. Let env be GetThisEnvironment( ). + 2. If env.HasSuperBinding() is false, throw a ReferenceError exception. + 3. Let actualThis be ? env.GetThisBinding(). + 4. Let baseValue be ? env.GetSuperBase(). + 5. Let bv be ? RequireObjectCoercible(baseValue). + 6. Return a value of type Reference that is a Super Reference whose base + value component is bv, whose referenced name component is propertyKey, + whose thisValue component is actualThis, and whose strict reference flag + is strict. +---*/ + +var fromA, fromB; +var A = { fromA: 'a', fromB: 'a' }; +var B = { fromB: 'b' }; +Object.setPrototypeOf(B, A); + +var obj = { + fromA: 'c', + fromB: 'c', + method() { + fromA = super['fromA']; + fromB = super['fromB']; + } +}; + +Object.setPrototypeOf(obj, B); + +obj.method(); + +assert.sameValue(fromA, 'a'); +assert.sameValue(fromB, 'b'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/prop-poisoned-underscore-proto.js b/js/src/tests/test262/language/expressions/super/prop-poisoned-underscore-proto.js new file mode 100644 index 0000000000..435d8b877b --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/prop-poisoned-underscore-proto.js @@ -0,0 +1,37 @@ +// Copyright (C) 2019 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: prod-SuperProperty +description: > + SuperProperty should directly call [[GetPrototypeOf]] internal method. +info: | + MakeSuperPropertyReference ( actualThis, propertyKey, strict ) + + [...] + 3. Let baseValue be ? env.GetSuperBase(). + + GetSuperBase ( ) + + [...] + 5. Return ? home.[[GetPrototypeOf]](). +---*/ + +Object.defineProperty(Object.prototype, '__proto__', { + get: function() { + throw new Test262Error('should not be called'); + }, +}); + +var obj = { + superExpression() { + return super['CONSTRUCTOR'.toLowerCase()]; + }, + superIdentifierName() { + return super.toString(); + }, +}; + +assert.sameValue(obj.superExpression(), Object); +assert.sameValue(obj.superIdentifierName(), '[object Object]'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/realm.js b/js/src/tests/test262/language/expressions/super/realm.js new file mode 100644 index 0000000000..2a019bf7ec --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/realm.js @@ -0,0 +1,39 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +es6id: 12.3.5 +description: > + Default [[Prototype]] value derived from realm of the newTarget value +info: | + 1. Let newTarget be GetNewTarget(). + [...] + 6. Let result be ? Construct(func, argList, newTarget). + [...] + + 9.1.14 GetPrototypeFromConstructor + + [...] + 3. Let proto be ? Get(constructor, "prototype"). + 4. If Type(proto) is not Object, then + a. Let realm be ? GetFunctionRealm(constructor). + b. Let proto be realm's intrinsic object named intrinsicDefaultProto. + [...] +features: [cross-realm, Reflect] +---*/ + +var other = $262.createRealm().global; +var C = new other.Function(); +C.prototype = null; + +class B extends function() {} { + constructor() { + super(); + } +} + +var b = Reflect.construct(B, [], C); + +assert.sameValue(Object.getPrototypeOf(b), other.Object.prototype); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/super/shell.js b/js/src/tests/test262/language/expressions/super/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/super/super-reference-resolution.js b/js/src/tests/test262/language/expressions/super/super-reference-resolution.js new file mode 100644 index 0000000000..6dba5ac52a --- /dev/null +++ b/js/src/tests/test262/language/expressions/super/super-reference-resolution.js @@ -0,0 +1,25 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-super-keyword +description: Binds the "this" value to value returned by "parent" constructor +info: | + 6. Let result be ? Construct(func, argList, newTarget). + 7. Let thisER be GetThisEnvironment( ). + 8. Return ? thisER.BindThisValue(result). +features: [class] +---*/ + +class X { + method() { return this; } +} + +class Y extends X { + method() { return super.method(); } +} + +const y = new Y(); + +assert.sameValue(y.method(), y); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/browser.js b/js/src/tests/test262/language/expressions/tagged-template/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-different-functions-same-site.js b/js/src/tests/test262/language/expressions/tagged-template/cache-different-functions-same-site.js new file mode 100644 index 0000000000..5f5eebfcf2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-different-functions-same-site.js @@ -0,0 +1,40 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached by source location inside a function +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} + +var a = 1; +var firstObject = null; +var previousObject = null; + +function factory() { + return function() { + tag`head${a}tail`; + } +} + +factory()(); +firstObject = previousObject; + +assert(firstObject !== null); +previousObject = null; + +factory()(); + +assert.sameValue( + previousObject, + firstObject, + 'The realm\'s template cache is for source code locations in a function' +); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-eval.js b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-eval.js new file mode 100644 index 0000000000..ca0ac70269 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-eval.js @@ -0,0 +1,27 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Template caching using distinct expressions within `eval` +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} +var a = 1; +var b = 2; +var firstObject = null; +var previousObject = null; + +tag`head${a}tail`; +firstObject = previousObject; +assert(firstObject !== null); +previousObject = null; + +eval('tag`head${b}tail`'); +assert.notSameValue(previousObject, firstObject); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-new-function.js b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-new-function.js new file mode 100644 index 0000000000..5c053dfe23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions-new-function.js @@ -0,0 +1,31 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Template caching using distinct expressions within `new Function` +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} +var a = 1; +var b = 2; +var firstObject = null; +var previousObject = null; + +tag`head${a}tail`; +firstObject = previousObject; +assert(firstObject !== null); +previousObject = null; + +(new Function('tag', 'a', 'b', 'return tag`head${b}tail`;'))(tag, 1, 2); +assert.notSameValue( + previousObject, + firstObject, + 'The realm\'s template cache is by site, not string contents' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions.js b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions.js new file mode 100644 index 0000000000..678bf69f36 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-expressions.js @@ -0,0 +1,27 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Template caching using distinct expressions +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} +var a = 1; +var b = 2; +var firstObject = null; +var previousObject = null; + +tag`head${a}tail`; +firstObject = previousObject; +assert(firstObject !== null); +previousObject = null; + +tag`head${b}tail`; +assert.notSameValue(previousObject, firstObject); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-differing-raw-strings.js b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-raw-strings.js new file mode 100644 index 0000000000..95e8a1c689 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-raw-strings.js @@ -0,0 +1,28 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached according to their site +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +var previousObject = null; +var firstObject = null; +function tag(templateObject) { + previousObject = templateObject; +} + +tag`\uc548\ub155`; + +assert(previousObject !== null); +firstObject = previousObject; +previousObject = null; + +tag`안녕`; + +assert(previousObject !== null); +assert(firstObject !== previousObject); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-differing-string-count.js b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-string-count.js new file mode 100644 index 0000000000..22a3527253 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-differing-string-count.js @@ -0,0 +1,28 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached according to the site +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +var previousObject = null; +var firstObject = null; +function tag(templateObject) { + previousObject = templateObject; +} + +tag`foo${1}bar`; + +assert(previousObject !== null); +firstObject = previousObject; +previousObject = null; + +tag`foo\${1}bar`; + +assert(previousObject !== null); +assert(firstObject !== previousObject); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-eval-inner-function.js b/js/src/tests/test262/language/expressions/tagged-template/cache-eval-inner-function.js new file mode 100644 index 0000000000..4615a481ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-eval-inner-function.js @@ -0,0 +1,37 @@ +// Copyright (C) 2018 Igalia, S. L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached by source location inside a function +info: > + Each time eval is called, it is a different site. However, a loop within + the eval is considered the same site. This is a regression test for an + issue that Caitlin Potter faced in implementations of the new template + caching semantics in both V8 and JSC. + + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ + +let objs = []; +function tag(templateObject) { + objs.push(templateObject); +} + +for (let a = 0; a < 2; a++) { + eval("\ + (function() {\ + for (let b = 0; b < 2; b++) {\ + tag`${a}${b}`;\ + }\ + })();\ + "); +} + +assert.sameValue(objs[0], objs[1]); +assert.notSameValue(objs[1], objs[2]); +assert.sameValue(objs[2], objs[3]); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-eval.js b/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-eval.js new file mode 100644 index 0000000000..8b4c290518 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-eval.js @@ -0,0 +1,26 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached by site, even using identical expressions within `eval` +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} +var a = 1; +var firstObject = null; +var previousObject = null; + +tag`head${a}tail`; +firstObject = previousObject; +assert(firstObject !== null); +previousObject = null; + +eval('tag`head${a}tail`'); +assert.notSameValue(previousObject, firstObject); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-new-function.js b/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-new-function.js new file mode 100644 index 0000000000..0e558e3c46 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source-new-function.js @@ -0,0 +1,26 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Template caching is by site, using identical expressions within `new Function` +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} +var a = 1; +var firstObject = null; +var previousObject = null; + +tag`head${a}tail`; +firstObject = previousObject; +assert(firstObject !== null); +previousObject = null; + +(new Function('tag', 'a', 'b', 'return tag`head${b}tail`;'))(tag, 1, 2); +assert.notSameValue(previousObject, firstObject); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source.js b/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source.js new file mode 100644 index 0000000000..976434b509 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-identical-source.js @@ -0,0 +1,30 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached by site, even when using identical expressions +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} +var a = 1; +var firstObject = null; +var previousObject = null; + +tag`head${a}tail`; +firstObject = previousObject; +assert(firstObject !== null); +previousObject = null; + +tag`head${a}tail`; +assert.notSameValue( + previousObject, + firstObject, + 'The realm\'s template cache is by site, not string contents' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-realm.js b/js/src/tests/test262/language/expressions/tagged-template/cache-realm.js new file mode 100644 index 0000000000..0d033da05f --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-realm.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literals +es6id: 12.2.9 +description: Each realm has a distinct template registry +info: | + TemplateLiteral:NoSubstitutionTemplate + + [...] + 2. Let siteObj be GetTemplateObject(templateLiteral). + [...] + + TemplateLiteral:TemplateHeadExpressionTemplateSpans + + [...] + 2. Let siteObj be GetTemplateObject(templateLiteral). + [...] + + Runtime Semantics: GetTemplateObject ( templateLiteral )# + + + 1. Let rawStrings be TemplateStrings of templateLiteral with argument + true. + 2. Let realm be the current Realm Record. + 3. Let templateRegistry be realm.[[TemplateMap]]. + 4. For each element e of templateRegistry, do + a. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + i. Return e.[[Array]]. +features: [cross-realm] +---*/ + +var other = $262.createRealm().global; +var strings1, strings2; + +strings1 = (function(strings) { return strings; })`1234`; +strings2 = other.eval('(function(strings) { return strings; })`1234`'); + +assert.notSameValue(strings1, strings2); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-same-site-top-level.js b/js/src/tests/test262/language/expressions/tagged-template/cache-same-site-top-level.js new file mode 100644 index 0000000000..f9970b4cad --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-same-site-top-level.js @@ -0,0 +1,33 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached by source location inside a function +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ + +let templates = []; + +function tag(templateObject) { + templates.push(templateObject); +} + +let a = 1; +for (let i = 0; i < 2; i++) { + tag`head${a}tail`; +} + +assert.sameValue(templates.length, 2); + +assert.sameValue( + templates[0], + templates[1], + 'The realm\'s template cache is for source code locations in a top-level script' +); + + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/cache-same-site.js b/js/src/tests/test262/language/expressions/tagged-template/cache-same-site.js new file mode 100644 index 0000000000..a3c29b135a --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/cache-same-site.js @@ -0,0 +1,38 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Templates are cached by source location inside a function +info: > + 1. For each element _e_ of _templateRegistry_, do + 1. If _e_.[[Site]] is the same Parse Node as _templateLiteral_, then + 1. Return _e_.[[Array]]. +---*/ +function tag(templateObject) { + previousObject = templateObject; +} + +var a = 1; +var firstObject = null; +var previousObject = null; + +function runTemplate() { + tag`head${a}tail`; +} + +runTemplate(); +firstObject = previousObject; + +assert(firstObject !== null); +previousObject = null; + +runTemplate(); + +assert.sameValue( + previousObject, + firstObject, + 'The realm\'s template cache is for source code locations in a function' +); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/call-expression-argument-list-evaluation.js b/js/src/tests/test262/language/expressions/tagged-template/call-expression-argument-list-evaluation.js new file mode 100644 index 0000000000..276812efa1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/call-expression-argument-list-evaluation.js @@ -0,0 +1,44 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: Argument list evalution for call expresions +info: | + A tagged template is a function call where the arguments of the call are + derived from a TemplateLiteral. The actual arguments include a template + object and the values produced by evaluating the expressions embedded + within the TemplateLiteral. +---*/ + +var number = 5; +var string = 'str'; +var object = {}; +function fn() { return 'result'; } +var calls; + +calls = 0; +(function() { + return function() { + calls++; + assert.sameValue( + arguments.length, 1, 'NoSubstitutionTemplate arguments length' + ); + }; +})()`NoSubstitutionTemplate`; +assert.sameValue(calls, 1, 'NoSubstitutionTemplate function invocation'); + +calls = 0; +(function() { + return function(site, n, s, o, f, r) { + calls++; + assert.sameValue(n, number); + assert.sameValue(s, string); + assert.sameValue(o, object); + assert.sameValue(f, fn); + assert.sameValue(r, 'result'); + assert.sameValue(arguments.length, 6, 'TemplateHead arguments length'); + }; +})()`TemplateHead${number}TemplateSpans${string}${object}${fn}${fn()}`; +assert.sameValue(calls, 1, 'TemplateHead function invocation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/call-expression-context-no-strict.js b/js/src/tests/test262/language/expressions/tagged-template/call-expression-context-no-strict.js new file mode 100644 index 0000000000..d2261a90cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/call-expression-context-no-strict.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: Invocation context for call expressions +info: | + A tagged template is a function call where the arguments of the call are + derived from a TemplateLiteral. The actual arguments include a template + object and the values produced by evaluating the expressions embedded + within the TemplateLiteral. +flags: [noStrict] +---*/ +var context = null; +var fn = function() { + return function() { + context = this; + }; +}; + +fn()`NoSubstitutionTemplate`; + +assert.sameValue(context, this); + +fn = function() { + return () => { context = this; }; +}; + +context = null; +fn()`NoSubstitutionTemplate`; + +assert.sameValue(context, this); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/call-expression-context-strict-strict.js b/js/src/tests/test262/language/expressions/tagged-template/call-expression-context-strict-strict.js new file mode 100644 index 0000000000..e03bc78b62 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/call-expression-context-strict-strict.js @@ -0,0 +1,34 @@ +'use strict'; +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: Invocation context for call expressions +info: | + A tagged template is a function call where the arguments of the call are + derived from a TemplateLiteral. The actual arguments include a template + object and the values produced by evaluating the expressions embedded + within the TemplateLiteral. +flags: [onlyStrict] +---*/ +var context = null; +var fn = function() { + return function() { + context = this; + }; +}; + +fn()`NoSubstitutionTemplate`; + +assert.sameValue(context, undefined); + +fn = function() { + return () => { context = this; }; +}; + +context = null; +fn()`NoSubstitutionTemplate`; + +assert.sameValue(context, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/chained-application.js b/js/src/tests/test262/language/expressions/tagged-template/chained-application.js new file mode 100644 index 0000000000..5bcbb9c7af --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/chained-application.js @@ -0,0 +1,22 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: > + Tagged templates may be chained and are applied in a left-to-right order. +---*/ + +var callCount = 0; +var expected = ['x', 'y', 'z']; +var tag = function(templateObject) { + assert.sameValue(templateObject[0], expected[callCount]); + callCount++; + return tag; +} + +var result = tag`x``y``z`; + +assert.sameValue(callCount, 3); +assert.sameValue(result, tag); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/constructor-invocation.js b/js/src/tests/test262/language/expressions/tagged-template/constructor-invocation.js new file mode 100644 index 0000000000..0c507333f9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/constructor-invocation.js @@ -0,0 +1,29 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: > + Tagged template application takes precedence over `new` invocation. +---*/ + +function Constructor(x) { + arg = x; +} +var tag = function(x) { + templateObject = x; + return Constructor; +}; +var arg = null; +var instance, templateObject; + +instance = new tag`first template`; + +assert(instance instanceof Constructor); +assert.sameValue(templateObject[0], 'first template'); +assert.sameValue(arg, undefined); + +instance = new tag`second template`('constructor argument'); +assert.sameValue(templateObject[0], 'second template', 'tagging function'); +assert.sameValue(arg, 'constructor argument'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/invalid-escape-sequences.js b/js/src/tests/test262/language/expressions/tagged-template/invalid-escape-sequences.js new file mode 100644 index 0000000000..a3ba8bb281 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/invalid-escape-sequences.js @@ -0,0 +1,82 @@ +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Invalid unicode escape sequence in tagged template literals are allowed +esid: sec-template-literal-lexical-components +---*/ + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\01'); +})`\01`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\1'); +})`\1`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\8'); +})`\8`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\9'); +})`\9`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\xg'); +})`\xg`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\xAg'); +})`\xAg`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u0'); +})`\u0`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u0g'); +})`\u0g`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u00g'); +})`\u00g`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u000g'); +})`\u000g`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u{g'); +})`\u{g`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u{0'); +})`\u{0`; + +(strs => { + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u{10FFFFF}'); +})`\u{10FFFFF}`; + +((strs, val) => { + assert.sameValue(val, 'inner'); + assert.sameValue(strs[0], undefined, 'Cooked template value should be undefined for illegal escape sequences'); + assert.sameValue(strs.raw[0], '\\u{10FFFFF}'); + + assert.sameValue(strs[1], 'right'); + assert.sameValue(strs.raw[1], 'right'); +})`\u{10FFFFF}${'inner'}right`; + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/member-expression-argument-list-evaluation.js b/js/src/tests/test262/language/expressions/tagged-template/member-expression-argument-list-evaluation.js new file mode 100644 index 0000000000..7b5810272e --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/member-expression-argument-list-evaluation.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: Argument list evalution for member expresions +info: | + A tagged template is a function call where the arguments of the call are + derived from a TemplateLiteral. The actual arguments include a template + object and the values produced by evaluating the expressions embedded + within the TemplateLiteral. +---*/ + +var number = 5; +var string = 'str'; +var object = {}; +function fn() { return 'result'; } +var calls; + +calls = 0; +(function() { + calls++; + assert.sameValue( + arguments.length, 1, 'NoSubstitutionTemplate arguments length' + ); +})`NoSubstitutionTemplate`; +assert.sameValue(calls, 1, 'NoSubstitutionTemplate function invocation'); + +calls = 0; +(function(site, n, s, o, f, r) { + calls++; + assert.sameValue(n, number); + assert.sameValue(s, string); + assert.sameValue(o, object); + assert.sameValue(f, fn); + assert.sameValue(r, 'result'); + assert.sameValue(arguments.length, 6, 'TemplateHead arguments length'); +})`TemplateHead${number}TemplateSpans${string}${object}${fn}${fn()}`; +assert.sameValue(calls, 1, 'TemplateHead function invocation'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/member-expression-context.js b/js/src/tests/test262/language/expressions/tagged-template/member-expression-context.js new file mode 100644 index 0000000000..c4c34659cf --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/member-expression-context.js @@ -0,0 +1,23 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: Invocation context for member expressions +info: | + A tagged template is a function call where the arguments of the call are + derived from a TemplateLiteral. The actual arguments include a template + object and the values produced by evaluating the expressions embedded + within the TemplateLiteral. +---*/ +var context; +var obj = { + fn: function() { + context = this; + } +}; + +obj.fn`NoSubstitutionTemplate`; + +assert.sameValue(context, obj); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/shell.js b/js/src/tests/test262/language/expressions/tagged-template/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/tagged-template/tco-call-strict.js b/js/src/tests/test262/language/expressions/tagged-template/tco-call-strict.js new file mode 100644 index 0000000000..748910f0db --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/tco-call-strict.js @@ -0,0 +1,29 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +(function() { + var finished = false; + function getF() { + return f; + } + function f(_, n) { + if (n === 0) { + finished = true; + return; + } + return getF()`${n-1}`; + } + f(null, $MAX_ITERATIONS); + return finished; +}()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/tco-member-strict.js b/js/src/tests/test262/language/expressions/tagged-template/tco-member-strict.js new file mode 100644 index 0000000000..cdec6c9dc2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/tco-member-strict.js @@ -0,0 +1,26 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +(function() { + var finished = false; + function f(_, n) { + if (n === 0) { + finished = true; + return; + } + return f`${n-1}`; + } + f(null, $MAX_ITERATIONS); + return finished; +}()); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-non-strict.js b/js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-non-strict.js new file mode 100644 index 0000000000..f742f8b75b --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-non-strict.js @@ -0,0 +1,34 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: Template objects are frozen (as demonstrated outside of strict mode) +info: | + The first argument to a tagged template should be frozen and define a `raw` + property that is also frozen. +flags: [noStrict] +---*/ + +var templateObject = null; +var threwError = false; +(function(parameter) { + templateObject = parameter; +})``; + +assert(templateObject !== null); +templateObject.test262Prop = true; + +assert.sameValue( + templateObject.test262Prop, undefined, 'The template object is frozen' +); + +templateObject.raw.test262Prop = true; + +assert.sameValue( + templateObject.raw.test262Prop, undefined, 'The "raw" object is frozen' +); +assert( + templateObject.raw !== undefined , 'Template object defines a `raw` property' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-strict-strict.js b/js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-strict-strict.js new file mode 100644 index 0000000000..55319cae68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/template-object-frozen-strict-strict.js @@ -0,0 +1,33 @@ +'use strict'; +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.3.7 +description: Template objects are frozen (as demonstrated within strict mode) +info: | + The first argument to a tagged template should be frozen and define a `raw` + property that is also frozen. +flags: [onlyStrict] +---*/ + +var templateObject = null; +var threwError = false; +(function(parameter) { + templateObject = parameter; +})``; + +assert(templateObject !== null); + +assert.throws(TypeError, function() { + templateObject.test262Prop = true; +}); + +assert( + templateObject.raw !== undefined , 'Template object defines a `raw` property' +); + +assert.throws(TypeError, function() { + templateObject.raw.test262Prop = true; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/template-object-template-map.js b/js/src/tests/test262/language/expressions/tagged-template/template-object-template-map.js new file mode 100644 index 0000000000..d8b58dbca2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/template-object-template-map.js @@ -0,0 +1,41 @@ +// Copyright (C) 2018 Andrea Giammarchi. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: > + Template objects are canonicalized separately for each realm using its Realm Record's [[TemplateMap]]. Each [[Site]] value is a Parse Node that is a TemplateLiteral +info: | + Let rawStrings be TemplateStrings of templateLiteral with argument true. + Let realm be the current Realm Record. + Let templateRegistry be realm.[[TemplateMap]]. + For each element e of templateRegistry, do + If e.[[Site]] is the same Parse Node as templateLiteral, then + Return e.[[Array]]. + +---*/ +var expect; +var cache = []; +function sameSite() { + tag`${Math.random()}`; +} + +function tag(parameter) { + if (!expect) { + expect = parameter; + } + cache.push(parameter); +} + +sameSite(); +sameSite(); +tag`${1}`; +sameSite(); +sameSite(); + +assert(cache[0] === expect); +assert(cache[1] === expect); +assert(cache[2] !== expect); +assert(cache[3] === expect); +assert(cache[4] === expect); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tagged-template/template-object.js b/js/src/tests/test262/language/expressions/tagged-template/template-object.js new file mode 100644 index 0000000000..fed36a36ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/tagged-template/template-object.js @@ -0,0 +1,53 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-gettemplateobject +description: Properties of the template object +info: | + The first argument to a tagged template should be a template object as + defined by the GetTemplateObject abstract operation. +includes: [propertyHelper.js] +---*/ +var templateObject + +function tag(parameter) { + templateObject = parameter; +} + +tag`${1}`; + +assert(Array.isArray(templateObject.raw), 'The template object is an array'); + +verifyProperty(templateObject, 'raw', { + enumerable: false, + writable: false, + configurable: false, +}); + +assert(Array.isArray(templateObject), 'The "raw" object is an array'); + +verifyProperty(templateObject, '0', { + enumerable: true, + writable: false, + configurable: false, +}); + +verifyProperty(templateObject, 'length', { + enumerable: false, + writable: false, + configurable: false, +}); + +verifyProperty(templateObject.raw, '0', { + enumerable: true, + writable: false, + configurable: false, +}); + +verifyProperty(templateObject.raw, 'length', { + enumerable: false, + writable: false, + configurable: false, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/tco-pos-strict.js b/js/src/tests/test262/language/expressions/tco-pos-strict.js new file mode 100644 index 0000000000..0cb1782629 --- /dev/null +++ b/js/src/tests/test262/language/expressions/tco-pos-strict.js @@ -0,0 +1,23 @@ +// |reftest| skip -- tail-call-optimization is not supported +'use strict'; +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Expression is a candidate for tail-call optimization. +esid: sec-static-semantics-hascallintailposition +flags: [onlyStrict] +features: [tail-call-optimization] +includes: [tcoHelper.js] +---*/ + +var callCount = 0; +(function f(n) { + if (n === 0) { + callCount += 1 + return; + } + return (f(n - 1)); +}($MAX_ITERATIONS)); +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/browser.js b/js/src/tests/test262/language/expressions/template-literal/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/template-literal/evaluation-order.js b/js/src/tests/test262/language/expressions/template-literal/evaluation-order.js new file mode 100644 index 0000000000..753726e715 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/evaluation-order.js @@ -0,0 +1,26 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8 +description: Expressions should be evaluated in left-to-right order. +---*/ + +var tag = function(templateObject, a, b, c) { + callCount++; + assert.sameValue(a, 0); + assert.sameValue(b, 1); + assert.sameValue(c, 2); +}; +var i = 0; +var callCount; + +assert.sameValue(`a${ i++ }b${ i++ }c${ i++ }d`, 'a0b1c2d'); + +i = 0; +callCount = 0; + +tag`a${ i++ }b${ i++ }c${ i++ }d`; + +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-1.js b/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-1.js new file mode 100644 index 0000000000..fe2f0a44ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-1.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid hexidecimal character escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\x0`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-2.js b/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-2.js new file mode 100644 index 0000000000..443c186ea3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-2.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid hexidecimal character escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\x0G`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-3.js b/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-3.js new file mode 100644 index 0000000000..6795e2bdd9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-hexidecimal-character-escape-sequence-truncated-3.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid hexidecimal character escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\xG`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-8.js b/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-8.js new file mode 100644 index 0000000000..862ea33b48 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-8.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: > + Invalid octal escape sequence (regardless of the presence of Annex B) +info: | + TemplateCharacter :: + $ [lookahead ≠ {] + \ TemplateEscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\8`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-9.js b/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-9.js new file mode 100644 index 0000000000..56fda2d44d --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence-9.js @@ -0,0 +1,28 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Sony Interactive Entertainment Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: > + Invalid octal escape sequence (regardless of the presence of Annex B) +info: | + TemplateCharacter :: + $ [lookahead ≠ {] + \ TemplateEscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\9`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js b/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js new file mode 100644 index 0000000000..66b4742731 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-legacy-octal-escape-sequence.js @@ -0,0 +1,27 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 16.1 +description: Invalid octal escape sequence +info: | + TemplateCharacter :: + $ [lookahead ≠ {] + \ TemplateEscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + TemplateEscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\00`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-1.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-1.js new file mode 100644 index 0000000000..29907753fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-1.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u0`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-2.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-2.js new file mode 100644 index 0000000000..b2f3ddf758 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-2.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u0g`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-3.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-3.js new file mode 100644 index 0000000000..cc77d03b8b --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-3.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u00g`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-4.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-4.js new file mode 100644 index 0000000000..280d629968 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-4.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u000g`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-5.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-5.js new file mode 100644 index 0000000000..27241d13ad --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-5.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u{g`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-6.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-6.js new file mode 100644 index 0000000000..846cbf625e --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-6.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u{0`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-7.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-7.js new file mode 100644 index 0000000000..78346d2f78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-7.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u{10FFFFF}`; diff --git a/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-8.js b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-8.js new file mode 100644 index 0000000000..1dc2d20316 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/invalid-unicode-escape-sequence-8.js @@ -0,0 +1,14 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 Tim Disney. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-template-literal-lexical-components +description: Invalid unicode escape sequence +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u{10FFFFF}${'inner'}right`; diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-abrupt.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-abrupt.js new file mode 100644 index 0000000000..a149a26682 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-abrupt.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Abrupt completion when evaluating expression of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). + 4. ReturnIfAbrupt(middle). +---*/ + +assert.throws(Test262Error, function() { + `${function() { throw new Test262Error(); }()}`; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-function.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-function.js new file mode 100644 index 0000000000..3801f8a72c --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-function.js @@ -0,0 +1,18 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Function invocation in expression position of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +function fn() { return 'result'; } + +assert.sameValue(`foo ${fn()} bar`, 'foo result bar'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-member-expr.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-member-expr.js new file mode 100644 index 0000000000..00410aa84e --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-member-expr.js @@ -0,0 +1,36 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: MemberExpression in expression position of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +var object = { + number: 5, + string: 'stringValue' +}; + +assert.sameValue( + `foo ${object.number} bar`, 'foo 5 bar', 'number value property' +); +assert.sameValue( + `foo ${object.string} bar`, 'foo stringValue bar', 'string value property' +); +assert.sameValue( + `foo ${object['string']} bar`, + 'foo stringValue bar', + 'string value property (single-quote string dereference)' +); +assert.sameValue( + `foo ${object["string"]} bar`, + 'foo stringValue bar', + 'string value property (double-quote string dereference)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-method.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-method.js new file mode 100644 index 0000000000..fc1ccec648 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-method.js @@ -0,0 +1,19 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Method invocation in expression position of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ +var object = { + fn: function() { return 'result'; } +}; + +assert.sameValue(`foo ${object.fn()} bar`, 'foo result bar'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-obj.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-obj.js new file mode 100644 index 0000000000..8eeb2fc503 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-obj.js @@ -0,0 +1,31 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Object reference in expression position of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +var plain = {}; +var custom = { + toString: function() { + return '"own" toString'; + } +}; + +assert.sameValue(`${plain}`, '[object Object]'); +assert.sameValue(`1${plain}`, '1[object Object]'); +assert.sameValue(`${plain}2`, '[object Object]2'); +assert.sameValue(`1${plain}2`, '1[object Object]2'); + +assert.sameValue(`${custom}`, '"own" toString'); +assert.sameValue(`1${custom}`, '1"own" toString'); +assert.sameValue(`${custom}2`, '"own" toString2'); +assert.sameValue(`1${custom}2`, '1"own" toString2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-primitive.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-primitive.js new file mode 100644 index 0000000000..589bc8edba --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-primitive.js @@ -0,0 +1,17 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Primitive value in expression position of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +assert.sameValue(`foo ${5} bar`, 'foo 5 bar', 'number value'); +assert.sameValue(`foo ${'string'} bar`, 'foo string bar', 'string value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-template.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-template.js new file mode 100644 index 0000000000..9a4fa20eb6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-template.js @@ -0,0 +1,16 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Template literal in expression position of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +assert.sameValue(`foo ${`bar ${5} baz`} qux`, 'foo bar 5 baz qux'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/literal-expr-tostr-error.js b/js/src/tests/test262/language/expressions/template-literal/literal-expr-tostr-error.js new file mode 100644 index 0000000000..48d049d5e7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/literal-expr-tostr-error.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Abrupt completion when converting expression value of TemplateLiteral +info: | + TemplateLiteral : TemplateHead Expression TemplateSpans + + 1. Let head be the TV of TemplateHead as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). + 4. ReturnIfAbrupt(middle). +---*/ + +var obj = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + `${obj}`; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-abrupt.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-abrupt.js new file mode 100644 index 0000000000..9ebcca2c43 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-abrupt.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Abrupt completion when evaluating expression of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). + 6. ReturnIfAbrupt(last). +---*/ + +assert.throws(Test262Error, function() { + `${0}${1}${function() { throw new Test262Error(); }()}`; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-function.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-function.js new file mode 100644 index 0000000000..e3da7b4e74 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-function.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Function invocation in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). +---*/ + +function fn() { return 'result'; } + +assert.sameValue(`${0} ${1} ${fn()}`, '0 1 result'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-member-expr.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-member-expr.js new file mode 100644 index 0000000000..5d47e017c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-member-expr.js @@ -0,0 +1,40 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: MemberExpression in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). +---*/ + +var object = { + number: 5, + string: 'stringValue' +}; + +assert.sameValue( + `${0} ${1} ${object.number} bar`, '0 1 5 bar', 'number value property' +); +assert.sameValue( + `${0} ${1} ${object.string} bar`, + '0 1 stringValue bar', + 'string value property' +); +assert.sameValue( + `${0} ${1} ${object['string']} bar`, + '0 1 stringValue bar', + 'string value property (single-quote string dereference)' +); +assert.sameValue( + `${0} ${1} ${object["string"]} bar`, + '0 1 stringValue bar', + 'string value property (double-quote string dereference)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-method.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-method.js new file mode 100644 index 0000000000..609a1b5d1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-method.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Method invocation in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). +---*/ +var object = { + fn: function() { return 'result'; } +}; + +assert.sameValue(`${0} ${1} ${object.fn()} bar`, '0 1 result bar'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-obj.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-obj.js new file mode 100644 index 0000000000..9757199311 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-obj.js @@ -0,0 +1,33 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Object reference in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). +---*/ + +var plain = {}; +var custom = { + toString: function() { + return '"own" toString'; + } +}; + +assert.sameValue(`${0} ${1} ${plain}`, '0 1 [object Object]'); +assert.sameValue(`${0} ${1} ${plain}`, '0 1 [object Object]'); +assert.sameValue(`${0} ${1} ${plain}2`, '0 1 [object Object]2'); +assert.sameValue(`${0} ${1} ${plain}2`, '0 1 [object Object]2'); + +assert.sameValue(`${0} ${1} ${custom}`, '0 1 "own" toString'); +assert.sameValue(`${0} ${1} ${custom}`, '0 1 "own" toString'); +assert.sameValue(`${0} ${1} ${custom}2`, '0 1 "own" toString2'); +assert.sameValue(`${0} ${1} ${custom}2`, '0 1 "own" toString2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-primitive.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-primitive.js new file mode 100644 index 0000000000..6b6de83834 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-primitive.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Primitive value in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). +---*/ + +assert.sameValue(`${0} ${1} ${5} bar`, '0 1 5 bar', 'number value'); +assert.sameValue(`${0} ${1} ${'string'} bar`, '0 1 string bar', 'string value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-template.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-template.js new file mode 100644 index 0000000000..703e390c68 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-template.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Template literal in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). +---*/ + +assert.sameValue(`${0} ${1} ${`bar ${5} baz`} qux`, '0 1 bar 5 baz qux'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-tostr-error.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-tostr-error.js new file mode 100644 index 0000000000..fee24208af --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-many-expr-tostr-error.js @@ -0,0 +1,27 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Abrupt completion when converting expression value of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression + + 1. Let rest be the result of evaluating TemplateMiddleList . + 2. ReturnIfAbrupt(rest). + 3. Let middle be the TV of TemplateMiddle as defined in 11.8.6. + 4. Let sub be the result of evaluating Expression. + 5. Let last be ToString(sub). + 6. ReturnIfAbrupt(last). +---*/ + +var obj = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + `${0} ${1} ${obj}`; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-abrupt.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-abrupt.js new file mode 100644 index 0000000000..438a0422f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-abrupt.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Abrupt completion when evaluating expression of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). + 4. ReturnIfAbrupt(middle). +---*/ + +assert.throws(Test262Error, function() { + `${0}${function() { throw new Test262Error(); }()}`; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-function.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-function.js new file mode 100644 index 0000000000..7421d6972b --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-function.js @@ -0,0 +1,18 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Function invocation in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +function fn() { return 'result'; } + +assert.sameValue(`${0} ${fn()}`, '0 result'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-member-expr.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-member-expr.js new file mode 100644 index 0000000000..9cc76f637c --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-member-expr.js @@ -0,0 +1,37 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: MemberExpression in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). + 4. ReturnIfAbrupt(middle). +---*/ + +var object = { + number: 5, + string: 'stringValue' +}; + +assert.sameValue( + `${0} ${object.number} bar`, '0 5 bar', 'number value property' +); +assert.sameValue( + `${0} ${object.string} bar`, '0 stringValue bar', 'string value property' +); +assert.sameValue( + `${0} ${object['string']} bar`, + '0 stringValue bar', + 'string value property (single-quote string dereference)' +); +assert.sameValue( + `${0} ${object["string"]} bar`, + '0 stringValue bar', + 'string value property (double-quote string dereference)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-method.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-method.js new file mode 100644 index 0000000000..78e3df887d --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-method.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Method invocation in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). + 4. ReturnIfAbrupt(middle). +---*/ +var object = { + fn: function() { return 'result'; } +}; + +assert.sameValue(`${0} ${object.fn()} bar`, '0 result bar'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-obj.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-obj.js new file mode 100644 index 0000000000..457f9d649a --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-obj.js @@ -0,0 +1,32 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Object reference in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). + 4. ReturnIfAbrupt(middle). +---*/ + +var plain = {}; +var custom = { + toString: function() { + return '"own" toString'; + } +}; + +assert.sameValue(`${0} ${plain}`, '0 [object Object]'); +assert.sameValue(`${0} ${plain}`, '0 [object Object]'); +assert.sameValue(`${0} ${plain}2`, '0 [object Object]2'); +assert.sameValue(`${0} ${plain}2`, '0 [object Object]2'); + +assert.sameValue(`${0} ${custom}`, '0 "own" toString'); +assert.sameValue(`${0} ${custom}`, '0 "own" toString'); +assert.sameValue(`${0} ${custom}2`, '0 "own" toString2'); +assert.sameValue(`${0} ${custom}2`, '0 "own" toString2'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-primitive.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-primitive.js new file mode 100644 index 0000000000..94298ac0f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-primitive.js @@ -0,0 +1,17 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Primitive value in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +assert.sameValue(`${0} ${5} bar`, '0 5 bar', 'number value'); +assert.sameValue(`${0} ${'string'} bar`, '0 string bar', 'string value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-template.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-template.js new file mode 100644 index 0000000000..394322c17c --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-template.js @@ -0,0 +1,16 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Template literal in expression position of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). +---*/ + +assert.sameValue(`${0} ${`bar ${5} baz`} qux`, '0 bar 5 baz qux'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-tostr-error.js b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-tostr-error.js new file mode 100644 index 0000000000..1630d2df5a --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/middle-list-one-expr-tostr-error.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Abrupt completion when converting expression value of TemplateMiddleList +info: | + TemplateMiddleList : TemplateMiddle Expression + + 1. Let head be the TV of TemplateMiddle as defined in 11.8.6. + 2. Let sub be the result of evaluating Expression. + 3. Let middle be ToString(sub). + 4. ReturnIfAbrupt(middle). +---*/ + +var obj = { + toString: function() { + throw new Test262Error(); + } +}; + +assert.throws(Test262Error, function() { + `${0} ${obj}`; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator-eval.js b/js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator-eval.js new file mode 100644 index 0000000000..eb379893c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator-eval.js @@ -0,0 +1,24 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in template literals (eval code). +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +assert.sameValue(eval("`\u180E`"), "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator.js b/js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator.js new file mode 100644 index 0000000000..b0acc7f31a --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/mongolian-vowel-separator.js @@ -0,0 +1,25 @@ +// Copyright (C) 2016 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-unicode-format-control-characters +description: > + Mongolian Vowel Separator can appear in template literals. +info: | + 11.1 Unicode Format-Control Characters + + The Unicode format-control characters (i.e., the characters in category “Cf” + in the Unicode Character Database such as LEFT-TO-RIGHT MARK or RIGHT-TO-LEFT + MARK) are control codes used to control the formatting of a range of text in + the absence of higher-level protocols for this (such as mark-up languages). + + It is useful to allow format-control characters in source text to facilitate + editing and display. All format control characters may be used within comments, + and within string literals, template literals, and regular expression literals. +features: [u180e] +---*/ + +// U+180E in template literals; UTF8(0x180E) = 0xE1 0xA0 0x8E +assert.sameValue(`᠎`, "\u180E"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/no-sub.js b/js/src/tests/test262/language/expressions/template-literal/no-sub.js new file mode 100644 index 0000000000..3b12d123af --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/no-sub.js @@ -0,0 +1,16 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.2.8.5 +description: Evaluation of NoSubstitutionTemplate +info: | + 12.2.8.5 Runtime Semantics: Evaluation + TemplateLiteral : NoSubstitutionTemplate + + 1. Return the string value whose code units are the elements of the TV of + NoSubstitutionTemplate as defined in 11.8.6. +---*/ + +assert.sameValue(`NoSubstitutionTemplate`, 'NoSubstitutionTemplate'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/shell.js b/js/src/tests/test262/language/expressions/template-literal/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-character-escape-sequence.js b/js/src/tests/test262/language/expressions/template-literal/tv-character-escape-sequence.js new file mode 100644 index 0000000000..56d27f20a5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-character-escape-sequence.js @@ -0,0 +1,119 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of character escape sequences +info: | + The TV of TemplateCharacter :: \ EscapeSequence is the SV of + EscapeSequence. + The TRV of TemplateCharacter :: \ EscapeSequence is the sequence consisting + of the code unit value 0x005C followed by the code units of TRV of + EscapeSequence. + The TRV of CharacterEscapeSequence :: SingleEscapeCharacter is the TRV of + the SingleEscapeCharacter. + The TRV of CharacterEscapeSequence :: NonEscapeCharacter is the SV of the + NonEscapeCharacter. +---*/ +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], "'", "TV of NonEscapeCharacter"); + assert.sameValue(s.raw[0], "\u005C\u0027", "TRV of NonEscapeCharacter"); +})`\'`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], "\"", "TV of SingleEscapeCharacter (double quote)"); + assert.sameValue( + s.raw[0], "\u005C\u0022", "TRV of SingleEscapeCharacter (double quote)" + ); +})`\"`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], "\\", "TV of SingleEscapeCharacter (backslash)"); + assert.sameValue( + s.raw[0], "\u005C\u005C", "TRV of SingleEscapeCharacter (backslash)" + ); +})`\\`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], "\b", "TV of SingleEscapeCharacter (backspace)"); + assert.sameValue( + s.raw[0], "\u005Cb", "TRV of SingleEscapeCharacter (backspace)" + ); +})`\b`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], "\f", "TV of SingleEscapeCharacter (form feed)"); + assert.sameValue( + s.raw[0], "\u005Cf", "TRV of SingleEscapeCharacter (form feed)" + ); +})`\f`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], "\n", "TV of SingleEscapeCharacter (new line)"); + assert.sameValue( + s.raw[0], "\u005Cn", "TRV of SingleEscapeCharacter (new line)" + ); +})`\n`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue( + s[0], "\r", "TV of SingleEscapeCharacter (carriage return)" + ); + assert.sameValue( + s.raw[0], "\u005Cr", "TRV of SingleEscapeCharacter (carriage return)" + ); +})`\r`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], " ", "TV of SingleEscapeCharacter (tab)"); + assert.sameValue(s.raw[0], "\u005Ct", "TRV of SingleEscapeCharacter (tab)"); +})`\t`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue( + s[0], "\v", "TV of SingleEscapeCharacter (line tabulation)" + ); + assert.sameValue( + s.raw[0], "\u005Cv", "TRV of SingleEscapeCharacter (line tabulation)" + ); +})`\v`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], "`", "TV of SingleEscapeCharacter (backtick)"); + assert.sameValue( + s.raw[0], "\u005C`", "TRV of SingleEscapeCharacter (backtick)" + ); +})`\``; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-hex-escape-sequence.js b/js/src/tests/test262/language/expressions/template-literal/tv-hex-escape-sequence.js new file mode 100644 index 0000000000..f3e2b2250b --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-hex-escape-sequence.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of hex escape sequences +info: | + The TV of TemplateCharacter :: \ EscapeSequence is the SV of + EscapeSequence. + The SV of UnicodeEscapeSequence :: u{ HexDigits } is the UTF16Encoding + (10.1.1) of the MV of HexDigits. + The TRV of UnicodeEscapeSequence :: u{ HexDigits } is the sequence + consisting of code unit value 0x0075 followed by code unit value 0x007B + followed by TRV of HexDigits followed by code unit value 0x007D. +---*/ + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], 'A', 'TV'); + assert.sameValue(s.raw[0], '\\x41', 'TRV'); +})`\x41`; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-line-continuation.js b/js/src/tests/test262/language/expressions/template-literal/tv-line-continuation.js new file mode 100644 index 0000000000..5179573aa2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-line-continuation.js @@ -0,0 +1,44 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of line continuations +info: | + The TV of LineContinuation :: \ LineTerminatorSequence is the empty code + unit sequence. + The TRV of LineContinuation :: \ LineTerminatorSequence is the sequence + consisting of the code unit value 0x005C followed by the code units of TRV + of LineTerminatorSequence. +---*/ + +var calls; + +calls = 0; +(function(cs) { + calls++; + assert.sameValue(cs[0], '', 'Line Feed and Carriage Return'); + assert.sameValue( + cs.raw[0], '\u005C\n\u005C\n\u005C\n', 'Line Feed and Carriage Return' + ); +})`\ +\ +\ ` +assert.sameValue(calls, 1); + +calls = 0; +(function(cs) { + calls++; + assert.sameValue(cs[0], '', 'Line Separator'); + assert.sameValue(cs.raw[0], '\\\u2028', 'Line Separator'); +})`\
` +assert.sameValue(calls, 1); + +calls = 0; +(function(cs) { + calls++; + assert.sameValue(cs[0], '', 'Paragraph Separater'); + assert.sameValue(cs.raw[0], '\\\u2029', 'Paragraph Separator'); +})`\
` +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-line-terminator-sequence.js b/js/src/tests/test262/language/expressions/template-literal/tv-line-terminator-sequence.js new file mode 100644 index 0000000000..bf3fb07887 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-line-terminator-sequence.js @@ -0,0 +1,46 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of line terminator sequences +info: | + The TV of TemplateCharacter :: LineTerminatorSequence is the TRV of + LineTerminatorSequence. + The TRV of LineTerminatorSequence :: is the code unit value 0x000A. + The TRV of LineTerminatorSequence :: is the code unit value 0x000A. + The TRV of LineTerminatorSequence :: is the code unit value 0x2028. + The TRV of LineTerminatorSequence :: is the code unit value 0x2029. + The TRV of LineTerminatorSequence :: is the sequence consisting of + the code unit value 0x000A. +---*/ + + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], '\n\n\n', 'Line Feed and Carriage Return'); + assert.sameValue(s.raw[0], '\n\n\n', 'Line Feed and Carriage Return'); +})` + + `; +assert.sameValue(calls, 1); + +calls = 0; +(function(cs) { + calls++; + assert.sameValue(cs[0], '\u2028', 'Line Separator'); + assert.sameValue(cs.raw[0], '\u2028', 'Line Separator'); +})`
` +assert.sameValue(calls, 1); + +calls = 0; +(function(cs) { + calls++; + assert.sameValue(cs[0], '\u2029', 'Paragraph Separator'); + assert.sameValue(cs.raw[0], '\u2029', 'Paragraph Separator'); +})`
` +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-no-substitution.js b/js/src/tests/test262/language/expressions/template-literal/tv-no-substitution.js new file mode 100644 index 0000000000..13cc94369a --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-no-substitution.js @@ -0,0 +1,33 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of templates without substitution patterns +info: | + The TV and TRV of NoSubstitutionTemplate :: `` is the empty code unit + sequence. + The TV of NoSubstitutionTemplate :: ` TemplateCharacters ` is the TV of + TemplateCharacters. + The TRV of NoSubstitutionTemplate :: ` TemplateCharacters ` is the TRV of + TemplateCharacters. +---*/ + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], '', 'Template value (empty)'); + assert.sameValue(s.raw[0], '', 'Template raw value (empty)'); +})``; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], 'foo', 'Template value (with content)'); + assert.sameValue(s.raw[0], 'foo', 'Template raw value (with content)'); +})`foo`; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-null-character-escape-sequence.js b/js/src/tests/test262/language/expressions/template-literal/tv-null-character-escape-sequence.js new file mode 100644 index 0000000000..4ff6974579 Binary files /dev/null and b/js/src/tests/test262/language/expressions/template-literal/tv-null-character-escape-sequence.js differ diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-template-character.js b/js/src/tests/test262/language/expressions/template-literal/tv-template-character.js new file mode 100644 index 0000000000..d58d21ad1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-template-character.js @@ -0,0 +1,40 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of single characters +info: | + The TV of TemplateCharacters :: TemplateCharacter is the TV of + TemplateCharacter. + The TV of TemplateCharacter :: SourceCharacter but not one of ` or \ or $ + or LineTerminator is the UTF16Encoding (10.1.1) of the code point value of + SourceCharacter. + The TV of TemplateCharacter :: $ is the code unit value 0x0024. + + The TRV of TemplateCharacters :: TemplateCharacter is the TRV of + TemplateCharacter. + The TRV of TemplateCharacter :: SourceCharacter but not one of ` or \ or $ + or LineTerminator is the UTF16Encoding (10.1.1) of the code point value of + SourceCharacter. + The TRV of TemplateCharacter :: $ is the code unit value 0x0024. +---*/ + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], 'a', '`a` character TV'); + assert.sameValue(s.raw[0], 'a', '`a` character TRV'); +})`a`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], '$', '`$` character TV'); + assert.sameValue(s.raw[0], '$', '`$` character TRV'); +})`$`; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-template-characters.js b/js/src/tests/test262/language/expressions/template-literal/tv-template-characters.js new file mode 100644 index 0000000000..30e838ba59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-template-characters.js @@ -0,0 +1,25 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of multiple template characters +info: | + The TV of TemplateCharacters :: TemplateCharacter TemplateCharacters is a + sequence consisting of the code units in the TV of TemplateCharacter + followed by all the code units in the TV of TemplateCharacters in order. + The TRV of TemplateCharacters :: TemplateCharacter TemplateCharacters is a + sequence consisting of the code units in the TRV of TemplateCharacter + followed by all the code units in the TRV of TemplateCharacters, in order. +---*/ + +var calls = 0; + +(function(s) { + calls++; + assert.sameValue(s.raw[0], 'test'); +})`test`; + +assert.sameValue(calls, 1); +assert.sameValue(`test`, 'test'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-template-head.js b/js/src/tests/test262/language/expressions/template-literal/tv-template-head.js new file mode 100644 index 0000000000..3a3d7df5e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-template-head.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of the template head pattern +info: | + The TV and TRV of TemplateHead :: `${ is the empty code unit sequence. + The TV of TemplateHead :: ` TemplateCharacters ${ is the TV of + TemplateCharacters. + The TRV of TemplateHead :: ` TemplateCharacters ${ is the TRV of + TemplateCharacters. +---*/ + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], '', 'Template value (empty)'); + assert.sameValue(s.raw[0], '', 'Template raw value (empty)'); +})`${1}`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], 'foo', 'Template value (with content)'); + assert.sameValue(s.raw[0], 'foo', 'Template raw value (with content)'); +})`foo${1}`; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-template-middle.js b/js/src/tests/test262/language/expressions/template-literal/tv-template-middle.js new file mode 100644 index 0000000000..56e0b167aa --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-template-middle.js @@ -0,0 +1,30 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of the template middle pattern +info: | + The TV and TRV of TemplateMiddle :: }${ is the empty code unit sequence. + The TRV of TemplateMiddle :: } TemplateCharacters ${ is the TRV of + TemplateCharacters. +---*/ + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[1], '', 'Template value (empty)'); + assert.sameValue(s.raw[1], '', 'Template raw value (empty)'); +})`${1}${2}`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[1], 'foo', 'Template value (with content)'); + assert.sameValue(s.raw[1], 'foo', 'Template raw value (with content)'); +})`${1}foo${2}`; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-template-tail.js b/js/src/tests/test262/language/expressions/template-literal/tv-template-tail.js new file mode 100644 index 0000000000..e04e089e44 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-template-tail.js @@ -0,0 +1,32 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of the template tail pattern +info: | + The TV and TRV of TemplateTail :: }` is the empty code unit sequence. + The TV of TemplateTail :: } TemplateCharacters ` is the TV of + TemplateCharacters. + The TRV of TemplateTail :: } TemplateCharacters ` is the TRV of + TemplateCharacters. +---*/ + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[1], '', 'Template value (empty)'); + assert.sameValue(s.raw[1], '', 'Template raw value (empty)'); +})`${1}`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[1], 'foo', 'Template value (with content)'); + assert.sameValue(s.raw[1], 'foo', 'Template raw value (with content)'); +})`${1}foo`; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-utf16-escape-sequence.js b/js/src/tests/test262/language/expressions/template-literal/tv-utf16-escape-sequence.js new file mode 100644 index 0000000000..d89be2fa1d --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-utf16-escape-sequence.js @@ -0,0 +1,52 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.8.6.1 +description: Template values of UTF-16 escape sequences +info: | + The TV of TemplateCharacter :: \ EscapeSequence is the SV of + EscapeSequence. + The SV of UnicodeEscapeSequence :: u{ HexDigits } is the UTF16Encoding + (10.1.1) of the MV of HexDigits. + The TRV of UnicodeEscapeSequence :: u Hex4Digits is the sequence consisting + of code unit value 0x0075 followed by TRV of Hex4Digits. + The TRV of UnicodeEscapeSequence :: u{ HexDigits } is the sequence + consisting of code unit value 0x0075 followed by code unit value 0x007B + followed by TRV of HexDigits followed by code unit value 0x007D. +---*/ + +var calls; + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], 'b', 'u Hex4Digits template value'); + assert.sameValue(s.raw[0], '\\u0062', 'u Hex4Digits template raw value'); +})`\u0062`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue(s[0], 'b', 'u{ HexDigits } template value'); + assert.sameValue( + s.raw[0], '\\u{62}', 'u{ Hex4Digits } template raw value' + ); +})`\u{62}`; +assert.sameValue(calls, 1); + +calls = 0; +(function(s) { + calls++; + assert.sameValue( + s[0], 'b', 'u{ HexDigits } template value (with leading zeros)' + ); + assert.sameValue( + s.raw[0], + '\\u{000062}', + 'u{ HexDigits } template raw value (with leading zeros)' + ); +})`\u{000062}`; +assert.sameValue(calls, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/tv-zwnbsp.js b/js/src/tests/test262/language/expressions/template-literal/tv-zwnbsp.js new file mode 100644 index 0000000000..e5bf735745 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/tv-zwnbsp.js @@ -0,0 +1,35 @@ +// Copyright (C) 2014 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 11.1.8.6.1 +description: Template values of the zero width no-break space character +info: | + The zero width no-break space format-control character may be used within + template literals. +---*/ + +var callCount; + +callCount = 0; +(function(s) { + callCount++; + assert.sameValue( + s[0], 'test', 'TV (specified via unicode escape sequence)' + ); + assert.sameValue( + s.raw[0], '\\uFEFFtest', 'TV (specified via unicode escape sequence)' + ); +})`\uFEFFtest`; +assert.sameValue(callCount, 1); + +callCount = 0; +(function(s) { + callCount++; + assert.sameValue(s[0], 'test', 'TV (specified via literal character)'); + assert.sameValue( + s.raw[0], 'test', 'TV (specified via literal character)' + ); +})`test`; +assert.sameValue(callCount, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/template-literal/unicode-escape-nls-err.js b/js/src/tests/test262/language/expressions/template-literal/unicode-escape-nls-err.js new file mode 100644 index 0000000000..57f7f3e4de --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/unicode-escape-nls-err.js @@ -0,0 +1,56 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2017 Valerie Young. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-Template +description: NumericLiteralSeperator disallowed in unicode CodePoint sequence +info: | + Template :: + NoSubstitutionTemplate + TemplateHead + + NoSubstitutionTemplate :: + `TemplateCharactersopt` + + TemplateCharacters :: + TemplateCharacterTemplateCharactersopt + + TemplateCharacter :: + $[lookahead ≠ {] + \EscapeSequence + \NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacterbut not one of ` or \ or $ or LineTerminator + + EscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + uHex4Digits + u{CodePoint} + + CodePoint :: + HexDigit but only if MV of HexDigits ≤ 0x10FFFF + CodePointDigits but only if MV of HexDigits ≤ 0x10FFFF + + CodePointDigits :: + HexDigit + CodePointDigitsHexDigit + + HexDigit :: one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +features: [numeric-separator-literal] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u{1F_639}`; diff --git a/js/src/tests/test262/language/expressions/template-literal/unicode-escape-no-hex-err.js b/js/src/tests/test262/language/expressions/template-literal/unicode-escape-no-hex-err.js new file mode 100644 index 0000000000..8f39d220f6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/template-literal/unicode-escape-no-hex-err.js @@ -0,0 +1,51 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: prod-Template +description: > + \u is at the end of string, Hex4Digits is required. +info: | + Template :: + NoSubstitutionTemplate + TemplateHead + + NoSubstitutionTemplate :: + ` TemplateCharacters_opt ` + + TemplateCharacters :: + TemplateCharacter TemplateCharacters_opt + + TemplateCharacter :: + $ [lookahead ≠ {] + \ EscapeSequence + \ NotEscapeSequence + LineContinuation + LineTerminatorSequence + SourceCharacter but not one of ` or \ or $ or LineTerminator + + EscapeSequence :: + CharacterEscapeSequence + 0 [lookahead ∉ DecimalDigit] + HexEscapeSequence + UnicodeEscapeSequence + + UnicodeEscapeSequence :: + u Hex4Digits + u{ CodePoint } + + Hex4Digits :: + HexDigit HexDigit HexDigit HexDigit + + HexDigit :: one of + 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F + +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +`\u` diff --git a/js/src/tests/test262/language/expressions/this/11.1.1-1.js b/js/src/tests/test262/language/expressions/this/11.1.1-1.js new file mode 100644 index 0000000000..0136301f39 --- /dev/null +++ b/js/src/tests/test262/language/expressions/this/11.1.1-1.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.1.1-1gs +description: the 'this' object at the global scope is not undefined +---*/ + +assert.notSameValue(this, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A1.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A1.js new file mode 100644 index 0000000000..3c0d0c179c --- /dev/null +++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A1.js @@ -0,0 +1,16 @@ +// |reftest| error:SyntaxError +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: The "this" is reserved word +es5id: 11.1.1_A1 +description: Checking if execution of "this=1" fails +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +this = 1; diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.js new file mode 100644 index 0000000000..1719872419 --- /dev/null +++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Being in function code, "this" and eval("this"), called as a functions, + return the global object +es5id: 11.1.1_A3.1 +description: Creating function which returns "this" or eval("this") +flags: [noStrict] +---*/ + +//CHECK#1 +function ReturnThis() {return this} +if (ReturnThis() !== this) { + throw new Test262Error('#1: function ReturnThis() {return this} ReturnThis() === this. Actual: ' + (ReturnThis())); +} + +//CHECK#2 +function ReturnEvalThis() {return eval("this")} +if (ReturnEvalThis() !== this) { + throw new Test262Error('#2: function ReturnEvalThis() {return eval("this")} ReturnEvalThis() === this. Actual: ' + (ReturnEvalThis())); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.js new file mode 100644 index 0000000000..438e14efed --- /dev/null +++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A3.2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Being in function code, "this" and eval("this"), called as a + constructors, return the object +es5id: 11.1.1_A3.2 +description: Create function. It have property, that returned "this" +---*/ + +//CHECK#1 +function SetThis() {this.THIS = this} +if ((new SetThis()).THIS.toString() !== "[object Object]") { + throw new Test262Error('#1: function SetThis() {this.THIS = this} (new SetThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetThis()).THIS.toString())); +} + +//CHECK#2 +function SetEvalThis() {this.THIS = eval("this")} +if ((new SetEvalThis()).THIS.toString() !== "[object Object]") { + throw new Test262Error('#2: function SetEvalThis() {this.THIS = eval("this")} (new SetEvalThis()).THIS.toString() !== "[object Object]". Actual: ' + ((new SetEvalThis()).THIS.toString())); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.js new file mode 100644 index 0000000000..e79314eddc --- /dev/null +++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Being in anonymous code, "this" and eval("this"), called as a function, + return the global object +es5id: 11.1.1_A4.1 +description: Creating function with new Function() constructor +---*/ + +//CHECK#1 +var MyFunction = new Function("return this"); +if (MyFunction() !== this) { + throw new Test262Error('#1: var MyFunction = new Function("return this"); MyFunction() === this. Actual: ' + (MyFunction())); +} + +//CHECK#2 +MyFunction = new Function("return eval(\'this\')"); +if (MyFunction() !== this) { + throw new Test262Error('#2: var MyFunction = new Function("return eval(\'this\')"); MyFunction() === this. Actual: ' + (MyFunction())); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.js b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.js new file mode 100644 index 0000000000..7c5a4e6326 --- /dev/null +++ b/js/src/tests/test262/language/expressions/this/S11.1.1_A4.2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Being in anonymous code, "this" and eval("this"), called as a + constructor, return the object +es5id: 11.1.1_A4.2 +description: > + Creating function by using new Function() constructor. It has the + property, which returns "this" +---*/ + +//CHECK#1 +var MyFunction = new Function("this.THIS = this"); +var MyObject = new MyFunction(); +if (MyObject.THIS.toString() !== "[object Object]") { + throw new Test262Error('#1: var MyFunction = new Function("this.THIS = this"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString())); +} + +//CHECK#2 +MyFunction = new Function("this.THIS = eval(\'this\')"); +MyObject = new MyFunction(); +if (MyObject.THIS.toString() !== "[object Object]") { + throw new Test262Error('#2: var MyFunction = new Function("this.THIS = eval(\'this\')"); var MyObject = new MyFunction(); MyObject.THIS.toString() === "[object Object]". Actual: ' + (MyObject.THIS.toString())); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/this/browser.js b/js/src/tests/test262/language/expressions/this/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/this/shell.js b/js/src/tests/test262/language/expressions/this/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/typeof/bigint.js b/js/src/tests/test262/language/expressions/typeof/bigint.js new file mode 100644 index 0000000000..ae3edbc016 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/bigint.js @@ -0,0 +1,54 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof BigInt literal and BigInt object +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + BigInt "bigint" + Object(BigInt()) "object" + +features: [BigInt] +---*/ + +assert.sameValue( + typeof 0n, + "bigint", + "typeof 0n === 'bigint'" +); +assert.sameValue( + typeof BigInt(0n), + "bigint", + "typeof BigInt(0n) === 'bigint'" +); +assert.sameValue( + typeof BigInt(0), + "bigint", + "typeof BigInt(0) === 'bigint'" +); +assert.sameValue( + typeof Object(BigInt(0n)), + "object", + "typeof Object(BigInt(0n)) === 'object'" +); +assert.sameValue( + typeof Object(BigInt(0)), + "object", + "typeof Object(BigInt(0)) === 'object'" +); +assert.sameValue( + typeof Object(0n), + "object", + "typeof Object(0n) === 'object'" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/boolean.js b/js/src/tests/test262/language/expressions/typeof/boolean.js new file mode 100644 index 0000000000..7b00346d2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/boolean.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Boolean literal +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Boolean "boolean" + + +---*/ + +assert.sameValue( + typeof true, + "boolean", + 'typeof true === "boolean"' +); + +assert.sameValue( + typeof false, + "boolean", + 'typeof false === "boolean"' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/browser.js b/js/src/tests/test262/language/expressions/typeof/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/typeof/built-in-exotic-objects-no-call.js b/js/src/tests/test262/language/expressions/typeof/built-in-exotic-objects-no-call.js new file mode 100644 index 0000000000..b41de3bf2b --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/built-in-exotic-objects-no-call.js @@ -0,0 +1,77 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Object (standard exotic and does not implement [[Call]]) === "object" +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Object (standard exotic and does not implement [[Call]]) "object" + + +---*/ + +assert.sameValue( + typeof this, + "object", + 'typeof this === "object"' +); + +assert.sameValue( + typeof new Object(), + "object", + 'typeof new Object() === "object"' +); + +assert.sameValue( + typeof new Array(), + "object", + 'typeof new Array() === "object"' +); + +assert.sameValue( + typeof new String(), + "object", + 'typeof new String() === "object"' +); + +assert.sameValue( + typeof new Boolean(), + "object", + 'typeof new Boolean() === "object"' +); + +assert.sameValue( + typeof new Number(), + "object", + 'typeof new Number() === "object"' +); + +assert.sameValue( + typeof new Date(), + "object", + 'typeof new Date() === "object"' +); + +assert.sameValue( + typeof new Error(), + "object", + ' typeof new Error() === "object"' +); + +assert.sameValue( + typeof new RegExp(), + "object", + ' typeof new RegExp() === "object"' +); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/built-in-functions.js b/js/src/tests/test262/language/expressions/typeof/built-in-functions.js new file mode 100644 index 0000000000..a0d3cb3ec1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/built-in-functions.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Object (implements [[Call]]) === "function" +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Object (implements [[Call]]) "function" + + + +---*/ + +assert.sameValue( + typeof Math.exp, + "function", + 'typeof Math.exp === "function"' +); + +assert.sameValue( + typeof parseInt, + "function", + 'typeof parseInt === "function"' +); + +// TODO: should this be expanded to check all built-ins? +// that might be excessive... + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/built-in-ordinary-objects-no-call.js b/js/src/tests/test262/language/expressions/typeof/built-in-ordinary-objects-no-call.js new file mode 100644 index 0000000000..10de33b1da --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/built-in-ordinary-objects-no-call.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Object (ordinary and does not implement [[Call]]) === "object" +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Object (ordinary and does not implement [[Call]]) "object" + +---*/ + +assert.sameValue( + typeof Math, + "object", + 'typeof Math === "object"' +); + +assert.sameValue( + typeof Reflect, + "object", + 'typeof Reflect === "object"' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/get-value-ref-err.js b/js/src/tests/test262/language/expressions/typeof/get-value-ref-err.js new file mode 100644 index 0000000000..8abd2c420c --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/get-value-ref-err.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: Operator "typeof" uses GetValue +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Set val to ? GetValue(val). + ... + + GetValue ( V ): + + ... + If IsUnresolvableReference(V) is true, throw a ReferenceError exception. + +---*/ + +assert.throws(ReferenceError, function() { + typeof x.x; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/get-value.js b/js/src/tests/test262/language/expressions/typeof/get-value.js new file mode 100644 index 0000000000..eb69003978 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/get-value.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: Operator "typeof" uses GetValue +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Set val to ? GetValue(val). + ... + +---*/ + +var count = 0; + +Object.defineProperties(this, { + x: { + value: 1 + }, + y: { + get() { + count++; + return 1; + } + } +}); + +assert.sameValue( + typeof x, + "number", + 'typeof x === "number"' +); + +assert.sameValue( + typeof y, + "number", + 'typeof y === "number"' +); + +assert.sameValue(count, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/native-call.js b/js/src/tests/test262/language/expressions/typeof/native-call.js new file mode 100644 index 0000000000..0a371f725f --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/native-call.js @@ -0,0 +1,78 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Object (implements [[Call]]) === "function" +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Object (implements [[Call]]) "function" + + +---*/ + +assert.sameValue( + typeof new Function(), + "function", + 'typeof new Function() === "function"' +); + +assert.sameValue( + typeof Function(), + "function", + 'typeof Function() === "function"' +); + +assert.sameValue( + typeof Object, + "function", + 'typeof Object === "function"' +); + +assert.sameValue( + typeof String, + "function", + 'typeof String === "function"' +); + +assert.sameValue( + typeof Boolean, + "function", + 'typeof Boolean === "function"' +); + +assert.sameValue( + typeof Number, + "function", + 'typeof Number === "function"' +); + +assert.sameValue( + typeof Date, + "function", + 'typeof Date === "function"' +); + +assert.sameValue( + typeof Error, + "function", + 'typeof Error === "function"' +); + +assert.sameValue( + typeof RegExp, + "function", + 'typeof RegExp === "function"' +); + +// TODO: Should this be extended to include all built-ins? + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/null.js b/js/src/tests/test262/language/expressions/typeof/null.js new file mode 100644 index 0000000000..6dc6205b06 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/null.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Object (implements [[Call]]) === "function" +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Null "object" + +---*/ + +assert.sameValue( + typeof null, + "object", + 'typeof null === "object"' +); + +assert.sameValue( + typeof RegExp("0").exec("1"), + "object", + 'typeof RegExp("0").exec("1") === "object"' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/number.js b/js/src/tests/test262/language/expressions/typeof/number.js new file mode 100644 index 0000000000..c539cf458a --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/number.js @@ -0,0 +1,51 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Number literal +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Number "number" + +---*/ + +assert.sameValue( + typeof 1, + "number", + 'typeof 1 === "number"' +); + +assert.sameValue( + typeof NaN, + "number", + 'typeof NaN === "number"' +); + +assert.sameValue( + typeof Infinity, + "number", + 'typeof Infinity === "number"' +); + +assert.sameValue( + typeof -Infinity, + "number", + 'typeof -Infinity === "number"' +); + +assert.sameValue( + typeof Math.PI, + "number", + 'typeof Math.PI === "number"' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/proxy.js b/js/src/tests/test262/language/expressions/typeof/proxy.js new file mode 100644 index 0000000000..5c8b285a97 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/proxy.js @@ -0,0 +1,43 @@ +// Copyright (C) 2019 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + The typeof operator on an proxy should match the typeof value the proxy wraps, + even if the proxy is later revoked. +esid: sec-typeof-operator +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Object (does not implement [[Call]]) "object" + Object (implements [[Call]]) "function" + + + ProxyCreate ( target, handler ) + ... + 7. If IsCallable(target) is true, then + a. Set P.[[Call]] as specified in 9.5.12. + ... +features: [Proxy] +---*/ + +assert.sameValue(typeof new Proxy({}, {}), 'object'); + +assert.sameValue(typeof new Proxy(function() {}, {}), 'function'); + +const rp1 = Proxy.revocable({}, {}); +rp1.revoke(); +assert.sameValue(typeof rp1.proxy, 'object'); + +const rp2 = Proxy.revocable(function() {}, {}); +rp2.revoke(); +assert.sameValue(typeof rp2.proxy, 'function'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/shell.js b/js/src/tests/test262/language/expressions/typeof/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/typeof/string.js b/js/src/tests/test262/language/expressions/typeof/string.js new file mode 100644 index 0000000000..0204c06aa9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/string.js @@ -0,0 +1,57 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof String literal +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + String "string" + +---*/ + +assert.sameValue( + typeof "1", + "string", + 'typeof "1" === "string"' +); + +assert.sameValue( + typeof "NaN", + "string", + 'typeof "NaN" === "string"' +); + +assert.sameValue( + typeof "Infinity", + "string", + 'typeof "Infinity" === "string"' +); + +assert.sameValue( + typeof "", + "string", + 'typeof "" === "string"' +); + +assert.sameValue( + typeof "true", + "string", + 'typeof "true" === "string"' +); + +assert.sameValue( + typeof Date(), + "string", + 'typeof Date() === "string"' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/symbol.js b/js/src/tests/test262/language/expressions/typeof/symbol.js new file mode 100644 index 0000000000..460121d71d --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/symbol.js @@ -0,0 +1,47 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof Symbol() and Object(Symbol) +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Symbol "symbol" + Object(Symbol()) "object" + +features: [Symbol] +---*/ + +assert.sameValue( + typeof Symbol(), + "symbol", + "typeof Symbol() === 'symbol'" +); + +assert.sameValue( + typeof Symbol("A"), + "symbol", + "typeof Symbol('A') === 'symbol'" +); + +assert.sameValue( + typeof Object(Symbol()), + "object", + "typeof Object(Symbol()) === 'object'" +); + +assert.sameValue( + typeof Object(Symbol("A")), + "object", + "typeof Object(Symbol('A')) === 'object'" +); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/syntax.js b/js/src/tests/test262/language/expressions/typeof/syntax.js new file mode 100644 index 0000000000..1482ec3a84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/syntax.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "typeof" and UnaryExpression are + allowed +es5id: 11.4.3_A1 +es6id: 12.5.6.1 +description: Checking by using eval +---*/ + +assert.sameValue( + eval("var x = 0; typeof\u0009x"), + "number", + '#1: var x = 0; typeof\\u0009x; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u000Bx"), + "number", + '#2: var x = 0; typeof\\u000Bx; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u000Cx"), + "number", + '#3: var x = 0; typeof\\u000Cx; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u0020x"), + "number", + '#4: var x = 0; typeof\\u0020x; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u00A0x"), + "number", + '#5: var x = 0; typeof\\u00A0x; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u000Ax"), + "number", + '#6: var x = 0; typeof\\u000Ax; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u000Dx"), + "number", + '#7: var x = 0; typeof\\u000Dx; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u2028x"), + "number", + '#8: var x = 0; typeof\\u2028x; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u2029x"), + "number", + '#9: var x = 0; typeof\\u2029x; x === "number".' +); + +assert.sameValue( + eval("var x = 0; typeof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029x"), + "number", + '#10: var x = 0; typeof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029x; x === "number".' +); + +assert.sameValue( + eval("typeof(0)"), + "number", + 'applied with grouping operator enclosing operand' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/undefined.js b/js/src/tests/test262/language/expressions/typeof/undefined.js new file mode 100644 index 0000000000..86455567c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/undefined.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: typeof undefined and void 0 +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + Return a String according to Table 35. + + #table-35 + + Undefined "undefined" +---*/ + +assert.sameValue( + typeof undefined, + "undefined", + 'typeof undefined === "undefined"' +); + +assert.sameValue( + typeof void 0, + "undefined", + 'typeof void 0 === "undefined"' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/typeof/unresolvable-reference.js b/js/src/tests/test262/language/expressions/typeof/unresolvable-reference.js new file mode 100644 index 0000000000..40a7a5c231 --- /dev/null +++ b/js/src/tests/test262/language/expressions/typeof/unresolvable-reference.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-typeof-operator-runtime-semantics-evaluation +description: If IsUnresolvableReference(val) is true, return "undefined". +info: | + The typeof Operator + + Runtime Semantics: Evaluation + + ... + If Type(val) is Reference, then + If IsUnresolvableReference(val) is true, return "undefined". + ... + +---*/ + +assert.sameValue( + typeof x, + "undefined", + "typeof x === 'undefined'" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/11.4.7-4-1.js b/js/src/tests/test262/language/expressions/unary-minus/11.4.7-4-1.js new file mode 100644 index 0000000000..69d85bfd59 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/11.4.7-4-1.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.4.7-4-1 +description: -"" should be zero +---*/ + +assert.sameValue(-"", -0, '-""'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A1.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A1.js new file mode 100644 index 0000000000..a7346c52fa --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "-" and UnaryExpression are + allowed +es5id: 11.4.7_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("-\u00091") !== -1) { + throw new Test262Error('#1: -\\u00091 === -1'); +} + +//CHECK#2 +if (eval("-\u000B1") !== -1) { + throw new Test262Error('#2: -\\u000B1 === -1'); +} + +//CHECK#3 +if (eval("-\u000C1") !== -1) { + throw new Test262Error('#3: -\\u000C1 === -1'); +} + +//CHECK#4 +if (eval("-\u00201") !== -1) { + throw new Test262Error('#4: -\\u0020 === -1'); +} + +//CHECK#5 +if (eval("-\u00A01") !== -1) { + throw new Test262Error('#5: -\\u00A01 === -1'); +} + +//CHECK#6 +if (eval("-\u000A1") !== -1) { + throw new Test262Error('#6: -\\u000A1 === -1'); +} + +//CHECK#7 +if (eval("-\u000D1") !== -1) { + throw new Test262Error('#7: -\\u000D1 === -1'); +} + +//CHECK#8 +if (eval("-\u20281") !== -1) { + throw new Test262Error('#8: -\\u20281 === -1'); +} + +//CHECK#9 +if (eval("-\u20291") !== -1) { + throw new Test262Error('#9: -\\u20291 === -1'); +} + +//CHECK#10 +if (eval("-\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== -1) { + throw new Test262Error('#10: -\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === -1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T1.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T1.js new file mode 100644 index 0000000000..f927f0f48d --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x uses GetValue +es5id: 11.4.7_A2.1_T1 +description: Either Type(x) is not Reference or GetBase(x) is not null +---*/ + +//CHECK#1 +if (-1 !== -1) { + throw new Test262Error('#1: -1 === -1. Actual: ' + (-1)); +} + +//CHECK#2 +if (-(-1) !== 1) { + throw new Test262Error('#2: -(-1) === -1. Actual: ' + (-(-1))); +} + +//CHECK#3 +var x = -1; +if (-x !== 1) { + throw new Test262Error('#3: var x = -1; -x === 1. Actual: ' + (-x)); +} + +//CHECK#4 +var x = -1; +if (-(-x) !== -1) { + throw new Test262Error('#4: var x = -1; -(-x) === -1. Actual: ' + (-(-x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 1; +if (-object.prop !== -1) { + throw new Test262Error('#5: var object = new Object(); object.prop = -1; -object.prop === -1. Actual: ' + (-object.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T2.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T2.js new file mode 100644 index 0000000000..c9d49abfc4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x uses GetValue +es5id: 11.4.7_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + -x; + throw new Test262Error('#1.1: -x throw ReferenceError. Actual: ' + (-x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: -x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.2_T1.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.2_T1.js new file mode 100644 index 0000000000..5eec8aaa18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A2.2_T1.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x uses [[Default Value]] +es5id: 11.4.7_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +var object = {valueOf: function() {return -1}}; +if (-object !== 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#2 +var object = {valueOf: function() {return -1}, toString: function() {return 0}}; +if (-object !== 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return -1}, toString: function() {return 0}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#3 +var object = {valueOf: function() {return -1}, toString: function() {return {}}}; +if (-object !== 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return -1}, toString: function() {return {}}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; + if (-object !== 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object === 1. Actual: ' + (-object)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return -1}}; +if (-object !== 1) { + throw new Test262Error('#5.1: var object = {toString: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return -1}} +if (-object !== 1) { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return -1}}; -object === 1. Actual: ' + (-object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; + -object; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (-object)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + -object; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (-object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T1.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T1.js new file mode 100644 index 0000000000..80e3f16129 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x returns -ToNumber(x) +es5id: 11.4.7_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +if (-false !== 0) { + throw new Test262Error('#1: -false === 0. Actual: ' + (-false)); +} + +//CHECK#2 +if (-new Boolean(true) !== -1) { + throw new Test262Error('#2: -new Boolean(true) === -1. Actual: ' + (-new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T2.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T2.js new file mode 100644 index 0000000000..10e3a726c7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x returns -ToNumber(x) +es5id: 11.4.7_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +if (-(1) !== -1) { + throw new Test262Error('#1: -(1) === -1. Actual: ' + (-(1))); +} + +//CHECK#2 +if (-new Number(-1) !== 1) { + throw new Test262Error('#2: -new Number(-1) === 1. Actual: ' + (-new Number(-1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T3.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T3.js new file mode 100644 index 0000000000..09976f23f5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x returns -ToNumber(x) +es5id: 11.4.7_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +if (-"1" !== -1) { + throw new Test262Error('#1: -"1" === -1. Actual: ' + (-"1")); +} + +//CHECK#2 +if (isNaN(-"x") !== true) { + throw new Test262Error('#2: -"x" === Not-a-Number. Actual: ' + (-"x")); +} + +//CHECK#3 +if (-new String("-1") !== 1) { + throw new Test262Error('#3: -new String("-1") === 1. Actual: ' + (-new String("-1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T4.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T4.js new file mode 100644 index 0000000000..f5906dd2a0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x returns -ToNumber(x) +es5id: 11.4.7_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +if (isNaN(-void 0) !== true) { + throw new Test262Error('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0)); +} + +//CHECK#2 +if (-null !== 0) { + throw new Test262Error('#2: +null === 0. Actual: ' + (+null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T5.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T5.js new file mode 100644 index 0000000000..c126479917 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A3_T5.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator -x returns -ToNumber(x) +es5id: 11.4.7_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +if (isNaN(-{}) !== true) { + throw new Test262Error('#1: -{} === Not-a-Number. Actual: ' + (-{})); +} + +//CHECK#2 +if (isNaN(-function(){return 1}) !== true) { + throw new Test262Error('#2: -function(){return 1} === Not-a-Number. Actual: ' + (-function(){return 1})); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.1.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.1.js new file mode 100644 index 0000000000..7a40185964 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If x is NaN, operator -x returns NaN +es5id: 11.4.7_A4.1 +description: Checking NaN +---*/ + +//CHECK#1 +if (isNaN(-NaN) !== true) { + throw new Test262Error('#1: -NaN === Not-a-Number. Actual: ' + (-NaN)); +} + +//CHECK#2 +var x = NaN; +if (isNaN(-x) != true) { + throw new Test262Error('#2: var x = NaN; -x === Not-a-Number. Actual: ' + (-x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.2.js b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.2.js new file mode 100644 index 0000000000..de82489eb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/S11.4.7_A4.2.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Negating +0 produces -0, negating -0 produces +0 +es5id: 11.4.7_A4.2 +description: Checking Infinity +---*/ + +//CHECK#1 +var x = 0; +x = -x; +if (x !== -0) { + throw new Test262Error('#1.1: var x = 0; x = -x; x === 0. Actual: ' + (x)); +} else { + if (1/x !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#1.2: var x = 0; x = -x; x === - 0. Actual: +0'); + } +} + +//CHECK#2 +var x = -0; +x = -x; +if (x !== 0) { + throw new Test262Error('#2.1: var x = -0; x = -x; x === 0. Actual: ' + (x)); +} else { + if (1/x !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: var x = -0; x = -x; x === + 0. Actual: -0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/unary-minus/bigint-non-primitive.js new file mode 100644 index 0000000000..31920ce3dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/bigint-non-primitive.js @@ -0,0 +1,54 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Unary minus for BigInt object wrappers +esid: sec-unary-minus-operator-runtime-semantics-evaluation +info: | + Runtime Semantics: Evaluation + UnaryExpression : - UnaryExpression + + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ? ToNumeric(? GetValue(expr)). + 3. Let T be Type(oldValue). + 4. Return ? T::unaryMinus(oldValue). + +features: [BigInt, Symbol.toPrimitive] +---*/ +assert.sameValue(-Object(1n), -1n, 'The value of -Object(1n) is -1n'); +assert.notSameValue(-Object(1n), 1n, 'The value of -Object(1n) is not 1n'); +assert.notSameValue(-Object(1n), Object(-1n), 'The value of -Object(1n) is not Object(-1n)'); +assert.sameValue(-Object(-1n), 1n, 'The value of -Object(-1n) is 1n'); +assert.notSameValue(-Object(-1n), -1n, 'The value of -Object(-1n) is not -1n'); +assert.notSameValue(-Object(-1n), Object(1n), 'The value of -Object(-1n) is not Object(1n)'); + +assert.sameValue(-{ + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: function() { + throw new Test262Error(); + }, + + toString: function() { + throw new Test262Error(); + } +}, -1n, 'The value of -{[Symbol.toPrimitive]: function() {return 1n;}, valueOf: function() {throw new Test262Error();}, toString: function() {throw new Test262Error();}} is -1n'); + +assert.sameValue(-{ + valueOf: function() { + return 1n; + }, + + toString: function() { + throw new Test262Error(); + } +}, -1n, 'The value of -{valueOf: function() {return 1n;}, toString: function() {throw new Test262Error();}} is -1n'); + +assert.sameValue(-{ + toString: function() { + return 1n; + } +}, -1n, 'The value of -{toString: function() {return 1n;}} is -1n'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/bigint.js b/js/src/tests/test262/language/expressions/unary-minus/bigint.js new file mode 100644 index 0000000000..727f6d5ed1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-minus/bigint.js @@ -0,0 +1,36 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Unary minus for BigInt values +esid: sec-numeric-types-bigint-unaryMinus +info: | + BigInt::unaryMinus (x) + + The abstract operation BigInt::unaryMinus with an argument x of BigInt type returns the result of negating x. + + Note: There is only one 0n value; -0n is the same as 0n. + +features: [BigInt] +---*/ + +assert.sameValue(-0n, 0n, "-0n === 0n"); +assert.sameValue(-(0n), 0n, "-(0n) === 0n"); +assert.notSameValue(-1n, 1n, "-1n !== 1n"); +assert.sameValue(-(1n), -1n, "-(1n) === -1n"); +assert.notSameValue(-(1n), 1n, "-(1n) !== 1n"); +assert.sameValue(-(-1n), 1n, "-(-1n) === 1n"); +assert.notSameValue(-(-1n), -1n, "-(-1n) !== -1n"); +assert.sameValue(- - 1n, 1n, "- - 1n === 1n"); +assert.notSameValue(- - 1n, -1n, "- - 1n !== -1n"); +assert.sameValue( + -(0x1fffffffffffff01n), -0x1fffffffffffff01n, + "-(0x1fffffffffffff01n) === -0x1fffffffffffff01n"); +assert.notSameValue( + -(0x1fffffffffffff01n), 0x1fffffffffffff01n, + "-(0x1fffffffffffff01n) !== 0x1fffffffffffff01n"); +assert.notSameValue( + -(0x1fffffffffffff01n), -0x1fffffffffffff00n, + "-(0x1fffffffffffff01n) !== -0x1fffffffffffff00n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-minus/browser.js b/js/src/tests/test262/language/expressions/unary-minus/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/unary-minus/shell.js b/js/src/tests/test262/language/expressions/unary-minus/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js b/js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js new file mode 100644 index 0000000000..ccc933af23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js @@ -0,0 +1,11 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +es5id: 11.4.6-2-1 +description: +"" should be zero +---*/ + +assert.sameValue(+"", 0, '+""'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A1.js new file mode 100644 index 0000000000..b5d7e718d5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "+" and UnaryExpression are + allowed +es5id: 11.4.6_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("+\u00091") !== 1) { + throw new Test262Error('#1: +\\u00091 === 1'); +} + +//CHECK#2 +if (eval("+\u000B1") !== 1) { + throw new Test262Error('#2: +\\u000B1 === 1'); +} + +//CHECK#3 +if (eval("+\u000C1") !== 1) { + throw new Test262Error('#3: +\\u000C1 === 1'); +} + +//CHECK#4 +if (eval("+\u00201") !== 1) { + throw new Test262Error('#4: +\\u0020 === 1'); +} + +//CHECK#5 +if (eval("+\u00A01") !== 1) { + throw new Test262Error('#5: +\\u00A01 === 1'); +} + +//CHECK#6 +if (eval("+\u000A1") !== 1) { + throw new Test262Error('#6: +\\u000A1 === 1'); +} + +//CHECK#7 +if (eval("+\u000D1") !== 1) { + throw new Test262Error('#7: +\\u000D1 === 1'); +} + +//CHECK#8 +if (eval("+\u20281") !== 1) { + throw new Test262Error('#8: +\\u20281 === 1'); +} + +//CHECK#9 +if (eval("+\u20291") !== 1) { + throw new Test262Error('#9: +\\u20291 === 1'); +} + +//CHECK#10 +if (eval("+\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) { + throw new Test262Error('#10: +\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T1.js new file mode 100644 index 0000000000..662355b2fe --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T1.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x uses GetValue +es5id: 11.4.6_A2.1_T1 +description: Either Type(x) is not Reference or GetBase(x) is not null +---*/ + +//CHECK#1 +if (+1 !== 1) { + throw new Test262Error('#1: +1 === 1. Actual: ' + (+1)); +} + +//CHECK#2 +if (+(+1) !== 1) { + throw new Test262Error('#2: +(+1) === -1. Actual: ' + (+(+1))); +} + +//CHECK#3 +var x = 1; +if (+x !== 1) { + throw new Test262Error('#3: var x = +1; -x === 1. Actual: ' + (-x)); +} + +//CHECK#4 +var x = 1; +if (+(+x) !== 1) { + throw new Test262Error('#4: var x = 1; +(+x) === 1. Actual: ' + (+(+x))); +} + +//CHECK#5 +var object = new Object(); +object.prop = 1; +if (+object.prop !== 1) { + throw new Test262Error('#5: var object = new Object(); object.prop = 1; +object.prop === 1. Actual: ' + (+object.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T2.js new file mode 100644 index 0000000000..00b3a7cef8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x uses GetValue +es5id: 11.4.6_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + +x; + throw new Test262Error('#1.1: +x throw ReferenceError. Actual: ' + (+x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: +x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.2_T1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.2_T1.js new file mode 100644 index 0000000000..d1f389d5eb --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.2_T1.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x uses [[Default Value]] +es5id: 11.4.6_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (+object !== 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (+object !== 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (+object !== 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if (+object !== 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object === 1. Actual: ' + (+object)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (+object !== 1) { + throw new Test262Error('#5: var object = {toString: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (+object !== 1) { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; +object === 1. Actual: ' + (+object)); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + +object; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +object throw "error". Actual: ' + (+object)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + +object; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (+object)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T1.js new file mode 100644 index 0000000000..247956659f --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x returns ToNumber(x) +es5id: 11.4.6_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +if (+false !== 0) { + throw new Test262Error('#1: +false === 0. Actual: ' + (+false)); +} + +//CHECK#2 +if (+new Boolean(true) !== 1) { + throw new Test262Error('#2: +new Boolean(true) === 1. Actual: ' + (+new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T2.js new file mode 100644 index 0000000000..4bdd74e78e --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x returns ToNumber(x) +es5id: 11.4.6_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +if (+0.1 !== 0.1) { + throw new Test262Error('#1: +0.1 === 0.1. Actual: ' + (+0.1)); +} + +//CHECK#2 +if (+new Number(-1.1) !== -1.1) { + throw new Test262Error('#2: +new Number(-1.1) === -1.1. Actual: ' + (+new Number(-1.1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T3.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T3.js new file mode 100644 index 0000000000..906bb290ea --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T3.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x returns ToNumber(x) +es5id: 11.4.6_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +if (+"1" !== 1) { + throw new Test262Error('#1: +"1" === 1. Actual: ' + (+"1")); +} + +//CHECK#2 +if (+new Number("-1") !== -1) { + throw new Test262Error('#2: +new String("-1") === -1. Actual: ' + (+new String("-1"))); +} + +//CHECK#3 +if (isNaN(+"x") !== true) { + throw new Test262Error('#3: +"x" === Not-a-Number. Actual: ' + (+"x")); +} + +//CHECK#4 +if (isNaN(+"INFINITY") !== true) { + throw new Test262Error('#4: +"INFINITY" === Not-a-Number. Actual: ' + (+"INFINITY")); +} + +//CHECK#5 +if (isNaN(+"infinity") !== true) { + throw new Test262Error('#5: +"infinity" === Not-a-Number. Actual: ' + (+"infinity")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T4.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T4.js new file mode 100644 index 0000000000..67b34ef740 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T4.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x returns ToNumber(x) +es5id: 11.4.6_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +if (isNaN(+void 0) !== true) { + throw new Test262Error('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0)); +} + +//CHECK#2 +if (+null !== 0) { + throw new Test262Error('#2: +null === 0. Actual: ' + (+null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T5.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T5.js new file mode 100644 index 0000000000..6d4a9e75c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T5.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator +x returns ToNumber(x) +es5id: 11.4.6_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +if (isNaN(+{}) !== true) { + throw new Test262Error('#1: +{} === Not-a-Number. Actual: ' + (+{})); +} + +//CHECK#2 +if (isNaN(+function(){return 1}) !== true) { + throw new Test262Error('#2: +function(){return 1} === Not-a-Number. Actual: ' + (+function(){return 1})); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_T2.js new file mode 100644 index 0000000000..b0e827c741 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of number conversion from undefined value is NaN +es5id: 9.3_A1_T2 +description: Undefined convert to Number by implicit transformation +---*/ + +// CHECK#1 +if (isNaN(+(undefined)) !== true) { + throw new Test262Error('#1: +(undefined) === Not-a-Number. Actual: ' + (+(undefined))); +} + +// CHECK#2 +if (isNaN(+(void 0)) !== true) { + throw new Test262Error('#2: +(void 0) === Not-a-Number. Actual: ' + (+(void 0))); +} + +// CHECK#3 +if (isNaN(+(eval("var x"))) !== true) { + throw new Test262Error('#3: +(eval("var x")) === Not-a-Number. Actual: ' + (+(eval("var x")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js new file mode 100644 index 0000000000..7f0f29a1d1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of number conversion from null value is +0 +es5id: 9.3_A2_T2 +description: null convert to Number by implicit transformation +---*/ + +// CHECK #1 +if (+(null) !== 0) { + throw new Test262Error('#1.1: +(null) === 0. Actual: ' + (+(null))); +} else { + if (1/+(null) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: +(null) === +0. Actual: -0'); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.js new file mode 100644 index 0000000000..6503a0e1c2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of number conversion from boolean value is 1 if the argument is + true, else is +0 +es5id: 9.3_A3_T2 +description: False and true convert to Number by implicit transformation +---*/ + +// CHECK#1 +if (+(false) !== +0) { + throw new Test262Error('#1.1: +(false) === 0. Actual: ' + (+(false))); +} else { + if (1/+(false) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: +(false) === +0. Actual: -0'); + } +} + +// CHECK#2 +if (+(true) !== 1) { + throw new Test262Error('#2: +(true) === 1. Actual: ' + (+(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.js new file mode 100644 index 0000000000..a41798df50 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of number conversion from number value equals to the input + argument (no conversion) +es5id: 9.3_A4.1_T2 +description: > + Some numbers including Number.MAX_VALUE and Number.MIN_VALUE are + converted to Number with implicit transformation +---*/ + +// CHECK#1 +if (+(13) !== 13) { + throw new Test262Error('#1: +(13) === 13. Actual: ' + (+(13))); +} + +// CHECK#2 +if (+(-13) !== -13) { + throw new Test262Error('#2: +(-13) === -13. Actual: ' + (+(-13))); +} + +// CHECK#3 +if (+(1.3) !== 1.3) { + throw new Test262Error('#3: +(1.3) === 1.3. Actual: ' + (+(1.3))); +} + +// CHECK#4 +if (+(-1.3) !== -1.3) { + throw new Test262Error('#4: +(-1.3) === -1.3. Actual: ' + (+(-1.3))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.js new file mode 100644 index 0000000000..312768bc1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of number conversion from number value equals to the input + argument (no conversion) +es5id: 9.3_A4.2_T2 +description: > + Number.NaN, +0, -0, Number.POSITIVE_INFINITY, + Number.NEGATIVE_INFINITY, Number.MAX_VALUE and Number.MIN_VALUE + convert to Number by implicit transformation +---*/ + +// CHECK#1 +if (isNaN(+(Number.NaN)) !== true) { + throw new Test262Error('#1: +(NaN) === Not-a-Number. Actual: ' + (+(NaN))); +} + +// CHECK#2 +if (+(+0) !== +0) { + throw new Test262Error('#2.1: +(+0) === 0. Actual: ' + (+(+0))); +} else { + if (1/+(+0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: +(+0) === +0. Actual: -0'); + } +} + +// CHECK#3 +if (+(-0) !== -0) { + throw new Test262Error('#3.1: +(-0) === 0. Actual: ' + (+(-0))); +} else { + if (1/+(-0) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#3.2: +(-0) === -0. Actual: +0'); + } +} + +// CHECK#4 +if (+(Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#4: +(+Infinity) === +Infinity. Actual: ' + (+(+Infinity))); +} + +// CHECK#5 +if (+(Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) { + throw new Test262Error('#5: +(-Infinity) === -Infinity. Actual: ' + (+(-Infinity))); +} + +// CHECK#6 +if (+(Number.MAX_VALUE) !== Number.MAX_VALUE) { + throw new Test262Error('#6: +(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (+(Number.MAX_VALUE))); +} + +// CHECK#7 +if (+(Number.MIN_VALUE) !== Number.MIN_VALUE) { + throw new Test262Error('#7: +(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (+(Number.MIN_VALUE))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js new file mode 100644 index 0000000000..f102ab3e7b --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js @@ -0,0 +1,129 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of number conversion from object value is the result + of conversion from primitive value +es5id: 9.3_A5_T2 +description: > + new Number(), new Number(0), new Number(Number.NaN), new + Number(null), new Number(void 0) and others convert to Number by + implicit transformation +---*/ + +// CHECK#1 +if (+(new Number()) !== 0) { + throw new Test262Error('#1: +(new Number()) === 0. Actual: ' + (+(new Number()))); +} + +// CHECK#2 +if (+(new Number(0)) !== 0) { + throw new Test262Error('#2: +(new Number(0)) === 0. Actual: ' + (+(new Number(0)))); +} + +// CHECK#3 +if (isNaN(+(new Number(Number.NaN)) !== true)) { + throw new Test262Error('#3: +(new Number(Number.NaN)) === Not-a-Number. Actual: ' + (+(new Number(Number.NaN)))); +} + +// CHECK#4 +if (+(new Number(null)) !== 0) { + throw new Test262Error('#4.1: +(new Number(null)) === 0. Actual: ' + (+(new Number(null)))); +} else { + if (1/+(new Number(null)) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#4.2: +(new Number(null)) === +0. Actual: -0'); + } +} + +// CHECK#5 +if (isNaN(+(new Number(void 0)) !== true)) { + throw new Test262Error('#5: +(new Number(void 0)) === Not-a-Number. Actual: ' + (+(new Number(void 0)))); +} + +// CHECK#6 +if (+(new Number(true)) !== 1) { + throw new Test262Error('#6: +(new Number(true)) === 1. Actual: ' + (+(new Number(true)))); +} + +// CHECK#7 +if (+(new Number(false)) !== +0) { + throw new Test262Error('#7.1: +(new Number(false)) === 0. Actual: ' + (+(new Number(false)))); +} else { + if (1/+(new Number(false)) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#7.2: +(new Number(false)) === +0. Actual: -0'); + } +} + +// CHECK#8 +if (+(new Boolean(true)) !== 1) { + throw new Test262Error('#8: +(new Boolean(true)) === 1. Actual: ' + (+(new Boolean(true)))); +} + +// CHECK#9 +if (+(new Boolean(false)) !== +0) { + throw new Test262Error('#9.1: +(new Boolean(false)) === 0. Actual: ' + (+(new Boolean(false)))); +} else { + if (1/+(new Boolean(false)) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#9.2: +(new Boolean(false)) === +0. Actual: -0'); + } +} + +// CHECK#10 +if (isNaN(+(new Array(2,4,8,16,32))) !== true) { + throw new Test262Error('#10: +(new Array(2,4,8,16,32)) === Not-a-Number. Actual: ' + (+(new Array(2,4,8,16,32)))); +} + +// CHECK#11 +var myobj1 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";}, + valueOf : function(){return "[object MyObj]";} + }; + +if (isNaN(+(myobj1)) !== true){ + throw new Test262Error("#11: +(myobj1) calls ToPrimitive with hint +. Exptected: Not-a-Number. Actual: " + (+(myobj1))); +} + +// CHECK#12 +var myobj2 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";}, + valueOf : function(){return "9876543210";} + }; + +if (+(myobj2) !== 9876543210){ + throw new Test262Error("#12: +(myobj2) calls ToPrimitive with hint +. Exptected: 9876543210. Actual: " + (+(myobj2))); +} + + +// CHECK#13 +var myobj3 = { + ToNumber : function(){return 12345;}, + toString : function(){return "[object MyObj]";} + }; + +if (isNaN(+(myobj3)) !== true){ + throw new Test262Error("#13: +(myobj3) calls ToPrimitive with hint +. Exptected: Not-a-Number. Actual: " + (+(myobj3))); +} + +// CHECK#14 +var myobj4 = { + ToNumber : function(){return 12345;}, + toString : function(){return "67890";} + }; + +if (+(myobj4) !== 67890){ + throw new Test262Error("#14: +(myobj4) calls ToPrimitive with hint +. Exptected: 67890. Actual: " + (+(myobj4))); +} + +// CHECK#15 +var myobj5 = { + ToNumber : function(){return 12345;} + }; + +if (isNaN(+(myobj5)) !== true){ + throw new Test262Error("#15: +(myobj5) calls ToPrimitive with hint +. Exptected: 12345. Actual: " + (+(myobj5))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js b/js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js new file mode 100644 index 0000000000..a7587706d8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js @@ -0,0 +1,33 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: The Unary + Operator throws a TypeError on BigInt numbers +esid: sec-unary-plus-operator-runtime-semantics-evaluation +info: | + UnaryExpression: + UnaryExpression + + 1. Let expr be the result of evaluating UnaryExpression. + 2. Return ? ToNumber(? GetValue(expr)). + + ToNumber ( argument ) + + BigInt: Throw a TypeError exception +features: [BigInt] +---*/ +assert.throws(TypeError, function() { + +0n; +}, '+0n throws TypeError'); + +assert.throws(TypeError, function() { + +1n; +}, '+1n throws TypeError'); + +assert.throws(TypeError, function() { + +-1n; +}, '+-1n throws TypeError'); + +assert.throws(TypeError, function() { + +1000000000000000n; +}, '+1000000000000000n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unary-plus/browser.js b/js/src/tests/test262/language/expressions/unary-plus/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/unary-plus/shell.js b/js/src/tests/test262/language/expressions/unary-plus/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A1.js new file mode 100644 index 0000000000..a818534041 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between ShiftExpression and ">>>" or + between ">>>" and AdditiveExpression are allowed +es5id: 11.7.3_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("-4\u0009>>>\u00091") !== 2147483646) { + throw new Test262Error('#1: -4\\u0009>>>\\u00091 === 2147483646'); +} + +//CHECK#2 +if (eval("-4\u000B>>>\u000B1") !== 2147483646) { + throw new Test262Error('#2: -4\\u000B>>>\\u000B1 === 2147483646'); +} + +//CHECK#3 +if (eval("-4\u000C>>>\u000C1") !== 2147483646) { + throw new Test262Error('#3: -4\\u000C>>>\\u000C1 === 2147483646'); +} + +//CHECK#4 +if (eval("-4\u0020>>>\u00201") !== 2147483646) { + throw new Test262Error('#4: -4\\u0020>>>\\u00201 === 2147483646'); +} + +//CHECK#5 +if (eval("-4\u00A0>>>\u00A01") !== 2147483646) { + throw new Test262Error('#5: -4\\u00A0>>>\\u00A01 === 2147483646'); +} + +//CHECK#6 +if (eval("-4\u000A>>>\u000A1") !== 2147483646) { + throw new Test262Error('#6: -4\\u000A>>>\\u000A1 === 2147483646'); +} + +//CHECK#7 +if (eval("-4\u000D>>>\u000D1") !== 2147483646) { + throw new Test262Error('#7: -4\\u000D>>>\\u000D1 === 2147483646'); +} + +//CHECK#8 +if (eval("-4\u2028>>>\u20281") !== 2147483646) { + throw new Test262Error('#8: -4\\u2028>>>\\u20281 === 2147483646'); +} + +//CHECK#9 +if (eval("-4\u2029>>>\u20291") !== 2147483646) { + throw new Test262Error('#9: -4\\u2029>>>\\u20291 === 2147483646'); +} + +//CHECK#10 +if (eval("-4\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029>>>\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 2147483646) { + throw new Test262Error('#10: -4\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029>>>\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 2147483646'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T1.js new file mode 100644 index 0000000000..5d5ba73e51 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T1.js @@ -0,0 +1,43 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y uses GetValue +es5id: 11.7.3_A2.1_T1 +description: Either Type is not Reference or GetBase is not null +---*/ + +//CHECK#1 +if (-4 >>> 1 !== 2147483646) { + throw new Test262Error('#1: -4 >>> 1 === 2147483646. Actual: ' + (-4 >>> 1)); +} + +//CHECK#2 +var x = -4; +if (x >>> 1 !== 2147483646) { + throw new Test262Error('#2: var x = -4; x >>> 1 === 2147483646. Actual: ' + (x >>> 1)); +} + +//CHECK#3 +var y = 1; +if (-4 >>> y !== 2147483646) { + throw new Test262Error('#3: var y = 1; -4 >>> y === 2147483646. Actual: ' + (-4 >>> y)); +} + +//CHECK#4 +var x = -4; +var y = 1; +if (x >>> y !== 2147483646) { + throw new Test262Error('#4: var x = -4; var y = 1; x >>> y === 2147483646. Actual: ' + (x >>> y)); +} + +//CHECK#5 +var objectx = new Object(); +var objecty = new Object(); +objectx.prop = -4; +objecty.prop = 1; +if (objectx.prop >>> objecty.prop !== 2147483646) { + throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = -4; objecty.prop = 1; objectx.prop >>> objecty.prop === 2147483646. Actual: ' + (objectx.prop >>> objecty.prop)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T2.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T2.js new file mode 100644 index 0000000000..0ca8904ead --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y uses GetValue +es5id: 11.7.3_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + x >>> 1; + throw new Test262Error('#1.1: x >>> 1 throw ReferenceError. Actual: ' + (x >>> 1)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >>> 1 throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T3.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T3.js new file mode 100644 index 0000000000..e1b49da750 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.1_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y uses GetValue +es5id: 11.7.3_A2.1_T3 +description: If GetBase(y) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + 1 >>> y; + throw new Test262Error('#1.1: 1 >>> y throw ReferenceError. Actual: ' + (1 >>> y)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: 1 >>> y throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.2_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.2_T1.js new file mode 100644 index 0000000000..705d79fb93 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.2_T1.js @@ -0,0 +1,71 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y uses [[Default Value]] +es5id: 11.7.3_A2.2_T1 +description: If Type(value) is Object, evaluate ToPrimitive(value, Number) +---*/ + +//CHECK#1 +if ({valueOf: function() {return -4}} >>> 1 !== 2147483646) { + throw new Test262Error('#1: {valueOf: function() {return -4}} >>> 1 === 2147483646. Actual: ' + ({valueOf: function() {return -4}} >>> 1)); +} + +//CHECK#2 +if ({valueOf: function() {return -4}, toString: function() {return 0}} >>> 1 !== 2147483646) { + throw new Test262Error('#2: {valueOf: function() {return -4}, toString: function() {return 0}} >>> 1 === 2147483646. Actual: ' + ({valueOf: function() {return -4}, toString: function() {return 0}} >>> 1)); +} + +//CHECK#3 +if ({valueOf: function() {return -4}, toString: function() {return {}}} >>> 1 !== 2147483646) { + throw new Test262Error('#3: {valueOf: function() {return -4}, toString: function() {return {}}} >>> 1 === 2147483646. Actual: ' + ({valueOf: function() {return -4}, toString: function() {return {}}} >>> 1)); +} + +//CHECK#4 +try { + if ({valueOf: function() {return -4}, toString: function() {throw "error"}} >>> 1 !== 2147483646) { + throw new Test262Error('#4.1: {valueOf: function() {return -4}, toString: function() {throw "error"}} >>> 1 === 2147483646. Actual: ' + ({valueOf: function() {return -4}, toString: function() {throw "error"}} >>> 1)); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: {valueOf: function() {return -4}, toString: function() {throw "error"}} >>> 1 not throw "error"'); + } else { + throw new Test262Error('#4.3: {valueOf: function() {return -4}, toString: function() {throw "error"}} >>> 1 not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +if (-4 >>> {toString: function() {return 1}} !== 2147483646) { + throw new Test262Error('#5: -4 >>> {toString: function() {return 1}} === 2147483646. Actual: ' + (-4 >>> {toString: function() {return 1}})); +} + +//CHECK#6 +if (-4 >>> {valueOf: function() {return {}}, toString: function() {return 1}} !== 2147483646) { + throw new Test262Error('#6: -4 >>> {valueOf: function() {return {}}, toString: function() {return 1}} === 2147483646. Actual: ' + (-4 >>> {valueOf: function() {return {}}, toString: function() {return 1}})); +} + +//CHECK#7 +try { + -4 >>> {valueOf: function() {throw "error"}, toString: function() {return 1}}; + throw new Test262Error('#7.1: -4 >>> {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (-4 >>> {valueOf: function() {throw "error"}, toString: function() {return 1}})); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: -4 >>> {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + -4 >>> {valueOf: function() {return {}}, toString: function() {return {}}}; + throw new Test262Error('#8.1: -4 >>> {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: -4 >>> {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.3_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.3_T1.js new file mode 100644 index 0000000000..e0abb01b5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.3_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + ToNumber(first expression) is called first, and then ToNumber(second + expression) +es5id: 11.7.3_A2.3_T1 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = { valueOf: function () { throw "x"; } }; +var y = { valueOf: function () { throw "y"; } }; +try { + x >>> y; + throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x >>> y throw "x". Actual: ' + (x >>> y)); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x >>> y throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T1.js new file mode 100644 index 0000000000..094d57aade --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.3_A2.4_T1 +description: Checking with "=" +---*/ + +//CHECK#1 +var x = 0; +if ((x = 1) >>> x !== 0) { + throw new Test262Error('#1: var x = 0; (x = 1) >>> x === 0. Actual: ' + ((x = 1) >>> x)); +} + +//CHECK#2 +var x = -4; +if (x >>> (x = 1) !== 2147483646) { + throw new Test262Error('#2: var x = -4; x >>> (x = 1) === 2147483646. Actual: ' + (x >>> (x = 1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T2.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T2.js new file mode 100644 index 0000000000..56102ddce3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T2.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.3_A2.4_T2 +description: Checking with "throw" +---*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() >>> y(); + throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() >>> y() throw "x". Actual: ' + (x() >>> y())); +} catch (e) { + if (e === "y") { + throw new Test262Error('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() >>> y() throw "x". Actual: ' + (e)); + } + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T3.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T3.js new file mode 100644 index 0000000000..d8b53f50cb --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T3.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.3_A2.4_T3 +description: Checking with undeclarated variables +---*/ + +//CHECK#1 +try { + x >>> (x = 1); + throw new Test262Error('#1.1: x >>> (x = 1) throw ReferenceError. Actual: ' + (x >>> (x = 1))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + throw new Test262Error('#1.2: x >>> (x = 1) throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T4.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T4.js new file mode 100644 index 0000000000..98adaebae8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A2.4_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: First expression is evaluated first, and then second expression +es5id: 11.7.3_A2.4_T4 +description: Checking with undeclarated variables +flags: [noStrict] +---*/ + +//CHECK#1 +if ((y = 1) >>> y !== 0) { + throw new Test262Error('#1: (y = 1) >>> y === 0. Actual: ' + ((y = 1) >>> y)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.1.js new file mode 100644 index 0000000000..5ec65ee79f --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T1.1 +description: > + Type(x) and Type(y) vary between primitive boolean and Boolean + object +---*/ + +//CHECK#1 +if (true >>> true !== 0) { + throw new Test262Error('#1: true >>> true === 0. Actual: ' + (true >>> true)); +} + +//CHECK#2 +if (new Boolean(true) >>> true !== 0) { + throw new Test262Error('#2: new Boolean(true) >>> true === 0. Actual: ' + (new Boolean(true) >>> true)); +} + +//CHECK#3 +if (true >>> new Boolean(true) !== 0) { + throw new Test262Error('#3: true >>> new Boolean(true) === 0. Actual: ' + (true >>> new Boolean(true))); +} + +//CHECK#4 +if (new Boolean(true) >>> new Boolean(true) !== 0) { + throw new Test262Error('#4: new Boolean(true) >>> new Boolean(true) === 0. Actual: ' + (new Boolean(true) >>> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.2.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.2.js new file mode 100644 index 0000000000..226511bfad --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.2.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T1.2 +description: Type(x) and Type(y) vary between primitive number and Number object +---*/ + +//CHECK#1 +if (1 >>> 1 !== 0) { + throw new Test262Error('#1: 1 >>> 1 === 0. Actual: ' + (1 >>> 1)); +} + +//CHECK#2 +if (new Number(1) >>> 1 !== 0) { + throw new Test262Error('#2: new Number(1) >>> 1 === 0. Actual: ' + (new Number(1) >>> 1)); +} + +//CHECK#3 +if (1 >>> new Number(1) !== 0) { + throw new Test262Error('#3: 1 >>> new Number(1) === 0. Actual: ' + (1 >>> new Number(1))); +} + +//CHECK#4 +if (new Number(1) >>> new Number(1) !== 0) { + throw new Test262Error('#4: new Number(1) >>> new Number(1) === 0. Actual: ' + (new Number(1) >>> new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.3.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.3.js new file mode 100644 index 0000000000..0d3d042844 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.3.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T1.3 +description: Type(x) and Type(y) vary between primitive string and String object +---*/ + +//CHECK#1 +if ("1" >>> "1" !== 0) { + throw new Test262Error('#1: "1" >>> "1" === 0. Actual: ' + ("1" >>> "1")); +} + +//CHECK#2 +if (new String("1") >>> "1" !== 0) { + throw new Test262Error('#2: new String("1") >>> "1" === 0. Actual: ' + (new String("1") >>> "1")); +} + +//CHECK#3 +if ("1" >>> new String("1") !== 0) { + throw new Test262Error('#3: "1" >>> new String("1") === 0. Actual: ' + ("1" >>> new String("1"))); +} + +//CHECK#4 +if (new String("1") >>> new String("1") !== 0) { + throw new Test262Error('#4: new String("1") >>> new String("1") === 0. Actual: ' + (new String("1") >>> new String("1"))); +} + +//CHECK#5 +if ("x" >>> "1" !== 0) { + throw new Test262Error('#5: "x" >>> "1" === 0. Actual: ' + ("x" >>> "1")); +} + +//CHECK#6 +if ("1" >>> "x" !== 1) { + throw new Test262Error('#6: "1" >>> "x" === 1. Actual: ' + ("1" >>> "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.4.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.4.js new file mode 100644 index 0000000000..1416f3158d --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.4.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T1.4 +description: Type(x) and Type(y) vary between Null and Undefined +---*/ + +//CHECK#1 +if (null >>> undefined !== 0) { + throw new Test262Error('#1: null >>> undefined === 0. Actual: ' + (null >>> undefined)); +} + +//CHECK#2 +if (undefined >>> null !== 0) { + throw new Test262Error('#2: undefined >>> null === 0. Actual: ' + (undefined >>> null)); +} + +//CHECK#3 +if (undefined >>> undefined !== 0) { + throw new Test262Error('#3: undefined >>> undefined === 0. Actual: ' + (undefined >>> undefined)); +} + +//CHECK#4 +if (null >>> null !== 0) { + throw new Test262Error('#4: null >>> null === 0. Actual: ' + (null >>> null)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.5.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.5.js new file mode 100644 index 0000000000..fbde91e56c --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T1.5.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T1.5 +description: Type(x) and Type(y) vary between Object object and Function object +---*/ + +//CHECK#1 +if (({} >>> function(){return 1}) !== 0) { + throw new Test262Error('#1: ({} >>> function(){return 1}) === 0. Actual: ' + (({} >>> function(){return 1}))); +} + +//CHECK#2 +if ((function(){return 1} >>> {}) !== 0) { + throw new Test262Error('#2: (function(){return 1} >>> {}) === 0. Actual: ' + ((function(){return 1} >>> {}))); +} + +//CHECK#3 +if ((function(){return 1} >>> function(){return 1}) !== 0) { + throw new Test262Error('#3: (function(){return 1} >>> function(){return 1}) === 0. Actual: ' + ((function(){return 1} >>> function(){return 1}))); +} + +//CHECK#4 +if (({} >>> {}) !== 0) { + throw new Test262Error('#4: ({} >>> {}) === 0. Actual: ' + (({} >>> {}))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.1.js new file mode 100644 index 0000000000..13824f129f --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.1 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true >>> 1 !== 0) { + throw new Test262Error('#1: true >>> 1 === 0. Actual: ' + (true >>> 1)); +} + +//CHECK#2 +if (1 >>> true !== 0) { + throw new Test262Error('#2: 1 >>> true === 0. Actual: ' + (1 >>> true)); +} + +//CHECK#3 +if (new Boolean(true) >>> 1 !== 0) { + throw new Test262Error('#3: new Boolean(true) >>> 1 === 0. Actual: ' + (new Boolean(true) >>> 1)); +} + +//CHECK#4 +if (1 >>> new Boolean(true) !== 0) { + throw new Test262Error('#4: 1 >>> new Boolean(true) === 0. Actual: ' + (1 >>> new Boolean(true))); +} + +//CHECK#5 +if (true >>> new Number(1) !== 0) { + throw new Test262Error('#5: true >>> new Number(1) === 0. Actual: ' + (true >>> new Number(1))); +} + +//CHECK#6 +if (new Number(1) >>> true !== 0) { + throw new Test262Error('#6: new Number(1) >>> true === 0. Actual: ' + (new Number(1) >>> true)); +} + +//CHECK#7 +if (new Boolean(true) >>> new Number(1) !== 0) { + throw new Test262Error('#7: new Boolean(true) >>> new Number(1) === 0. Actual: ' + (new Boolean(true) >>> new Number(1))); +} + +//CHECK#8 +if (new Number(1) >>> new Boolean(true) !== 0) { + throw new Test262Error('#8: new Number(1) >>> new Boolean(true) === 0. Actual: ' + (new Number(1) >>> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.2.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.2.js new file mode 100644 index 0000000000..caea1ea3df --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.2.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.2 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and String (primitive and object) +---*/ + +//CHECK#1 +if ("1" >>> 1 !== 0) { + throw new Test262Error('#1: "1" >>> 1 === 0. Actual: ' + ("1" >>> 1)); +} + +//CHECK#2 +if (1 >>> "1" !== 0) { + throw new Test262Error('#2: 1 >>> "1" === 0. Actual: ' + (1 >>> "1")); +} + +//CHECK#3 +if (new String("1") >>> 1 !== 0) { + throw new Test262Error('#3: new String("1") >>> 1 === 0. Actual: ' + (new String("1") >>> 1)); +} + +//CHECK#4 +if (1 >>> new String("1") !== 0) { + throw new Test262Error('#4: 1 >>> new String("1") === 0. Actual: ' + (1 >>> new String("1"))); +} + +//CHECK#5 +if ("1" >>> new Number(1) !== 0) { + throw new Test262Error('#5: "1" >>> new Number(1) === 0. Actual: ' + ("1" >>> new Number(1))); +} + +//CHECK#6 +if (new Number(1) >>> "1" !== 0) { + throw new Test262Error('#6: new Number(1) >>> "1" === 0. Actual: ' + (new Number(1) >>> "1")); +} + +//CHECK#7 +if (new String("1") >>> new Number(1) !== 0) { + throw new Test262Error('#7: new String("1") >>> new Number(1) === 0. Actual: ' + (new String("1") >>> new Number(1))); +} + +//CHECK#8 +if (new Number(1) >>> new String("1") !== 0) { + throw new Test262Error('#8: new Number(1) >>> new String("1") === 0. Actual: ' + (new Number(1) >>> new String("1"))); +} + +//CHECK#9 +if ("x" >>> 1 !== 0) { + throw new Test262Error('#9: "x" >>> 1 === 0. Actual: ' + ("x" >>> 1)); +} + +//CHECK#10 +if (1 >>> "x" !== 1) { + throw new Test262Error('#10: 1 >>> "x" === 1. Actual: ' + (1 >>> "x")); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.3.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.3.js new file mode 100644 index 0000000000..e539be8e18 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.3.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.3 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Null +---*/ + +//CHECK#1 +if (1 >>> null !== 1) { + throw new Test262Error('#1: 1 >>> null === 1. Actual: ' + (1 >>> null)); +} + +//CHECK#2 +if (null >>> 1 !== 0) { + throw new Test262Error('#2: null >>> 1 === 0. Actual: ' + (null >>> 1)); +} + +//CHECK#3 +if (new Number(1) >>> null !== 1) { + throw new Test262Error('#3: new Number(1) >>> null === 1. Actual: ' + (new Number(1) >>> null)); +} + +//CHECK#4 +if (null >>> new Number(1) !== 0) { + throw new Test262Error('#4: null >>> new Number(1) === 0. Actual: ' + (null >>> new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.4.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.4.js new file mode 100644 index 0000000000..2f9cb122fc --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.4.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.4 +description: > + Type(x) is different from Type(y) and both types vary between + Number (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (1 >>> undefined !== 1) { + throw new Test262Error('#1: 1 >>> undefined === 1. Actual: ' + (1 >>> undefined)); +} + +//CHECK#2 +if (undefined >>> 1 !== 0) { + throw new Test262Error('#2: undefined >>> 1 === 0. Actual: ' + (undefined >>> 1)); +} + +//CHECK#3 +if (new Number(1) >>> undefined !== 1) { + throw new Test262Error('#3: new Number(1) >>> undefined === 1. Actual: ' + (new Number(1) >>> undefined)); +} + +//CHECK#4 +if (undefined >>> new Number(1) !== 0) { + throw new Test262Error('#4: undefined >>> new Number(1) === 0. Actual: ' + (undefined >>> new Number(1))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.5.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.5.js new file mode 100644 index 0000000000..c9f16ef8dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.5.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.5 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Boolean (primitive and object) +---*/ + +//CHECK#1 +if (true >>> "1" !== 0) { + throw new Test262Error('#1: true >>> "1" === 0. Actual: ' + (true >>> "1")); +} + +//CHECK#2 +if ("1" >>> true !== 0) { + throw new Test262Error('#2: "1" >>> true === 0. Actual: ' + ("1" >>> true)); +} + +//CHECK#3 +if (new Boolean(true) >>> "1" !== 0) { + throw new Test262Error('#3: new Boolean(true) >>> "1" === 0. Actual: ' + (new Boolean(true) >>> "1")); +} + +//CHECK#4 +if ("1" >>> new Boolean(true) !== 0) { + throw new Test262Error('#4: "1" >>> new Boolean(true) === 0. Actual: ' + ("1" >>> new Boolean(true))); +} + +//CHECK#5 +if (true >>> new String("1") !== 0) { + throw new Test262Error('#5: true >>> new String("1") === 0. Actual: ' + (true >>> new String("1"))); +} + +//CHECK#6 +if (new String("1") >>> true !== 0) { + throw new Test262Error('#6: new String("1") >>> true === 0. Actual: ' + (new String("1") >>> true)); +} + +//CHECK#7 +if (new Boolean(true) >>> new String("1") !== 0) { + throw new Test262Error('#7: new Boolean(true) >>> new String("1") === 0. Actual: ' + (new Boolean(true) >>> new String("1"))); +} + +//CHECK#8 +if (new String("1") >>> new Boolean(true) !== 0) { + throw new Test262Error('#8: new String("1") >>> new Boolean(true) === 0. Actual: ' + (new String("1") >>> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.6.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.6.js new file mode 100644 index 0000000000..4825506ebd --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.6.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.6 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Undefined +---*/ + +//CHECK#1 +if ("1" >>> undefined !== 1) { + throw new Test262Error('#1: "1" >>> undefined === 1. Actual: ' + ("1" >>> undefined)); +} + +//CHECK#2 +if (undefined >>> "1" !== 0) { + throw new Test262Error('#2: undefined >>> "1" === 0. Actual: ' + (undefined >>> "1")); +} + +//CHECK#3 +if (new String("1") >>> undefined !== 1) { + throw new Test262Error('#3: new String("1") >>> undefined === 1. Actual: ' + (new String("1") >>> undefined)); +} + +//CHECK#4 +if (undefined >>> new String("1") !== 0) { + throw new Test262Error('#4: undefined >>> new String("1") === 0. Actual: ' + (undefined >>> new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.7.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.7.js new file mode 100644 index 0000000000..437d385c26 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.7.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.7 +description: > + Type(x) is different from Type(y) and both types vary between + String (primitive or object) and Null +---*/ + +//CHECK#1 +if ("1" >>> null !== 1) { + throw new Test262Error('#1: "1" >>> null === 1. Actual: ' + ("1" >>> null)); +} + +//CHECK#2 +if (null >>> "1" !== 0) { + throw new Test262Error('#2: null >>> "1" === 0. Actual: ' + (null >>> "1")); +} + +//CHECK#3 +if (new String("1") >>> null !== 1) { + throw new Test262Error('#3: new String("1") >>> null === 1. Actual: ' + (new String("1") >>> null)); +} + +//CHECK#4 +if (null >>> new String("1") !== 0) { + throw new Test262Error('#4: null >>> new String("1") === 0. Actual: ' + (null >>> new String("1"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.8.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.8.js new file mode 100644 index 0000000000..af47de8e80 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.8.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.8 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Undefined +---*/ + +//CHECK#1 +if (true >>> undefined !== 1) { + throw new Test262Error('#1: true >>> undefined === 1. Actual: ' + (true >>> undefined)); +} + +//CHECK#2 +if (undefined >>> true !== 0) { + throw new Test262Error('#2: undefined >>> true === 0. Actual: ' + (undefined >>> true)); +} + +//CHECK#3 +if (new Boolean(true) >>> undefined !== 1) { + throw new Test262Error('#3: new Boolean(true) >>> undefined === 1. Actual: ' + (new Boolean(true) >>> undefined)); +} + +//CHECK#4 +if (undefined >>> new Boolean(true) !== 0) { + throw new Test262Error('#4: undefined >>> new Boolean(true) === 0. Actual: ' + (undefined >>> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.9.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.9.js new file mode 100644 index 0000000000..9701d768c5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A3_T2.9.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y returns ToNumber(x) >>> ToNumber(y) +es5id: 11.7.3_A3_T2.9 +description: > + Type(x) is different from Type(y) and both types vary between + Boolean (primitive or object) and Null +---*/ + +//CHECK#1 +if (true >>> null !== 1) { + throw new Test262Error('#1: true >>> null === 1. Actual: ' + (true >>> null)); +} + +//CHECK#2 +if (null >>> true !== 0) { + throw new Test262Error('#2: null >>> true === 0. Actual: ' + (null >>> true)); +} + +//CHECK#3 +if (new Boolean(true) >>> null !== 1) { + throw new Test262Error('#3: new Boolean(true) >>> null === 1. Actual: ' + (new Boolean(true) >>> null)); +} + +//CHECK#4 +if (null >>> new Boolean(true) !== 0) { + throw new Test262Error('#4: null >>> new Boolean(true) === 0. Actual: ' + (null >>> new Boolean(true))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T1.js new file mode 100644 index 0000000000..ce6aeed6f2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T1.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x >>> y in distinct points +es5id: 11.7.3_A4_T1 +description: ShiftExpression = 2^n, n = 0...15 +---*/ + +//CHECK + +if (1 >>> 0 !== 1) { + throw new Test262Error('#1: 1 >>> 0 === 1. Actual: ' + (1 >>> 0)); +} + + +if (2 >>> 0 !== 2) { + throw new Test262Error('#2: 2 >>> 0 === 2. Actual: ' + (2 >>> 0)); +} + + +if (4 >>> 0 !== 4) { + throw new Test262Error('#3: 4 >>> 0 === 4. Actual: ' + (4 >>> 0)); +} + + +if (8 >>> 0 !== 8) { + throw new Test262Error('#4: 8 >>> 0 === 8. Actual: ' + (8 >>> 0)); +} + + +if (16 >>> 0 !== 16) { + throw new Test262Error('#5: 16 >>> 0 === 16. Actual: ' + (16 >>> 0)); +} + + +if (32 >>> 0 !== 32) { + throw new Test262Error('#6: 32 >>> 0 === 32. Actual: ' + (32 >>> 0)); +} + + +if (64 >>> 0 !== 64) { + throw new Test262Error('#7: 64 >>> 0 === 64. Actual: ' + (64 >>> 0)); +} + + +if (128 >>> 0 !== 128) { + throw new Test262Error('#8: 128 >>> 0 === 128. Actual: ' + (128 >>> 0)); +} + + +if (256 >>> 0 !== 256) { + throw new Test262Error('#9: 256 >>> 0 === 256. Actual: ' + (256 >>> 0)); +} + + +if (512 >>> 0 !== 512) { + throw new Test262Error('#10: 512 >>> 0 === 512. Actual: ' + (512 >>> 0)); +} + + +if (1024 >>> 0 !== 1024) { + throw new Test262Error('#11: 1024 >>> 0 === 1024. Actual: ' + (1024 >>> 0)); +} + + +if (2048 >>> 0 !== 2048) { + throw new Test262Error('#12: 2048 >>> 0 === 2048. Actual: ' + (2048 >>> 0)); +} + + +if (4096 >>> 0 !== 4096) { + throw new Test262Error('#13: 4096 >>> 0 === 4096. Actual: ' + (4096 >>> 0)); +} + + +if (8192 >>> 0 !== 8192) { + throw new Test262Error('#14: 8192 >>> 0 === 8192. Actual: ' + (8192 >>> 0)); +} + + +if (16384 >>> 0 !== 16384) { + throw new Test262Error('#15: 16384 >>> 0 === 16384. Actual: ' + (16384 >>> 0)); +} + + +if (32768 >>> 0 !== 32768) { + throw new Test262Error('#16: 32768 >>> 0 === 32768. Actual: ' + (32768 >>> 0)); +} + + +if (65536 >>> 0 !== 65536) { + throw new Test262Error('#17: 65536 >>> 0 === 65536. Actual: ' + (65536 >>> 0)); +} + + +if (131072 >>> 0 !== 131072) { + throw new Test262Error('#18: 131072 >>> 0 === 131072. Actual: ' + (131072 >>> 0)); +} + + +if (262144 >>> 0 !== 262144) { + throw new Test262Error('#19: 262144 >>> 0 === 262144. Actual: ' + (262144 >>> 0)); +} + + +if (524288 >>> 0 !== 524288) { + throw new Test262Error('#20: 524288 >>> 0 === 524288. Actual: ' + (524288 >>> 0)); +} + + +if (1048576 >>> 0 !== 1048576) { + throw new Test262Error('#21: 1048576 >>> 0 === 1048576. Actual: ' + (1048576 >>> 0)); +} + + +if (2097152 >>> 0 !== 2097152) { + throw new Test262Error('#22: 2097152 >>> 0 === 2097152. Actual: ' + (2097152 >>> 0)); +} + + +if (4194304 >>> 0 !== 4194304) { + throw new Test262Error('#23: 4194304 >>> 0 === 4194304. Actual: ' + (4194304 >>> 0)); +} + + +if (8388608 >>> 0 !== 8388608) { + throw new Test262Error('#24: 8388608 >>> 0 === 8388608. Actual: ' + (8388608 >>> 0)); +} + + +if (16777216 >>> 0 !== 16777216) { + throw new Test262Error('#25: 16777216 >>> 0 === 16777216. Actual: ' + (16777216 >>> 0)); +} + + +if (33554432 >>> 0 !== 33554432) { + throw new Test262Error('#26: 33554432 >>> 0 === 33554432. Actual: ' + (33554432 >>> 0)); +} + + +if (67108864 >>> 0 !== 67108864) { + throw new Test262Error('#27: 67108864 >>> 0 === 67108864. Actual: ' + (67108864 >>> 0)); +} + + +if (134217728 >>> 0 !== 134217728) { + throw new Test262Error('#28: 134217728 >>> 0 === 134217728. Actual: ' + (134217728 >>> 0)); +} + + +if (268435456 >>> 0 !== 268435456) { + throw new Test262Error('#29: 268435456 >>> 0 === 268435456. Actual: ' + (268435456 >>> 0)); +} + + +if (536870912 >>> 0 !== 536870912) { + throw new Test262Error('#30: 536870912 >>> 0 === 536870912. Actual: ' + (536870912 >>> 0)); +} + + +if (1073741824 >>> 0 !== 1073741824) { + throw new Test262Error('#31: 1073741824 >>> 0 === 1073741824. Actual: ' + (1073741824 >>> 0)); +} + + +if (2147483648 >>> 0 !== 2147483648) { + throw new Test262Error('#32: 2147483648 >>> 0 === 2147483648. Actual: ' + (2147483648 >>> 0)); +} + + +if (1 >>> 1 !== 0) { + throw new Test262Error('#33: 1 >>> 1 === 0. Actual: ' + (1 >>> 1)); +} + + +if (2 >>> 1 !== 1) { + throw new Test262Error('#34: 2 >>> 1 === 1. Actual: ' + (2 >>> 1)); +} + + +if (4 >>> 1 !== 2) { + throw new Test262Error('#35: 4 >>> 1 === 2. Actual: ' + (4 >>> 1)); +} + + +if (8 >>> 1 !== 4) { + throw new Test262Error('#36: 8 >>> 1 === 4. Actual: ' + (8 >>> 1)); +} + + +if (16 >>> 1 !== 8) { + throw new Test262Error('#37: 16 >>> 1 === 8. Actual: ' + (16 >>> 1)); +} + + +if (32 >>> 1 !== 16) { + throw new Test262Error('#38: 32 >>> 1 === 16. Actual: ' + (32 >>> 1)); +} + + +if (64 >>> 1 !== 32) { + throw new Test262Error('#39: 64 >>> 1 === 32. Actual: ' + (64 >>> 1)); +} + + +if (128 >>> 1 !== 64) { + throw new Test262Error('#40: 128 >>> 1 === 64. Actual: ' + (128 >>> 1)); +} + + +if (256 >>> 1 !== 128) { + throw new Test262Error('#41: 256 >>> 1 === 128. Actual: ' + (256 >>> 1)); +} + + +if (512 >>> 1 !== 256) { + throw new Test262Error('#42: 512 >>> 1 === 256. Actual: ' + (512 >>> 1)); +} + + +if (1024 >>> 1 !== 512) { + throw new Test262Error('#43: 1024 >>> 1 === 512. Actual: ' + (1024 >>> 1)); +} + + +if (2048 >>> 1 !== 1024) { + throw new Test262Error('#44: 2048 >>> 1 === 1024. Actual: ' + (2048 >>> 1)); +} + + +if (4096 >>> 1 !== 2048) { + throw new Test262Error('#45: 4096 >>> 1 === 2048. Actual: ' + (4096 >>> 1)); +} + + +if (8192 >>> 1 !== 4096) { + throw new Test262Error('#46: 8192 >>> 1 === 4096. Actual: ' + (8192 >>> 1)); +} + + +if (16384 >>> 1 !== 8192) { + throw new Test262Error('#47: 16384 >>> 1 === 8192. Actual: ' + (16384 >>> 1)); +} + + +if (32768 >>> 1 !== 16384) { + throw new Test262Error('#48: 32768 >>> 1 === 16384. Actual: ' + (32768 >>> 1)); +} + + +if (65536 >>> 1 !== 32768) { + throw new Test262Error('#49: 65536 >>> 1 === 32768. Actual: ' + (65536 >>> 1)); +} + + +if (131072 >>> 1 !== 65536) { + throw new Test262Error('#50: 131072 >>> 1 === 65536. Actual: ' + (131072 >>> 1)); +} + + +if (262144 >>> 1 !== 131072) { + throw new Test262Error('#51: 262144 >>> 1 === 131072. Actual: ' + (262144 >>> 1)); +} + + +if (524288 >>> 1 !== 262144) { + throw new Test262Error('#52: 524288 >>> 1 === 262144. Actual: ' + (524288 >>> 1)); +} + + +if (1048576 >>> 1 !== 524288) { + throw new Test262Error('#53: 1048576 >>> 1 === 524288. Actual: ' + (1048576 >>> 1)); +} + + +if (2097152 >>> 1 !== 1048576) { + throw new Test262Error('#54: 2097152 >>> 1 === 1048576. Actual: ' + (2097152 >>> 1)); +} + + +if (4194304 >>> 1 !== 2097152) { + throw new Test262Error('#55: 4194304 >>> 1 === 2097152. Actual: ' + (4194304 >>> 1)); +} + + +if (8388608 >>> 1 !== 4194304) { + throw new Test262Error('#56: 8388608 >>> 1 === 4194304. Actual: ' + (8388608 >>> 1)); +} + + +if (16777216 >>> 1 !== 8388608) { + throw new Test262Error('#57: 16777216 >>> 1 === 8388608. Actual: ' + (16777216 >>> 1)); +} + + +if (33554432 >>> 1 !== 16777216) { + throw new Test262Error('#58: 33554432 >>> 1 === 16777216. Actual: ' + (33554432 >>> 1)); +} + + +if (67108864 >>> 1 !== 33554432) { + throw new Test262Error('#59: 67108864 >>> 1 === 33554432. Actual: ' + (67108864 >>> 1)); +} + + +if (134217728 >>> 1 !== 67108864) { + throw new Test262Error('#60: 134217728 >>> 1 === 67108864. Actual: ' + (134217728 >>> 1)); +} + + +if (268435456 >>> 1 !== 134217728) { + throw new Test262Error('#61: 268435456 >>> 1 === 134217728. Actual: ' + (268435456 >>> 1)); +} + + +if (536870912 >>> 1 !== 268435456) { + throw new Test262Error('#62: 536870912 >>> 1 === 268435456. Actual: ' + (536870912 >>> 1)); +} + + +if (1073741824 >>> 1 !== 536870912) { + throw new Test262Error('#63: 1073741824 >>> 1 === 536870912. Actual: ' + (1073741824 >>> 1)); +} + + +if (2147483648 >>> 1 !== 1073741824) { + throw new Test262Error('#64: 2147483648 >>> 1 === 1073741824. Actual: ' + (2147483648 >>> 1)); +} + + +if (1 >>> 2 !== 0) { + throw new Test262Error('#65: 1 >>> 2 === 0. Actual: ' + (1 >>> 2)); +} + + +if (2 >>> 2 !== 0) { + throw new Test262Error('#66: 2 >>> 2 === 0. Actual: ' + (2 >>> 2)); +} + + +if (4 >>> 2 !== 1) { + throw new Test262Error('#67: 4 >>> 2 === 1. Actual: ' + (4 >>> 2)); +} + + +if (8 >>> 2 !== 2) { + throw new Test262Error('#68: 8 >>> 2 === 2. Actual: ' + (8 >>> 2)); +} + + +if (16 >>> 2 !== 4) { + throw new Test262Error('#69: 16 >>> 2 === 4. Actual: ' + (16 >>> 2)); +} + + +if (32 >>> 2 !== 8) { + throw new Test262Error('#70: 32 >>> 2 === 8. Actual: ' + (32 >>> 2)); +} + + +if (64 >>> 2 !== 16) { + throw new Test262Error('#71: 64 >>> 2 === 16. Actual: ' + (64 >>> 2)); +} + + +if (128 >>> 2 !== 32) { + throw new Test262Error('#72: 128 >>> 2 === 32. Actual: ' + (128 >>> 2)); +} + + +if (256 >>> 2 !== 64) { + throw new Test262Error('#73: 256 >>> 2 === 64. Actual: ' + (256 >>> 2)); +} + + +if (512 >>> 2 !== 128) { + throw new Test262Error('#74: 512 >>> 2 === 128. Actual: ' + (512 >>> 2)); +} + + +if (1024 >>> 2 !== 256) { + throw new Test262Error('#75: 1024 >>> 2 === 256. Actual: ' + (1024 >>> 2)); +} + + +if (2048 >>> 2 !== 512) { + throw new Test262Error('#76: 2048 >>> 2 === 512. Actual: ' + (2048 >>> 2)); +} + + +if (4096 >>> 2 !== 1024) { + throw new Test262Error('#77: 4096 >>> 2 === 1024. Actual: ' + (4096 >>> 2)); +} + + +if (8192 >>> 2 !== 2048) { + throw new Test262Error('#78: 8192 >>> 2 === 2048. Actual: ' + (8192 >>> 2)); +} + + +if (16384 >>> 2 !== 4096) { + throw new Test262Error('#79: 16384 >>> 2 === 4096. Actual: ' + (16384 >>> 2)); +} + + +if (32768 >>> 2 !== 8192) { + throw new Test262Error('#80: 32768 >>> 2 === 8192. Actual: ' + (32768 >>> 2)); +} + + +if (65536 >>> 2 !== 16384) { + throw new Test262Error('#81: 65536 >>> 2 === 16384. Actual: ' + (65536 >>> 2)); +} + + +if (131072 >>> 2 !== 32768) { + throw new Test262Error('#82: 131072 >>> 2 === 32768. Actual: ' + (131072 >>> 2)); +} + + +if (262144 >>> 2 !== 65536) { + throw new Test262Error('#83: 262144 >>> 2 === 65536. Actual: ' + (262144 >>> 2)); +} + + +if (524288 >>> 2 !== 131072) { + throw new Test262Error('#84: 524288 >>> 2 === 131072. Actual: ' + (524288 >>> 2)); +} + + +if (1048576 >>> 2 !== 262144) { + throw new Test262Error('#85: 1048576 >>> 2 === 262144. Actual: ' + (1048576 >>> 2)); +} + + +if (2097152 >>> 2 !== 524288) { + throw new Test262Error('#86: 2097152 >>> 2 === 524288. Actual: ' + (2097152 >>> 2)); +} + + +if (4194304 >>> 2 !== 1048576) { + throw new Test262Error('#87: 4194304 >>> 2 === 1048576. Actual: ' + (4194304 >>> 2)); +} + + +if (8388608 >>> 2 !== 2097152) { + throw new Test262Error('#88: 8388608 >>> 2 === 2097152. Actual: ' + (8388608 >>> 2)); +} + + +if (16777216 >>> 2 !== 4194304) { + throw new Test262Error('#89: 16777216 >>> 2 === 4194304. Actual: ' + (16777216 >>> 2)); +} + + +if (33554432 >>> 2 !== 8388608) { + throw new Test262Error('#90: 33554432 >>> 2 === 8388608. Actual: ' + (33554432 >>> 2)); +} + + +if (67108864 >>> 2 !== 16777216) { + throw new Test262Error('#91: 67108864 >>> 2 === 16777216. Actual: ' + (67108864 >>> 2)); +} + + +if (134217728 >>> 2 !== 33554432) { + throw new Test262Error('#92: 134217728 >>> 2 === 33554432. Actual: ' + (134217728 >>> 2)); +} + + +if (268435456 >>> 2 !== 67108864) { + throw new Test262Error('#93: 268435456 >>> 2 === 67108864. Actual: ' + (268435456 >>> 2)); +} + + +if (536870912 >>> 2 !== 134217728) { + throw new Test262Error('#94: 536870912 >>> 2 === 134217728. Actual: ' + (536870912 >>> 2)); +} + + +if (1073741824 >>> 2 !== 268435456) { + throw new Test262Error('#95: 1073741824 >>> 2 === 268435456. Actual: ' + (1073741824 >>> 2)); +} + + +if (2147483648 >>> 2 !== 536870912) { + throw new Test262Error('#96: 2147483648 >>> 2 === 536870912. Actual: ' + (2147483648 >>> 2)); +} + + +if (1 >>> 3 !== 0) { + throw new Test262Error('#97: 1 >>> 3 === 0. Actual: ' + (1 >>> 3)); +} + + +if (2 >>> 3 !== 0) { + throw new Test262Error('#98: 2 >>> 3 === 0. Actual: ' + (2 >>> 3)); +} + + +if (4 >>> 3 !== 0) { + throw new Test262Error('#99: 4 >>> 3 === 0. Actual: ' + (4 >>> 3)); +} + + +if (8 >>> 3 !== 1) { + throw new Test262Error('#100: 8 >>> 3 === 1. Actual: ' + (8 >>> 3)); +} + + +if (16 >>> 3 !== 2) { + throw new Test262Error('#101: 16 >>> 3 === 2. Actual: ' + (16 >>> 3)); +} + + +if (32 >>> 3 !== 4) { + throw new Test262Error('#102: 32 >>> 3 === 4. Actual: ' + (32 >>> 3)); +} + + +if (64 >>> 3 !== 8) { + throw new Test262Error('#103: 64 >>> 3 === 8. Actual: ' + (64 >>> 3)); +} + + +if (128 >>> 3 !== 16) { + throw new Test262Error('#104: 128 >>> 3 === 16. Actual: ' + (128 >>> 3)); +} + + +if (256 >>> 3 !== 32) { + throw new Test262Error('#105: 256 >>> 3 === 32. Actual: ' + (256 >>> 3)); +} + + +if (512 >>> 3 !== 64) { + throw new Test262Error('#106: 512 >>> 3 === 64. Actual: ' + (512 >>> 3)); +} + + +if (1024 >>> 3 !== 128) { + throw new Test262Error('#107: 1024 >>> 3 === 128. Actual: ' + (1024 >>> 3)); +} + + +if (2048 >>> 3 !== 256) { + throw new Test262Error('#108: 2048 >>> 3 === 256. Actual: ' + (2048 >>> 3)); +} + + +if (4096 >>> 3 !== 512) { + throw new Test262Error('#109: 4096 >>> 3 === 512. Actual: ' + (4096 >>> 3)); +} + + +if (8192 >>> 3 !== 1024) { + throw new Test262Error('#110: 8192 >>> 3 === 1024. Actual: ' + (8192 >>> 3)); +} + + +if (16384 >>> 3 !== 2048) { + throw new Test262Error('#111: 16384 >>> 3 === 2048. Actual: ' + (16384 >>> 3)); +} + + +if (32768 >>> 3 !== 4096) { + throw new Test262Error('#112: 32768 >>> 3 === 4096. Actual: ' + (32768 >>> 3)); +} + + +if (65536 >>> 3 !== 8192) { + throw new Test262Error('#113: 65536 >>> 3 === 8192. Actual: ' + (65536 >>> 3)); +} + + +if (131072 >>> 3 !== 16384) { + throw new Test262Error('#114: 131072 >>> 3 === 16384. Actual: ' + (131072 >>> 3)); +} + + +if (262144 >>> 3 !== 32768) { + throw new Test262Error('#115: 262144 >>> 3 === 32768. Actual: ' + (262144 >>> 3)); +} + + +if (524288 >>> 3 !== 65536) { + throw new Test262Error('#116: 524288 >>> 3 === 65536. Actual: ' + (524288 >>> 3)); +} + + +if (1048576 >>> 3 !== 131072) { + throw new Test262Error('#117: 1048576 >>> 3 === 131072. Actual: ' + (1048576 >>> 3)); +} + + +if (2097152 >>> 3 !== 262144) { + throw new Test262Error('#118: 2097152 >>> 3 === 262144. Actual: ' + (2097152 >>> 3)); +} + + +if (4194304 >>> 3 !== 524288) { + throw new Test262Error('#119: 4194304 >>> 3 === 524288. Actual: ' + (4194304 >>> 3)); +} + + +if (8388608 >>> 3 !== 1048576) { + throw new Test262Error('#120: 8388608 >>> 3 === 1048576. Actual: ' + (8388608 >>> 3)); +} + + +if (16777216 >>> 3 !== 2097152) { + throw new Test262Error('#121: 16777216 >>> 3 === 2097152. Actual: ' + (16777216 >>> 3)); +} + + +if (33554432 >>> 3 !== 4194304) { + throw new Test262Error('#122: 33554432 >>> 3 === 4194304. Actual: ' + (33554432 >>> 3)); +} + + +if (67108864 >>> 3 !== 8388608) { + throw new Test262Error('#123: 67108864 >>> 3 === 8388608. Actual: ' + (67108864 >>> 3)); +} + + +if (134217728 >>> 3 !== 16777216) { + throw new Test262Error('#124: 134217728 >>> 3 === 16777216. Actual: ' + (134217728 >>> 3)); +} + + +if (268435456 >>> 3 !== 33554432) { + throw new Test262Error('#125: 268435456 >>> 3 === 33554432. Actual: ' + (268435456 >>> 3)); +} + + +if (536870912 >>> 3 !== 67108864) { + throw new Test262Error('#126: 536870912 >>> 3 === 67108864. Actual: ' + (536870912 >>> 3)); +} + + +if (1073741824 >>> 3 !== 134217728) { + throw new Test262Error('#127: 1073741824 >>> 3 === 134217728. Actual: ' + (1073741824 >>> 3)); +} + + +if (2147483648 >>> 3 !== 268435456) { + throw new Test262Error('#128: 2147483648 >>> 3 === 268435456. Actual: ' + (2147483648 >>> 3)); +} + + +if (1 >>> 4 !== 0) { + throw new Test262Error('#129: 1 >>> 4 === 0. Actual: ' + (1 >>> 4)); +} + + +if (2 >>> 4 !== 0) { + throw new Test262Error('#130: 2 >>> 4 === 0. Actual: ' + (2 >>> 4)); +} + + +if (4 >>> 4 !== 0) { + throw new Test262Error('#131: 4 >>> 4 === 0. Actual: ' + (4 >>> 4)); +} + + +if (8 >>> 4 !== 0) { + throw new Test262Error('#132: 8 >>> 4 === 0. Actual: ' + (8 >>> 4)); +} + + +if (16 >>> 4 !== 1) { + throw new Test262Error('#133: 16 >>> 4 === 1. Actual: ' + (16 >>> 4)); +} + + +if (32 >>> 4 !== 2) { + throw new Test262Error('#134: 32 >>> 4 === 2. Actual: ' + (32 >>> 4)); +} + + +if (64 >>> 4 !== 4) { + throw new Test262Error('#135: 64 >>> 4 === 4. Actual: ' + (64 >>> 4)); +} + + +if (128 >>> 4 !== 8) { + throw new Test262Error('#136: 128 >>> 4 === 8. Actual: ' + (128 >>> 4)); +} + + +if (256 >>> 4 !== 16) { + throw new Test262Error('#137: 256 >>> 4 === 16. Actual: ' + (256 >>> 4)); +} + + +if (512 >>> 4 !== 32) { + throw new Test262Error('#138: 512 >>> 4 === 32. Actual: ' + (512 >>> 4)); +} + + +if (1024 >>> 4 !== 64) { + throw new Test262Error('#139: 1024 >>> 4 === 64. Actual: ' + (1024 >>> 4)); +} + + +if (2048 >>> 4 !== 128) { + throw new Test262Error('#140: 2048 >>> 4 === 128. Actual: ' + (2048 >>> 4)); +} + + +if (4096 >>> 4 !== 256) { + throw new Test262Error('#141: 4096 >>> 4 === 256. Actual: ' + (4096 >>> 4)); +} + + +if (8192 >>> 4 !== 512) { + throw new Test262Error('#142: 8192 >>> 4 === 512. Actual: ' + (8192 >>> 4)); +} + + +if (16384 >>> 4 !== 1024) { + throw new Test262Error('#143: 16384 >>> 4 === 1024. Actual: ' + (16384 >>> 4)); +} + + +if (32768 >>> 4 !== 2048) { + throw new Test262Error('#144: 32768 >>> 4 === 2048. Actual: ' + (32768 >>> 4)); +} + + +if (65536 >>> 4 !== 4096) { + throw new Test262Error('#145: 65536 >>> 4 === 4096. Actual: ' + (65536 >>> 4)); +} + + +if (131072 >>> 4 !== 8192) { + throw new Test262Error('#146: 131072 >>> 4 === 8192. Actual: ' + (131072 >>> 4)); +} + + +if (262144 >>> 4 !== 16384) { + throw new Test262Error('#147: 262144 >>> 4 === 16384. Actual: ' + (262144 >>> 4)); +} + + +if (524288 >>> 4 !== 32768) { + throw new Test262Error('#148: 524288 >>> 4 === 32768. Actual: ' + (524288 >>> 4)); +} + + +if (1048576 >>> 4 !== 65536) { + throw new Test262Error('#149: 1048576 >>> 4 === 65536. Actual: ' + (1048576 >>> 4)); +} + + +if (2097152 >>> 4 !== 131072) { + throw new Test262Error('#150: 2097152 >>> 4 === 131072. Actual: ' + (2097152 >>> 4)); +} + + +if (4194304 >>> 4 !== 262144) { + throw new Test262Error('#151: 4194304 >>> 4 === 262144. Actual: ' + (4194304 >>> 4)); +} + + +if (8388608 >>> 4 !== 524288) { + throw new Test262Error('#152: 8388608 >>> 4 === 524288. Actual: ' + (8388608 >>> 4)); +} + + +if (16777216 >>> 4 !== 1048576) { + throw new Test262Error('#153: 16777216 >>> 4 === 1048576. Actual: ' + (16777216 >>> 4)); +} + + +if (33554432 >>> 4 !== 2097152) { + throw new Test262Error('#154: 33554432 >>> 4 === 2097152. Actual: ' + (33554432 >>> 4)); +} + + +if (67108864 >>> 4 !== 4194304) { + throw new Test262Error('#155: 67108864 >>> 4 === 4194304. Actual: ' + (67108864 >>> 4)); +} + + +if (134217728 >>> 4 !== 8388608) { + throw new Test262Error('#156: 134217728 >>> 4 === 8388608. Actual: ' + (134217728 >>> 4)); +} + + +if (268435456 >>> 4 !== 16777216) { + throw new Test262Error('#157: 268435456 >>> 4 === 16777216. Actual: ' + (268435456 >>> 4)); +} + + +if (536870912 >>> 4 !== 33554432) { + throw new Test262Error('#158: 536870912 >>> 4 === 33554432. Actual: ' + (536870912 >>> 4)); +} + + +if (1073741824 >>> 4 !== 67108864) { + throw new Test262Error('#159: 1073741824 >>> 4 === 67108864. Actual: ' + (1073741824 >>> 4)); +} + + +if (2147483648 >>> 4 !== 134217728) { + throw new Test262Error('#160: 2147483648 >>> 4 === 134217728. Actual: ' + (2147483648 >>> 4)); +} + + +if (1 >>> 5 !== 0) { + throw new Test262Error('#161: 1 >>> 5 === 0. Actual: ' + (1 >>> 5)); +} + + +if (2 >>> 5 !== 0) { + throw new Test262Error('#162: 2 >>> 5 === 0. Actual: ' + (2 >>> 5)); +} + + +if (4 >>> 5 !== 0) { + throw new Test262Error('#163: 4 >>> 5 === 0. Actual: ' + (4 >>> 5)); +} + + +if (8 >>> 5 !== 0) { + throw new Test262Error('#164: 8 >>> 5 === 0. Actual: ' + (8 >>> 5)); +} + + +if (16 >>> 5 !== 0) { + throw new Test262Error('#165: 16 >>> 5 === 0. Actual: ' + (16 >>> 5)); +} + + +if (32 >>> 5 !== 1) { + throw new Test262Error('#166: 32 >>> 5 === 1. Actual: ' + (32 >>> 5)); +} + + +if (64 >>> 5 !== 2) { + throw new Test262Error('#167: 64 >>> 5 === 2. Actual: ' + (64 >>> 5)); +} + + +if (128 >>> 5 !== 4) { + throw new Test262Error('#168: 128 >>> 5 === 4. Actual: ' + (128 >>> 5)); +} + + +if (256 >>> 5 !== 8) { + throw new Test262Error('#169: 256 >>> 5 === 8. Actual: ' + (256 >>> 5)); +} + + +if (512 >>> 5 !== 16) { + throw new Test262Error('#170: 512 >>> 5 === 16. Actual: ' + (512 >>> 5)); +} + + +if (1024 >>> 5 !== 32) { + throw new Test262Error('#171: 1024 >>> 5 === 32. Actual: ' + (1024 >>> 5)); +} + + +if (2048 >>> 5 !== 64) { + throw new Test262Error('#172: 2048 >>> 5 === 64. Actual: ' + (2048 >>> 5)); +} + + +if (4096 >>> 5 !== 128) { + throw new Test262Error('#173: 4096 >>> 5 === 128. Actual: ' + (4096 >>> 5)); +} + + +if (8192 >>> 5 !== 256) { + throw new Test262Error('#174: 8192 >>> 5 === 256. Actual: ' + (8192 >>> 5)); +} + + +if (16384 >>> 5 !== 512) { + throw new Test262Error('#175: 16384 >>> 5 === 512. Actual: ' + (16384 >>> 5)); +} + + +if (32768 >>> 5 !== 1024) { + throw new Test262Error('#176: 32768 >>> 5 === 1024. Actual: ' + (32768 >>> 5)); +} + + +if (65536 >>> 5 !== 2048) { + throw new Test262Error('#177: 65536 >>> 5 === 2048. Actual: ' + (65536 >>> 5)); +} + + +if (131072 >>> 5 !== 4096) { + throw new Test262Error('#178: 131072 >>> 5 === 4096. Actual: ' + (131072 >>> 5)); +} + + +if (262144 >>> 5 !== 8192) { + throw new Test262Error('#179: 262144 >>> 5 === 8192. Actual: ' + (262144 >>> 5)); +} + + +if (524288 >>> 5 !== 16384) { + throw new Test262Error('#180: 524288 >>> 5 === 16384. Actual: ' + (524288 >>> 5)); +} + + +if (1048576 >>> 5 !== 32768) { + throw new Test262Error('#181: 1048576 >>> 5 === 32768. Actual: ' + (1048576 >>> 5)); +} + + +if (2097152 >>> 5 !== 65536) { + throw new Test262Error('#182: 2097152 >>> 5 === 65536. Actual: ' + (2097152 >>> 5)); +} + + +if (4194304 >>> 5 !== 131072) { + throw new Test262Error('#183: 4194304 >>> 5 === 131072. Actual: ' + (4194304 >>> 5)); +} + + +if (8388608 >>> 5 !== 262144) { + throw new Test262Error('#184: 8388608 >>> 5 === 262144. Actual: ' + (8388608 >>> 5)); +} + + +if (16777216 >>> 5 !== 524288) { + throw new Test262Error('#185: 16777216 >>> 5 === 524288. Actual: ' + (16777216 >>> 5)); +} + + +if (33554432 >>> 5 !== 1048576) { + throw new Test262Error('#186: 33554432 >>> 5 === 1048576. Actual: ' + (33554432 >>> 5)); +} + + +if (67108864 >>> 5 !== 2097152) { + throw new Test262Error('#187: 67108864 >>> 5 === 2097152. Actual: ' + (67108864 >>> 5)); +} + + +if (134217728 >>> 5 !== 4194304) { + throw new Test262Error('#188: 134217728 >>> 5 === 4194304. Actual: ' + (134217728 >>> 5)); +} + + +if (268435456 >>> 5 !== 8388608) { + throw new Test262Error('#189: 268435456 >>> 5 === 8388608. Actual: ' + (268435456 >>> 5)); +} + + +if (536870912 >>> 5 !== 16777216) { + throw new Test262Error('#190: 536870912 >>> 5 === 16777216. Actual: ' + (536870912 >>> 5)); +} + + +if (1073741824 >>> 5 !== 33554432) { + throw new Test262Error('#191: 1073741824 >>> 5 === 33554432. Actual: ' + (1073741824 >>> 5)); +} + + +if (2147483648 >>> 5 !== 67108864) { + throw new Test262Error('#192: 2147483648 >>> 5 === 67108864. Actual: ' + (2147483648 >>> 5)); +} + + +if (1 >>> 6 !== 0) { + throw new Test262Error('#193: 1 >>> 6 === 0. Actual: ' + (1 >>> 6)); +} + + +if (2 >>> 6 !== 0) { + throw new Test262Error('#194: 2 >>> 6 === 0. Actual: ' + (2 >>> 6)); +} + + +if (4 >>> 6 !== 0) { + throw new Test262Error('#195: 4 >>> 6 === 0. Actual: ' + (4 >>> 6)); +} + + +if (8 >>> 6 !== 0) { + throw new Test262Error('#196: 8 >>> 6 === 0. Actual: ' + (8 >>> 6)); +} + + +if (16 >>> 6 !== 0) { + throw new Test262Error('#197: 16 >>> 6 === 0. Actual: ' + (16 >>> 6)); +} + + +if (32 >>> 6 !== 0) { + throw new Test262Error('#198: 32 >>> 6 === 0. Actual: ' + (32 >>> 6)); +} + + +if (64 >>> 6 !== 1) { + throw new Test262Error('#199: 64 >>> 6 === 1. Actual: ' + (64 >>> 6)); +} + + +if (128 >>> 6 !== 2) { + throw new Test262Error('#200: 128 >>> 6 === 2. Actual: ' + (128 >>> 6)); +} + + +if (256 >>> 6 !== 4) { + throw new Test262Error('#201: 256 >>> 6 === 4. Actual: ' + (256 >>> 6)); +} + + +if (512 >>> 6 !== 8) { + throw new Test262Error('#202: 512 >>> 6 === 8. Actual: ' + (512 >>> 6)); +} + + +if (1024 >>> 6 !== 16) { + throw new Test262Error('#203: 1024 >>> 6 === 16. Actual: ' + (1024 >>> 6)); +} + + +if (2048 >>> 6 !== 32) { + throw new Test262Error('#204: 2048 >>> 6 === 32. Actual: ' + (2048 >>> 6)); +} + + +if (4096 >>> 6 !== 64) { + throw new Test262Error('#205: 4096 >>> 6 === 64. Actual: ' + (4096 >>> 6)); +} + + +if (8192 >>> 6 !== 128) { + throw new Test262Error('#206: 8192 >>> 6 === 128. Actual: ' + (8192 >>> 6)); +} + + +if (16384 >>> 6 !== 256) { + throw new Test262Error('#207: 16384 >>> 6 === 256. Actual: ' + (16384 >>> 6)); +} + + +if (32768 >>> 6 !== 512) { + throw new Test262Error('#208: 32768 >>> 6 === 512. Actual: ' + (32768 >>> 6)); +} + + +if (65536 >>> 6 !== 1024) { + throw new Test262Error('#209: 65536 >>> 6 === 1024. Actual: ' + (65536 >>> 6)); +} + + +if (131072 >>> 6 !== 2048) { + throw new Test262Error('#210: 131072 >>> 6 === 2048. Actual: ' + (131072 >>> 6)); +} + + +if (262144 >>> 6 !== 4096) { + throw new Test262Error('#211: 262144 >>> 6 === 4096. Actual: ' + (262144 >>> 6)); +} + + +if (524288 >>> 6 !== 8192) { + throw new Test262Error('#212: 524288 >>> 6 === 8192. Actual: ' + (524288 >>> 6)); +} + + +if (1048576 >>> 6 !== 16384) { + throw new Test262Error('#213: 1048576 >>> 6 === 16384. Actual: ' + (1048576 >>> 6)); +} + + +if (2097152 >>> 6 !== 32768) { + throw new Test262Error('#214: 2097152 >>> 6 === 32768. Actual: ' + (2097152 >>> 6)); +} + + +if (4194304 >>> 6 !== 65536) { + throw new Test262Error('#215: 4194304 >>> 6 === 65536. Actual: ' + (4194304 >>> 6)); +} + + +if (8388608 >>> 6 !== 131072) { + throw new Test262Error('#216: 8388608 >>> 6 === 131072. Actual: ' + (8388608 >>> 6)); +} + + +if (16777216 >>> 6 !== 262144) { + throw new Test262Error('#217: 16777216 >>> 6 === 262144. Actual: ' + (16777216 >>> 6)); +} + + +if (33554432 >>> 6 !== 524288) { + throw new Test262Error('#218: 33554432 >>> 6 === 524288. Actual: ' + (33554432 >>> 6)); +} + + +if (67108864 >>> 6 !== 1048576) { + throw new Test262Error('#219: 67108864 >>> 6 === 1048576. Actual: ' + (67108864 >>> 6)); +} + + +if (134217728 >>> 6 !== 2097152) { + throw new Test262Error('#220: 134217728 >>> 6 === 2097152. Actual: ' + (134217728 >>> 6)); +} + + +if (268435456 >>> 6 !== 4194304) { + throw new Test262Error('#221: 268435456 >>> 6 === 4194304. Actual: ' + (268435456 >>> 6)); +} + + +if (536870912 >>> 6 !== 8388608) { + throw new Test262Error('#222: 536870912 >>> 6 === 8388608. Actual: ' + (536870912 >>> 6)); +} + + +if (1073741824 >>> 6 !== 16777216) { + throw new Test262Error('#223: 1073741824 >>> 6 === 16777216. Actual: ' + (1073741824 >>> 6)); +} + + +if (2147483648 >>> 6 !== 33554432) { + throw new Test262Error('#224: 2147483648 >>> 6 === 33554432. Actual: ' + (2147483648 >>> 6)); +} + + +if (1 >>> 7 !== 0) { + throw new Test262Error('#225: 1 >>> 7 === 0. Actual: ' + (1 >>> 7)); +} + + +if (2 >>> 7 !== 0) { + throw new Test262Error('#226: 2 >>> 7 === 0. Actual: ' + (2 >>> 7)); +} + + +if (4 >>> 7 !== 0) { + throw new Test262Error('#227: 4 >>> 7 === 0. Actual: ' + (4 >>> 7)); +} + + +if (8 >>> 7 !== 0) { + throw new Test262Error('#228: 8 >>> 7 === 0. Actual: ' + (8 >>> 7)); +} + + +if (16 >>> 7 !== 0) { + throw new Test262Error('#229: 16 >>> 7 === 0. Actual: ' + (16 >>> 7)); +} + + +if (32 >>> 7 !== 0) { + throw new Test262Error('#230: 32 >>> 7 === 0. Actual: ' + (32 >>> 7)); +} + + +if (64 >>> 7 !== 0) { + throw new Test262Error('#231: 64 >>> 7 === 0. Actual: ' + (64 >>> 7)); +} + + +if (128 >>> 7 !== 1) { + throw new Test262Error('#232: 128 >>> 7 === 1. Actual: ' + (128 >>> 7)); +} + + +if (256 >>> 7 !== 2) { + throw new Test262Error('#233: 256 >>> 7 === 2. Actual: ' + (256 >>> 7)); +} + + +if (512 >>> 7 !== 4) { + throw new Test262Error('#234: 512 >>> 7 === 4. Actual: ' + (512 >>> 7)); +} + + +if (1024 >>> 7 !== 8) { + throw new Test262Error('#235: 1024 >>> 7 === 8. Actual: ' + (1024 >>> 7)); +} + + +if (2048 >>> 7 !== 16) { + throw new Test262Error('#236: 2048 >>> 7 === 16. Actual: ' + (2048 >>> 7)); +} + + +if (4096 >>> 7 !== 32) { + throw new Test262Error('#237: 4096 >>> 7 === 32. Actual: ' + (4096 >>> 7)); +} + + +if (8192 >>> 7 !== 64) { + throw new Test262Error('#238: 8192 >>> 7 === 64. Actual: ' + (8192 >>> 7)); +} + + +if (16384 >>> 7 !== 128) { + throw new Test262Error('#239: 16384 >>> 7 === 128. Actual: ' + (16384 >>> 7)); +} + + +if (32768 >>> 7 !== 256) { + throw new Test262Error('#240: 32768 >>> 7 === 256. Actual: ' + (32768 >>> 7)); +} + + +if (65536 >>> 7 !== 512) { + throw new Test262Error('#241: 65536 >>> 7 === 512. Actual: ' + (65536 >>> 7)); +} + + +if (131072 >>> 7 !== 1024) { + throw new Test262Error('#242: 131072 >>> 7 === 1024. Actual: ' + (131072 >>> 7)); +} + + +if (262144 >>> 7 !== 2048) { + throw new Test262Error('#243: 262144 >>> 7 === 2048. Actual: ' + (262144 >>> 7)); +} + + +if (524288 >>> 7 !== 4096) { + throw new Test262Error('#244: 524288 >>> 7 === 4096. Actual: ' + (524288 >>> 7)); +} + + +if (1048576 >>> 7 !== 8192) { + throw new Test262Error('#245: 1048576 >>> 7 === 8192. Actual: ' + (1048576 >>> 7)); +} + + +if (2097152 >>> 7 !== 16384) { + throw new Test262Error('#246: 2097152 >>> 7 === 16384. Actual: ' + (2097152 >>> 7)); +} + + +if (4194304 >>> 7 !== 32768) { + throw new Test262Error('#247: 4194304 >>> 7 === 32768. Actual: ' + (4194304 >>> 7)); +} + + +if (8388608 >>> 7 !== 65536) { + throw new Test262Error('#248: 8388608 >>> 7 === 65536. Actual: ' + (8388608 >>> 7)); +} + + +if (16777216 >>> 7 !== 131072) { + throw new Test262Error('#249: 16777216 >>> 7 === 131072. Actual: ' + (16777216 >>> 7)); +} + + +if (33554432 >>> 7 !== 262144) { + throw new Test262Error('#250: 33554432 >>> 7 === 262144. Actual: ' + (33554432 >>> 7)); +} + + +if (67108864 >>> 7 !== 524288) { + throw new Test262Error('#251: 67108864 >>> 7 === 524288. Actual: ' + (67108864 >>> 7)); +} + + +if (134217728 >>> 7 !== 1048576) { + throw new Test262Error('#252: 134217728 >>> 7 === 1048576. Actual: ' + (134217728 >>> 7)); +} + + +if (268435456 >>> 7 !== 2097152) { + throw new Test262Error('#253: 268435456 >>> 7 === 2097152. Actual: ' + (268435456 >>> 7)); +} + + +if (536870912 >>> 7 !== 4194304) { + throw new Test262Error('#254: 536870912 >>> 7 === 4194304. Actual: ' + (536870912 >>> 7)); +} + + +if (1073741824 >>> 7 !== 8388608) { + throw new Test262Error('#255: 1073741824 >>> 7 === 8388608. Actual: ' + (1073741824 >>> 7)); +} + + +if (2147483648 >>> 7 !== 16777216) { + throw new Test262Error('#256: 2147483648 >>> 7 === 16777216. Actual: ' + (2147483648 >>> 7)); +} + + +if (1 >>> 8 !== 0) { + throw new Test262Error('#257: 1 >>> 8 === 0. Actual: ' + (1 >>> 8)); +} + + +if (2 >>> 8 !== 0) { + throw new Test262Error('#258: 2 >>> 8 === 0. Actual: ' + (2 >>> 8)); +} + + +if (4 >>> 8 !== 0) { + throw new Test262Error('#259: 4 >>> 8 === 0. Actual: ' + (4 >>> 8)); +} + + +if (8 >>> 8 !== 0) { + throw new Test262Error('#260: 8 >>> 8 === 0. Actual: ' + (8 >>> 8)); +} + + +if (16 >>> 8 !== 0) { + throw new Test262Error('#261: 16 >>> 8 === 0. Actual: ' + (16 >>> 8)); +} + + +if (32 >>> 8 !== 0) { + throw new Test262Error('#262: 32 >>> 8 === 0. Actual: ' + (32 >>> 8)); +} + + +if (64 >>> 8 !== 0) { + throw new Test262Error('#263: 64 >>> 8 === 0. Actual: ' + (64 >>> 8)); +} + + +if (128 >>> 8 !== 0) { + throw new Test262Error('#264: 128 >>> 8 === 0. Actual: ' + (128 >>> 8)); +} + + +if (256 >>> 8 !== 1) { + throw new Test262Error('#265: 256 >>> 8 === 1. Actual: ' + (256 >>> 8)); +} + + +if (512 >>> 8 !== 2) { + throw new Test262Error('#266: 512 >>> 8 === 2. Actual: ' + (512 >>> 8)); +} + + +if (1024 >>> 8 !== 4) { + throw new Test262Error('#267: 1024 >>> 8 === 4. Actual: ' + (1024 >>> 8)); +} + + +if (2048 >>> 8 !== 8) { + throw new Test262Error('#268: 2048 >>> 8 === 8. Actual: ' + (2048 >>> 8)); +} + + +if (4096 >>> 8 !== 16) { + throw new Test262Error('#269: 4096 >>> 8 === 16. Actual: ' + (4096 >>> 8)); +} + + +if (8192 >>> 8 !== 32) { + throw new Test262Error('#270: 8192 >>> 8 === 32. Actual: ' + (8192 >>> 8)); +} + + +if (16384 >>> 8 !== 64) { + throw new Test262Error('#271: 16384 >>> 8 === 64. Actual: ' + (16384 >>> 8)); +} + + +if (32768 >>> 8 !== 128) { + throw new Test262Error('#272: 32768 >>> 8 === 128. Actual: ' + (32768 >>> 8)); +} + + +if (65536 >>> 8 !== 256) { + throw new Test262Error('#273: 65536 >>> 8 === 256. Actual: ' + (65536 >>> 8)); +} + + +if (131072 >>> 8 !== 512) { + throw new Test262Error('#274: 131072 >>> 8 === 512. Actual: ' + (131072 >>> 8)); +} + + +if (262144 >>> 8 !== 1024) { + throw new Test262Error('#275: 262144 >>> 8 === 1024. Actual: ' + (262144 >>> 8)); +} + + +if (524288 >>> 8 !== 2048) { + throw new Test262Error('#276: 524288 >>> 8 === 2048. Actual: ' + (524288 >>> 8)); +} + + +if (1048576 >>> 8 !== 4096) { + throw new Test262Error('#277: 1048576 >>> 8 === 4096. Actual: ' + (1048576 >>> 8)); +} + + +if (2097152 >>> 8 !== 8192) { + throw new Test262Error('#278: 2097152 >>> 8 === 8192. Actual: ' + (2097152 >>> 8)); +} + + +if (4194304 >>> 8 !== 16384) { + throw new Test262Error('#279: 4194304 >>> 8 === 16384. Actual: ' + (4194304 >>> 8)); +} + + +if (8388608 >>> 8 !== 32768) { + throw new Test262Error('#280: 8388608 >>> 8 === 32768. Actual: ' + (8388608 >>> 8)); +} + + +if (16777216 >>> 8 !== 65536) { + throw new Test262Error('#281: 16777216 >>> 8 === 65536. Actual: ' + (16777216 >>> 8)); +} + + +if (33554432 >>> 8 !== 131072) { + throw new Test262Error('#282: 33554432 >>> 8 === 131072. Actual: ' + (33554432 >>> 8)); +} + + +if (67108864 >>> 8 !== 262144) { + throw new Test262Error('#283: 67108864 >>> 8 === 262144. Actual: ' + (67108864 >>> 8)); +} + + +if (134217728 >>> 8 !== 524288) { + throw new Test262Error('#284: 134217728 >>> 8 === 524288. Actual: ' + (134217728 >>> 8)); +} + + +if (268435456 >>> 8 !== 1048576) { + throw new Test262Error('#285: 268435456 >>> 8 === 1048576. Actual: ' + (268435456 >>> 8)); +} + + +if (536870912 >>> 8 !== 2097152) { + throw new Test262Error('#286: 536870912 >>> 8 === 2097152. Actual: ' + (536870912 >>> 8)); +} + + +if (1073741824 >>> 8 !== 4194304) { + throw new Test262Error('#287: 1073741824 >>> 8 === 4194304. Actual: ' + (1073741824 >>> 8)); +} + + +if (2147483648 >>> 8 !== 8388608) { + throw new Test262Error('#288: 2147483648 >>> 8 === 8388608. Actual: ' + (2147483648 >>> 8)); +} + + +if (1 >>> 9 !== 0) { + throw new Test262Error('#289: 1 >>> 9 === 0. Actual: ' + (1 >>> 9)); +} + + +if (2 >>> 9 !== 0) { + throw new Test262Error('#290: 2 >>> 9 === 0. Actual: ' + (2 >>> 9)); +} + + +if (4 >>> 9 !== 0) { + throw new Test262Error('#291: 4 >>> 9 === 0. Actual: ' + (4 >>> 9)); +} + + +if (8 >>> 9 !== 0) { + throw new Test262Error('#292: 8 >>> 9 === 0. Actual: ' + (8 >>> 9)); +} + + +if (16 >>> 9 !== 0) { + throw new Test262Error('#293: 16 >>> 9 === 0. Actual: ' + (16 >>> 9)); +} + + +if (32 >>> 9 !== 0) { + throw new Test262Error('#294: 32 >>> 9 === 0. Actual: ' + (32 >>> 9)); +} + + +if (64 >>> 9 !== 0) { + throw new Test262Error('#295: 64 >>> 9 === 0. Actual: ' + (64 >>> 9)); +} + + +if (128 >>> 9 !== 0) { + throw new Test262Error('#296: 128 >>> 9 === 0. Actual: ' + (128 >>> 9)); +} + + +if (256 >>> 9 !== 0) { + throw new Test262Error('#297: 256 >>> 9 === 0. Actual: ' + (256 >>> 9)); +} + + +if (512 >>> 9 !== 1) { + throw new Test262Error('#298: 512 >>> 9 === 1. Actual: ' + (512 >>> 9)); +} + + +if (1024 >>> 9 !== 2) { + throw new Test262Error('#299: 1024 >>> 9 === 2. Actual: ' + (1024 >>> 9)); +} + + +if (2048 >>> 9 !== 4) { + throw new Test262Error('#300: 2048 >>> 9 === 4. Actual: ' + (2048 >>> 9)); +} + + +if (4096 >>> 9 !== 8) { + throw new Test262Error('#301: 4096 >>> 9 === 8. Actual: ' + (4096 >>> 9)); +} + + +if (8192 >>> 9 !== 16) { + throw new Test262Error('#302: 8192 >>> 9 === 16. Actual: ' + (8192 >>> 9)); +} + + +if (16384 >>> 9 !== 32) { + throw new Test262Error('#303: 16384 >>> 9 === 32. Actual: ' + (16384 >>> 9)); +} + + +if (32768 >>> 9 !== 64) { + throw new Test262Error('#304: 32768 >>> 9 === 64. Actual: ' + (32768 >>> 9)); +} + + +if (65536 >>> 9 !== 128) { + throw new Test262Error('#305: 65536 >>> 9 === 128. Actual: ' + (65536 >>> 9)); +} + + +if (131072 >>> 9 !== 256) { + throw new Test262Error('#306: 131072 >>> 9 === 256. Actual: ' + (131072 >>> 9)); +} + + +if (262144 >>> 9 !== 512) { + throw new Test262Error('#307: 262144 >>> 9 === 512. Actual: ' + (262144 >>> 9)); +} + + +if (524288 >>> 9 !== 1024) { + throw new Test262Error('#308: 524288 >>> 9 === 1024. Actual: ' + (524288 >>> 9)); +} + + +if (1048576 >>> 9 !== 2048) { + throw new Test262Error('#309: 1048576 >>> 9 === 2048. Actual: ' + (1048576 >>> 9)); +} + + +if (2097152 >>> 9 !== 4096) { + throw new Test262Error('#310: 2097152 >>> 9 === 4096. Actual: ' + (2097152 >>> 9)); +} + + +if (4194304 >>> 9 !== 8192) { + throw new Test262Error('#311: 4194304 >>> 9 === 8192. Actual: ' + (4194304 >>> 9)); +} + + +if (8388608 >>> 9 !== 16384) { + throw new Test262Error('#312: 8388608 >>> 9 === 16384. Actual: ' + (8388608 >>> 9)); +} + + +if (16777216 >>> 9 !== 32768) { + throw new Test262Error('#313: 16777216 >>> 9 === 32768. Actual: ' + (16777216 >>> 9)); +} + + +if (33554432 >>> 9 !== 65536) { + throw new Test262Error('#314: 33554432 >>> 9 === 65536. Actual: ' + (33554432 >>> 9)); +} + + +if (67108864 >>> 9 !== 131072) { + throw new Test262Error('#315: 67108864 >>> 9 === 131072. Actual: ' + (67108864 >>> 9)); +} + + +if (134217728 >>> 9 !== 262144) { + throw new Test262Error('#316: 134217728 >>> 9 === 262144. Actual: ' + (134217728 >>> 9)); +} + + +if (268435456 >>> 9 !== 524288) { + throw new Test262Error('#317: 268435456 >>> 9 === 524288. Actual: ' + (268435456 >>> 9)); +} + + +if (536870912 >>> 9 !== 1048576) { + throw new Test262Error('#318: 536870912 >>> 9 === 1048576. Actual: ' + (536870912 >>> 9)); +} + + +if (1073741824 >>> 9 !== 2097152) { + throw new Test262Error('#319: 1073741824 >>> 9 === 2097152. Actual: ' + (1073741824 >>> 9)); +} + + +if (2147483648 >>> 9 !== 4194304) { + throw new Test262Error('#320: 2147483648 >>> 9 === 4194304. Actual: ' + (2147483648 >>> 9)); +} + + +if (1 >>> 10 !== 0) { + throw new Test262Error('#321: 1 >>> 10 === 0. Actual: ' + (1 >>> 10)); +} + + +if (2 >>> 10 !== 0) { + throw new Test262Error('#322: 2 >>> 10 === 0. Actual: ' + (2 >>> 10)); +} + + +if (4 >>> 10 !== 0) { + throw new Test262Error('#323: 4 >>> 10 === 0. Actual: ' + (4 >>> 10)); +} + + +if (8 >>> 10 !== 0) { + throw new Test262Error('#324: 8 >>> 10 === 0. Actual: ' + (8 >>> 10)); +} + + +if (16 >>> 10 !== 0) { + throw new Test262Error('#325: 16 >>> 10 === 0. Actual: ' + (16 >>> 10)); +} + + +if (32 >>> 10 !== 0) { + throw new Test262Error('#326: 32 >>> 10 === 0. Actual: ' + (32 >>> 10)); +} + + +if (64 >>> 10 !== 0) { + throw new Test262Error('#327: 64 >>> 10 === 0. Actual: ' + (64 >>> 10)); +} + + +if (128 >>> 10 !== 0) { + throw new Test262Error('#328: 128 >>> 10 === 0. Actual: ' + (128 >>> 10)); +} + + +if (256 >>> 10 !== 0) { + throw new Test262Error('#329: 256 >>> 10 === 0. Actual: ' + (256 >>> 10)); +} + + +if (512 >>> 10 !== 0) { + throw new Test262Error('#330: 512 >>> 10 === 0. Actual: ' + (512 >>> 10)); +} + + +if (1024 >>> 10 !== 1) { + throw new Test262Error('#331: 1024 >>> 10 === 1. Actual: ' + (1024 >>> 10)); +} + + +if (2048 >>> 10 !== 2) { + throw new Test262Error('#332: 2048 >>> 10 === 2. Actual: ' + (2048 >>> 10)); +} + + +if (4096 >>> 10 !== 4) { + throw new Test262Error('#333: 4096 >>> 10 === 4. Actual: ' + (4096 >>> 10)); +} + + +if (8192 >>> 10 !== 8) { + throw new Test262Error('#334: 8192 >>> 10 === 8. Actual: ' + (8192 >>> 10)); +} + + +if (16384 >>> 10 !== 16) { + throw new Test262Error('#335: 16384 >>> 10 === 16. Actual: ' + (16384 >>> 10)); +} + + +if (32768 >>> 10 !== 32) { + throw new Test262Error('#336: 32768 >>> 10 === 32. Actual: ' + (32768 >>> 10)); +} + + +if (65536 >>> 10 !== 64) { + throw new Test262Error('#337: 65536 >>> 10 === 64. Actual: ' + (65536 >>> 10)); +} + + +if (131072 >>> 10 !== 128) { + throw new Test262Error('#338: 131072 >>> 10 === 128. Actual: ' + (131072 >>> 10)); +} + + +if (262144 >>> 10 !== 256) { + throw new Test262Error('#339: 262144 >>> 10 === 256. Actual: ' + (262144 >>> 10)); +} + + +if (524288 >>> 10 !== 512) { + throw new Test262Error('#340: 524288 >>> 10 === 512. Actual: ' + (524288 >>> 10)); +} + + +if (1048576 >>> 10 !== 1024) { + throw new Test262Error('#341: 1048576 >>> 10 === 1024. Actual: ' + (1048576 >>> 10)); +} + + +if (2097152 >>> 10 !== 2048) { + throw new Test262Error('#342: 2097152 >>> 10 === 2048. Actual: ' + (2097152 >>> 10)); +} + + +if (4194304 >>> 10 !== 4096) { + throw new Test262Error('#343: 4194304 >>> 10 === 4096. Actual: ' + (4194304 >>> 10)); +} + + +if (8388608 >>> 10 !== 8192) { + throw new Test262Error('#344: 8388608 >>> 10 === 8192. Actual: ' + (8388608 >>> 10)); +} + + +if (16777216 >>> 10 !== 16384) { + throw new Test262Error('#345: 16777216 >>> 10 === 16384. Actual: ' + (16777216 >>> 10)); +} + + +if (33554432 >>> 10 !== 32768) { + throw new Test262Error('#346: 33554432 >>> 10 === 32768. Actual: ' + (33554432 >>> 10)); +} + + +if (67108864 >>> 10 !== 65536) { + throw new Test262Error('#347: 67108864 >>> 10 === 65536. Actual: ' + (67108864 >>> 10)); +} + + +if (134217728 >>> 10 !== 131072) { + throw new Test262Error('#348: 134217728 >>> 10 === 131072. Actual: ' + (134217728 >>> 10)); +} + + +if (268435456 >>> 10 !== 262144) { + throw new Test262Error('#349: 268435456 >>> 10 === 262144. Actual: ' + (268435456 >>> 10)); +} + + +if (536870912 >>> 10 !== 524288) { + throw new Test262Error('#350: 536870912 >>> 10 === 524288. Actual: ' + (536870912 >>> 10)); +} + + +if (1073741824 >>> 10 !== 1048576) { + throw new Test262Error('#351: 1073741824 >>> 10 === 1048576. Actual: ' + (1073741824 >>> 10)); +} + + +if (2147483648 >>> 10 !== 2097152) { + throw new Test262Error('#352: 2147483648 >>> 10 === 2097152. Actual: ' + (2147483648 >>> 10)); +} + + +if (1 >>> 11 !== 0) { + throw new Test262Error('#353: 1 >>> 11 === 0. Actual: ' + (1 >>> 11)); +} + + +if (2 >>> 11 !== 0) { + throw new Test262Error('#354: 2 >>> 11 === 0. Actual: ' + (2 >>> 11)); +} + + +if (4 >>> 11 !== 0) { + throw new Test262Error('#355: 4 >>> 11 === 0. Actual: ' + (4 >>> 11)); +} + + +if (8 >>> 11 !== 0) { + throw new Test262Error('#356: 8 >>> 11 === 0. Actual: ' + (8 >>> 11)); +} + + +if (16 >>> 11 !== 0) { + throw new Test262Error('#357: 16 >>> 11 === 0. Actual: ' + (16 >>> 11)); +} + + +if (32 >>> 11 !== 0) { + throw new Test262Error('#358: 32 >>> 11 === 0. Actual: ' + (32 >>> 11)); +} + + +if (64 >>> 11 !== 0) { + throw new Test262Error('#359: 64 >>> 11 === 0. Actual: ' + (64 >>> 11)); +} + + +if (128 >>> 11 !== 0) { + throw new Test262Error('#360: 128 >>> 11 === 0. Actual: ' + (128 >>> 11)); +} + + +if (256 >>> 11 !== 0) { + throw new Test262Error('#361: 256 >>> 11 === 0. Actual: ' + (256 >>> 11)); +} + + +if (512 >>> 11 !== 0) { + throw new Test262Error('#362: 512 >>> 11 === 0. Actual: ' + (512 >>> 11)); +} + + +if (1024 >>> 11 !== 0) { + throw new Test262Error('#363: 1024 >>> 11 === 0. Actual: ' + (1024 >>> 11)); +} + + +if (2048 >>> 11 !== 1) { + throw new Test262Error('#364: 2048 >>> 11 === 1. Actual: ' + (2048 >>> 11)); +} + + +if (4096 >>> 11 !== 2) { + throw new Test262Error('#365: 4096 >>> 11 === 2. Actual: ' + (4096 >>> 11)); +} + + +if (8192 >>> 11 !== 4) { + throw new Test262Error('#366: 8192 >>> 11 === 4. Actual: ' + (8192 >>> 11)); +} + + +if (16384 >>> 11 !== 8) { + throw new Test262Error('#367: 16384 >>> 11 === 8. Actual: ' + (16384 >>> 11)); +} + + +if (32768 >>> 11 !== 16) { + throw new Test262Error('#368: 32768 >>> 11 === 16. Actual: ' + (32768 >>> 11)); +} + + +if (65536 >>> 11 !== 32) { + throw new Test262Error('#369: 65536 >>> 11 === 32. Actual: ' + (65536 >>> 11)); +} + + +if (131072 >>> 11 !== 64) { + throw new Test262Error('#370: 131072 >>> 11 === 64. Actual: ' + (131072 >>> 11)); +} + + +if (262144 >>> 11 !== 128) { + throw new Test262Error('#371: 262144 >>> 11 === 128. Actual: ' + (262144 >>> 11)); +} + + +if (524288 >>> 11 !== 256) { + throw new Test262Error('#372: 524288 >>> 11 === 256. Actual: ' + (524288 >>> 11)); +} + + +if (1048576 >>> 11 !== 512) { + throw new Test262Error('#373: 1048576 >>> 11 === 512. Actual: ' + (1048576 >>> 11)); +} + + +if (2097152 >>> 11 !== 1024) { + throw new Test262Error('#374: 2097152 >>> 11 === 1024. Actual: ' + (2097152 >>> 11)); +} + + +if (4194304 >>> 11 !== 2048) { + throw new Test262Error('#375: 4194304 >>> 11 === 2048. Actual: ' + (4194304 >>> 11)); +} + + +if (8388608 >>> 11 !== 4096) { + throw new Test262Error('#376: 8388608 >>> 11 === 4096. Actual: ' + (8388608 >>> 11)); +} + + +if (16777216 >>> 11 !== 8192) { + throw new Test262Error('#377: 16777216 >>> 11 === 8192. Actual: ' + (16777216 >>> 11)); +} + + +if (33554432 >>> 11 !== 16384) { + throw new Test262Error('#378: 33554432 >>> 11 === 16384. Actual: ' + (33554432 >>> 11)); +} + + +if (67108864 >>> 11 !== 32768) { + throw new Test262Error('#379: 67108864 >>> 11 === 32768. Actual: ' + (67108864 >>> 11)); +} + + +if (134217728 >>> 11 !== 65536) { + throw new Test262Error('#380: 134217728 >>> 11 === 65536. Actual: ' + (134217728 >>> 11)); +} + + +if (268435456 >>> 11 !== 131072) { + throw new Test262Error('#381: 268435456 >>> 11 === 131072. Actual: ' + (268435456 >>> 11)); +} + + +if (536870912 >>> 11 !== 262144) { + throw new Test262Error('#382: 536870912 >>> 11 === 262144. Actual: ' + (536870912 >>> 11)); +} + + +if (1073741824 >>> 11 !== 524288) { + throw new Test262Error('#383: 1073741824 >>> 11 === 524288. Actual: ' + (1073741824 >>> 11)); +} + + +if (2147483648 >>> 11 !== 1048576) { + throw new Test262Error('#384: 2147483648 >>> 11 === 1048576. Actual: ' + (2147483648 >>> 11)); +} + + +if (1 >>> 12 !== 0) { + throw new Test262Error('#385: 1 >>> 12 === 0. Actual: ' + (1 >>> 12)); +} + + +if (2 >>> 12 !== 0) { + throw new Test262Error('#386: 2 >>> 12 === 0. Actual: ' + (2 >>> 12)); +} + + +if (4 >>> 12 !== 0) { + throw new Test262Error('#387: 4 >>> 12 === 0. Actual: ' + (4 >>> 12)); +} + + +if (8 >>> 12 !== 0) { + throw new Test262Error('#388: 8 >>> 12 === 0. Actual: ' + (8 >>> 12)); +} + + +if (16 >>> 12 !== 0) { + throw new Test262Error('#389: 16 >>> 12 === 0. Actual: ' + (16 >>> 12)); +} + + +if (32 >>> 12 !== 0) { + throw new Test262Error('#390: 32 >>> 12 === 0. Actual: ' + (32 >>> 12)); +} + + +if (64 >>> 12 !== 0) { + throw new Test262Error('#391: 64 >>> 12 === 0. Actual: ' + (64 >>> 12)); +} + + +if (128 >>> 12 !== 0) { + throw new Test262Error('#392: 128 >>> 12 === 0. Actual: ' + (128 >>> 12)); +} + + +if (256 >>> 12 !== 0) { + throw new Test262Error('#393: 256 >>> 12 === 0. Actual: ' + (256 >>> 12)); +} + + +if (512 >>> 12 !== 0) { + throw new Test262Error('#394: 512 >>> 12 === 0. Actual: ' + (512 >>> 12)); +} + + +if (1024 >>> 12 !== 0) { + throw new Test262Error('#395: 1024 >>> 12 === 0. Actual: ' + (1024 >>> 12)); +} + + +if (2048 >>> 12 !== 0) { + throw new Test262Error('#396: 2048 >>> 12 === 0. Actual: ' + (2048 >>> 12)); +} + + +if (4096 >>> 12 !== 1) { + throw new Test262Error('#397: 4096 >>> 12 === 1. Actual: ' + (4096 >>> 12)); +} + + +if (8192 >>> 12 !== 2) { + throw new Test262Error('#398: 8192 >>> 12 === 2. Actual: ' + (8192 >>> 12)); +} + + +if (16384 >>> 12 !== 4) { + throw new Test262Error('#399: 16384 >>> 12 === 4. Actual: ' + (16384 >>> 12)); +} + + +if (32768 >>> 12 !== 8) { + throw new Test262Error('#400: 32768 >>> 12 === 8. Actual: ' + (32768 >>> 12)); +} + + +if (65536 >>> 12 !== 16) { + throw new Test262Error('#401: 65536 >>> 12 === 16. Actual: ' + (65536 >>> 12)); +} + + +if (131072 >>> 12 !== 32) { + throw new Test262Error('#402: 131072 >>> 12 === 32. Actual: ' + (131072 >>> 12)); +} + + +if (262144 >>> 12 !== 64) { + throw new Test262Error('#403: 262144 >>> 12 === 64. Actual: ' + (262144 >>> 12)); +} + + +if (524288 >>> 12 !== 128) { + throw new Test262Error('#404: 524288 >>> 12 === 128. Actual: ' + (524288 >>> 12)); +} + + +if (1048576 >>> 12 !== 256) { + throw new Test262Error('#405: 1048576 >>> 12 === 256. Actual: ' + (1048576 >>> 12)); +} + + +if (2097152 >>> 12 !== 512) { + throw new Test262Error('#406: 2097152 >>> 12 === 512. Actual: ' + (2097152 >>> 12)); +} + + +if (4194304 >>> 12 !== 1024) { + throw new Test262Error('#407: 4194304 >>> 12 === 1024. Actual: ' + (4194304 >>> 12)); +} + + +if (8388608 >>> 12 !== 2048) { + throw new Test262Error('#408: 8388608 >>> 12 === 2048. Actual: ' + (8388608 >>> 12)); +} + + +if (16777216 >>> 12 !== 4096) { + throw new Test262Error('#409: 16777216 >>> 12 === 4096. Actual: ' + (16777216 >>> 12)); +} + + +if (33554432 >>> 12 !== 8192) { + throw new Test262Error('#410: 33554432 >>> 12 === 8192. Actual: ' + (33554432 >>> 12)); +} + + +if (67108864 >>> 12 !== 16384) { + throw new Test262Error('#411: 67108864 >>> 12 === 16384. Actual: ' + (67108864 >>> 12)); +} + + +if (134217728 >>> 12 !== 32768) { + throw new Test262Error('#412: 134217728 >>> 12 === 32768. Actual: ' + (134217728 >>> 12)); +} + + +if (268435456 >>> 12 !== 65536) { + throw new Test262Error('#413: 268435456 >>> 12 === 65536. Actual: ' + (268435456 >>> 12)); +} + + +if (536870912 >>> 12 !== 131072) { + throw new Test262Error('#414: 536870912 >>> 12 === 131072. Actual: ' + (536870912 >>> 12)); +} + + +if (1073741824 >>> 12 !== 262144) { + throw new Test262Error('#415: 1073741824 >>> 12 === 262144. Actual: ' + (1073741824 >>> 12)); +} + + +if (2147483648 >>> 12 !== 524288) { + throw new Test262Error('#416: 2147483648 >>> 12 === 524288. Actual: ' + (2147483648 >>> 12)); +} + + +if (1 >>> 13 !== 0) { + throw new Test262Error('#417: 1 >>> 13 === 0. Actual: ' + (1 >>> 13)); +} + + +if (2 >>> 13 !== 0) { + throw new Test262Error('#418: 2 >>> 13 === 0. Actual: ' + (2 >>> 13)); +} + + +if (4 >>> 13 !== 0) { + throw new Test262Error('#419: 4 >>> 13 === 0. Actual: ' + (4 >>> 13)); +} + + +if (8 >>> 13 !== 0) { + throw new Test262Error('#420: 8 >>> 13 === 0. Actual: ' + (8 >>> 13)); +} + + +if (16 >>> 13 !== 0) { + throw new Test262Error('#421: 16 >>> 13 === 0. Actual: ' + (16 >>> 13)); +} + + +if (32 >>> 13 !== 0) { + throw new Test262Error('#422: 32 >>> 13 === 0. Actual: ' + (32 >>> 13)); +} + + +if (64 >>> 13 !== 0) { + throw new Test262Error('#423: 64 >>> 13 === 0. Actual: ' + (64 >>> 13)); +} + + +if (128 >>> 13 !== 0) { + throw new Test262Error('#424: 128 >>> 13 === 0. Actual: ' + (128 >>> 13)); +} + + +if (256 >>> 13 !== 0) { + throw new Test262Error('#425: 256 >>> 13 === 0. Actual: ' + (256 >>> 13)); +} + + +if (512 >>> 13 !== 0) { + throw new Test262Error('#426: 512 >>> 13 === 0. Actual: ' + (512 >>> 13)); +} + + +if (1024 >>> 13 !== 0) { + throw new Test262Error('#427: 1024 >>> 13 === 0. Actual: ' + (1024 >>> 13)); +} + + +if (2048 >>> 13 !== 0) { + throw new Test262Error('#428: 2048 >>> 13 === 0. Actual: ' + (2048 >>> 13)); +} + + +if (4096 >>> 13 !== 0) { + throw new Test262Error('#429: 4096 >>> 13 === 0. Actual: ' + (4096 >>> 13)); +} + + +if (8192 >>> 13 !== 1) { + throw new Test262Error('#430: 8192 >>> 13 === 1. Actual: ' + (8192 >>> 13)); +} + + +if (16384 >>> 13 !== 2) { + throw new Test262Error('#431: 16384 >>> 13 === 2. Actual: ' + (16384 >>> 13)); +} + + +if (32768 >>> 13 !== 4) { + throw new Test262Error('#432: 32768 >>> 13 === 4. Actual: ' + (32768 >>> 13)); +} + + +if (65536 >>> 13 !== 8) { + throw new Test262Error('#433: 65536 >>> 13 === 8. Actual: ' + (65536 >>> 13)); +} + + +if (131072 >>> 13 !== 16) { + throw new Test262Error('#434: 131072 >>> 13 === 16. Actual: ' + (131072 >>> 13)); +} + + +if (262144 >>> 13 !== 32) { + throw new Test262Error('#435: 262144 >>> 13 === 32. Actual: ' + (262144 >>> 13)); +} + + +if (524288 >>> 13 !== 64) { + throw new Test262Error('#436: 524288 >>> 13 === 64. Actual: ' + (524288 >>> 13)); +} + + +if (1048576 >>> 13 !== 128) { + throw new Test262Error('#437: 1048576 >>> 13 === 128. Actual: ' + (1048576 >>> 13)); +} + + +if (2097152 >>> 13 !== 256) { + throw new Test262Error('#438: 2097152 >>> 13 === 256. Actual: ' + (2097152 >>> 13)); +} + + +if (4194304 >>> 13 !== 512) { + throw new Test262Error('#439: 4194304 >>> 13 === 512. Actual: ' + (4194304 >>> 13)); +} + + +if (8388608 >>> 13 !== 1024) { + throw new Test262Error('#440: 8388608 >>> 13 === 1024. Actual: ' + (8388608 >>> 13)); +} + + +if (16777216 >>> 13 !== 2048) { + throw new Test262Error('#441: 16777216 >>> 13 === 2048. Actual: ' + (16777216 >>> 13)); +} + + +if (33554432 >>> 13 !== 4096) { + throw new Test262Error('#442: 33554432 >>> 13 === 4096. Actual: ' + (33554432 >>> 13)); +} + + +if (67108864 >>> 13 !== 8192) { + throw new Test262Error('#443: 67108864 >>> 13 === 8192. Actual: ' + (67108864 >>> 13)); +} + + +if (134217728 >>> 13 !== 16384) { + throw new Test262Error('#444: 134217728 >>> 13 === 16384. Actual: ' + (134217728 >>> 13)); +} + + +if (268435456 >>> 13 !== 32768) { + throw new Test262Error('#445: 268435456 >>> 13 === 32768. Actual: ' + (268435456 >>> 13)); +} + + +if (536870912 >>> 13 !== 65536) { + throw new Test262Error('#446: 536870912 >>> 13 === 65536. Actual: ' + (536870912 >>> 13)); +} + + +if (1073741824 >>> 13 !== 131072) { + throw new Test262Error('#447: 1073741824 >>> 13 === 131072. Actual: ' + (1073741824 >>> 13)); +} + + +if (2147483648 >>> 13 !== 262144) { + throw new Test262Error('#448: 2147483648 >>> 13 === 262144. Actual: ' + (2147483648 >>> 13)); +} + + +if (1 >>> 14 !== 0) { + throw new Test262Error('#449: 1 >>> 14 === 0. Actual: ' + (1 >>> 14)); +} + + +if (2 >>> 14 !== 0) { + throw new Test262Error('#450: 2 >>> 14 === 0. Actual: ' + (2 >>> 14)); +} + + +if (4 >>> 14 !== 0) { + throw new Test262Error('#451: 4 >>> 14 === 0. Actual: ' + (4 >>> 14)); +} + + +if (8 >>> 14 !== 0) { + throw new Test262Error('#452: 8 >>> 14 === 0. Actual: ' + (8 >>> 14)); +} + + +if (16 >>> 14 !== 0) { + throw new Test262Error('#453: 16 >>> 14 === 0. Actual: ' + (16 >>> 14)); +} + + +if (32 >>> 14 !== 0) { + throw new Test262Error('#454: 32 >>> 14 === 0. Actual: ' + (32 >>> 14)); +} + + +if (64 >>> 14 !== 0) { + throw new Test262Error('#455: 64 >>> 14 === 0. Actual: ' + (64 >>> 14)); +} + + +if (128 >>> 14 !== 0) { + throw new Test262Error('#456: 128 >>> 14 === 0. Actual: ' + (128 >>> 14)); +} + + +if (256 >>> 14 !== 0) { + throw new Test262Error('#457: 256 >>> 14 === 0. Actual: ' + (256 >>> 14)); +} + + +if (512 >>> 14 !== 0) { + throw new Test262Error('#458: 512 >>> 14 === 0. Actual: ' + (512 >>> 14)); +} + + +if (1024 >>> 14 !== 0) { + throw new Test262Error('#459: 1024 >>> 14 === 0. Actual: ' + (1024 >>> 14)); +} + + +if (2048 >>> 14 !== 0) { + throw new Test262Error('#460: 2048 >>> 14 === 0. Actual: ' + (2048 >>> 14)); +} + + +if (4096 >>> 14 !== 0) { + throw new Test262Error('#461: 4096 >>> 14 === 0. Actual: ' + (4096 >>> 14)); +} + + +if (8192 >>> 14 !== 0) { + throw new Test262Error('#462: 8192 >>> 14 === 0. Actual: ' + (8192 >>> 14)); +} + + +if (16384 >>> 14 !== 1) { + throw new Test262Error('#463: 16384 >>> 14 === 1. Actual: ' + (16384 >>> 14)); +} + + +if (32768 >>> 14 !== 2) { + throw new Test262Error('#464: 32768 >>> 14 === 2. Actual: ' + (32768 >>> 14)); +} + + +if (65536 >>> 14 !== 4) { + throw new Test262Error('#465: 65536 >>> 14 === 4. Actual: ' + (65536 >>> 14)); +} + + +if (131072 >>> 14 !== 8) { + throw new Test262Error('#466: 131072 >>> 14 === 8. Actual: ' + (131072 >>> 14)); +} + + +if (262144 >>> 14 !== 16) { + throw new Test262Error('#467: 262144 >>> 14 === 16. Actual: ' + (262144 >>> 14)); +} + + +if (524288 >>> 14 !== 32) { + throw new Test262Error('#468: 524288 >>> 14 === 32. Actual: ' + (524288 >>> 14)); +} + + +if (1048576 >>> 14 !== 64) { + throw new Test262Error('#469: 1048576 >>> 14 === 64. Actual: ' + (1048576 >>> 14)); +} + + +if (2097152 >>> 14 !== 128) { + throw new Test262Error('#470: 2097152 >>> 14 === 128. Actual: ' + (2097152 >>> 14)); +} + + +if (4194304 >>> 14 !== 256) { + throw new Test262Error('#471: 4194304 >>> 14 === 256. Actual: ' + (4194304 >>> 14)); +} + + +if (8388608 >>> 14 !== 512) { + throw new Test262Error('#472: 8388608 >>> 14 === 512. Actual: ' + (8388608 >>> 14)); +} + + +if (16777216 >>> 14 !== 1024) { + throw new Test262Error('#473: 16777216 >>> 14 === 1024. Actual: ' + (16777216 >>> 14)); +} + + +if (33554432 >>> 14 !== 2048) { + throw new Test262Error('#474: 33554432 >>> 14 === 2048. Actual: ' + (33554432 >>> 14)); +} + + +if (67108864 >>> 14 !== 4096) { + throw new Test262Error('#475: 67108864 >>> 14 === 4096. Actual: ' + (67108864 >>> 14)); +} + + +if (134217728 >>> 14 !== 8192) { + throw new Test262Error('#476: 134217728 >>> 14 === 8192. Actual: ' + (134217728 >>> 14)); +} + + +if (268435456 >>> 14 !== 16384) { + throw new Test262Error('#477: 268435456 >>> 14 === 16384. Actual: ' + (268435456 >>> 14)); +} + + +if (536870912 >>> 14 !== 32768) { + throw new Test262Error('#478: 536870912 >>> 14 === 32768. Actual: ' + (536870912 >>> 14)); +} + + +if (1073741824 >>> 14 !== 65536) { + throw new Test262Error('#479: 1073741824 >>> 14 === 65536. Actual: ' + (1073741824 >>> 14)); +} + + +if (2147483648 >>> 14 !== 131072) { + throw new Test262Error('#480: 2147483648 >>> 14 === 131072. Actual: ' + (2147483648 >>> 14)); +} + + +if (1 >>> 15 !== 0) { + throw new Test262Error('#481: 1 >>> 15 === 0. Actual: ' + (1 >>> 15)); +} + + +if (2 >>> 15 !== 0) { + throw new Test262Error('#482: 2 >>> 15 === 0. Actual: ' + (2 >>> 15)); +} + + +if (4 >>> 15 !== 0) { + throw new Test262Error('#483: 4 >>> 15 === 0. Actual: ' + (4 >>> 15)); +} + + +if (8 >>> 15 !== 0) { + throw new Test262Error('#484: 8 >>> 15 === 0. Actual: ' + (8 >>> 15)); +} + + +if (16 >>> 15 !== 0) { + throw new Test262Error('#485: 16 >>> 15 === 0. Actual: ' + (16 >>> 15)); +} + + +if (32 >>> 15 !== 0) { + throw new Test262Error('#486: 32 >>> 15 === 0. Actual: ' + (32 >>> 15)); +} + + +if (64 >>> 15 !== 0) { + throw new Test262Error('#487: 64 >>> 15 === 0. Actual: ' + (64 >>> 15)); +} + + +if (128 >>> 15 !== 0) { + throw new Test262Error('#488: 128 >>> 15 === 0. Actual: ' + (128 >>> 15)); +} + + +if (256 >>> 15 !== 0) { + throw new Test262Error('#489: 256 >>> 15 === 0. Actual: ' + (256 >>> 15)); +} + + +if (512 >>> 15 !== 0) { + throw new Test262Error('#490: 512 >>> 15 === 0. Actual: ' + (512 >>> 15)); +} + + +if (1024 >>> 15 !== 0) { + throw new Test262Error('#491: 1024 >>> 15 === 0. Actual: ' + (1024 >>> 15)); +} + + +if (2048 >>> 15 !== 0) { + throw new Test262Error('#492: 2048 >>> 15 === 0. Actual: ' + (2048 >>> 15)); +} + + +if (4096 >>> 15 !== 0) { + throw new Test262Error('#493: 4096 >>> 15 === 0. Actual: ' + (4096 >>> 15)); +} + + +if (8192 >>> 15 !== 0) { + throw new Test262Error('#494: 8192 >>> 15 === 0. Actual: ' + (8192 >>> 15)); +} + + +if (16384 >>> 15 !== 0) { + throw new Test262Error('#495: 16384 >>> 15 === 0. Actual: ' + (16384 >>> 15)); +} + + +if (32768 >>> 15 !== 1) { + throw new Test262Error('#496: 32768 >>> 15 === 1. Actual: ' + (32768 >>> 15)); +} + + +if (65536 >>> 15 !== 2) { + throw new Test262Error('#497: 65536 >>> 15 === 2. Actual: ' + (65536 >>> 15)); +} + + +if (131072 >>> 15 !== 4) { + throw new Test262Error('#498: 131072 >>> 15 === 4. Actual: ' + (131072 >>> 15)); +} + + +if (262144 >>> 15 !== 8) { + throw new Test262Error('#499: 262144 >>> 15 === 8. Actual: ' + (262144 >>> 15)); +} + + +if (524288 >>> 15 !== 16) { + throw new Test262Error('#500: 524288 >>> 15 === 16. Actual: ' + (524288 >>> 15)); +} + + +if (1048576 >>> 15 !== 32) { + throw new Test262Error('#501: 1048576 >>> 15 === 32. Actual: ' + (1048576 >>> 15)); +} + + +if (2097152 >>> 15 !== 64) { + throw new Test262Error('#502: 2097152 >>> 15 === 64. Actual: ' + (2097152 >>> 15)); +} + + +if (4194304 >>> 15 !== 128) { + throw new Test262Error('#503: 4194304 >>> 15 === 128. Actual: ' + (4194304 >>> 15)); +} + + +if (8388608 >>> 15 !== 256) { + throw new Test262Error('#504: 8388608 >>> 15 === 256. Actual: ' + (8388608 >>> 15)); +} + + +if (16777216 >>> 15 !== 512) { + throw new Test262Error('#505: 16777216 >>> 15 === 512. Actual: ' + (16777216 >>> 15)); +} + + +if (33554432 >>> 15 !== 1024) { + throw new Test262Error('#506: 33554432 >>> 15 === 1024. Actual: ' + (33554432 >>> 15)); +} + + +if (67108864 >>> 15 !== 2048) { + throw new Test262Error('#507: 67108864 >>> 15 === 2048. Actual: ' + (67108864 >>> 15)); +} + + +if (134217728 >>> 15 !== 4096) { + throw new Test262Error('#508: 134217728 >>> 15 === 4096. Actual: ' + (134217728 >>> 15)); +} + + +if (268435456 >>> 15 !== 8192) { + throw new Test262Error('#509: 268435456 >>> 15 === 8192. Actual: ' + (268435456 >>> 15)); +} + + +if (536870912 >>> 15 !== 16384) { + throw new Test262Error('#510: 536870912 >>> 15 === 16384. Actual: ' + (536870912 >>> 15)); +} + + +if (1073741824 >>> 15 !== 32768) { + throw new Test262Error('#511: 1073741824 >>> 15 === 32768. Actual: ' + (1073741824 >>> 15)); +} + + +if (2147483648 >>> 15 !== 65536) { + throw new Test262Error('#512: 2147483648 >>> 15 === 65536. Actual: ' + (2147483648 >>> 15)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T2.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T2.js new file mode 100644 index 0000000000..5a4b10435e --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T2.js @@ -0,0 +1,2571 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x >>> y in distinct points +es5id: 11.7.3_A4_T2 +description: ShiftExpression = 2^n - 1, n = 16...31 +---*/ + +//CHECK + +if (1 >>> 16 !== 0) { + throw new Test262Error('#513: 1 >>> 16 === 0. Actual: ' + (1 >>> 16)); +} + + +if (2 >>> 16 !== 0) { + throw new Test262Error('#514: 2 >>> 16 === 0. Actual: ' + (2 >>> 16)); +} + + +if (4 >>> 16 !== 0) { + throw new Test262Error('#515: 4 >>> 16 === 0. Actual: ' + (4 >>> 16)); +} + + +if (8 >>> 16 !== 0) { + throw new Test262Error('#516: 8 >>> 16 === 0. Actual: ' + (8 >>> 16)); +} + + +if (16 >>> 16 !== 0) { + throw new Test262Error('#517: 16 >>> 16 === 0. Actual: ' + (16 >>> 16)); +} + + +if (32 >>> 16 !== 0) { + throw new Test262Error('#518: 32 >>> 16 === 0. Actual: ' + (32 >>> 16)); +} + + +if (64 >>> 16 !== 0) { + throw new Test262Error('#519: 64 >>> 16 === 0. Actual: ' + (64 >>> 16)); +} + + +if (128 >>> 16 !== 0) { + throw new Test262Error('#520: 128 >>> 16 === 0. Actual: ' + (128 >>> 16)); +} + + +if (256 >>> 16 !== 0) { + throw new Test262Error('#521: 256 >>> 16 === 0. Actual: ' + (256 >>> 16)); +} + + +if (512 >>> 16 !== 0) { + throw new Test262Error('#522: 512 >>> 16 === 0. Actual: ' + (512 >>> 16)); +} + + +if (1024 >>> 16 !== 0) { + throw new Test262Error('#523: 1024 >>> 16 === 0. Actual: ' + (1024 >>> 16)); +} + + +if (2048 >>> 16 !== 0) { + throw new Test262Error('#524: 2048 >>> 16 === 0. Actual: ' + (2048 >>> 16)); +} + + +if (4096 >>> 16 !== 0) { + throw new Test262Error('#525: 4096 >>> 16 === 0. Actual: ' + (4096 >>> 16)); +} + + +if (8192 >>> 16 !== 0) { + throw new Test262Error('#526: 8192 >>> 16 === 0. Actual: ' + (8192 >>> 16)); +} + + +if (16384 >>> 16 !== 0) { + throw new Test262Error('#527: 16384 >>> 16 === 0. Actual: ' + (16384 >>> 16)); +} + + +if (32768 >>> 16 !== 0) { + throw new Test262Error('#528: 32768 >>> 16 === 0. Actual: ' + (32768 >>> 16)); +} + + +if (65536 >>> 16 !== 1) { + throw new Test262Error('#529: 65536 >>> 16 === 1. Actual: ' + (65536 >>> 16)); +} + + +if (131072 >>> 16 !== 2) { + throw new Test262Error('#530: 131072 >>> 16 === 2. Actual: ' + (131072 >>> 16)); +} + + +if (262144 >>> 16 !== 4) { + throw new Test262Error('#531: 262144 >>> 16 === 4. Actual: ' + (262144 >>> 16)); +} + + +if (524288 >>> 16 !== 8) { + throw new Test262Error('#532: 524288 >>> 16 === 8. Actual: ' + (524288 >>> 16)); +} + + +if (1048576 >>> 16 !== 16) { + throw new Test262Error('#533: 1048576 >>> 16 === 16. Actual: ' + (1048576 >>> 16)); +} + + +if (2097152 >>> 16 !== 32) { + throw new Test262Error('#534: 2097152 >>> 16 === 32. Actual: ' + (2097152 >>> 16)); +} + + +if (4194304 >>> 16 !== 64) { + throw new Test262Error('#535: 4194304 >>> 16 === 64. Actual: ' + (4194304 >>> 16)); +} + + +if (8388608 >>> 16 !== 128) { + throw new Test262Error('#536: 8388608 >>> 16 === 128. Actual: ' + (8388608 >>> 16)); +} + + +if (16777216 >>> 16 !== 256) { + throw new Test262Error('#537: 16777216 >>> 16 === 256. Actual: ' + (16777216 >>> 16)); +} + + +if (33554432 >>> 16 !== 512) { + throw new Test262Error('#538: 33554432 >>> 16 === 512. Actual: ' + (33554432 >>> 16)); +} + + +if (67108864 >>> 16 !== 1024) { + throw new Test262Error('#539: 67108864 >>> 16 === 1024. Actual: ' + (67108864 >>> 16)); +} + + +if (134217728 >>> 16 !== 2048) { + throw new Test262Error('#540: 134217728 >>> 16 === 2048. Actual: ' + (134217728 >>> 16)); +} + + +if (268435456 >>> 16 !== 4096) { + throw new Test262Error('#541: 268435456 >>> 16 === 4096. Actual: ' + (268435456 >>> 16)); +} + + +if (536870912 >>> 16 !== 8192) { + throw new Test262Error('#542: 536870912 >>> 16 === 8192. Actual: ' + (536870912 >>> 16)); +} + + +if (1073741824 >>> 16 !== 16384) { + throw new Test262Error('#543: 1073741824 >>> 16 === 16384. Actual: ' + (1073741824 >>> 16)); +} + + +if (2147483648 >>> 16 !== 32768) { + throw new Test262Error('#544: 2147483648 >>> 16 === 32768. Actual: ' + (2147483648 >>> 16)); +} + + +if (1 >>> 17 !== 0) { + throw new Test262Error('#545: 1 >>> 17 === 0. Actual: ' + (1 >>> 17)); +} + + +if (2 >>> 17 !== 0) { + throw new Test262Error('#546: 2 >>> 17 === 0. Actual: ' + (2 >>> 17)); +} + + +if (4 >>> 17 !== 0) { + throw new Test262Error('#547: 4 >>> 17 === 0. Actual: ' + (4 >>> 17)); +} + + +if (8 >>> 17 !== 0) { + throw new Test262Error('#548: 8 >>> 17 === 0. Actual: ' + (8 >>> 17)); +} + + +if (16 >>> 17 !== 0) { + throw new Test262Error('#549: 16 >>> 17 === 0. Actual: ' + (16 >>> 17)); +} + + +if (32 >>> 17 !== 0) { + throw new Test262Error('#550: 32 >>> 17 === 0. Actual: ' + (32 >>> 17)); +} + + +if (64 >>> 17 !== 0) { + throw new Test262Error('#551: 64 >>> 17 === 0. Actual: ' + (64 >>> 17)); +} + + +if (128 >>> 17 !== 0) { + throw new Test262Error('#552: 128 >>> 17 === 0. Actual: ' + (128 >>> 17)); +} + + +if (256 >>> 17 !== 0) { + throw new Test262Error('#553: 256 >>> 17 === 0. Actual: ' + (256 >>> 17)); +} + + +if (512 >>> 17 !== 0) { + throw new Test262Error('#554: 512 >>> 17 === 0. Actual: ' + (512 >>> 17)); +} + + +if (1024 >>> 17 !== 0) { + throw new Test262Error('#555: 1024 >>> 17 === 0. Actual: ' + (1024 >>> 17)); +} + + +if (2048 >>> 17 !== 0) { + throw new Test262Error('#556: 2048 >>> 17 === 0. Actual: ' + (2048 >>> 17)); +} + + +if (4096 >>> 17 !== 0) { + throw new Test262Error('#557: 4096 >>> 17 === 0. Actual: ' + (4096 >>> 17)); +} + + +if (8192 >>> 17 !== 0) { + throw new Test262Error('#558: 8192 >>> 17 === 0. Actual: ' + (8192 >>> 17)); +} + + +if (16384 >>> 17 !== 0) { + throw new Test262Error('#559: 16384 >>> 17 === 0. Actual: ' + (16384 >>> 17)); +} + + +if (32768 >>> 17 !== 0) { + throw new Test262Error('#560: 32768 >>> 17 === 0. Actual: ' + (32768 >>> 17)); +} + + +if (65536 >>> 17 !== 0) { + throw new Test262Error('#561: 65536 >>> 17 === 0. Actual: ' + (65536 >>> 17)); +} + + +if (131072 >>> 17 !== 1) { + throw new Test262Error('#562: 131072 >>> 17 === 1. Actual: ' + (131072 >>> 17)); +} + + +if (262144 >>> 17 !== 2) { + throw new Test262Error('#563: 262144 >>> 17 === 2. Actual: ' + (262144 >>> 17)); +} + + +if (524288 >>> 17 !== 4) { + throw new Test262Error('#564: 524288 >>> 17 === 4. Actual: ' + (524288 >>> 17)); +} + + +if (1048576 >>> 17 !== 8) { + throw new Test262Error('#565: 1048576 >>> 17 === 8. Actual: ' + (1048576 >>> 17)); +} + + +if (2097152 >>> 17 !== 16) { + throw new Test262Error('#566: 2097152 >>> 17 === 16. Actual: ' + (2097152 >>> 17)); +} + + +if (4194304 >>> 17 !== 32) { + throw new Test262Error('#567: 4194304 >>> 17 === 32. Actual: ' + (4194304 >>> 17)); +} + + +if (8388608 >>> 17 !== 64) { + throw new Test262Error('#568: 8388608 >>> 17 === 64. Actual: ' + (8388608 >>> 17)); +} + + +if (16777216 >>> 17 !== 128) { + throw new Test262Error('#569: 16777216 >>> 17 === 128. Actual: ' + (16777216 >>> 17)); +} + + +if (33554432 >>> 17 !== 256) { + throw new Test262Error('#570: 33554432 >>> 17 === 256. Actual: ' + (33554432 >>> 17)); +} + + +if (67108864 >>> 17 !== 512) { + throw new Test262Error('#571: 67108864 >>> 17 === 512. Actual: ' + (67108864 >>> 17)); +} + + +if (134217728 >>> 17 !== 1024) { + throw new Test262Error('#572: 134217728 >>> 17 === 1024. Actual: ' + (134217728 >>> 17)); +} + + +if (268435456 >>> 17 !== 2048) { + throw new Test262Error('#573: 268435456 >>> 17 === 2048. Actual: ' + (268435456 >>> 17)); +} + + +if (536870912 >>> 17 !== 4096) { + throw new Test262Error('#574: 536870912 >>> 17 === 4096. Actual: ' + (536870912 >>> 17)); +} + + +if (1073741824 >>> 17 !== 8192) { + throw new Test262Error('#575: 1073741824 >>> 17 === 8192. Actual: ' + (1073741824 >>> 17)); +} + + +if (2147483648 >>> 17 !== 16384) { + throw new Test262Error('#576: 2147483648 >>> 17 === 16384. Actual: ' + (2147483648 >>> 17)); +} + + +if (1 >>> 18 !== 0) { + throw new Test262Error('#577: 1 >>> 18 === 0. Actual: ' + (1 >>> 18)); +} + + +if (2 >>> 18 !== 0) { + throw new Test262Error('#578: 2 >>> 18 === 0. Actual: ' + (2 >>> 18)); +} + + +if (4 >>> 18 !== 0) { + throw new Test262Error('#579: 4 >>> 18 === 0. Actual: ' + (4 >>> 18)); +} + + +if (8 >>> 18 !== 0) { + throw new Test262Error('#580: 8 >>> 18 === 0. Actual: ' + (8 >>> 18)); +} + + +if (16 >>> 18 !== 0) { + throw new Test262Error('#581: 16 >>> 18 === 0. Actual: ' + (16 >>> 18)); +} + + +if (32 >>> 18 !== 0) { + throw new Test262Error('#582: 32 >>> 18 === 0. Actual: ' + (32 >>> 18)); +} + + +if (64 >>> 18 !== 0) { + throw new Test262Error('#583: 64 >>> 18 === 0. Actual: ' + (64 >>> 18)); +} + + +if (128 >>> 18 !== 0) { + throw new Test262Error('#584: 128 >>> 18 === 0. Actual: ' + (128 >>> 18)); +} + + +if (256 >>> 18 !== 0) { + throw new Test262Error('#585: 256 >>> 18 === 0. Actual: ' + (256 >>> 18)); +} + + +if (512 >>> 18 !== 0) { + throw new Test262Error('#586: 512 >>> 18 === 0. Actual: ' + (512 >>> 18)); +} + + +if (1024 >>> 18 !== 0) { + throw new Test262Error('#587: 1024 >>> 18 === 0. Actual: ' + (1024 >>> 18)); +} + + +if (2048 >>> 18 !== 0) { + throw new Test262Error('#588: 2048 >>> 18 === 0. Actual: ' + (2048 >>> 18)); +} + + +if (4096 >>> 18 !== 0) { + throw new Test262Error('#589: 4096 >>> 18 === 0. Actual: ' + (4096 >>> 18)); +} + + +if (8192 >>> 18 !== 0) { + throw new Test262Error('#590: 8192 >>> 18 === 0. Actual: ' + (8192 >>> 18)); +} + + +if (16384 >>> 18 !== 0) { + throw new Test262Error('#591: 16384 >>> 18 === 0. Actual: ' + (16384 >>> 18)); +} + + +if (32768 >>> 18 !== 0) { + throw new Test262Error('#592: 32768 >>> 18 === 0. Actual: ' + (32768 >>> 18)); +} + + +if (65536 >>> 18 !== 0) { + throw new Test262Error('#593: 65536 >>> 18 === 0. Actual: ' + (65536 >>> 18)); +} + + +if (131072 >>> 18 !== 0) { + throw new Test262Error('#594: 131072 >>> 18 === 0. Actual: ' + (131072 >>> 18)); +} + + +if (262144 >>> 18 !== 1) { + throw new Test262Error('#595: 262144 >>> 18 === 1. Actual: ' + (262144 >>> 18)); +} + + +if (524288 >>> 18 !== 2) { + throw new Test262Error('#596: 524288 >>> 18 === 2. Actual: ' + (524288 >>> 18)); +} + + +if (1048576 >>> 18 !== 4) { + throw new Test262Error('#597: 1048576 >>> 18 === 4. Actual: ' + (1048576 >>> 18)); +} + + +if (2097152 >>> 18 !== 8) { + throw new Test262Error('#598: 2097152 >>> 18 === 8. Actual: ' + (2097152 >>> 18)); +} + + +if (4194304 >>> 18 !== 16) { + throw new Test262Error('#599: 4194304 >>> 18 === 16. Actual: ' + (4194304 >>> 18)); +} + + +if (8388608 >>> 18 !== 32) { + throw new Test262Error('#600: 8388608 >>> 18 === 32. Actual: ' + (8388608 >>> 18)); +} + + +if (16777216 >>> 18 !== 64) { + throw new Test262Error('#601: 16777216 >>> 18 === 64. Actual: ' + (16777216 >>> 18)); +} + + +if (33554432 >>> 18 !== 128) { + throw new Test262Error('#602: 33554432 >>> 18 === 128. Actual: ' + (33554432 >>> 18)); +} + + +if (67108864 >>> 18 !== 256) { + throw new Test262Error('#603: 67108864 >>> 18 === 256. Actual: ' + (67108864 >>> 18)); +} + + +if (134217728 >>> 18 !== 512) { + throw new Test262Error('#604: 134217728 >>> 18 === 512. Actual: ' + (134217728 >>> 18)); +} + + +if (268435456 >>> 18 !== 1024) { + throw new Test262Error('#605: 268435456 >>> 18 === 1024. Actual: ' + (268435456 >>> 18)); +} + + +if (536870912 >>> 18 !== 2048) { + throw new Test262Error('#606: 536870912 >>> 18 === 2048. Actual: ' + (536870912 >>> 18)); +} + + +if (1073741824 >>> 18 !== 4096) { + throw new Test262Error('#607: 1073741824 >>> 18 === 4096. Actual: ' + (1073741824 >>> 18)); +} + + +if (2147483648 >>> 18 !== 8192) { + throw new Test262Error('#608: 2147483648 >>> 18 === 8192. Actual: ' + (2147483648 >>> 18)); +} + + +if (1 >>> 19 !== 0) { + throw new Test262Error('#609: 1 >>> 19 === 0. Actual: ' + (1 >>> 19)); +} + + +if (2 >>> 19 !== 0) { + throw new Test262Error('#610: 2 >>> 19 === 0. Actual: ' + (2 >>> 19)); +} + + +if (4 >>> 19 !== 0) { + throw new Test262Error('#611: 4 >>> 19 === 0. Actual: ' + (4 >>> 19)); +} + + +if (8 >>> 19 !== 0) { + throw new Test262Error('#612: 8 >>> 19 === 0. Actual: ' + (8 >>> 19)); +} + + +if (16 >>> 19 !== 0) { + throw new Test262Error('#613: 16 >>> 19 === 0. Actual: ' + (16 >>> 19)); +} + + +if (32 >>> 19 !== 0) { + throw new Test262Error('#614: 32 >>> 19 === 0. Actual: ' + (32 >>> 19)); +} + + +if (64 >>> 19 !== 0) { + throw new Test262Error('#615: 64 >>> 19 === 0. Actual: ' + (64 >>> 19)); +} + + +if (128 >>> 19 !== 0) { + throw new Test262Error('#616: 128 >>> 19 === 0. Actual: ' + (128 >>> 19)); +} + + +if (256 >>> 19 !== 0) { + throw new Test262Error('#617: 256 >>> 19 === 0. Actual: ' + (256 >>> 19)); +} + + +if (512 >>> 19 !== 0) { + throw new Test262Error('#618: 512 >>> 19 === 0. Actual: ' + (512 >>> 19)); +} + + +if (1024 >>> 19 !== 0) { + throw new Test262Error('#619: 1024 >>> 19 === 0. Actual: ' + (1024 >>> 19)); +} + + +if (2048 >>> 19 !== 0) { + throw new Test262Error('#620: 2048 >>> 19 === 0. Actual: ' + (2048 >>> 19)); +} + + +if (4096 >>> 19 !== 0) { + throw new Test262Error('#621: 4096 >>> 19 === 0. Actual: ' + (4096 >>> 19)); +} + + +if (8192 >>> 19 !== 0) { + throw new Test262Error('#622: 8192 >>> 19 === 0. Actual: ' + (8192 >>> 19)); +} + + +if (16384 >>> 19 !== 0) { + throw new Test262Error('#623: 16384 >>> 19 === 0. Actual: ' + (16384 >>> 19)); +} + + +if (32768 >>> 19 !== 0) { + throw new Test262Error('#624: 32768 >>> 19 === 0. Actual: ' + (32768 >>> 19)); +} + + +if (65536 >>> 19 !== 0) { + throw new Test262Error('#625: 65536 >>> 19 === 0. Actual: ' + (65536 >>> 19)); +} + + +if (131072 >>> 19 !== 0) { + throw new Test262Error('#626: 131072 >>> 19 === 0. Actual: ' + (131072 >>> 19)); +} + + +if (262144 >>> 19 !== 0) { + throw new Test262Error('#627: 262144 >>> 19 === 0. Actual: ' + (262144 >>> 19)); +} + + +if (524288 >>> 19 !== 1) { + throw new Test262Error('#628: 524288 >>> 19 === 1. Actual: ' + (524288 >>> 19)); +} + + +if (1048576 >>> 19 !== 2) { + throw new Test262Error('#629: 1048576 >>> 19 === 2. Actual: ' + (1048576 >>> 19)); +} + + +if (2097152 >>> 19 !== 4) { + throw new Test262Error('#630: 2097152 >>> 19 === 4. Actual: ' + (2097152 >>> 19)); +} + + +if (4194304 >>> 19 !== 8) { + throw new Test262Error('#631: 4194304 >>> 19 === 8. Actual: ' + (4194304 >>> 19)); +} + + +if (8388608 >>> 19 !== 16) { + throw new Test262Error('#632: 8388608 >>> 19 === 16. Actual: ' + (8388608 >>> 19)); +} + + +if (16777216 >>> 19 !== 32) { + throw new Test262Error('#633: 16777216 >>> 19 === 32. Actual: ' + (16777216 >>> 19)); +} + + +if (33554432 >>> 19 !== 64) { + throw new Test262Error('#634: 33554432 >>> 19 === 64. Actual: ' + (33554432 >>> 19)); +} + + +if (67108864 >>> 19 !== 128) { + throw new Test262Error('#635: 67108864 >>> 19 === 128. Actual: ' + (67108864 >>> 19)); +} + + +if (134217728 >>> 19 !== 256) { + throw new Test262Error('#636: 134217728 >>> 19 === 256. Actual: ' + (134217728 >>> 19)); +} + + +if (268435456 >>> 19 !== 512) { + throw new Test262Error('#637: 268435456 >>> 19 === 512. Actual: ' + (268435456 >>> 19)); +} + + +if (536870912 >>> 19 !== 1024) { + throw new Test262Error('#638: 536870912 >>> 19 === 1024. Actual: ' + (536870912 >>> 19)); +} + + +if (1073741824 >>> 19 !== 2048) { + throw new Test262Error('#639: 1073741824 >>> 19 === 2048. Actual: ' + (1073741824 >>> 19)); +} + + +if (2147483648 >>> 19 !== 4096) { + throw new Test262Error('#640: 2147483648 >>> 19 === 4096. Actual: ' + (2147483648 >>> 19)); +} + + +if (1 >>> 20 !== 0) { + throw new Test262Error('#641: 1 >>> 20 === 0. Actual: ' + (1 >>> 20)); +} + + +if (2 >>> 20 !== 0) { + throw new Test262Error('#642: 2 >>> 20 === 0. Actual: ' + (2 >>> 20)); +} + + +if (4 >>> 20 !== 0) { + throw new Test262Error('#643: 4 >>> 20 === 0. Actual: ' + (4 >>> 20)); +} + + +if (8 >>> 20 !== 0) { + throw new Test262Error('#644: 8 >>> 20 === 0. Actual: ' + (8 >>> 20)); +} + + +if (16 >>> 20 !== 0) { + throw new Test262Error('#645: 16 >>> 20 === 0. Actual: ' + (16 >>> 20)); +} + + +if (32 >>> 20 !== 0) { + throw new Test262Error('#646: 32 >>> 20 === 0. Actual: ' + (32 >>> 20)); +} + + +if (64 >>> 20 !== 0) { + throw new Test262Error('#647: 64 >>> 20 === 0. Actual: ' + (64 >>> 20)); +} + + +if (128 >>> 20 !== 0) { + throw new Test262Error('#648: 128 >>> 20 === 0. Actual: ' + (128 >>> 20)); +} + + +if (256 >>> 20 !== 0) { + throw new Test262Error('#649: 256 >>> 20 === 0. Actual: ' + (256 >>> 20)); +} + + +if (512 >>> 20 !== 0) { + throw new Test262Error('#650: 512 >>> 20 === 0. Actual: ' + (512 >>> 20)); +} + + +if (1024 >>> 20 !== 0) { + throw new Test262Error('#651: 1024 >>> 20 === 0. Actual: ' + (1024 >>> 20)); +} + + +if (2048 >>> 20 !== 0) { + throw new Test262Error('#652: 2048 >>> 20 === 0. Actual: ' + (2048 >>> 20)); +} + + +if (4096 >>> 20 !== 0) { + throw new Test262Error('#653: 4096 >>> 20 === 0. Actual: ' + (4096 >>> 20)); +} + + +if (8192 >>> 20 !== 0) { + throw new Test262Error('#654: 8192 >>> 20 === 0. Actual: ' + (8192 >>> 20)); +} + + +if (16384 >>> 20 !== 0) { + throw new Test262Error('#655: 16384 >>> 20 === 0. Actual: ' + (16384 >>> 20)); +} + + +if (32768 >>> 20 !== 0) { + throw new Test262Error('#656: 32768 >>> 20 === 0. Actual: ' + (32768 >>> 20)); +} + + +if (65536 >>> 20 !== 0) { + throw new Test262Error('#657: 65536 >>> 20 === 0. Actual: ' + (65536 >>> 20)); +} + + +if (131072 >>> 20 !== 0) { + throw new Test262Error('#658: 131072 >>> 20 === 0. Actual: ' + (131072 >>> 20)); +} + + +if (262144 >>> 20 !== 0) { + throw new Test262Error('#659: 262144 >>> 20 === 0. Actual: ' + (262144 >>> 20)); +} + + +if (524288 >>> 20 !== 0) { + throw new Test262Error('#660: 524288 >>> 20 === 0. Actual: ' + (524288 >>> 20)); +} + + +if (1048576 >>> 20 !== 1) { + throw new Test262Error('#661: 1048576 >>> 20 === 1. Actual: ' + (1048576 >>> 20)); +} + + +if (2097152 >>> 20 !== 2) { + throw new Test262Error('#662: 2097152 >>> 20 === 2. Actual: ' + (2097152 >>> 20)); +} + + +if (4194304 >>> 20 !== 4) { + throw new Test262Error('#663: 4194304 >>> 20 === 4. Actual: ' + (4194304 >>> 20)); +} + + +if (8388608 >>> 20 !== 8) { + throw new Test262Error('#664: 8388608 >>> 20 === 8. Actual: ' + (8388608 >>> 20)); +} + + +if (16777216 >>> 20 !== 16) { + throw new Test262Error('#665: 16777216 >>> 20 === 16. Actual: ' + (16777216 >>> 20)); +} + + +if (33554432 >>> 20 !== 32) { + throw new Test262Error('#666: 33554432 >>> 20 === 32. Actual: ' + (33554432 >>> 20)); +} + + +if (67108864 >>> 20 !== 64) { + throw new Test262Error('#667: 67108864 >>> 20 === 64. Actual: ' + (67108864 >>> 20)); +} + + +if (134217728 >>> 20 !== 128) { + throw new Test262Error('#668: 134217728 >>> 20 === 128. Actual: ' + (134217728 >>> 20)); +} + + +if (268435456 >>> 20 !== 256) { + throw new Test262Error('#669: 268435456 >>> 20 === 256. Actual: ' + (268435456 >>> 20)); +} + + +if (536870912 >>> 20 !== 512) { + throw new Test262Error('#670: 536870912 >>> 20 === 512. Actual: ' + (536870912 >>> 20)); +} + + +if (1073741824 >>> 20 !== 1024) { + throw new Test262Error('#671: 1073741824 >>> 20 === 1024. Actual: ' + (1073741824 >>> 20)); +} + + +if (2147483648 >>> 20 !== 2048) { + throw new Test262Error('#672: 2147483648 >>> 20 === 2048. Actual: ' + (2147483648 >>> 20)); +} + + +if (1 >>> 21 !== 0) { + throw new Test262Error('#673: 1 >>> 21 === 0. Actual: ' + (1 >>> 21)); +} + + +if (2 >>> 21 !== 0) { + throw new Test262Error('#674: 2 >>> 21 === 0. Actual: ' + (2 >>> 21)); +} + + +if (4 >>> 21 !== 0) { + throw new Test262Error('#675: 4 >>> 21 === 0. Actual: ' + (4 >>> 21)); +} + + +if (8 >>> 21 !== 0) { + throw new Test262Error('#676: 8 >>> 21 === 0. Actual: ' + (8 >>> 21)); +} + + +if (16 >>> 21 !== 0) { + throw new Test262Error('#677: 16 >>> 21 === 0. Actual: ' + (16 >>> 21)); +} + + +if (32 >>> 21 !== 0) { + throw new Test262Error('#678: 32 >>> 21 === 0. Actual: ' + (32 >>> 21)); +} + + +if (64 >>> 21 !== 0) { + throw new Test262Error('#679: 64 >>> 21 === 0. Actual: ' + (64 >>> 21)); +} + + +if (128 >>> 21 !== 0) { + throw new Test262Error('#680: 128 >>> 21 === 0. Actual: ' + (128 >>> 21)); +} + + +if (256 >>> 21 !== 0) { + throw new Test262Error('#681: 256 >>> 21 === 0. Actual: ' + (256 >>> 21)); +} + + +if (512 >>> 21 !== 0) { + throw new Test262Error('#682: 512 >>> 21 === 0. Actual: ' + (512 >>> 21)); +} + + +if (1024 >>> 21 !== 0) { + throw new Test262Error('#683: 1024 >>> 21 === 0. Actual: ' + (1024 >>> 21)); +} + + +if (2048 >>> 21 !== 0) { + throw new Test262Error('#684: 2048 >>> 21 === 0. Actual: ' + (2048 >>> 21)); +} + + +if (4096 >>> 21 !== 0) { + throw new Test262Error('#685: 4096 >>> 21 === 0. Actual: ' + (4096 >>> 21)); +} + + +if (8192 >>> 21 !== 0) { + throw new Test262Error('#686: 8192 >>> 21 === 0. Actual: ' + (8192 >>> 21)); +} + + +if (16384 >>> 21 !== 0) { + throw new Test262Error('#687: 16384 >>> 21 === 0. Actual: ' + (16384 >>> 21)); +} + + +if (32768 >>> 21 !== 0) { + throw new Test262Error('#688: 32768 >>> 21 === 0. Actual: ' + (32768 >>> 21)); +} + + +if (65536 >>> 21 !== 0) { + throw new Test262Error('#689: 65536 >>> 21 === 0. Actual: ' + (65536 >>> 21)); +} + + +if (131072 >>> 21 !== 0) { + throw new Test262Error('#690: 131072 >>> 21 === 0. Actual: ' + (131072 >>> 21)); +} + + +if (262144 >>> 21 !== 0) { + throw new Test262Error('#691: 262144 >>> 21 === 0. Actual: ' + (262144 >>> 21)); +} + + +if (524288 >>> 21 !== 0) { + throw new Test262Error('#692: 524288 >>> 21 === 0. Actual: ' + (524288 >>> 21)); +} + + +if (1048576 >>> 21 !== 0) { + throw new Test262Error('#693: 1048576 >>> 21 === 0. Actual: ' + (1048576 >>> 21)); +} + + +if (2097152 >>> 21 !== 1) { + throw new Test262Error('#694: 2097152 >>> 21 === 1. Actual: ' + (2097152 >>> 21)); +} + + +if (4194304 >>> 21 !== 2) { + throw new Test262Error('#695: 4194304 >>> 21 === 2. Actual: ' + (4194304 >>> 21)); +} + + +if (8388608 >>> 21 !== 4) { + throw new Test262Error('#696: 8388608 >>> 21 === 4. Actual: ' + (8388608 >>> 21)); +} + + +if (16777216 >>> 21 !== 8) { + throw new Test262Error('#697: 16777216 >>> 21 === 8. Actual: ' + (16777216 >>> 21)); +} + + +if (33554432 >>> 21 !== 16) { + throw new Test262Error('#698: 33554432 >>> 21 === 16. Actual: ' + (33554432 >>> 21)); +} + + +if (67108864 >>> 21 !== 32) { + throw new Test262Error('#699: 67108864 >>> 21 === 32. Actual: ' + (67108864 >>> 21)); +} + + +if (134217728 >>> 21 !== 64) { + throw new Test262Error('#700: 134217728 >>> 21 === 64. Actual: ' + (134217728 >>> 21)); +} + + +if (268435456 >>> 21 !== 128) { + throw new Test262Error('#701: 268435456 >>> 21 === 128. Actual: ' + (268435456 >>> 21)); +} + + +if (536870912 >>> 21 !== 256) { + throw new Test262Error('#702: 536870912 >>> 21 === 256. Actual: ' + (536870912 >>> 21)); +} + + +if (1073741824 >>> 21 !== 512) { + throw new Test262Error('#703: 1073741824 >>> 21 === 512. Actual: ' + (1073741824 >>> 21)); +} + + +if (2147483648 >>> 21 !== 1024) { + throw new Test262Error('#704: 2147483648 >>> 21 === 1024. Actual: ' + (2147483648 >>> 21)); +} + + +if (1 >>> 22 !== 0) { + throw new Test262Error('#705: 1 >>> 22 === 0. Actual: ' + (1 >>> 22)); +} + + +if (2 >>> 22 !== 0) { + throw new Test262Error('#706: 2 >>> 22 === 0. Actual: ' + (2 >>> 22)); +} + + +if (4 >>> 22 !== 0) { + throw new Test262Error('#707: 4 >>> 22 === 0. Actual: ' + (4 >>> 22)); +} + + +if (8 >>> 22 !== 0) { + throw new Test262Error('#708: 8 >>> 22 === 0. Actual: ' + (8 >>> 22)); +} + + +if (16 >>> 22 !== 0) { + throw new Test262Error('#709: 16 >>> 22 === 0. Actual: ' + (16 >>> 22)); +} + + +if (32 >>> 22 !== 0) { + throw new Test262Error('#710: 32 >>> 22 === 0. Actual: ' + (32 >>> 22)); +} + + +if (64 >>> 22 !== 0) { + throw new Test262Error('#711: 64 >>> 22 === 0. Actual: ' + (64 >>> 22)); +} + + +if (128 >>> 22 !== 0) { + throw new Test262Error('#712: 128 >>> 22 === 0. Actual: ' + (128 >>> 22)); +} + + +if (256 >>> 22 !== 0) { + throw new Test262Error('#713: 256 >>> 22 === 0. Actual: ' + (256 >>> 22)); +} + + +if (512 >>> 22 !== 0) { + throw new Test262Error('#714: 512 >>> 22 === 0. Actual: ' + (512 >>> 22)); +} + + +if (1024 >>> 22 !== 0) { + throw new Test262Error('#715: 1024 >>> 22 === 0. Actual: ' + (1024 >>> 22)); +} + + +if (2048 >>> 22 !== 0) { + throw new Test262Error('#716: 2048 >>> 22 === 0. Actual: ' + (2048 >>> 22)); +} + + +if (4096 >>> 22 !== 0) { + throw new Test262Error('#717: 4096 >>> 22 === 0. Actual: ' + (4096 >>> 22)); +} + + +if (8192 >>> 22 !== 0) { + throw new Test262Error('#718: 8192 >>> 22 === 0. Actual: ' + (8192 >>> 22)); +} + + +if (16384 >>> 22 !== 0) { + throw new Test262Error('#719: 16384 >>> 22 === 0. Actual: ' + (16384 >>> 22)); +} + + +if (32768 >>> 22 !== 0) { + throw new Test262Error('#720: 32768 >>> 22 === 0. Actual: ' + (32768 >>> 22)); +} + + +if (65536 >>> 22 !== 0) { + throw new Test262Error('#721: 65536 >>> 22 === 0. Actual: ' + (65536 >>> 22)); +} + + +if (131072 >>> 22 !== 0) { + throw new Test262Error('#722: 131072 >>> 22 === 0. Actual: ' + (131072 >>> 22)); +} + + +if (262144 >>> 22 !== 0) { + throw new Test262Error('#723: 262144 >>> 22 === 0. Actual: ' + (262144 >>> 22)); +} + + +if (524288 >>> 22 !== 0) { + throw new Test262Error('#724: 524288 >>> 22 === 0. Actual: ' + (524288 >>> 22)); +} + + +if (1048576 >>> 22 !== 0) { + throw new Test262Error('#725: 1048576 >>> 22 === 0. Actual: ' + (1048576 >>> 22)); +} + + +if (2097152 >>> 22 !== 0) { + throw new Test262Error('#726: 2097152 >>> 22 === 0. Actual: ' + (2097152 >>> 22)); +} + + +if (4194304 >>> 22 !== 1) { + throw new Test262Error('#727: 4194304 >>> 22 === 1. Actual: ' + (4194304 >>> 22)); +} + + +if (8388608 >>> 22 !== 2) { + throw new Test262Error('#728: 8388608 >>> 22 === 2. Actual: ' + (8388608 >>> 22)); +} + + +if (16777216 >>> 22 !== 4) { + throw new Test262Error('#729: 16777216 >>> 22 === 4. Actual: ' + (16777216 >>> 22)); +} + + +if (33554432 >>> 22 !== 8) { + throw new Test262Error('#730: 33554432 >>> 22 === 8. Actual: ' + (33554432 >>> 22)); +} + + +if (67108864 >>> 22 !== 16) { + throw new Test262Error('#731: 67108864 >>> 22 === 16. Actual: ' + (67108864 >>> 22)); +} + + +if (134217728 >>> 22 !== 32) { + throw new Test262Error('#732: 134217728 >>> 22 === 32. Actual: ' + (134217728 >>> 22)); +} + + +if (268435456 >>> 22 !== 64) { + throw new Test262Error('#733: 268435456 >>> 22 === 64. Actual: ' + (268435456 >>> 22)); +} + + +if (536870912 >>> 22 !== 128) { + throw new Test262Error('#734: 536870912 >>> 22 === 128. Actual: ' + (536870912 >>> 22)); +} + + +if (1073741824 >>> 22 !== 256) { + throw new Test262Error('#735: 1073741824 >>> 22 === 256. Actual: ' + (1073741824 >>> 22)); +} + + +if (2147483648 >>> 22 !== 512) { + throw new Test262Error('#736: 2147483648 >>> 22 === 512. Actual: ' + (2147483648 >>> 22)); +} + + +if (1 >>> 23 !== 0) { + throw new Test262Error('#737: 1 >>> 23 === 0. Actual: ' + (1 >>> 23)); +} + + +if (2 >>> 23 !== 0) { + throw new Test262Error('#738: 2 >>> 23 === 0. Actual: ' + (2 >>> 23)); +} + + +if (4 >>> 23 !== 0) { + throw new Test262Error('#739: 4 >>> 23 === 0. Actual: ' + (4 >>> 23)); +} + + +if (8 >>> 23 !== 0) { + throw new Test262Error('#740: 8 >>> 23 === 0. Actual: ' + (8 >>> 23)); +} + + +if (16 >>> 23 !== 0) { + throw new Test262Error('#741: 16 >>> 23 === 0. Actual: ' + (16 >>> 23)); +} + + +if (32 >>> 23 !== 0) { + throw new Test262Error('#742: 32 >>> 23 === 0. Actual: ' + (32 >>> 23)); +} + + +if (64 >>> 23 !== 0) { + throw new Test262Error('#743: 64 >>> 23 === 0. Actual: ' + (64 >>> 23)); +} + + +if (128 >>> 23 !== 0) { + throw new Test262Error('#744: 128 >>> 23 === 0. Actual: ' + (128 >>> 23)); +} + + +if (256 >>> 23 !== 0) { + throw new Test262Error('#745: 256 >>> 23 === 0. Actual: ' + (256 >>> 23)); +} + + +if (512 >>> 23 !== 0) { + throw new Test262Error('#746: 512 >>> 23 === 0. Actual: ' + (512 >>> 23)); +} + + +if (1024 >>> 23 !== 0) { + throw new Test262Error('#747: 1024 >>> 23 === 0. Actual: ' + (1024 >>> 23)); +} + + +if (2048 >>> 23 !== 0) { + throw new Test262Error('#748: 2048 >>> 23 === 0. Actual: ' + (2048 >>> 23)); +} + + +if (4096 >>> 23 !== 0) { + throw new Test262Error('#749: 4096 >>> 23 === 0. Actual: ' + (4096 >>> 23)); +} + + +if (8192 >>> 23 !== 0) { + throw new Test262Error('#750: 8192 >>> 23 === 0. Actual: ' + (8192 >>> 23)); +} + + +if (16384 >>> 23 !== 0) { + throw new Test262Error('#751: 16384 >>> 23 === 0. Actual: ' + (16384 >>> 23)); +} + + +if (32768 >>> 23 !== 0) { + throw new Test262Error('#752: 32768 >>> 23 === 0. Actual: ' + (32768 >>> 23)); +} + + +if (65536 >>> 23 !== 0) { + throw new Test262Error('#753: 65536 >>> 23 === 0. Actual: ' + (65536 >>> 23)); +} + + +if (131072 >>> 23 !== 0) { + throw new Test262Error('#754: 131072 >>> 23 === 0. Actual: ' + (131072 >>> 23)); +} + + +if (262144 >>> 23 !== 0) { + throw new Test262Error('#755: 262144 >>> 23 === 0. Actual: ' + (262144 >>> 23)); +} + + +if (524288 >>> 23 !== 0) { + throw new Test262Error('#756: 524288 >>> 23 === 0. Actual: ' + (524288 >>> 23)); +} + + +if (1048576 >>> 23 !== 0) { + throw new Test262Error('#757: 1048576 >>> 23 === 0. Actual: ' + (1048576 >>> 23)); +} + + +if (2097152 >>> 23 !== 0) { + throw new Test262Error('#758: 2097152 >>> 23 === 0. Actual: ' + (2097152 >>> 23)); +} + + +if (4194304 >>> 23 !== 0) { + throw new Test262Error('#759: 4194304 >>> 23 === 0. Actual: ' + (4194304 >>> 23)); +} + + +if (8388608 >>> 23 !== 1) { + throw new Test262Error('#760: 8388608 >>> 23 === 1. Actual: ' + (8388608 >>> 23)); +} + + +if (16777216 >>> 23 !== 2) { + throw new Test262Error('#761: 16777216 >>> 23 === 2. Actual: ' + (16777216 >>> 23)); +} + + +if (33554432 >>> 23 !== 4) { + throw new Test262Error('#762: 33554432 >>> 23 === 4. Actual: ' + (33554432 >>> 23)); +} + + +if (67108864 >>> 23 !== 8) { + throw new Test262Error('#763: 67108864 >>> 23 === 8. Actual: ' + (67108864 >>> 23)); +} + + +if (134217728 >>> 23 !== 16) { + throw new Test262Error('#764: 134217728 >>> 23 === 16. Actual: ' + (134217728 >>> 23)); +} + + +if (268435456 >>> 23 !== 32) { + throw new Test262Error('#765: 268435456 >>> 23 === 32. Actual: ' + (268435456 >>> 23)); +} + + +if (536870912 >>> 23 !== 64) { + throw new Test262Error('#766: 536870912 >>> 23 === 64. Actual: ' + (536870912 >>> 23)); +} + + +if (1073741824 >>> 23 !== 128) { + throw new Test262Error('#767: 1073741824 >>> 23 === 128. Actual: ' + (1073741824 >>> 23)); +} + + +if (2147483648 >>> 23 !== 256) { + throw new Test262Error('#768: 2147483648 >>> 23 === 256. Actual: ' + (2147483648 >>> 23)); +} + + +if (1 >>> 24 !== 0) { + throw new Test262Error('#769: 1 >>> 24 === 0. Actual: ' + (1 >>> 24)); +} + + +if (2 >>> 24 !== 0) { + throw new Test262Error('#770: 2 >>> 24 === 0. Actual: ' + (2 >>> 24)); +} + + +if (4 >>> 24 !== 0) { + throw new Test262Error('#771: 4 >>> 24 === 0. Actual: ' + (4 >>> 24)); +} + + +if (8 >>> 24 !== 0) { + throw new Test262Error('#772: 8 >>> 24 === 0. Actual: ' + (8 >>> 24)); +} + + +if (16 >>> 24 !== 0) { + throw new Test262Error('#773: 16 >>> 24 === 0. Actual: ' + (16 >>> 24)); +} + + +if (32 >>> 24 !== 0) { + throw new Test262Error('#774: 32 >>> 24 === 0. Actual: ' + (32 >>> 24)); +} + + +if (64 >>> 24 !== 0) { + throw new Test262Error('#775: 64 >>> 24 === 0. Actual: ' + (64 >>> 24)); +} + + +if (128 >>> 24 !== 0) { + throw new Test262Error('#776: 128 >>> 24 === 0. Actual: ' + (128 >>> 24)); +} + + +if (256 >>> 24 !== 0) { + throw new Test262Error('#777: 256 >>> 24 === 0. Actual: ' + (256 >>> 24)); +} + + +if (512 >>> 24 !== 0) { + throw new Test262Error('#778: 512 >>> 24 === 0. Actual: ' + (512 >>> 24)); +} + + +if (1024 >>> 24 !== 0) { + throw new Test262Error('#779: 1024 >>> 24 === 0. Actual: ' + (1024 >>> 24)); +} + + +if (2048 >>> 24 !== 0) { + throw new Test262Error('#780: 2048 >>> 24 === 0. Actual: ' + (2048 >>> 24)); +} + + +if (4096 >>> 24 !== 0) { + throw new Test262Error('#781: 4096 >>> 24 === 0. Actual: ' + (4096 >>> 24)); +} + + +if (8192 >>> 24 !== 0) { + throw new Test262Error('#782: 8192 >>> 24 === 0. Actual: ' + (8192 >>> 24)); +} + + +if (16384 >>> 24 !== 0) { + throw new Test262Error('#783: 16384 >>> 24 === 0. Actual: ' + (16384 >>> 24)); +} + + +if (32768 >>> 24 !== 0) { + throw new Test262Error('#784: 32768 >>> 24 === 0. Actual: ' + (32768 >>> 24)); +} + + +if (65536 >>> 24 !== 0) { + throw new Test262Error('#785: 65536 >>> 24 === 0. Actual: ' + (65536 >>> 24)); +} + + +if (131072 >>> 24 !== 0) { + throw new Test262Error('#786: 131072 >>> 24 === 0. Actual: ' + (131072 >>> 24)); +} + + +if (262144 >>> 24 !== 0) { + throw new Test262Error('#787: 262144 >>> 24 === 0. Actual: ' + (262144 >>> 24)); +} + + +if (524288 >>> 24 !== 0) { + throw new Test262Error('#788: 524288 >>> 24 === 0. Actual: ' + (524288 >>> 24)); +} + + +if (1048576 >>> 24 !== 0) { + throw new Test262Error('#789: 1048576 >>> 24 === 0. Actual: ' + (1048576 >>> 24)); +} + + +if (2097152 >>> 24 !== 0) { + throw new Test262Error('#790: 2097152 >>> 24 === 0. Actual: ' + (2097152 >>> 24)); +} + + +if (4194304 >>> 24 !== 0) { + throw new Test262Error('#791: 4194304 >>> 24 === 0. Actual: ' + (4194304 >>> 24)); +} + + +if (8388608 >>> 24 !== 0) { + throw new Test262Error('#792: 8388608 >>> 24 === 0. Actual: ' + (8388608 >>> 24)); +} + + +if (16777216 >>> 24 !== 1) { + throw new Test262Error('#793: 16777216 >>> 24 === 1. Actual: ' + (16777216 >>> 24)); +} + + +if (33554432 >>> 24 !== 2) { + throw new Test262Error('#794: 33554432 >>> 24 === 2. Actual: ' + (33554432 >>> 24)); +} + + +if (67108864 >>> 24 !== 4) { + throw new Test262Error('#795: 67108864 >>> 24 === 4. Actual: ' + (67108864 >>> 24)); +} + + +if (134217728 >>> 24 !== 8) { + throw new Test262Error('#796: 134217728 >>> 24 === 8. Actual: ' + (134217728 >>> 24)); +} + + +if (268435456 >>> 24 !== 16) { + throw new Test262Error('#797: 268435456 >>> 24 === 16. Actual: ' + (268435456 >>> 24)); +} + + +if (536870912 >>> 24 !== 32) { + throw new Test262Error('#798: 536870912 >>> 24 === 32. Actual: ' + (536870912 >>> 24)); +} + + +if (1073741824 >>> 24 !== 64) { + throw new Test262Error('#799: 1073741824 >>> 24 === 64. Actual: ' + (1073741824 >>> 24)); +} + + +if (2147483648 >>> 24 !== 128) { + throw new Test262Error('#800: 2147483648 >>> 24 === 128. Actual: ' + (2147483648 >>> 24)); +} + + +if (1 >>> 25 !== 0) { + throw new Test262Error('#801: 1 >>> 25 === 0. Actual: ' + (1 >>> 25)); +} + + +if (2 >>> 25 !== 0) { + throw new Test262Error('#802: 2 >>> 25 === 0. Actual: ' + (2 >>> 25)); +} + + +if (4 >>> 25 !== 0) { + throw new Test262Error('#803: 4 >>> 25 === 0. Actual: ' + (4 >>> 25)); +} + + +if (8 >>> 25 !== 0) { + throw new Test262Error('#804: 8 >>> 25 === 0. Actual: ' + (8 >>> 25)); +} + + +if (16 >>> 25 !== 0) { + throw new Test262Error('#805: 16 >>> 25 === 0. Actual: ' + (16 >>> 25)); +} + + +if (32 >>> 25 !== 0) { + throw new Test262Error('#806: 32 >>> 25 === 0. Actual: ' + (32 >>> 25)); +} + + +if (64 >>> 25 !== 0) { + throw new Test262Error('#807: 64 >>> 25 === 0. Actual: ' + (64 >>> 25)); +} + + +if (128 >>> 25 !== 0) { + throw new Test262Error('#808: 128 >>> 25 === 0. Actual: ' + (128 >>> 25)); +} + + +if (256 >>> 25 !== 0) { + throw new Test262Error('#809: 256 >>> 25 === 0. Actual: ' + (256 >>> 25)); +} + + +if (512 >>> 25 !== 0) { + throw new Test262Error('#810: 512 >>> 25 === 0. Actual: ' + (512 >>> 25)); +} + + +if (1024 >>> 25 !== 0) { + throw new Test262Error('#811: 1024 >>> 25 === 0. Actual: ' + (1024 >>> 25)); +} + + +if (2048 >>> 25 !== 0) { + throw new Test262Error('#812: 2048 >>> 25 === 0. Actual: ' + (2048 >>> 25)); +} + + +if (4096 >>> 25 !== 0) { + throw new Test262Error('#813: 4096 >>> 25 === 0. Actual: ' + (4096 >>> 25)); +} + + +if (8192 >>> 25 !== 0) { + throw new Test262Error('#814: 8192 >>> 25 === 0. Actual: ' + (8192 >>> 25)); +} + + +if (16384 >>> 25 !== 0) { + throw new Test262Error('#815: 16384 >>> 25 === 0. Actual: ' + (16384 >>> 25)); +} + + +if (32768 >>> 25 !== 0) { + throw new Test262Error('#816: 32768 >>> 25 === 0. Actual: ' + (32768 >>> 25)); +} + + +if (65536 >>> 25 !== 0) { + throw new Test262Error('#817: 65536 >>> 25 === 0. Actual: ' + (65536 >>> 25)); +} + + +if (131072 >>> 25 !== 0) { + throw new Test262Error('#818: 131072 >>> 25 === 0. Actual: ' + (131072 >>> 25)); +} + + +if (262144 >>> 25 !== 0) { + throw new Test262Error('#819: 262144 >>> 25 === 0. Actual: ' + (262144 >>> 25)); +} + + +if (524288 >>> 25 !== 0) { + throw new Test262Error('#820: 524288 >>> 25 === 0. Actual: ' + (524288 >>> 25)); +} + + +if (1048576 >>> 25 !== 0) { + throw new Test262Error('#821: 1048576 >>> 25 === 0. Actual: ' + (1048576 >>> 25)); +} + + +if (2097152 >>> 25 !== 0) { + throw new Test262Error('#822: 2097152 >>> 25 === 0. Actual: ' + (2097152 >>> 25)); +} + + +if (4194304 >>> 25 !== 0) { + throw new Test262Error('#823: 4194304 >>> 25 === 0. Actual: ' + (4194304 >>> 25)); +} + + +if (8388608 >>> 25 !== 0) { + throw new Test262Error('#824: 8388608 >>> 25 === 0. Actual: ' + (8388608 >>> 25)); +} + + +if (16777216 >>> 25 !== 0) { + throw new Test262Error('#825: 16777216 >>> 25 === 0. Actual: ' + (16777216 >>> 25)); +} + + +if (33554432 >>> 25 !== 1) { + throw new Test262Error('#826: 33554432 >>> 25 === 1. Actual: ' + (33554432 >>> 25)); +} + + +if (67108864 >>> 25 !== 2) { + throw new Test262Error('#827: 67108864 >>> 25 === 2. Actual: ' + (67108864 >>> 25)); +} + + +if (134217728 >>> 25 !== 4) { + throw new Test262Error('#828: 134217728 >>> 25 === 4. Actual: ' + (134217728 >>> 25)); +} + + +if (268435456 >>> 25 !== 8) { + throw new Test262Error('#829: 268435456 >>> 25 === 8. Actual: ' + (268435456 >>> 25)); +} + + +if (536870912 >>> 25 !== 16) { + throw new Test262Error('#830: 536870912 >>> 25 === 16. Actual: ' + (536870912 >>> 25)); +} + + +if (1073741824 >>> 25 !== 32) { + throw new Test262Error('#831: 1073741824 >>> 25 === 32. Actual: ' + (1073741824 >>> 25)); +} + + +if (2147483648 >>> 25 !== 64) { + throw new Test262Error('#832: 2147483648 >>> 25 === 64. Actual: ' + (2147483648 >>> 25)); +} + + +if (1 >>> 26 !== 0) { + throw new Test262Error('#833: 1 >>> 26 === 0. Actual: ' + (1 >>> 26)); +} + + +if (2 >>> 26 !== 0) { + throw new Test262Error('#834: 2 >>> 26 === 0. Actual: ' + (2 >>> 26)); +} + + +if (4 >>> 26 !== 0) { + throw new Test262Error('#835: 4 >>> 26 === 0. Actual: ' + (4 >>> 26)); +} + + +if (8 >>> 26 !== 0) { + throw new Test262Error('#836: 8 >>> 26 === 0. Actual: ' + (8 >>> 26)); +} + + +if (16 >>> 26 !== 0) { + throw new Test262Error('#837: 16 >>> 26 === 0. Actual: ' + (16 >>> 26)); +} + + +if (32 >>> 26 !== 0) { + throw new Test262Error('#838: 32 >>> 26 === 0. Actual: ' + (32 >>> 26)); +} + + +if (64 >>> 26 !== 0) { + throw new Test262Error('#839: 64 >>> 26 === 0. Actual: ' + (64 >>> 26)); +} + + +if (128 >>> 26 !== 0) { + throw new Test262Error('#840: 128 >>> 26 === 0. Actual: ' + (128 >>> 26)); +} + + +if (256 >>> 26 !== 0) { + throw new Test262Error('#841: 256 >>> 26 === 0. Actual: ' + (256 >>> 26)); +} + + +if (512 >>> 26 !== 0) { + throw new Test262Error('#842: 512 >>> 26 === 0. Actual: ' + (512 >>> 26)); +} + + +if (1024 >>> 26 !== 0) { + throw new Test262Error('#843: 1024 >>> 26 === 0. Actual: ' + (1024 >>> 26)); +} + + +if (2048 >>> 26 !== 0) { + throw new Test262Error('#844: 2048 >>> 26 === 0. Actual: ' + (2048 >>> 26)); +} + + +if (4096 >>> 26 !== 0) { + throw new Test262Error('#845: 4096 >>> 26 === 0. Actual: ' + (4096 >>> 26)); +} + + +if (8192 >>> 26 !== 0) { + throw new Test262Error('#846: 8192 >>> 26 === 0. Actual: ' + (8192 >>> 26)); +} + + +if (16384 >>> 26 !== 0) { + throw new Test262Error('#847: 16384 >>> 26 === 0. Actual: ' + (16384 >>> 26)); +} + + +if (32768 >>> 26 !== 0) { + throw new Test262Error('#848: 32768 >>> 26 === 0. Actual: ' + (32768 >>> 26)); +} + + +if (65536 >>> 26 !== 0) { + throw new Test262Error('#849: 65536 >>> 26 === 0. Actual: ' + (65536 >>> 26)); +} + + +if (131072 >>> 26 !== 0) { + throw new Test262Error('#850: 131072 >>> 26 === 0. Actual: ' + (131072 >>> 26)); +} + + +if (262144 >>> 26 !== 0) { + throw new Test262Error('#851: 262144 >>> 26 === 0. Actual: ' + (262144 >>> 26)); +} + + +if (524288 >>> 26 !== 0) { + throw new Test262Error('#852: 524288 >>> 26 === 0. Actual: ' + (524288 >>> 26)); +} + + +if (1048576 >>> 26 !== 0) { + throw new Test262Error('#853: 1048576 >>> 26 === 0. Actual: ' + (1048576 >>> 26)); +} + + +if (2097152 >>> 26 !== 0) { + throw new Test262Error('#854: 2097152 >>> 26 === 0. Actual: ' + (2097152 >>> 26)); +} + + +if (4194304 >>> 26 !== 0) { + throw new Test262Error('#855: 4194304 >>> 26 === 0. Actual: ' + (4194304 >>> 26)); +} + + +if (8388608 >>> 26 !== 0) { + throw new Test262Error('#856: 8388608 >>> 26 === 0. Actual: ' + (8388608 >>> 26)); +} + + +if (16777216 >>> 26 !== 0) { + throw new Test262Error('#857: 16777216 >>> 26 === 0. Actual: ' + (16777216 >>> 26)); +} + + +if (33554432 >>> 26 !== 0) { + throw new Test262Error('#858: 33554432 >>> 26 === 0. Actual: ' + (33554432 >>> 26)); +} + + +if (67108864 >>> 26 !== 1) { + throw new Test262Error('#859: 67108864 >>> 26 === 1. Actual: ' + (67108864 >>> 26)); +} + + +if (134217728 >>> 26 !== 2) { + throw new Test262Error('#860: 134217728 >>> 26 === 2. Actual: ' + (134217728 >>> 26)); +} + + +if (268435456 >>> 26 !== 4) { + throw new Test262Error('#861: 268435456 >>> 26 === 4. Actual: ' + (268435456 >>> 26)); +} + + +if (536870912 >>> 26 !== 8) { + throw new Test262Error('#862: 536870912 >>> 26 === 8. Actual: ' + (536870912 >>> 26)); +} + + +if (1073741824 >>> 26 !== 16) { + throw new Test262Error('#863: 1073741824 >>> 26 === 16. Actual: ' + (1073741824 >>> 26)); +} + + +if (2147483648 >>> 26 !== 32) { + throw new Test262Error('#864: 2147483648 >>> 26 === 32. Actual: ' + (2147483648 >>> 26)); +} + + +if (1 >>> 27 !== 0) { + throw new Test262Error('#865: 1 >>> 27 === 0. Actual: ' + (1 >>> 27)); +} + + +if (2 >>> 27 !== 0) { + throw new Test262Error('#866: 2 >>> 27 === 0. Actual: ' + (2 >>> 27)); +} + + +if (4 >>> 27 !== 0) { + throw new Test262Error('#867: 4 >>> 27 === 0. Actual: ' + (4 >>> 27)); +} + + +if (8 >>> 27 !== 0) { + throw new Test262Error('#868: 8 >>> 27 === 0. Actual: ' + (8 >>> 27)); +} + + +if (16 >>> 27 !== 0) { + throw new Test262Error('#869: 16 >>> 27 === 0. Actual: ' + (16 >>> 27)); +} + + +if (32 >>> 27 !== 0) { + throw new Test262Error('#870: 32 >>> 27 === 0. Actual: ' + (32 >>> 27)); +} + + +if (64 >>> 27 !== 0) { + throw new Test262Error('#871: 64 >>> 27 === 0. Actual: ' + (64 >>> 27)); +} + + +if (128 >>> 27 !== 0) { + throw new Test262Error('#872: 128 >>> 27 === 0. Actual: ' + (128 >>> 27)); +} + + +if (256 >>> 27 !== 0) { + throw new Test262Error('#873: 256 >>> 27 === 0. Actual: ' + (256 >>> 27)); +} + + +if (512 >>> 27 !== 0) { + throw new Test262Error('#874: 512 >>> 27 === 0. Actual: ' + (512 >>> 27)); +} + + +if (1024 >>> 27 !== 0) { + throw new Test262Error('#875: 1024 >>> 27 === 0. Actual: ' + (1024 >>> 27)); +} + + +if (2048 >>> 27 !== 0) { + throw new Test262Error('#876: 2048 >>> 27 === 0. Actual: ' + (2048 >>> 27)); +} + + +if (4096 >>> 27 !== 0) { + throw new Test262Error('#877: 4096 >>> 27 === 0. Actual: ' + (4096 >>> 27)); +} + + +if (8192 >>> 27 !== 0) { + throw new Test262Error('#878: 8192 >>> 27 === 0. Actual: ' + (8192 >>> 27)); +} + + +if (16384 >>> 27 !== 0) { + throw new Test262Error('#879: 16384 >>> 27 === 0. Actual: ' + (16384 >>> 27)); +} + + +if (32768 >>> 27 !== 0) { + throw new Test262Error('#880: 32768 >>> 27 === 0. Actual: ' + (32768 >>> 27)); +} + + +if (65536 >>> 27 !== 0) { + throw new Test262Error('#881: 65536 >>> 27 === 0. Actual: ' + (65536 >>> 27)); +} + + +if (131072 >>> 27 !== 0) { + throw new Test262Error('#882: 131072 >>> 27 === 0. Actual: ' + (131072 >>> 27)); +} + + +if (262144 >>> 27 !== 0) { + throw new Test262Error('#883: 262144 >>> 27 === 0. Actual: ' + (262144 >>> 27)); +} + + +if (524288 >>> 27 !== 0) { + throw new Test262Error('#884: 524288 >>> 27 === 0. Actual: ' + (524288 >>> 27)); +} + + +if (1048576 >>> 27 !== 0) { + throw new Test262Error('#885: 1048576 >>> 27 === 0. Actual: ' + (1048576 >>> 27)); +} + + +if (2097152 >>> 27 !== 0) { + throw new Test262Error('#886: 2097152 >>> 27 === 0. Actual: ' + (2097152 >>> 27)); +} + + +if (4194304 >>> 27 !== 0) { + throw new Test262Error('#887: 4194304 >>> 27 === 0. Actual: ' + (4194304 >>> 27)); +} + + +if (8388608 >>> 27 !== 0) { + throw new Test262Error('#888: 8388608 >>> 27 === 0. Actual: ' + (8388608 >>> 27)); +} + + +if (16777216 >>> 27 !== 0) { + throw new Test262Error('#889: 16777216 >>> 27 === 0. Actual: ' + (16777216 >>> 27)); +} + + +if (33554432 >>> 27 !== 0) { + throw new Test262Error('#890: 33554432 >>> 27 === 0. Actual: ' + (33554432 >>> 27)); +} + + +if (67108864 >>> 27 !== 0) { + throw new Test262Error('#891: 67108864 >>> 27 === 0. Actual: ' + (67108864 >>> 27)); +} + + +if (134217728 >>> 27 !== 1) { + throw new Test262Error('#892: 134217728 >>> 27 === 1. Actual: ' + (134217728 >>> 27)); +} + + +if (268435456 >>> 27 !== 2) { + throw new Test262Error('#893: 268435456 >>> 27 === 2. Actual: ' + (268435456 >>> 27)); +} + + +if (536870912 >>> 27 !== 4) { + throw new Test262Error('#894: 536870912 >>> 27 === 4. Actual: ' + (536870912 >>> 27)); +} + + +if (1073741824 >>> 27 !== 8) { + throw new Test262Error('#895: 1073741824 >>> 27 === 8. Actual: ' + (1073741824 >>> 27)); +} + + +if (2147483648 >>> 27 !== 16) { + throw new Test262Error('#896: 2147483648 >>> 27 === 16. Actual: ' + (2147483648 >>> 27)); +} + + +if (1 >>> 28 !== 0) { + throw new Test262Error('#897: 1 >>> 28 === 0. Actual: ' + (1 >>> 28)); +} + + +if (2 >>> 28 !== 0) { + throw new Test262Error('#898: 2 >>> 28 === 0. Actual: ' + (2 >>> 28)); +} + + +if (4 >>> 28 !== 0) { + throw new Test262Error('#899: 4 >>> 28 === 0. Actual: ' + (4 >>> 28)); +} + + +if (8 >>> 28 !== 0) { + throw new Test262Error('#900: 8 >>> 28 === 0. Actual: ' + (8 >>> 28)); +} + + +if (16 >>> 28 !== 0) { + throw new Test262Error('#901: 16 >>> 28 === 0. Actual: ' + (16 >>> 28)); +} + + +if (32 >>> 28 !== 0) { + throw new Test262Error('#902: 32 >>> 28 === 0. Actual: ' + (32 >>> 28)); +} + + +if (64 >>> 28 !== 0) { + throw new Test262Error('#903: 64 >>> 28 === 0. Actual: ' + (64 >>> 28)); +} + + +if (128 >>> 28 !== 0) { + throw new Test262Error('#904: 128 >>> 28 === 0. Actual: ' + (128 >>> 28)); +} + + +if (256 >>> 28 !== 0) { + throw new Test262Error('#905: 256 >>> 28 === 0. Actual: ' + (256 >>> 28)); +} + + +if (512 >>> 28 !== 0) { + throw new Test262Error('#906: 512 >>> 28 === 0. Actual: ' + (512 >>> 28)); +} + + +if (1024 >>> 28 !== 0) { + throw new Test262Error('#907: 1024 >>> 28 === 0. Actual: ' + (1024 >>> 28)); +} + + +if (2048 >>> 28 !== 0) { + throw new Test262Error('#908: 2048 >>> 28 === 0. Actual: ' + (2048 >>> 28)); +} + + +if (4096 >>> 28 !== 0) { + throw new Test262Error('#909: 4096 >>> 28 === 0. Actual: ' + (4096 >>> 28)); +} + + +if (8192 >>> 28 !== 0) { + throw new Test262Error('#910: 8192 >>> 28 === 0. Actual: ' + (8192 >>> 28)); +} + + +if (16384 >>> 28 !== 0) { + throw new Test262Error('#911: 16384 >>> 28 === 0. Actual: ' + (16384 >>> 28)); +} + + +if (32768 >>> 28 !== 0) { + throw new Test262Error('#912: 32768 >>> 28 === 0. Actual: ' + (32768 >>> 28)); +} + + +if (65536 >>> 28 !== 0) { + throw new Test262Error('#913: 65536 >>> 28 === 0. Actual: ' + (65536 >>> 28)); +} + + +if (131072 >>> 28 !== 0) { + throw new Test262Error('#914: 131072 >>> 28 === 0. Actual: ' + (131072 >>> 28)); +} + + +if (262144 >>> 28 !== 0) { + throw new Test262Error('#915: 262144 >>> 28 === 0. Actual: ' + (262144 >>> 28)); +} + + +if (524288 >>> 28 !== 0) { + throw new Test262Error('#916: 524288 >>> 28 === 0. Actual: ' + (524288 >>> 28)); +} + + +if (1048576 >>> 28 !== 0) { + throw new Test262Error('#917: 1048576 >>> 28 === 0. Actual: ' + (1048576 >>> 28)); +} + + +if (2097152 >>> 28 !== 0) { + throw new Test262Error('#918: 2097152 >>> 28 === 0. Actual: ' + (2097152 >>> 28)); +} + + +if (4194304 >>> 28 !== 0) { + throw new Test262Error('#919: 4194304 >>> 28 === 0. Actual: ' + (4194304 >>> 28)); +} + + +if (8388608 >>> 28 !== 0) { + throw new Test262Error('#920: 8388608 >>> 28 === 0. Actual: ' + (8388608 >>> 28)); +} + + +if (16777216 >>> 28 !== 0) { + throw new Test262Error('#921: 16777216 >>> 28 === 0. Actual: ' + (16777216 >>> 28)); +} + + +if (33554432 >>> 28 !== 0) { + throw new Test262Error('#922: 33554432 >>> 28 === 0. Actual: ' + (33554432 >>> 28)); +} + + +if (67108864 >>> 28 !== 0) { + throw new Test262Error('#923: 67108864 >>> 28 === 0. Actual: ' + (67108864 >>> 28)); +} + + +if (134217728 >>> 28 !== 0) { + throw new Test262Error('#924: 134217728 >>> 28 === 0. Actual: ' + (134217728 >>> 28)); +} + + +if (268435456 >>> 28 !== 1) { + throw new Test262Error('#925: 268435456 >>> 28 === 1. Actual: ' + (268435456 >>> 28)); +} + + +if (536870912 >>> 28 !== 2) { + throw new Test262Error('#926: 536870912 >>> 28 === 2. Actual: ' + (536870912 >>> 28)); +} + + +if (1073741824 >>> 28 !== 4) { + throw new Test262Error('#927: 1073741824 >>> 28 === 4. Actual: ' + (1073741824 >>> 28)); +} + + +if (2147483648 >>> 28 !== 8) { + throw new Test262Error('#928: 2147483648 >>> 28 === 8. Actual: ' + (2147483648 >>> 28)); +} + + +if (1 >>> 29 !== 0) { + throw new Test262Error('#929: 1 >>> 29 === 0. Actual: ' + (1 >>> 29)); +} + + +if (2 >>> 29 !== 0) { + throw new Test262Error('#930: 2 >>> 29 === 0. Actual: ' + (2 >>> 29)); +} + + +if (4 >>> 29 !== 0) { + throw new Test262Error('#931: 4 >>> 29 === 0. Actual: ' + (4 >>> 29)); +} + + +if (8 >>> 29 !== 0) { + throw new Test262Error('#932: 8 >>> 29 === 0. Actual: ' + (8 >>> 29)); +} + + +if (16 >>> 29 !== 0) { + throw new Test262Error('#933: 16 >>> 29 === 0. Actual: ' + (16 >>> 29)); +} + + +if (32 >>> 29 !== 0) { + throw new Test262Error('#934: 32 >>> 29 === 0. Actual: ' + (32 >>> 29)); +} + + +if (64 >>> 29 !== 0) { + throw new Test262Error('#935: 64 >>> 29 === 0. Actual: ' + (64 >>> 29)); +} + + +if (128 >>> 29 !== 0) { + throw new Test262Error('#936: 128 >>> 29 === 0. Actual: ' + (128 >>> 29)); +} + + +if (256 >>> 29 !== 0) { + throw new Test262Error('#937: 256 >>> 29 === 0. Actual: ' + (256 >>> 29)); +} + + +if (512 >>> 29 !== 0) { + throw new Test262Error('#938: 512 >>> 29 === 0. Actual: ' + (512 >>> 29)); +} + + +if (1024 >>> 29 !== 0) { + throw new Test262Error('#939: 1024 >>> 29 === 0. Actual: ' + (1024 >>> 29)); +} + + +if (2048 >>> 29 !== 0) { + throw new Test262Error('#940: 2048 >>> 29 === 0. Actual: ' + (2048 >>> 29)); +} + + +if (4096 >>> 29 !== 0) { + throw new Test262Error('#941: 4096 >>> 29 === 0. Actual: ' + (4096 >>> 29)); +} + + +if (8192 >>> 29 !== 0) { + throw new Test262Error('#942: 8192 >>> 29 === 0. Actual: ' + (8192 >>> 29)); +} + + +if (16384 >>> 29 !== 0) { + throw new Test262Error('#943: 16384 >>> 29 === 0. Actual: ' + (16384 >>> 29)); +} + + +if (32768 >>> 29 !== 0) { + throw new Test262Error('#944: 32768 >>> 29 === 0. Actual: ' + (32768 >>> 29)); +} + + +if (65536 >>> 29 !== 0) { + throw new Test262Error('#945: 65536 >>> 29 === 0. Actual: ' + (65536 >>> 29)); +} + + +if (131072 >>> 29 !== 0) { + throw new Test262Error('#946: 131072 >>> 29 === 0. Actual: ' + (131072 >>> 29)); +} + + +if (262144 >>> 29 !== 0) { + throw new Test262Error('#947: 262144 >>> 29 === 0. Actual: ' + (262144 >>> 29)); +} + + +if (524288 >>> 29 !== 0) { + throw new Test262Error('#948: 524288 >>> 29 === 0. Actual: ' + (524288 >>> 29)); +} + + +if (1048576 >>> 29 !== 0) { + throw new Test262Error('#949: 1048576 >>> 29 === 0. Actual: ' + (1048576 >>> 29)); +} + + +if (2097152 >>> 29 !== 0) { + throw new Test262Error('#950: 2097152 >>> 29 === 0. Actual: ' + (2097152 >>> 29)); +} + + +if (4194304 >>> 29 !== 0) { + throw new Test262Error('#951: 4194304 >>> 29 === 0. Actual: ' + (4194304 >>> 29)); +} + + +if (8388608 >>> 29 !== 0) { + throw new Test262Error('#952: 8388608 >>> 29 === 0. Actual: ' + (8388608 >>> 29)); +} + + +if (16777216 >>> 29 !== 0) { + throw new Test262Error('#953: 16777216 >>> 29 === 0. Actual: ' + (16777216 >>> 29)); +} + + +if (33554432 >>> 29 !== 0) { + throw new Test262Error('#954: 33554432 >>> 29 === 0. Actual: ' + (33554432 >>> 29)); +} + + +if (67108864 >>> 29 !== 0) { + throw new Test262Error('#955: 67108864 >>> 29 === 0. Actual: ' + (67108864 >>> 29)); +} + + +if (134217728 >>> 29 !== 0) { + throw new Test262Error('#956: 134217728 >>> 29 === 0. Actual: ' + (134217728 >>> 29)); +} + + +if (268435456 >>> 29 !== 0) { + throw new Test262Error('#957: 268435456 >>> 29 === 0. Actual: ' + (268435456 >>> 29)); +} + + +if (536870912 >>> 29 !== 1) { + throw new Test262Error('#958: 536870912 >>> 29 === 1. Actual: ' + (536870912 >>> 29)); +} + + +if (1073741824 >>> 29 !== 2) { + throw new Test262Error('#959: 1073741824 >>> 29 === 2. Actual: ' + (1073741824 >>> 29)); +} + + +if (2147483648 >>> 29 !== 4) { + throw new Test262Error('#960: 2147483648 >>> 29 === 4. Actual: ' + (2147483648 >>> 29)); +} + + +if (1 >>> 30 !== 0) { + throw new Test262Error('#961: 1 >>> 30 === 0. Actual: ' + (1 >>> 30)); +} + + +if (2 >>> 30 !== 0) { + throw new Test262Error('#962: 2 >>> 30 === 0. Actual: ' + (2 >>> 30)); +} + + +if (4 >>> 30 !== 0) { + throw new Test262Error('#963: 4 >>> 30 === 0. Actual: ' + (4 >>> 30)); +} + + +if (8 >>> 30 !== 0) { + throw new Test262Error('#964: 8 >>> 30 === 0. Actual: ' + (8 >>> 30)); +} + + +if (16 >>> 30 !== 0) { + throw new Test262Error('#965: 16 >>> 30 === 0. Actual: ' + (16 >>> 30)); +} + + +if (32 >>> 30 !== 0) { + throw new Test262Error('#966: 32 >>> 30 === 0. Actual: ' + (32 >>> 30)); +} + + +if (64 >>> 30 !== 0) { + throw new Test262Error('#967: 64 >>> 30 === 0. Actual: ' + (64 >>> 30)); +} + + +if (128 >>> 30 !== 0) { + throw new Test262Error('#968: 128 >>> 30 === 0. Actual: ' + (128 >>> 30)); +} + + +if (256 >>> 30 !== 0) { + throw new Test262Error('#969: 256 >>> 30 === 0. Actual: ' + (256 >>> 30)); +} + + +if (512 >>> 30 !== 0) { + throw new Test262Error('#970: 512 >>> 30 === 0. Actual: ' + (512 >>> 30)); +} + + +if (1024 >>> 30 !== 0) { + throw new Test262Error('#971: 1024 >>> 30 === 0. Actual: ' + (1024 >>> 30)); +} + + +if (2048 >>> 30 !== 0) { + throw new Test262Error('#972: 2048 >>> 30 === 0. Actual: ' + (2048 >>> 30)); +} + + +if (4096 >>> 30 !== 0) { + throw new Test262Error('#973: 4096 >>> 30 === 0. Actual: ' + (4096 >>> 30)); +} + + +if (8192 >>> 30 !== 0) { + throw new Test262Error('#974: 8192 >>> 30 === 0. Actual: ' + (8192 >>> 30)); +} + + +if (16384 >>> 30 !== 0) { + throw new Test262Error('#975: 16384 >>> 30 === 0. Actual: ' + (16384 >>> 30)); +} + + +if (32768 >>> 30 !== 0) { + throw new Test262Error('#976: 32768 >>> 30 === 0. Actual: ' + (32768 >>> 30)); +} + + +if (65536 >>> 30 !== 0) { + throw new Test262Error('#977: 65536 >>> 30 === 0. Actual: ' + (65536 >>> 30)); +} + + +if (131072 >>> 30 !== 0) { + throw new Test262Error('#978: 131072 >>> 30 === 0. Actual: ' + (131072 >>> 30)); +} + + +if (262144 >>> 30 !== 0) { + throw new Test262Error('#979: 262144 >>> 30 === 0. Actual: ' + (262144 >>> 30)); +} + + +if (524288 >>> 30 !== 0) { + throw new Test262Error('#980: 524288 >>> 30 === 0. Actual: ' + (524288 >>> 30)); +} + + +if (1048576 >>> 30 !== 0) { + throw new Test262Error('#981: 1048576 >>> 30 === 0. Actual: ' + (1048576 >>> 30)); +} + + +if (2097152 >>> 30 !== 0) { + throw new Test262Error('#982: 2097152 >>> 30 === 0. Actual: ' + (2097152 >>> 30)); +} + + +if (4194304 >>> 30 !== 0) { + throw new Test262Error('#983: 4194304 >>> 30 === 0. Actual: ' + (4194304 >>> 30)); +} + + +if (8388608 >>> 30 !== 0) { + throw new Test262Error('#984: 8388608 >>> 30 === 0. Actual: ' + (8388608 >>> 30)); +} + + +if (16777216 >>> 30 !== 0) { + throw new Test262Error('#985: 16777216 >>> 30 === 0. Actual: ' + (16777216 >>> 30)); +} + + +if (33554432 >>> 30 !== 0) { + throw new Test262Error('#986: 33554432 >>> 30 === 0. Actual: ' + (33554432 >>> 30)); +} + + +if (67108864 >>> 30 !== 0) { + throw new Test262Error('#987: 67108864 >>> 30 === 0. Actual: ' + (67108864 >>> 30)); +} + + +if (134217728 >>> 30 !== 0) { + throw new Test262Error('#988: 134217728 >>> 30 === 0. Actual: ' + (134217728 >>> 30)); +} + + +if (268435456 >>> 30 !== 0) { + throw new Test262Error('#989: 268435456 >>> 30 === 0. Actual: ' + (268435456 >>> 30)); +} + + +if (536870912 >>> 30 !== 0) { + throw new Test262Error('#990: 536870912 >>> 30 === 0. Actual: ' + (536870912 >>> 30)); +} + + +if (1073741824 >>> 30 !== 1) { + throw new Test262Error('#991: 1073741824 >>> 30 === 1. Actual: ' + (1073741824 >>> 30)); +} + + +if (2147483648 >>> 30 !== 2) { + throw new Test262Error('#992: 2147483648 >>> 30 === 2. Actual: ' + (2147483648 >>> 30)); +} + + +if (1 >>> 31 !== 0) { + throw new Test262Error('#993: 1 >>> 31 === 0. Actual: ' + (1 >>> 31)); +} + + +if (2 >>> 31 !== 0) { + throw new Test262Error('#994: 2 >>> 31 === 0. Actual: ' + (2 >>> 31)); +} + + +if (4 >>> 31 !== 0) { + throw new Test262Error('#995: 4 >>> 31 === 0. Actual: ' + (4 >>> 31)); +} + + +if (8 >>> 31 !== 0) { + throw new Test262Error('#996: 8 >>> 31 === 0. Actual: ' + (8 >>> 31)); +} + + +if (16 >>> 31 !== 0) { + throw new Test262Error('#997: 16 >>> 31 === 0. Actual: ' + (16 >>> 31)); +} + + +if (32 >>> 31 !== 0) { + throw new Test262Error('#998: 32 >>> 31 === 0. Actual: ' + (32 >>> 31)); +} + + +if (64 >>> 31 !== 0) { + throw new Test262Error('#999: 64 >>> 31 === 0. Actual: ' + (64 >>> 31)); +} + + +if (128 >>> 31 !== 0) { + throw new Test262Error('#1000: 128 >>> 31 === 0. Actual: ' + (128 >>> 31)); +} + + +if (256 >>> 31 !== 0) { + throw new Test262Error('#1001: 256 >>> 31 === 0. Actual: ' + (256 >>> 31)); +} + + +if (512 >>> 31 !== 0) { + throw new Test262Error('#1002: 512 >>> 31 === 0. Actual: ' + (512 >>> 31)); +} + + +if (1024 >>> 31 !== 0) { + throw new Test262Error('#1003: 1024 >>> 31 === 0. Actual: ' + (1024 >>> 31)); +} + + +if (2048 >>> 31 !== 0) { + throw new Test262Error('#1004: 2048 >>> 31 === 0. Actual: ' + (2048 >>> 31)); +} + + +if (4096 >>> 31 !== 0) { + throw new Test262Error('#1005: 4096 >>> 31 === 0. Actual: ' + (4096 >>> 31)); +} + + +if (8192 >>> 31 !== 0) { + throw new Test262Error('#1006: 8192 >>> 31 === 0. Actual: ' + (8192 >>> 31)); +} + + +if (16384 >>> 31 !== 0) { + throw new Test262Error('#1007: 16384 >>> 31 === 0. Actual: ' + (16384 >>> 31)); +} + + +if (32768 >>> 31 !== 0) { + throw new Test262Error('#1008: 32768 >>> 31 === 0. Actual: ' + (32768 >>> 31)); +} + + +if (65536 >>> 31 !== 0) { + throw new Test262Error('#1009: 65536 >>> 31 === 0. Actual: ' + (65536 >>> 31)); +} + + +if (131072 >>> 31 !== 0) { + throw new Test262Error('#1010: 131072 >>> 31 === 0. Actual: ' + (131072 >>> 31)); +} + + +if (262144 >>> 31 !== 0) { + throw new Test262Error('#1011: 262144 >>> 31 === 0. Actual: ' + (262144 >>> 31)); +} + + +if (524288 >>> 31 !== 0) { + throw new Test262Error('#1012: 524288 >>> 31 === 0. Actual: ' + (524288 >>> 31)); +} + + +if (1048576 >>> 31 !== 0) { + throw new Test262Error('#1013: 1048576 >>> 31 === 0. Actual: ' + (1048576 >>> 31)); +} + + +if (2097152 >>> 31 !== 0) { + throw new Test262Error('#1014: 2097152 >>> 31 === 0. Actual: ' + (2097152 >>> 31)); +} + + +if (4194304 >>> 31 !== 0) { + throw new Test262Error('#1015: 4194304 >>> 31 === 0. Actual: ' + (4194304 >>> 31)); +} + + +if (8388608 >>> 31 !== 0) { + throw new Test262Error('#1016: 8388608 >>> 31 === 0. Actual: ' + (8388608 >>> 31)); +} + + +if (16777216 >>> 31 !== 0) { + throw new Test262Error('#1017: 16777216 >>> 31 === 0. Actual: ' + (16777216 >>> 31)); +} + + +if (33554432 >>> 31 !== 0) { + throw new Test262Error('#1018: 33554432 >>> 31 === 0. Actual: ' + (33554432 >>> 31)); +} + + +if (67108864 >>> 31 !== 0) { + throw new Test262Error('#1019: 67108864 >>> 31 === 0. Actual: ' + (67108864 >>> 31)); +} + + +if (134217728 >>> 31 !== 0) { + throw new Test262Error('#1020: 134217728 >>> 31 === 0. Actual: ' + (134217728 >>> 31)); +} + + +if (268435456 >>> 31 !== 0) { + throw new Test262Error('#1021: 268435456 >>> 31 === 0. Actual: ' + (268435456 >>> 31)); +} + + +if (536870912 >>> 31 !== 0) { + throw new Test262Error('#1022: 536870912 >>> 31 === 0. Actual: ' + (536870912 >>> 31)); +} + + +if (1073741824 >>> 31 !== 0) { + throw new Test262Error('#1023: 1073741824 >>> 31 === 0. Actual: ' + (1073741824 >>> 31)); +} + + +if (2147483648 >>> 31 !== 1) { + throw new Test262Error('#1024: 2147483648 >>> 31 === 1. Actual: ' + (2147483648 >>> 31)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T3.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T3.js new file mode 100644 index 0000000000..a4a7ba2d69 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T3.js @@ -0,0 +1,2651 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x >>> y in distinct points +es5id: 11.7.3_A4_T3 +description: ShiftExpression = 2^n - 1, n = 0...15 +---*/ + +//CHECK + +if (0 >>> 0 !== 0) { + throw new Test262Error('#1: 0 >>> 0 === 0. Actual: ' + (0 >>> 0)); +} + + +if (1 >>> 0 !== 1) { + throw new Test262Error('#2: 1 >>> 0 === 1. Actual: ' + (1 >>> 0)); +} + + +if (3 >>> 0 !== 3) { + throw new Test262Error('#3: 3 >>> 0 === 3. Actual: ' + (3 >>> 0)); +} + + +if (7 >>> 0 !== 7) { + throw new Test262Error('#4: 7 >>> 0 === 7. Actual: ' + (7 >>> 0)); +} + + +if (15 >>> 0 !== 15) { + throw new Test262Error('#5: 15 >>> 0 === 15. Actual: ' + (15 >>> 0)); +} + + +if (31 >>> 0 !== 31) { + throw new Test262Error('#6: 31 >>> 0 === 31. Actual: ' + (31 >>> 0)); +} + + +if (63 >>> 0 !== 63) { + throw new Test262Error('#7: 63 >>> 0 === 63. Actual: ' + (63 >>> 0)); +} + + +if (127 >>> 0 !== 127) { + throw new Test262Error('#8: 127 >>> 0 === 127. Actual: ' + (127 >>> 0)); +} + + +if (255 >>> 0 !== 255) { + throw new Test262Error('#9: 255 >>> 0 === 255. Actual: ' + (255 >>> 0)); +} + + +if (511 >>> 0 !== 511) { + throw new Test262Error('#10: 511 >>> 0 === 511. Actual: ' + (511 >>> 0)); +} + + +if (1023 >>> 0 !== 1023) { + throw new Test262Error('#11: 1023 >>> 0 === 1023. Actual: ' + (1023 >>> 0)); +} + + +if (2047 >>> 0 !== 2047) { + throw new Test262Error('#12: 2047 >>> 0 === 2047. Actual: ' + (2047 >>> 0)); +} + + +if (4095 >>> 0 !== 4095) { + throw new Test262Error('#13: 4095 >>> 0 === 4095. Actual: ' + (4095 >>> 0)); +} + + +if (8191 >>> 0 !== 8191) { + throw new Test262Error('#14: 8191 >>> 0 === 8191. Actual: ' + (8191 >>> 0)); +} + + +if (16383 >>> 0 !== 16383) { + throw new Test262Error('#15: 16383 >>> 0 === 16383. Actual: ' + (16383 >>> 0)); +} + + +if (32767 >>> 0 !== 32767) { + throw new Test262Error('#16: 32767 >>> 0 === 32767. Actual: ' + (32767 >>> 0)); +} + + +if (65535 >>> 0 !== 65535) { + throw new Test262Error('#17: 65535 >>> 0 === 65535. Actual: ' + (65535 >>> 0)); +} + + +if (131071 >>> 0 !== 131071) { + throw new Test262Error('#18: 131071 >>> 0 === 131071. Actual: ' + (131071 >>> 0)); +} + + +if (262143 >>> 0 !== 262143) { + throw new Test262Error('#19: 262143 >>> 0 === 262143. Actual: ' + (262143 >>> 0)); +} + + +if (524287 >>> 0 !== 524287) { + throw new Test262Error('#20: 524287 >>> 0 === 524287. Actual: ' + (524287 >>> 0)); +} + + +if (1048575 >>> 0 !== 1048575) { + throw new Test262Error('#21: 1048575 >>> 0 === 1048575. Actual: ' + (1048575 >>> 0)); +} + + +if (2097151 >>> 0 !== 2097151) { + throw new Test262Error('#22: 2097151 >>> 0 === 2097151. Actual: ' + (2097151 >>> 0)); +} + + +if (4194303 >>> 0 !== 4194303) { + throw new Test262Error('#23: 4194303 >>> 0 === 4194303. Actual: ' + (4194303 >>> 0)); +} + + +if (8388607 >>> 0 !== 8388607) { + throw new Test262Error('#24: 8388607 >>> 0 === 8388607. Actual: ' + (8388607 >>> 0)); +} + + +if (16777215 >>> 0 !== 16777215) { + throw new Test262Error('#25: 16777215 >>> 0 === 16777215. Actual: ' + (16777215 >>> 0)); +} + + +if (33554431 >>> 0 !== 33554431) { + throw new Test262Error('#26: 33554431 >>> 0 === 33554431. Actual: ' + (33554431 >>> 0)); +} + + +if (67108863 >>> 0 !== 67108863) { + throw new Test262Error('#27: 67108863 >>> 0 === 67108863. Actual: ' + (67108863 >>> 0)); +} + + +if (134217727 >>> 0 !== 134217727) { + throw new Test262Error('#28: 134217727 >>> 0 === 134217727. Actual: ' + (134217727 >>> 0)); +} + + +if (268435455 >>> 0 !== 268435455) { + throw new Test262Error('#29: 268435455 >>> 0 === 268435455. Actual: ' + (268435455 >>> 0)); +} + + +if (536870911 >>> 0 !== 536870911) { + throw new Test262Error('#30: 536870911 >>> 0 === 536870911. Actual: ' + (536870911 >>> 0)); +} + + +if (1073741823 >>> 0 !== 1073741823) { + throw new Test262Error('#31: 1073741823 >>> 0 === 1073741823. Actual: ' + (1073741823 >>> 0)); +} + + +if (2147483647 >>> 0 !== 2147483647) { + throw new Test262Error('#32: 2147483647 >>> 0 === 2147483647. Actual: ' + (2147483647 >>> 0)); +} + + +if (4294967295 >>> 0 !== 4294967295) { + throw new Test262Error('#33: 4294967295 >>> 0 === 4294967295. Actual: ' + (4294967295 >>> 0)); +} + + +if (0 >>> 1 !== 0) { + throw new Test262Error('#34: 0 >>> 1 === 0. Actual: ' + (0 >>> 1)); +} + + +if (1 >>> 1 !== 0) { + throw new Test262Error('#35: 1 >>> 1 === 0. Actual: ' + (1 >>> 1)); +} + + +if (3 >>> 1 !== 1) { + throw new Test262Error('#36: 3 >>> 1 === 1. Actual: ' + (3 >>> 1)); +} + + +if (7 >>> 1 !== 3) { + throw new Test262Error('#37: 7 >>> 1 === 3. Actual: ' + (7 >>> 1)); +} + + +if (15 >>> 1 !== 7) { + throw new Test262Error('#38: 15 >>> 1 === 7. Actual: ' + (15 >>> 1)); +} + + +if (31 >>> 1 !== 15) { + throw new Test262Error('#39: 31 >>> 1 === 15. Actual: ' + (31 >>> 1)); +} + + +if (63 >>> 1 !== 31) { + throw new Test262Error('#40: 63 >>> 1 === 31. Actual: ' + (63 >>> 1)); +} + + +if (127 >>> 1 !== 63) { + throw new Test262Error('#41: 127 >>> 1 === 63. Actual: ' + (127 >>> 1)); +} + + +if (255 >>> 1 !== 127) { + throw new Test262Error('#42: 255 >>> 1 === 127. Actual: ' + (255 >>> 1)); +} + + +if (511 >>> 1 !== 255) { + throw new Test262Error('#43: 511 >>> 1 === 255. Actual: ' + (511 >>> 1)); +} + + +if (1023 >>> 1 !== 511) { + throw new Test262Error('#44: 1023 >>> 1 === 511. Actual: ' + (1023 >>> 1)); +} + + +if (2047 >>> 1 !== 1023) { + throw new Test262Error('#45: 2047 >>> 1 === 1023. Actual: ' + (2047 >>> 1)); +} + + +if (4095 >>> 1 !== 2047) { + throw new Test262Error('#46: 4095 >>> 1 === 2047. Actual: ' + (4095 >>> 1)); +} + + +if (8191 >>> 1 !== 4095) { + throw new Test262Error('#47: 8191 >>> 1 === 4095. Actual: ' + (8191 >>> 1)); +} + + +if (16383 >>> 1 !== 8191) { + throw new Test262Error('#48: 16383 >>> 1 === 8191. Actual: ' + (16383 >>> 1)); +} + + +if (32767 >>> 1 !== 16383) { + throw new Test262Error('#49: 32767 >>> 1 === 16383. Actual: ' + (32767 >>> 1)); +} + + +if (65535 >>> 1 !== 32767) { + throw new Test262Error('#50: 65535 >>> 1 === 32767. Actual: ' + (65535 >>> 1)); +} + + +if (131071 >>> 1 !== 65535) { + throw new Test262Error('#51: 131071 >>> 1 === 65535. Actual: ' + (131071 >>> 1)); +} + + +if (262143 >>> 1 !== 131071) { + throw new Test262Error('#52: 262143 >>> 1 === 131071. Actual: ' + (262143 >>> 1)); +} + + +if (524287 >>> 1 !== 262143) { + throw new Test262Error('#53: 524287 >>> 1 === 262143. Actual: ' + (524287 >>> 1)); +} + + +if (1048575 >>> 1 !== 524287) { + throw new Test262Error('#54: 1048575 >>> 1 === 524287. Actual: ' + (1048575 >>> 1)); +} + + +if (2097151 >>> 1 !== 1048575) { + throw new Test262Error('#55: 2097151 >>> 1 === 1048575. Actual: ' + (2097151 >>> 1)); +} + + +if (4194303 >>> 1 !== 2097151) { + throw new Test262Error('#56: 4194303 >>> 1 === 2097151. Actual: ' + (4194303 >>> 1)); +} + + +if (8388607 >>> 1 !== 4194303) { + throw new Test262Error('#57: 8388607 >>> 1 === 4194303. Actual: ' + (8388607 >>> 1)); +} + + +if (16777215 >>> 1 !== 8388607) { + throw new Test262Error('#58: 16777215 >>> 1 === 8388607. Actual: ' + (16777215 >>> 1)); +} + + +if (33554431 >>> 1 !== 16777215) { + throw new Test262Error('#59: 33554431 >>> 1 === 16777215. Actual: ' + (33554431 >>> 1)); +} + + +if (67108863 >>> 1 !== 33554431) { + throw new Test262Error('#60: 67108863 >>> 1 === 33554431. Actual: ' + (67108863 >>> 1)); +} + + +if (134217727 >>> 1 !== 67108863) { + throw new Test262Error('#61: 134217727 >>> 1 === 67108863. Actual: ' + (134217727 >>> 1)); +} + + +if (268435455 >>> 1 !== 134217727) { + throw new Test262Error('#62: 268435455 >>> 1 === 134217727. Actual: ' + (268435455 >>> 1)); +} + + +if (536870911 >>> 1 !== 268435455) { + throw new Test262Error('#63: 536870911 >>> 1 === 268435455. Actual: ' + (536870911 >>> 1)); +} + + +if (1073741823 >>> 1 !== 536870911) { + throw new Test262Error('#64: 1073741823 >>> 1 === 536870911. Actual: ' + (1073741823 >>> 1)); +} + + +if (2147483647 >>> 1 !== 1073741823) { + throw new Test262Error('#65: 2147483647 >>> 1 === 1073741823. Actual: ' + (2147483647 >>> 1)); +} + + +if (4294967295 >>> 1 !== 2147483647) { + throw new Test262Error('#66: 4294967295 >>> 1 === 2147483647. Actual: ' + (4294967295 >>> 1)); +} + + +if (0 >>> 2 !== 0) { + throw new Test262Error('#67: 0 >>> 2 === 0. Actual: ' + (0 >>> 2)); +} + + +if (1 >>> 2 !== 0) { + throw new Test262Error('#68: 1 >>> 2 === 0. Actual: ' + (1 >>> 2)); +} + + +if (3 >>> 2 !== 0) { + throw new Test262Error('#69: 3 >>> 2 === 0. Actual: ' + (3 >>> 2)); +} + + +if (7 >>> 2 !== 1) { + throw new Test262Error('#70: 7 >>> 2 === 1. Actual: ' + (7 >>> 2)); +} + + +if (15 >>> 2 !== 3) { + throw new Test262Error('#71: 15 >>> 2 === 3. Actual: ' + (15 >>> 2)); +} + + +if (31 >>> 2 !== 7) { + throw new Test262Error('#72: 31 >>> 2 === 7. Actual: ' + (31 >>> 2)); +} + + +if (63 >>> 2 !== 15) { + throw new Test262Error('#73: 63 >>> 2 === 15. Actual: ' + (63 >>> 2)); +} + + +if (127 >>> 2 !== 31) { + throw new Test262Error('#74: 127 >>> 2 === 31. Actual: ' + (127 >>> 2)); +} + + +if (255 >>> 2 !== 63) { + throw new Test262Error('#75: 255 >>> 2 === 63. Actual: ' + (255 >>> 2)); +} + + +if (511 >>> 2 !== 127) { + throw new Test262Error('#76: 511 >>> 2 === 127. Actual: ' + (511 >>> 2)); +} + + +if (1023 >>> 2 !== 255) { + throw new Test262Error('#77: 1023 >>> 2 === 255. Actual: ' + (1023 >>> 2)); +} + + +if (2047 >>> 2 !== 511) { + throw new Test262Error('#78: 2047 >>> 2 === 511. Actual: ' + (2047 >>> 2)); +} + + +if (4095 >>> 2 !== 1023) { + throw new Test262Error('#79: 4095 >>> 2 === 1023. Actual: ' + (4095 >>> 2)); +} + + +if (8191 >>> 2 !== 2047) { + throw new Test262Error('#80: 8191 >>> 2 === 2047. Actual: ' + (8191 >>> 2)); +} + + +if (16383 >>> 2 !== 4095) { + throw new Test262Error('#81: 16383 >>> 2 === 4095. Actual: ' + (16383 >>> 2)); +} + + +if (32767 >>> 2 !== 8191) { + throw new Test262Error('#82: 32767 >>> 2 === 8191. Actual: ' + (32767 >>> 2)); +} + + +if (65535 >>> 2 !== 16383) { + throw new Test262Error('#83: 65535 >>> 2 === 16383. Actual: ' + (65535 >>> 2)); +} + + +if (131071 >>> 2 !== 32767) { + throw new Test262Error('#84: 131071 >>> 2 === 32767. Actual: ' + (131071 >>> 2)); +} + + +if (262143 >>> 2 !== 65535) { + throw new Test262Error('#85: 262143 >>> 2 === 65535. Actual: ' + (262143 >>> 2)); +} + + +if (524287 >>> 2 !== 131071) { + throw new Test262Error('#86: 524287 >>> 2 === 131071. Actual: ' + (524287 >>> 2)); +} + + +if (1048575 >>> 2 !== 262143) { + throw new Test262Error('#87: 1048575 >>> 2 === 262143. Actual: ' + (1048575 >>> 2)); +} + + +if (2097151 >>> 2 !== 524287) { + throw new Test262Error('#88: 2097151 >>> 2 === 524287. Actual: ' + (2097151 >>> 2)); +} + + +if (4194303 >>> 2 !== 1048575) { + throw new Test262Error('#89: 4194303 >>> 2 === 1048575. Actual: ' + (4194303 >>> 2)); +} + + +if (8388607 >>> 2 !== 2097151) { + throw new Test262Error('#90: 8388607 >>> 2 === 2097151. Actual: ' + (8388607 >>> 2)); +} + + +if (16777215 >>> 2 !== 4194303) { + throw new Test262Error('#91: 16777215 >>> 2 === 4194303. Actual: ' + (16777215 >>> 2)); +} + + +if (33554431 >>> 2 !== 8388607) { + throw new Test262Error('#92: 33554431 >>> 2 === 8388607. Actual: ' + (33554431 >>> 2)); +} + + +if (67108863 >>> 2 !== 16777215) { + throw new Test262Error('#93: 67108863 >>> 2 === 16777215. Actual: ' + (67108863 >>> 2)); +} + + +if (134217727 >>> 2 !== 33554431) { + throw new Test262Error('#94: 134217727 >>> 2 === 33554431. Actual: ' + (134217727 >>> 2)); +} + + +if (268435455 >>> 2 !== 67108863) { + throw new Test262Error('#95: 268435455 >>> 2 === 67108863. Actual: ' + (268435455 >>> 2)); +} + + +if (536870911 >>> 2 !== 134217727) { + throw new Test262Error('#96: 536870911 >>> 2 === 134217727. Actual: ' + (536870911 >>> 2)); +} + + +if (1073741823 >>> 2 !== 268435455) { + throw new Test262Error('#97: 1073741823 >>> 2 === 268435455. Actual: ' + (1073741823 >>> 2)); +} + + +if (2147483647 >>> 2 !== 536870911) { + throw new Test262Error('#98: 2147483647 >>> 2 === 536870911. Actual: ' + (2147483647 >>> 2)); +} + + +if (4294967295 >>> 2 !== 1073741823) { + throw new Test262Error('#99: 4294967295 >>> 2 === 1073741823. Actual: ' + (4294967295 >>> 2)); +} + + +if (0 >>> 3 !== 0) { + throw new Test262Error('#100: 0 >>> 3 === 0. Actual: ' + (0 >>> 3)); +} + + +if (1 >>> 3 !== 0) { + throw new Test262Error('#101: 1 >>> 3 === 0. Actual: ' + (1 >>> 3)); +} + + +if (3 >>> 3 !== 0) { + throw new Test262Error('#102: 3 >>> 3 === 0. Actual: ' + (3 >>> 3)); +} + + +if (7 >>> 3 !== 0) { + throw new Test262Error('#103: 7 >>> 3 === 0. Actual: ' + (7 >>> 3)); +} + + +if (15 >>> 3 !== 1) { + throw new Test262Error('#104: 15 >>> 3 === 1. Actual: ' + (15 >>> 3)); +} + + +if (31 >>> 3 !== 3) { + throw new Test262Error('#105: 31 >>> 3 === 3. Actual: ' + (31 >>> 3)); +} + + +if (63 >>> 3 !== 7) { + throw new Test262Error('#106: 63 >>> 3 === 7. Actual: ' + (63 >>> 3)); +} + + +if (127 >>> 3 !== 15) { + throw new Test262Error('#107: 127 >>> 3 === 15. Actual: ' + (127 >>> 3)); +} + + +if (255 >>> 3 !== 31) { + throw new Test262Error('#108: 255 >>> 3 === 31. Actual: ' + (255 >>> 3)); +} + + +if (511 >>> 3 !== 63) { + throw new Test262Error('#109: 511 >>> 3 === 63. Actual: ' + (511 >>> 3)); +} + + +if (1023 >>> 3 !== 127) { + throw new Test262Error('#110: 1023 >>> 3 === 127. Actual: ' + (1023 >>> 3)); +} + + +if (2047 >>> 3 !== 255) { + throw new Test262Error('#111: 2047 >>> 3 === 255. Actual: ' + (2047 >>> 3)); +} + + +if (4095 >>> 3 !== 511) { + throw new Test262Error('#112: 4095 >>> 3 === 511. Actual: ' + (4095 >>> 3)); +} + + +if (8191 >>> 3 !== 1023) { + throw new Test262Error('#113: 8191 >>> 3 === 1023. Actual: ' + (8191 >>> 3)); +} + + +if (16383 >>> 3 !== 2047) { + throw new Test262Error('#114: 16383 >>> 3 === 2047. Actual: ' + (16383 >>> 3)); +} + + +if (32767 >>> 3 !== 4095) { + throw new Test262Error('#115: 32767 >>> 3 === 4095. Actual: ' + (32767 >>> 3)); +} + + +if (65535 >>> 3 !== 8191) { + throw new Test262Error('#116: 65535 >>> 3 === 8191. Actual: ' + (65535 >>> 3)); +} + + +if (131071 >>> 3 !== 16383) { + throw new Test262Error('#117: 131071 >>> 3 === 16383. Actual: ' + (131071 >>> 3)); +} + + +if (262143 >>> 3 !== 32767) { + throw new Test262Error('#118: 262143 >>> 3 === 32767. Actual: ' + (262143 >>> 3)); +} + + +if (524287 >>> 3 !== 65535) { + throw new Test262Error('#119: 524287 >>> 3 === 65535. Actual: ' + (524287 >>> 3)); +} + + +if (1048575 >>> 3 !== 131071) { + throw new Test262Error('#120: 1048575 >>> 3 === 131071. Actual: ' + (1048575 >>> 3)); +} + + +if (2097151 >>> 3 !== 262143) { + throw new Test262Error('#121: 2097151 >>> 3 === 262143. Actual: ' + (2097151 >>> 3)); +} + + +if (4194303 >>> 3 !== 524287) { + throw new Test262Error('#122: 4194303 >>> 3 === 524287. Actual: ' + (4194303 >>> 3)); +} + + +if (8388607 >>> 3 !== 1048575) { + throw new Test262Error('#123: 8388607 >>> 3 === 1048575. Actual: ' + (8388607 >>> 3)); +} + + +if (16777215 >>> 3 !== 2097151) { + throw new Test262Error('#124: 16777215 >>> 3 === 2097151. Actual: ' + (16777215 >>> 3)); +} + + +if (33554431 >>> 3 !== 4194303) { + throw new Test262Error('#125: 33554431 >>> 3 === 4194303. Actual: ' + (33554431 >>> 3)); +} + + +if (67108863 >>> 3 !== 8388607) { + throw new Test262Error('#126: 67108863 >>> 3 === 8388607. Actual: ' + (67108863 >>> 3)); +} + + +if (134217727 >>> 3 !== 16777215) { + throw new Test262Error('#127: 134217727 >>> 3 === 16777215. Actual: ' + (134217727 >>> 3)); +} + + +if (268435455 >>> 3 !== 33554431) { + throw new Test262Error('#128: 268435455 >>> 3 === 33554431. Actual: ' + (268435455 >>> 3)); +} + + +if (536870911 >>> 3 !== 67108863) { + throw new Test262Error('#129: 536870911 >>> 3 === 67108863. Actual: ' + (536870911 >>> 3)); +} + + +if (1073741823 >>> 3 !== 134217727) { + throw new Test262Error('#130: 1073741823 >>> 3 === 134217727. Actual: ' + (1073741823 >>> 3)); +} + + +if (2147483647 >>> 3 !== 268435455) { + throw new Test262Error('#131: 2147483647 >>> 3 === 268435455. Actual: ' + (2147483647 >>> 3)); +} + + +if (4294967295 >>> 3 !== 536870911) { + throw new Test262Error('#132: 4294967295 >>> 3 === 536870911. Actual: ' + (4294967295 >>> 3)); +} + + +if (0 >>> 4 !== 0) { + throw new Test262Error('#133: 0 >>> 4 === 0. Actual: ' + (0 >>> 4)); +} + + +if (1 >>> 4 !== 0) { + throw new Test262Error('#134: 1 >>> 4 === 0. Actual: ' + (1 >>> 4)); +} + + +if (3 >>> 4 !== 0) { + throw new Test262Error('#135: 3 >>> 4 === 0. Actual: ' + (3 >>> 4)); +} + + +if (7 >>> 4 !== 0) { + throw new Test262Error('#136: 7 >>> 4 === 0. Actual: ' + (7 >>> 4)); +} + + +if (15 >>> 4 !== 0) { + throw new Test262Error('#137: 15 >>> 4 === 0. Actual: ' + (15 >>> 4)); +} + + +if (31 >>> 4 !== 1) { + throw new Test262Error('#138: 31 >>> 4 === 1. Actual: ' + (31 >>> 4)); +} + + +if (63 >>> 4 !== 3) { + throw new Test262Error('#139: 63 >>> 4 === 3. Actual: ' + (63 >>> 4)); +} + + +if (127 >>> 4 !== 7) { + throw new Test262Error('#140: 127 >>> 4 === 7. Actual: ' + (127 >>> 4)); +} + + +if (255 >>> 4 !== 15) { + throw new Test262Error('#141: 255 >>> 4 === 15. Actual: ' + (255 >>> 4)); +} + + +if (511 >>> 4 !== 31) { + throw new Test262Error('#142: 511 >>> 4 === 31. Actual: ' + (511 >>> 4)); +} + + +if (1023 >>> 4 !== 63) { + throw new Test262Error('#143: 1023 >>> 4 === 63. Actual: ' + (1023 >>> 4)); +} + + +if (2047 >>> 4 !== 127) { + throw new Test262Error('#144: 2047 >>> 4 === 127. Actual: ' + (2047 >>> 4)); +} + + +if (4095 >>> 4 !== 255) { + throw new Test262Error('#145: 4095 >>> 4 === 255. Actual: ' + (4095 >>> 4)); +} + + +if (8191 >>> 4 !== 511) { + throw new Test262Error('#146: 8191 >>> 4 === 511. Actual: ' + (8191 >>> 4)); +} + + +if (16383 >>> 4 !== 1023) { + throw new Test262Error('#147: 16383 >>> 4 === 1023. Actual: ' + (16383 >>> 4)); +} + + +if (32767 >>> 4 !== 2047) { + throw new Test262Error('#148: 32767 >>> 4 === 2047. Actual: ' + (32767 >>> 4)); +} + + +if (65535 >>> 4 !== 4095) { + throw new Test262Error('#149: 65535 >>> 4 === 4095. Actual: ' + (65535 >>> 4)); +} + + +if (131071 >>> 4 !== 8191) { + throw new Test262Error('#150: 131071 >>> 4 === 8191. Actual: ' + (131071 >>> 4)); +} + + +if (262143 >>> 4 !== 16383) { + throw new Test262Error('#151: 262143 >>> 4 === 16383. Actual: ' + (262143 >>> 4)); +} + + +if (524287 >>> 4 !== 32767) { + throw new Test262Error('#152: 524287 >>> 4 === 32767. Actual: ' + (524287 >>> 4)); +} + + +if (1048575 >>> 4 !== 65535) { + throw new Test262Error('#153: 1048575 >>> 4 === 65535. Actual: ' + (1048575 >>> 4)); +} + + +if (2097151 >>> 4 !== 131071) { + throw new Test262Error('#154: 2097151 >>> 4 === 131071. Actual: ' + (2097151 >>> 4)); +} + + +if (4194303 >>> 4 !== 262143) { + throw new Test262Error('#155: 4194303 >>> 4 === 262143. Actual: ' + (4194303 >>> 4)); +} + + +if (8388607 >>> 4 !== 524287) { + throw new Test262Error('#156: 8388607 >>> 4 === 524287. Actual: ' + (8388607 >>> 4)); +} + + +if (16777215 >>> 4 !== 1048575) { + throw new Test262Error('#157: 16777215 >>> 4 === 1048575. Actual: ' + (16777215 >>> 4)); +} + + +if (33554431 >>> 4 !== 2097151) { + throw new Test262Error('#158: 33554431 >>> 4 === 2097151. Actual: ' + (33554431 >>> 4)); +} + + +if (67108863 >>> 4 !== 4194303) { + throw new Test262Error('#159: 67108863 >>> 4 === 4194303. Actual: ' + (67108863 >>> 4)); +} + + +if (134217727 >>> 4 !== 8388607) { + throw new Test262Error('#160: 134217727 >>> 4 === 8388607. Actual: ' + (134217727 >>> 4)); +} + + +if (268435455 >>> 4 !== 16777215) { + throw new Test262Error('#161: 268435455 >>> 4 === 16777215. Actual: ' + (268435455 >>> 4)); +} + + +if (536870911 >>> 4 !== 33554431) { + throw new Test262Error('#162: 536870911 >>> 4 === 33554431. Actual: ' + (536870911 >>> 4)); +} + + +if (1073741823 >>> 4 !== 67108863) { + throw new Test262Error('#163: 1073741823 >>> 4 === 67108863. Actual: ' + (1073741823 >>> 4)); +} + + +if (2147483647 >>> 4 !== 134217727) { + throw new Test262Error('#164: 2147483647 >>> 4 === 134217727. Actual: ' + (2147483647 >>> 4)); +} + + +if (4294967295 >>> 4 !== 268435455) { + throw new Test262Error('#165: 4294967295 >>> 4 === 268435455. Actual: ' + (4294967295 >>> 4)); +} + + +if (0 >>> 5 !== 0) { + throw new Test262Error('#166: 0 >>> 5 === 0. Actual: ' + (0 >>> 5)); +} + + +if (1 >>> 5 !== 0) { + throw new Test262Error('#167: 1 >>> 5 === 0. Actual: ' + (1 >>> 5)); +} + + +if (3 >>> 5 !== 0) { + throw new Test262Error('#168: 3 >>> 5 === 0. Actual: ' + (3 >>> 5)); +} + + +if (7 >>> 5 !== 0) { + throw new Test262Error('#169: 7 >>> 5 === 0. Actual: ' + (7 >>> 5)); +} + + +if (15 >>> 5 !== 0) { + throw new Test262Error('#170: 15 >>> 5 === 0. Actual: ' + (15 >>> 5)); +} + + +if (31 >>> 5 !== 0) { + throw new Test262Error('#171: 31 >>> 5 === 0. Actual: ' + (31 >>> 5)); +} + + +if (63 >>> 5 !== 1) { + throw new Test262Error('#172: 63 >>> 5 === 1. Actual: ' + (63 >>> 5)); +} + + +if (127 >>> 5 !== 3) { + throw new Test262Error('#173: 127 >>> 5 === 3. Actual: ' + (127 >>> 5)); +} + + +if (255 >>> 5 !== 7) { + throw new Test262Error('#174: 255 >>> 5 === 7. Actual: ' + (255 >>> 5)); +} + + +if (511 >>> 5 !== 15) { + throw new Test262Error('#175: 511 >>> 5 === 15. Actual: ' + (511 >>> 5)); +} + + +if (1023 >>> 5 !== 31) { + throw new Test262Error('#176: 1023 >>> 5 === 31. Actual: ' + (1023 >>> 5)); +} + + +if (2047 >>> 5 !== 63) { + throw new Test262Error('#177: 2047 >>> 5 === 63. Actual: ' + (2047 >>> 5)); +} + + +if (4095 >>> 5 !== 127) { + throw new Test262Error('#178: 4095 >>> 5 === 127. Actual: ' + (4095 >>> 5)); +} + + +if (8191 >>> 5 !== 255) { + throw new Test262Error('#179: 8191 >>> 5 === 255. Actual: ' + (8191 >>> 5)); +} + + +if (16383 >>> 5 !== 511) { + throw new Test262Error('#180: 16383 >>> 5 === 511. Actual: ' + (16383 >>> 5)); +} + + +if (32767 >>> 5 !== 1023) { + throw new Test262Error('#181: 32767 >>> 5 === 1023. Actual: ' + (32767 >>> 5)); +} + + +if (65535 >>> 5 !== 2047) { + throw new Test262Error('#182: 65535 >>> 5 === 2047. Actual: ' + (65535 >>> 5)); +} + + +if (131071 >>> 5 !== 4095) { + throw new Test262Error('#183: 131071 >>> 5 === 4095. Actual: ' + (131071 >>> 5)); +} + + +if (262143 >>> 5 !== 8191) { + throw new Test262Error('#184: 262143 >>> 5 === 8191. Actual: ' + (262143 >>> 5)); +} + + +if (524287 >>> 5 !== 16383) { + throw new Test262Error('#185: 524287 >>> 5 === 16383. Actual: ' + (524287 >>> 5)); +} + + +if (1048575 >>> 5 !== 32767) { + throw new Test262Error('#186: 1048575 >>> 5 === 32767. Actual: ' + (1048575 >>> 5)); +} + + +if (2097151 >>> 5 !== 65535) { + throw new Test262Error('#187: 2097151 >>> 5 === 65535. Actual: ' + (2097151 >>> 5)); +} + + +if (4194303 >>> 5 !== 131071) { + throw new Test262Error('#188: 4194303 >>> 5 === 131071. Actual: ' + (4194303 >>> 5)); +} + + +if (8388607 >>> 5 !== 262143) { + throw new Test262Error('#189: 8388607 >>> 5 === 262143. Actual: ' + (8388607 >>> 5)); +} + + +if (16777215 >>> 5 !== 524287) { + throw new Test262Error('#190: 16777215 >>> 5 === 524287. Actual: ' + (16777215 >>> 5)); +} + + +if (33554431 >>> 5 !== 1048575) { + throw new Test262Error('#191: 33554431 >>> 5 === 1048575. Actual: ' + (33554431 >>> 5)); +} + + +if (67108863 >>> 5 !== 2097151) { + throw new Test262Error('#192: 67108863 >>> 5 === 2097151. Actual: ' + (67108863 >>> 5)); +} + + +if (134217727 >>> 5 !== 4194303) { + throw new Test262Error('#193: 134217727 >>> 5 === 4194303. Actual: ' + (134217727 >>> 5)); +} + + +if (268435455 >>> 5 !== 8388607) { + throw new Test262Error('#194: 268435455 >>> 5 === 8388607. Actual: ' + (268435455 >>> 5)); +} + + +if (536870911 >>> 5 !== 16777215) { + throw new Test262Error('#195: 536870911 >>> 5 === 16777215. Actual: ' + (536870911 >>> 5)); +} + + +if (1073741823 >>> 5 !== 33554431) { + throw new Test262Error('#196: 1073741823 >>> 5 === 33554431. Actual: ' + (1073741823 >>> 5)); +} + + +if (2147483647 >>> 5 !== 67108863) { + throw new Test262Error('#197: 2147483647 >>> 5 === 67108863. Actual: ' + (2147483647 >>> 5)); +} + + +if (4294967295 >>> 5 !== 134217727) { + throw new Test262Error('#198: 4294967295 >>> 5 === 134217727. Actual: ' + (4294967295 >>> 5)); +} + + +if (0 >>> 6 !== 0) { + throw new Test262Error('#199: 0 >>> 6 === 0. Actual: ' + (0 >>> 6)); +} + + +if (1 >>> 6 !== 0) { + throw new Test262Error('#200: 1 >>> 6 === 0. Actual: ' + (1 >>> 6)); +} + + +if (3 >>> 6 !== 0) { + throw new Test262Error('#201: 3 >>> 6 === 0. Actual: ' + (3 >>> 6)); +} + + +if (7 >>> 6 !== 0) { + throw new Test262Error('#202: 7 >>> 6 === 0. Actual: ' + (7 >>> 6)); +} + + +if (15 >>> 6 !== 0) { + throw new Test262Error('#203: 15 >>> 6 === 0. Actual: ' + (15 >>> 6)); +} + + +if (31 >>> 6 !== 0) { + throw new Test262Error('#204: 31 >>> 6 === 0. Actual: ' + (31 >>> 6)); +} + + +if (63 >>> 6 !== 0) { + throw new Test262Error('#205: 63 >>> 6 === 0. Actual: ' + (63 >>> 6)); +} + + +if (127 >>> 6 !== 1) { + throw new Test262Error('#206: 127 >>> 6 === 1. Actual: ' + (127 >>> 6)); +} + + +if (255 >>> 6 !== 3) { + throw new Test262Error('#207: 255 >>> 6 === 3. Actual: ' + (255 >>> 6)); +} + + +if (511 >>> 6 !== 7) { + throw new Test262Error('#208: 511 >>> 6 === 7. Actual: ' + (511 >>> 6)); +} + + +if (1023 >>> 6 !== 15) { + throw new Test262Error('#209: 1023 >>> 6 === 15. Actual: ' + (1023 >>> 6)); +} + + +if (2047 >>> 6 !== 31) { + throw new Test262Error('#210: 2047 >>> 6 === 31. Actual: ' + (2047 >>> 6)); +} + + +if (4095 >>> 6 !== 63) { + throw new Test262Error('#211: 4095 >>> 6 === 63. Actual: ' + (4095 >>> 6)); +} + + +if (8191 >>> 6 !== 127) { + throw new Test262Error('#212: 8191 >>> 6 === 127. Actual: ' + (8191 >>> 6)); +} + + +if (16383 >>> 6 !== 255) { + throw new Test262Error('#213: 16383 >>> 6 === 255. Actual: ' + (16383 >>> 6)); +} + + +if (32767 >>> 6 !== 511) { + throw new Test262Error('#214: 32767 >>> 6 === 511. Actual: ' + (32767 >>> 6)); +} + + +if (65535 >>> 6 !== 1023) { + throw new Test262Error('#215: 65535 >>> 6 === 1023. Actual: ' + (65535 >>> 6)); +} + + +if (131071 >>> 6 !== 2047) { + throw new Test262Error('#216: 131071 >>> 6 === 2047. Actual: ' + (131071 >>> 6)); +} + + +if (262143 >>> 6 !== 4095) { + throw new Test262Error('#217: 262143 >>> 6 === 4095. Actual: ' + (262143 >>> 6)); +} + + +if (524287 >>> 6 !== 8191) { + throw new Test262Error('#218: 524287 >>> 6 === 8191. Actual: ' + (524287 >>> 6)); +} + + +if (1048575 >>> 6 !== 16383) { + throw new Test262Error('#219: 1048575 >>> 6 === 16383. Actual: ' + (1048575 >>> 6)); +} + + +if (2097151 >>> 6 !== 32767) { + throw new Test262Error('#220: 2097151 >>> 6 === 32767. Actual: ' + (2097151 >>> 6)); +} + + +if (4194303 >>> 6 !== 65535) { + throw new Test262Error('#221: 4194303 >>> 6 === 65535. Actual: ' + (4194303 >>> 6)); +} + + +if (8388607 >>> 6 !== 131071) { + throw new Test262Error('#222: 8388607 >>> 6 === 131071. Actual: ' + (8388607 >>> 6)); +} + + +if (16777215 >>> 6 !== 262143) { + throw new Test262Error('#223: 16777215 >>> 6 === 262143. Actual: ' + (16777215 >>> 6)); +} + + +if (33554431 >>> 6 !== 524287) { + throw new Test262Error('#224: 33554431 >>> 6 === 524287. Actual: ' + (33554431 >>> 6)); +} + + +if (67108863 >>> 6 !== 1048575) { + throw new Test262Error('#225: 67108863 >>> 6 === 1048575. Actual: ' + (67108863 >>> 6)); +} + + +if (134217727 >>> 6 !== 2097151) { + throw new Test262Error('#226: 134217727 >>> 6 === 2097151. Actual: ' + (134217727 >>> 6)); +} + + +if (268435455 >>> 6 !== 4194303) { + throw new Test262Error('#227: 268435455 >>> 6 === 4194303. Actual: ' + (268435455 >>> 6)); +} + + +if (536870911 >>> 6 !== 8388607) { + throw new Test262Error('#228: 536870911 >>> 6 === 8388607. Actual: ' + (536870911 >>> 6)); +} + + +if (1073741823 >>> 6 !== 16777215) { + throw new Test262Error('#229: 1073741823 >>> 6 === 16777215. Actual: ' + (1073741823 >>> 6)); +} + + +if (2147483647 >>> 6 !== 33554431) { + throw new Test262Error('#230: 2147483647 >>> 6 === 33554431. Actual: ' + (2147483647 >>> 6)); +} + + +if (4294967295 >>> 6 !== 67108863) { + throw new Test262Error('#231: 4294967295 >>> 6 === 67108863. Actual: ' + (4294967295 >>> 6)); +} + + +if (0 >>> 7 !== 0) { + throw new Test262Error('#232: 0 >>> 7 === 0. Actual: ' + (0 >>> 7)); +} + + +if (1 >>> 7 !== 0) { + throw new Test262Error('#233: 1 >>> 7 === 0. Actual: ' + (1 >>> 7)); +} + + +if (3 >>> 7 !== 0) { + throw new Test262Error('#234: 3 >>> 7 === 0. Actual: ' + (3 >>> 7)); +} + + +if (7 >>> 7 !== 0) { + throw new Test262Error('#235: 7 >>> 7 === 0. Actual: ' + (7 >>> 7)); +} + + +if (15 >>> 7 !== 0) { + throw new Test262Error('#236: 15 >>> 7 === 0. Actual: ' + (15 >>> 7)); +} + + +if (31 >>> 7 !== 0) { + throw new Test262Error('#237: 31 >>> 7 === 0. Actual: ' + (31 >>> 7)); +} + + +if (63 >>> 7 !== 0) { + throw new Test262Error('#238: 63 >>> 7 === 0. Actual: ' + (63 >>> 7)); +} + + +if (127 >>> 7 !== 0) { + throw new Test262Error('#239: 127 >>> 7 === 0. Actual: ' + (127 >>> 7)); +} + + +if (255 >>> 7 !== 1) { + throw new Test262Error('#240: 255 >>> 7 === 1. Actual: ' + (255 >>> 7)); +} + + +if (511 >>> 7 !== 3) { + throw new Test262Error('#241: 511 >>> 7 === 3. Actual: ' + (511 >>> 7)); +} + + +if (1023 >>> 7 !== 7) { + throw new Test262Error('#242: 1023 >>> 7 === 7. Actual: ' + (1023 >>> 7)); +} + + +if (2047 >>> 7 !== 15) { + throw new Test262Error('#243: 2047 >>> 7 === 15. Actual: ' + (2047 >>> 7)); +} + + +if (4095 >>> 7 !== 31) { + throw new Test262Error('#244: 4095 >>> 7 === 31. Actual: ' + (4095 >>> 7)); +} + + +if (8191 >>> 7 !== 63) { + throw new Test262Error('#245: 8191 >>> 7 === 63. Actual: ' + (8191 >>> 7)); +} + + +if (16383 >>> 7 !== 127) { + throw new Test262Error('#246: 16383 >>> 7 === 127. Actual: ' + (16383 >>> 7)); +} + + +if (32767 >>> 7 !== 255) { + throw new Test262Error('#247: 32767 >>> 7 === 255. Actual: ' + (32767 >>> 7)); +} + + +if (65535 >>> 7 !== 511) { + throw new Test262Error('#248: 65535 >>> 7 === 511. Actual: ' + (65535 >>> 7)); +} + + +if (131071 >>> 7 !== 1023) { + throw new Test262Error('#249: 131071 >>> 7 === 1023. Actual: ' + (131071 >>> 7)); +} + + +if (262143 >>> 7 !== 2047) { + throw new Test262Error('#250: 262143 >>> 7 === 2047. Actual: ' + (262143 >>> 7)); +} + + +if (524287 >>> 7 !== 4095) { + throw new Test262Error('#251: 524287 >>> 7 === 4095. Actual: ' + (524287 >>> 7)); +} + + +if (1048575 >>> 7 !== 8191) { + throw new Test262Error('#252: 1048575 >>> 7 === 8191. Actual: ' + (1048575 >>> 7)); +} + + +if (2097151 >>> 7 !== 16383) { + throw new Test262Error('#253: 2097151 >>> 7 === 16383. Actual: ' + (2097151 >>> 7)); +} + + +if (4194303 >>> 7 !== 32767) { + throw new Test262Error('#254: 4194303 >>> 7 === 32767. Actual: ' + (4194303 >>> 7)); +} + + +if (8388607 >>> 7 !== 65535) { + throw new Test262Error('#255: 8388607 >>> 7 === 65535. Actual: ' + (8388607 >>> 7)); +} + + +if (16777215 >>> 7 !== 131071) { + throw new Test262Error('#256: 16777215 >>> 7 === 131071. Actual: ' + (16777215 >>> 7)); +} + + +if (33554431 >>> 7 !== 262143) { + throw new Test262Error('#257: 33554431 >>> 7 === 262143. Actual: ' + (33554431 >>> 7)); +} + + +if (67108863 >>> 7 !== 524287) { + throw new Test262Error('#258: 67108863 >>> 7 === 524287. Actual: ' + (67108863 >>> 7)); +} + + +if (134217727 >>> 7 !== 1048575) { + throw new Test262Error('#259: 134217727 >>> 7 === 1048575. Actual: ' + (134217727 >>> 7)); +} + + +if (268435455 >>> 7 !== 2097151) { + throw new Test262Error('#260: 268435455 >>> 7 === 2097151. Actual: ' + (268435455 >>> 7)); +} + + +if (536870911 >>> 7 !== 4194303) { + throw new Test262Error('#261: 536870911 >>> 7 === 4194303. Actual: ' + (536870911 >>> 7)); +} + + +if (1073741823 >>> 7 !== 8388607) { + throw new Test262Error('#262: 1073741823 >>> 7 === 8388607. Actual: ' + (1073741823 >>> 7)); +} + + +if (2147483647 >>> 7 !== 16777215) { + throw new Test262Error('#263: 2147483647 >>> 7 === 16777215. Actual: ' + (2147483647 >>> 7)); +} + + +if (4294967295 >>> 7 !== 33554431) { + throw new Test262Error('#264: 4294967295 >>> 7 === 33554431. Actual: ' + (4294967295 >>> 7)); +} + + +if (0 >>> 8 !== 0) { + throw new Test262Error('#265: 0 >>> 8 === 0. Actual: ' + (0 >>> 8)); +} + + +if (1 >>> 8 !== 0) { + throw new Test262Error('#266: 1 >>> 8 === 0. Actual: ' + (1 >>> 8)); +} + + +if (3 >>> 8 !== 0) { + throw new Test262Error('#267: 3 >>> 8 === 0. Actual: ' + (3 >>> 8)); +} + + +if (7 >>> 8 !== 0) { + throw new Test262Error('#268: 7 >>> 8 === 0. Actual: ' + (7 >>> 8)); +} + + +if (15 >>> 8 !== 0) { + throw new Test262Error('#269: 15 >>> 8 === 0. Actual: ' + (15 >>> 8)); +} + + +if (31 >>> 8 !== 0) { + throw new Test262Error('#270: 31 >>> 8 === 0. Actual: ' + (31 >>> 8)); +} + + +if (63 >>> 8 !== 0) { + throw new Test262Error('#271: 63 >>> 8 === 0. Actual: ' + (63 >>> 8)); +} + + +if (127 >>> 8 !== 0) { + throw new Test262Error('#272: 127 >>> 8 === 0. Actual: ' + (127 >>> 8)); +} + + +if (255 >>> 8 !== 0) { + throw new Test262Error('#273: 255 >>> 8 === 0. Actual: ' + (255 >>> 8)); +} + + +if (511 >>> 8 !== 1) { + throw new Test262Error('#274: 511 >>> 8 === 1. Actual: ' + (511 >>> 8)); +} + + +if (1023 >>> 8 !== 3) { + throw new Test262Error('#275: 1023 >>> 8 === 3. Actual: ' + (1023 >>> 8)); +} + + +if (2047 >>> 8 !== 7) { + throw new Test262Error('#276: 2047 >>> 8 === 7. Actual: ' + (2047 >>> 8)); +} + + +if (4095 >>> 8 !== 15) { + throw new Test262Error('#277: 4095 >>> 8 === 15. Actual: ' + (4095 >>> 8)); +} + + +if (8191 >>> 8 !== 31) { + throw new Test262Error('#278: 8191 >>> 8 === 31. Actual: ' + (8191 >>> 8)); +} + + +if (16383 >>> 8 !== 63) { + throw new Test262Error('#279: 16383 >>> 8 === 63. Actual: ' + (16383 >>> 8)); +} + + +if (32767 >>> 8 !== 127) { + throw new Test262Error('#280: 32767 >>> 8 === 127. Actual: ' + (32767 >>> 8)); +} + + +if (65535 >>> 8 !== 255) { + throw new Test262Error('#281: 65535 >>> 8 === 255. Actual: ' + (65535 >>> 8)); +} + + +if (131071 >>> 8 !== 511) { + throw new Test262Error('#282: 131071 >>> 8 === 511. Actual: ' + (131071 >>> 8)); +} + + +if (262143 >>> 8 !== 1023) { + throw new Test262Error('#283: 262143 >>> 8 === 1023. Actual: ' + (262143 >>> 8)); +} + + +if (524287 >>> 8 !== 2047) { + throw new Test262Error('#284: 524287 >>> 8 === 2047. Actual: ' + (524287 >>> 8)); +} + + +if (1048575 >>> 8 !== 4095) { + throw new Test262Error('#285: 1048575 >>> 8 === 4095. Actual: ' + (1048575 >>> 8)); +} + + +if (2097151 >>> 8 !== 8191) { + throw new Test262Error('#286: 2097151 >>> 8 === 8191. Actual: ' + (2097151 >>> 8)); +} + + +if (4194303 >>> 8 !== 16383) { + throw new Test262Error('#287: 4194303 >>> 8 === 16383. Actual: ' + (4194303 >>> 8)); +} + + +if (8388607 >>> 8 !== 32767) { + throw new Test262Error('#288: 8388607 >>> 8 === 32767. Actual: ' + (8388607 >>> 8)); +} + + +if (16777215 >>> 8 !== 65535) { + throw new Test262Error('#289: 16777215 >>> 8 === 65535. Actual: ' + (16777215 >>> 8)); +} + + +if (33554431 >>> 8 !== 131071) { + throw new Test262Error('#290: 33554431 >>> 8 === 131071. Actual: ' + (33554431 >>> 8)); +} + + +if (67108863 >>> 8 !== 262143) { + throw new Test262Error('#291: 67108863 >>> 8 === 262143. Actual: ' + (67108863 >>> 8)); +} + + +if (134217727 >>> 8 !== 524287) { + throw new Test262Error('#292: 134217727 >>> 8 === 524287. Actual: ' + (134217727 >>> 8)); +} + + +if (268435455 >>> 8 !== 1048575) { + throw new Test262Error('#293: 268435455 >>> 8 === 1048575. Actual: ' + (268435455 >>> 8)); +} + + +if (536870911 >>> 8 !== 2097151) { + throw new Test262Error('#294: 536870911 >>> 8 === 2097151. Actual: ' + (536870911 >>> 8)); +} + + +if (1073741823 >>> 8 !== 4194303) { + throw new Test262Error('#295: 1073741823 >>> 8 === 4194303. Actual: ' + (1073741823 >>> 8)); +} + + +if (2147483647 >>> 8 !== 8388607) { + throw new Test262Error('#296: 2147483647 >>> 8 === 8388607. Actual: ' + (2147483647 >>> 8)); +} + + +if (4294967295 >>> 8 !== 16777215) { + throw new Test262Error('#297: 4294967295 >>> 8 === 16777215. Actual: ' + (4294967295 >>> 8)); +} + + +if (0 >>> 9 !== 0) { + throw new Test262Error('#298: 0 >>> 9 === 0. Actual: ' + (0 >>> 9)); +} + + +if (1 >>> 9 !== 0) { + throw new Test262Error('#299: 1 >>> 9 === 0. Actual: ' + (1 >>> 9)); +} + + +if (3 >>> 9 !== 0) { + throw new Test262Error('#300: 3 >>> 9 === 0. Actual: ' + (3 >>> 9)); +} + + +if (7 >>> 9 !== 0) { + throw new Test262Error('#301: 7 >>> 9 === 0. Actual: ' + (7 >>> 9)); +} + + +if (15 >>> 9 !== 0) { + throw new Test262Error('#302: 15 >>> 9 === 0. Actual: ' + (15 >>> 9)); +} + + +if (31 >>> 9 !== 0) { + throw new Test262Error('#303: 31 >>> 9 === 0. Actual: ' + (31 >>> 9)); +} + + +if (63 >>> 9 !== 0) { + throw new Test262Error('#304: 63 >>> 9 === 0. Actual: ' + (63 >>> 9)); +} + + +if (127 >>> 9 !== 0) { + throw new Test262Error('#305: 127 >>> 9 === 0. Actual: ' + (127 >>> 9)); +} + + +if (255 >>> 9 !== 0) { + throw new Test262Error('#306: 255 >>> 9 === 0. Actual: ' + (255 >>> 9)); +} + + +if (511 >>> 9 !== 0) { + throw new Test262Error('#307: 511 >>> 9 === 0. Actual: ' + (511 >>> 9)); +} + + +if (1023 >>> 9 !== 1) { + throw new Test262Error('#308: 1023 >>> 9 === 1. Actual: ' + (1023 >>> 9)); +} + + +if (2047 >>> 9 !== 3) { + throw new Test262Error('#309: 2047 >>> 9 === 3. Actual: ' + (2047 >>> 9)); +} + + +if (4095 >>> 9 !== 7) { + throw new Test262Error('#310: 4095 >>> 9 === 7. Actual: ' + (4095 >>> 9)); +} + + +if (8191 >>> 9 !== 15) { + throw new Test262Error('#311: 8191 >>> 9 === 15. Actual: ' + (8191 >>> 9)); +} + + +if (16383 >>> 9 !== 31) { + throw new Test262Error('#312: 16383 >>> 9 === 31. Actual: ' + (16383 >>> 9)); +} + + +if (32767 >>> 9 !== 63) { + throw new Test262Error('#313: 32767 >>> 9 === 63. Actual: ' + (32767 >>> 9)); +} + + +if (65535 >>> 9 !== 127) { + throw new Test262Error('#314: 65535 >>> 9 === 127. Actual: ' + (65535 >>> 9)); +} + + +if (131071 >>> 9 !== 255) { + throw new Test262Error('#315: 131071 >>> 9 === 255. Actual: ' + (131071 >>> 9)); +} + + +if (262143 >>> 9 !== 511) { + throw new Test262Error('#316: 262143 >>> 9 === 511. Actual: ' + (262143 >>> 9)); +} + + +if (524287 >>> 9 !== 1023) { + throw new Test262Error('#317: 524287 >>> 9 === 1023. Actual: ' + (524287 >>> 9)); +} + + +if (1048575 >>> 9 !== 2047) { + throw new Test262Error('#318: 1048575 >>> 9 === 2047. Actual: ' + (1048575 >>> 9)); +} + + +if (2097151 >>> 9 !== 4095) { + throw new Test262Error('#319: 2097151 >>> 9 === 4095. Actual: ' + (2097151 >>> 9)); +} + + +if (4194303 >>> 9 !== 8191) { + throw new Test262Error('#320: 4194303 >>> 9 === 8191. Actual: ' + (4194303 >>> 9)); +} + + +if (8388607 >>> 9 !== 16383) { + throw new Test262Error('#321: 8388607 >>> 9 === 16383. Actual: ' + (8388607 >>> 9)); +} + + +if (16777215 >>> 9 !== 32767) { + throw new Test262Error('#322: 16777215 >>> 9 === 32767. Actual: ' + (16777215 >>> 9)); +} + + +if (33554431 >>> 9 !== 65535) { + throw new Test262Error('#323: 33554431 >>> 9 === 65535. Actual: ' + (33554431 >>> 9)); +} + + +if (67108863 >>> 9 !== 131071) { + throw new Test262Error('#324: 67108863 >>> 9 === 131071. Actual: ' + (67108863 >>> 9)); +} + + +if (134217727 >>> 9 !== 262143) { + throw new Test262Error('#325: 134217727 >>> 9 === 262143. Actual: ' + (134217727 >>> 9)); +} + + +if (268435455 >>> 9 !== 524287) { + throw new Test262Error('#326: 268435455 >>> 9 === 524287. Actual: ' + (268435455 >>> 9)); +} + + +if (536870911 >>> 9 !== 1048575) { + throw new Test262Error('#327: 536870911 >>> 9 === 1048575. Actual: ' + (536870911 >>> 9)); +} + + +if (1073741823 >>> 9 !== 2097151) { + throw new Test262Error('#328: 1073741823 >>> 9 === 2097151. Actual: ' + (1073741823 >>> 9)); +} + + +if (2147483647 >>> 9 !== 4194303) { + throw new Test262Error('#329: 2147483647 >>> 9 === 4194303. Actual: ' + (2147483647 >>> 9)); +} + + +if (4294967295 >>> 9 !== 8388607) { + throw new Test262Error('#330: 4294967295 >>> 9 === 8388607. Actual: ' + (4294967295 >>> 9)); +} + + +if (0 >>> 10 !== 0) { + throw new Test262Error('#331: 0 >>> 10 === 0. Actual: ' + (0 >>> 10)); +} + + +if (1 >>> 10 !== 0) { + throw new Test262Error('#332: 1 >>> 10 === 0. Actual: ' + (1 >>> 10)); +} + + +if (3 >>> 10 !== 0) { + throw new Test262Error('#333: 3 >>> 10 === 0. Actual: ' + (3 >>> 10)); +} + + +if (7 >>> 10 !== 0) { + throw new Test262Error('#334: 7 >>> 10 === 0. Actual: ' + (7 >>> 10)); +} + + +if (15 >>> 10 !== 0) { + throw new Test262Error('#335: 15 >>> 10 === 0. Actual: ' + (15 >>> 10)); +} + + +if (31 >>> 10 !== 0) { + throw new Test262Error('#336: 31 >>> 10 === 0. Actual: ' + (31 >>> 10)); +} + + +if (63 >>> 10 !== 0) { + throw new Test262Error('#337: 63 >>> 10 === 0. Actual: ' + (63 >>> 10)); +} + + +if (127 >>> 10 !== 0) { + throw new Test262Error('#338: 127 >>> 10 === 0. Actual: ' + (127 >>> 10)); +} + + +if (255 >>> 10 !== 0) { + throw new Test262Error('#339: 255 >>> 10 === 0. Actual: ' + (255 >>> 10)); +} + + +if (511 >>> 10 !== 0) { + throw new Test262Error('#340: 511 >>> 10 === 0. Actual: ' + (511 >>> 10)); +} + + +if (1023 >>> 10 !== 0) { + throw new Test262Error('#341: 1023 >>> 10 === 0. Actual: ' + (1023 >>> 10)); +} + + +if (2047 >>> 10 !== 1) { + throw new Test262Error('#342: 2047 >>> 10 === 1. Actual: ' + (2047 >>> 10)); +} + + +if (4095 >>> 10 !== 3) { + throw new Test262Error('#343: 4095 >>> 10 === 3. Actual: ' + (4095 >>> 10)); +} + + +if (8191 >>> 10 !== 7) { + throw new Test262Error('#344: 8191 >>> 10 === 7. Actual: ' + (8191 >>> 10)); +} + + +if (16383 >>> 10 !== 15) { + throw new Test262Error('#345: 16383 >>> 10 === 15. Actual: ' + (16383 >>> 10)); +} + + +if (32767 >>> 10 !== 31) { + throw new Test262Error('#346: 32767 >>> 10 === 31. Actual: ' + (32767 >>> 10)); +} + + +if (65535 >>> 10 !== 63) { + throw new Test262Error('#347: 65535 >>> 10 === 63. Actual: ' + (65535 >>> 10)); +} + + +if (131071 >>> 10 !== 127) { + throw new Test262Error('#348: 131071 >>> 10 === 127. Actual: ' + (131071 >>> 10)); +} + + +if (262143 >>> 10 !== 255) { + throw new Test262Error('#349: 262143 >>> 10 === 255. Actual: ' + (262143 >>> 10)); +} + + +if (524287 >>> 10 !== 511) { + throw new Test262Error('#350: 524287 >>> 10 === 511. Actual: ' + (524287 >>> 10)); +} + + +if (1048575 >>> 10 !== 1023) { + throw new Test262Error('#351: 1048575 >>> 10 === 1023. Actual: ' + (1048575 >>> 10)); +} + + +if (2097151 >>> 10 !== 2047) { + throw new Test262Error('#352: 2097151 >>> 10 === 2047. Actual: ' + (2097151 >>> 10)); +} + + +if (4194303 >>> 10 !== 4095) { + throw new Test262Error('#353: 4194303 >>> 10 === 4095. Actual: ' + (4194303 >>> 10)); +} + + +if (8388607 >>> 10 !== 8191) { + throw new Test262Error('#354: 8388607 >>> 10 === 8191. Actual: ' + (8388607 >>> 10)); +} + + +if (16777215 >>> 10 !== 16383) { + throw new Test262Error('#355: 16777215 >>> 10 === 16383. Actual: ' + (16777215 >>> 10)); +} + + +if (33554431 >>> 10 !== 32767) { + throw new Test262Error('#356: 33554431 >>> 10 === 32767. Actual: ' + (33554431 >>> 10)); +} + + +if (67108863 >>> 10 !== 65535) { + throw new Test262Error('#357: 67108863 >>> 10 === 65535. Actual: ' + (67108863 >>> 10)); +} + + +if (134217727 >>> 10 !== 131071) { + throw new Test262Error('#358: 134217727 >>> 10 === 131071. Actual: ' + (134217727 >>> 10)); +} + + +if (268435455 >>> 10 !== 262143) { + throw new Test262Error('#359: 268435455 >>> 10 === 262143. Actual: ' + (268435455 >>> 10)); +} + + +if (536870911 >>> 10 !== 524287) { + throw new Test262Error('#360: 536870911 >>> 10 === 524287. Actual: ' + (536870911 >>> 10)); +} + + +if (1073741823 >>> 10 !== 1048575) { + throw new Test262Error('#361: 1073741823 >>> 10 === 1048575. Actual: ' + (1073741823 >>> 10)); +} + + +if (2147483647 >>> 10 !== 2097151) { + throw new Test262Error('#362: 2147483647 >>> 10 === 2097151. Actual: ' + (2147483647 >>> 10)); +} + + +if (4294967295 >>> 10 !== 4194303) { + throw new Test262Error('#363: 4294967295 >>> 10 === 4194303. Actual: ' + (4294967295 >>> 10)); +} + + +if (0 >>> 11 !== 0) { + throw new Test262Error('#364: 0 >>> 11 === 0. Actual: ' + (0 >>> 11)); +} + + +if (1 >>> 11 !== 0) { + throw new Test262Error('#365: 1 >>> 11 === 0. Actual: ' + (1 >>> 11)); +} + + +if (3 >>> 11 !== 0) { + throw new Test262Error('#366: 3 >>> 11 === 0. Actual: ' + (3 >>> 11)); +} + + +if (7 >>> 11 !== 0) { + throw new Test262Error('#367: 7 >>> 11 === 0. Actual: ' + (7 >>> 11)); +} + + +if (15 >>> 11 !== 0) { + throw new Test262Error('#368: 15 >>> 11 === 0. Actual: ' + (15 >>> 11)); +} + + +if (31 >>> 11 !== 0) { + throw new Test262Error('#369: 31 >>> 11 === 0. Actual: ' + (31 >>> 11)); +} + + +if (63 >>> 11 !== 0) { + throw new Test262Error('#370: 63 >>> 11 === 0. Actual: ' + (63 >>> 11)); +} + + +if (127 >>> 11 !== 0) { + throw new Test262Error('#371: 127 >>> 11 === 0. Actual: ' + (127 >>> 11)); +} + + +if (255 >>> 11 !== 0) { + throw new Test262Error('#372: 255 >>> 11 === 0. Actual: ' + (255 >>> 11)); +} + + +if (511 >>> 11 !== 0) { + throw new Test262Error('#373: 511 >>> 11 === 0. Actual: ' + (511 >>> 11)); +} + + +if (1023 >>> 11 !== 0) { + throw new Test262Error('#374: 1023 >>> 11 === 0. Actual: ' + (1023 >>> 11)); +} + + +if (2047 >>> 11 !== 0) { + throw new Test262Error('#375: 2047 >>> 11 === 0. Actual: ' + (2047 >>> 11)); +} + + +if (4095 >>> 11 !== 1) { + throw new Test262Error('#376: 4095 >>> 11 === 1. Actual: ' + (4095 >>> 11)); +} + + +if (8191 >>> 11 !== 3) { + throw new Test262Error('#377: 8191 >>> 11 === 3. Actual: ' + (8191 >>> 11)); +} + + +if (16383 >>> 11 !== 7) { + throw new Test262Error('#378: 16383 >>> 11 === 7. Actual: ' + (16383 >>> 11)); +} + + +if (32767 >>> 11 !== 15) { + throw new Test262Error('#379: 32767 >>> 11 === 15. Actual: ' + (32767 >>> 11)); +} + + +if (65535 >>> 11 !== 31) { + throw new Test262Error('#380: 65535 >>> 11 === 31. Actual: ' + (65535 >>> 11)); +} + + +if (131071 >>> 11 !== 63) { + throw new Test262Error('#381: 131071 >>> 11 === 63. Actual: ' + (131071 >>> 11)); +} + + +if (262143 >>> 11 !== 127) { + throw new Test262Error('#382: 262143 >>> 11 === 127. Actual: ' + (262143 >>> 11)); +} + + +if (524287 >>> 11 !== 255) { + throw new Test262Error('#383: 524287 >>> 11 === 255. Actual: ' + (524287 >>> 11)); +} + + +if (1048575 >>> 11 !== 511) { + throw new Test262Error('#384: 1048575 >>> 11 === 511. Actual: ' + (1048575 >>> 11)); +} + + +if (2097151 >>> 11 !== 1023) { + throw new Test262Error('#385: 2097151 >>> 11 === 1023. Actual: ' + (2097151 >>> 11)); +} + + +if (4194303 >>> 11 !== 2047) { + throw new Test262Error('#386: 4194303 >>> 11 === 2047. Actual: ' + (4194303 >>> 11)); +} + + +if (8388607 >>> 11 !== 4095) { + throw new Test262Error('#387: 8388607 >>> 11 === 4095. Actual: ' + (8388607 >>> 11)); +} + + +if (16777215 >>> 11 !== 8191) { + throw new Test262Error('#388: 16777215 >>> 11 === 8191. Actual: ' + (16777215 >>> 11)); +} + + +if (33554431 >>> 11 !== 16383) { + throw new Test262Error('#389: 33554431 >>> 11 === 16383. Actual: ' + (33554431 >>> 11)); +} + + +if (67108863 >>> 11 !== 32767) { + throw new Test262Error('#390: 67108863 >>> 11 === 32767. Actual: ' + (67108863 >>> 11)); +} + + +if (134217727 >>> 11 !== 65535) { + throw new Test262Error('#391: 134217727 >>> 11 === 65535. Actual: ' + (134217727 >>> 11)); +} + + +if (268435455 >>> 11 !== 131071) { + throw new Test262Error('#392: 268435455 >>> 11 === 131071. Actual: ' + (268435455 >>> 11)); +} + + +if (536870911 >>> 11 !== 262143) { + throw new Test262Error('#393: 536870911 >>> 11 === 262143. Actual: ' + (536870911 >>> 11)); +} + + +if (1073741823 >>> 11 !== 524287) { + throw new Test262Error('#394: 1073741823 >>> 11 === 524287. Actual: ' + (1073741823 >>> 11)); +} + + +if (2147483647 >>> 11 !== 1048575) { + throw new Test262Error('#395: 2147483647 >>> 11 === 1048575. Actual: ' + (2147483647 >>> 11)); +} + + +if (4294967295 >>> 11 !== 2097151) { + throw new Test262Error('#396: 4294967295 >>> 11 === 2097151. Actual: ' + (4294967295 >>> 11)); +} + + +if (0 >>> 12 !== 0) { + throw new Test262Error('#397: 0 >>> 12 === 0. Actual: ' + (0 >>> 12)); +} + + +if (1 >>> 12 !== 0) { + throw new Test262Error('#398: 1 >>> 12 === 0. Actual: ' + (1 >>> 12)); +} + + +if (3 >>> 12 !== 0) { + throw new Test262Error('#399: 3 >>> 12 === 0. Actual: ' + (3 >>> 12)); +} + + +if (7 >>> 12 !== 0) { + throw new Test262Error('#400: 7 >>> 12 === 0. Actual: ' + (7 >>> 12)); +} + + +if (15 >>> 12 !== 0) { + throw new Test262Error('#401: 15 >>> 12 === 0. Actual: ' + (15 >>> 12)); +} + + +if (31 >>> 12 !== 0) { + throw new Test262Error('#402: 31 >>> 12 === 0. Actual: ' + (31 >>> 12)); +} + + +if (63 >>> 12 !== 0) { + throw new Test262Error('#403: 63 >>> 12 === 0. Actual: ' + (63 >>> 12)); +} + + +if (127 >>> 12 !== 0) { + throw new Test262Error('#404: 127 >>> 12 === 0. Actual: ' + (127 >>> 12)); +} + + +if (255 >>> 12 !== 0) { + throw new Test262Error('#405: 255 >>> 12 === 0. Actual: ' + (255 >>> 12)); +} + + +if (511 >>> 12 !== 0) { + throw new Test262Error('#406: 511 >>> 12 === 0. Actual: ' + (511 >>> 12)); +} + + +if (1023 >>> 12 !== 0) { + throw new Test262Error('#407: 1023 >>> 12 === 0. Actual: ' + (1023 >>> 12)); +} + + +if (2047 >>> 12 !== 0) { + throw new Test262Error('#408: 2047 >>> 12 === 0. Actual: ' + (2047 >>> 12)); +} + + +if (4095 >>> 12 !== 0) { + throw new Test262Error('#409: 4095 >>> 12 === 0. Actual: ' + (4095 >>> 12)); +} + + +if (8191 >>> 12 !== 1) { + throw new Test262Error('#410: 8191 >>> 12 === 1. Actual: ' + (8191 >>> 12)); +} + + +if (16383 >>> 12 !== 3) { + throw new Test262Error('#411: 16383 >>> 12 === 3. Actual: ' + (16383 >>> 12)); +} + + +if (32767 >>> 12 !== 7) { + throw new Test262Error('#412: 32767 >>> 12 === 7. Actual: ' + (32767 >>> 12)); +} + + +if (65535 >>> 12 !== 15) { + throw new Test262Error('#413: 65535 >>> 12 === 15. Actual: ' + (65535 >>> 12)); +} + + +if (131071 >>> 12 !== 31) { + throw new Test262Error('#414: 131071 >>> 12 === 31. Actual: ' + (131071 >>> 12)); +} + + +if (262143 >>> 12 !== 63) { + throw new Test262Error('#415: 262143 >>> 12 === 63. Actual: ' + (262143 >>> 12)); +} + + +if (524287 >>> 12 !== 127) { + throw new Test262Error('#416: 524287 >>> 12 === 127. Actual: ' + (524287 >>> 12)); +} + + +if (1048575 >>> 12 !== 255) { + throw new Test262Error('#417: 1048575 >>> 12 === 255. Actual: ' + (1048575 >>> 12)); +} + + +if (2097151 >>> 12 !== 511) { + throw new Test262Error('#418: 2097151 >>> 12 === 511. Actual: ' + (2097151 >>> 12)); +} + + +if (4194303 >>> 12 !== 1023) { + throw new Test262Error('#419: 4194303 >>> 12 === 1023. Actual: ' + (4194303 >>> 12)); +} + + +if (8388607 >>> 12 !== 2047) { + throw new Test262Error('#420: 8388607 >>> 12 === 2047. Actual: ' + (8388607 >>> 12)); +} + + +if (16777215 >>> 12 !== 4095) { + throw new Test262Error('#421: 16777215 >>> 12 === 4095. Actual: ' + (16777215 >>> 12)); +} + + +if (33554431 >>> 12 !== 8191) { + throw new Test262Error('#422: 33554431 >>> 12 === 8191. Actual: ' + (33554431 >>> 12)); +} + + +if (67108863 >>> 12 !== 16383) { + throw new Test262Error('#423: 67108863 >>> 12 === 16383. Actual: ' + (67108863 >>> 12)); +} + + +if (134217727 >>> 12 !== 32767) { + throw new Test262Error('#424: 134217727 >>> 12 === 32767. Actual: ' + (134217727 >>> 12)); +} + + +if (268435455 >>> 12 !== 65535) { + throw new Test262Error('#425: 268435455 >>> 12 === 65535. Actual: ' + (268435455 >>> 12)); +} + + +if (536870911 >>> 12 !== 131071) { + throw new Test262Error('#426: 536870911 >>> 12 === 131071. Actual: ' + (536870911 >>> 12)); +} + + +if (1073741823 >>> 12 !== 262143) { + throw new Test262Error('#427: 1073741823 >>> 12 === 262143. Actual: ' + (1073741823 >>> 12)); +} + + +if (2147483647 >>> 12 !== 524287) { + throw new Test262Error('#428: 2147483647 >>> 12 === 524287. Actual: ' + (2147483647 >>> 12)); +} + + +if (4294967295 >>> 12 !== 1048575) { + throw new Test262Error('#429: 4294967295 >>> 12 === 1048575. Actual: ' + (4294967295 >>> 12)); +} + + +if (0 >>> 13 !== 0) { + throw new Test262Error('#430: 0 >>> 13 === 0. Actual: ' + (0 >>> 13)); +} + + +if (1 >>> 13 !== 0) { + throw new Test262Error('#431: 1 >>> 13 === 0. Actual: ' + (1 >>> 13)); +} + + +if (3 >>> 13 !== 0) { + throw new Test262Error('#432: 3 >>> 13 === 0. Actual: ' + (3 >>> 13)); +} + + +if (7 >>> 13 !== 0) { + throw new Test262Error('#433: 7 >>> 13 === 0. Actual: ' + (7 >>> 13)); +} + + +if (15 >>> 13 !== 0) { + throw new Test262Error('#434: 15 >>> 13 === 0. Actual: ' + (15 >>> 13)); +} + + +if (31 >>> 13 !== 0) { + throw new Test262Error('#435: 31 >>> 13 === 0. Actual: ' + (31 >>> 13)); +} + + +if (63 >>> 13 !== 0) { + throw new Test262Error('#436: 63 >>> 13 === 0. Actual: ' + (63 >>> 13)); +} + + +if (127 >>> 13 !== 0) { + throw new Test262Error('#437: 127 >>> 13 === 0. Actual: ' + (127 >>> 13)); +} + + +if (255 >>> 13 !== 0) { + throw new Test262Error('#438: 255 >>> 13 === 0. Actual: ' + (255 >>> 13)); +} + + +if (511 >>> 13 !== 0) { + throw new Test262Error('#439: 511 >>> 13 === 0. Actual: ' + (511 >>> 13)); +} + + +if (1023 >>> 13 !== 0) { + throw new Test262Error('#440: 1023 >>> 13 === 0. Actual: ' + (1023 >>> 13)); +} + + +if (2047 >>> 13 !== 0) { + throw new Test262Error('#441: 2047 >>> 13 === 0. Actual: ' + (2047 >>> 13)); +} + + +if (4095 >>> 13 !== 0) { + throw new Test262Error('#442: 4095 >>> 13 === 0. Actual: ' + (4095 >>> 13)); +} + + +if (8191 >>> 13 !== 0) { + throw new Test262Error('#443: 8191 >>> 13 === 0. Actual: ' + (8191 >>> 13)); +} + + +if (16383 >>> 13 !== 1) { + throw new Test262Error('#444: 16383 >>> 13 === 1. Actual: ' + (16383 >>> 13)); +} + + +if (32767 >>> 13 !== 3) { + throw new Test262Error('#445: 32767 >>> 13 === 3. Actual: ' + (32767 >>> 13)); +} + + +if (65535 >>> 13 !== 7) { + throw new Test262Error('#446: 65535 >>> 13 === 7. Actual: ' + (65535 >>> 13)); +} + + +if (131071 >>> 13 !== 15) { + throw new Test262Error('#447: 131071 >>> 13 === 15. Actual: ' + (131071 >>> 13)); +} + + +if (262143 >>> 13 !== 31) { + throw new Test262Error('#448: 262143 >>> 13 === 31. Actual: ' + (262143 >>> 13)); +} + + +if (524287 >>> 13 !== 63) { + throw new Test262Error('#449: 524287 >>> 13 === 63. Actual: ' + (524287 >>> 13)); +} + + +if (1048575 >>> 13 !== 127) { + throw new Test262Error('#450: 1048575 >>> 13 === 127. Actual: ' + (1048575 >>> 13)); +} + + +if (2097151 >>> 13 !== 255) { + throw new Test262Error('#451: 2097151 >>> 13 === 255. Actual: ' + (2097151 >>> 13)); +} + + +if (4194303 >>> 13 !== 511) { + throw new Test262Error('#452: 4194303 >>> 13 === 511. Actual: ' + (4194303 >>> 13)); +} + + +if (8388607 >>> 13 !== 1023) { + throw new Test262Error('#453: 8388607 >>> 13 === 1023. Actual: ' + (8388607 >>> 13)); +} + + +if (16777215 >>> 13 !== 2047) { + throw new Test262Error('#454: 16777215 >>> 13 === 2047. Actual: ' + (16777215 >>> 13)); +} + + +if (33554431 >>> 13 !== 4095) { + throw new Test262Error('#455: 33554431 >>> 13 === 4095. Actual: ' + (33554431 >>> 13)); +} + + +if (67108863 >>> 13 !== 8191) { + throw new Test262Error('#456: 67108863 >>> 13 === 8191. Actual: ' + (67108863 >>> 13)); +} + + +if (134217727 >>> 13 !== 16383) { + throw new Test262Error('#457: 134217727 >>> 13 === 16383. Actual: ' + (134217727 >>> 13)); +} + + +if (268435455 >>> 13 !== 32767) { + throw new Test262Error('#458: 268435455 >>> 13 === 32767. Actual: ' + (268435455 >>> 13)); +} + + +if (536870911 >>> 13 !== 65535) { + throw new Test262Error('#459: 536870911 >>> 13 === 65535. Actual: ' + (536870911 >>> 13)); +} + + +if (1073741823 >>> 13 !== 131071) { + throw new Test262Error('#460: 1073741823 >>> 13 === 131071. Actual: ' + (1073741823 >>> 13)); +} + + +if (2147483647 >>> 13 !== 262143) { + throw new Test262Error('#461: 2147483647 >>> 13 === 262143. Actual: ' + (2147483647 >>> 13)); +} + + +if (4294967295 >>> 13 !== 524287) { + throw new Test262Error('#462: 4294967295 >>> 13 === 524287. Actual: ' + (4294967295 >>> 13)); +} + + +if (0 >>> 14 !== 0) { + throw new Test262Error('#463: 0 >>> 14 === 0. Actual: ' + (0 >>> 14)); +} + + +if (1 >>> 14 !== 0) { + throw new Test262Error('#464: 1 >>> 14 === 0. Actual: ' + (1 >>> 14)); +} + + +if (3 >>> 14 !== 0) { + throw new Test262Error('#465: 3 >>> 14 === 0. Actual: ' + (3 >>> 14)); +} + + +if (7 >>> 14 !== 0) { + throw new Test262Error('#466: 7 >>> 14 === 0. Actual: ' + (7 >>> 14)); +} + + +if (15 >>> 14 !== 0) { + throw new Test262Error('#467: 15 >>> 14 === 0. Actual: ' + (15 >>> 14)); +} + + +if (31 >>> 14 !== 0) { + throw new Test262Error('#468: 31 >>> 14 === 0. Actual: ' + (31 >>> 14)); +} + + +if (63 >>> 14 !== 0) { + throw new Test262Error('#469: 63 >>> 14 === 0. Actual: ' + (63 >>> 14)); +} + + +if (127 >>> 14 !== 0) { + throw new Test262Error('#470: 127 >>> 14 === 0. Actual: ' + (127 >>> 14)); +} + + +if (255 >>> 14 !== 0) { + throw new Test262Error('#471: 255 >>> 14 === 0. Actual: ' + (255 >>> 14)); +} + + +if (511 >>> 14 !== 0) { + throw new Test262Error('#472: 511 >>> 14 === 0. Actual: ' + (511 >>> 14)); +} + + +if (1023 >>> 14 !== 0) { + throw new Test262Error('#473: 1023 >>> 14 === 0. Actual: ' + (1023 >>> 14)); +} + + +if (2047 >>> 14 !== 0) { + throw new Test262Error('#474: 2047 >>> 14 === 0. Actual: ' + (2047 >>> 14)); +} + + +if (4095 >>> 14 !== 0) { + throw new Test262Error('#475: 4095 >>> 14 === 0. Actual: ' + (4095 >>> 14)); +} + + +if (8191 >>> 14 !== 0) { + throw new Test262Error('#476: 8191 >>> 14 === 0. Actual: ' + (8191 >>> 14)); +} + + +if (16383 >>> 14 !== 0) { + throw new Test262Error('#477: 16383 >>> 14 === 0. Actual: ' + (16383 >>> 14)); +} + + +if (32767 >>> 14 !== 1) { + throw new Test262Error('#478: 32767 >>> 14 === 1. Actual: ' + (32767 >>> 14)); +} + + +if (65535 >>> 14 !== 3) { + throw new Test262Error('#479: 65535 >>> 14 === 3. Actual: ' + (65535 >>> 14)); +} + + +if (131071 >>> 14 !== 7) { + throw new Test262Error('#480: 131071 >>> 14 === 7. Actual: ' + (131071 >>> 14)); +} + + +if (262143 >>> 14 !== 15) { + throw new Test262Error('#481: 262143 >>> 14 === 15. Actual: ' + (262143 >>> 14)); +} + + +if (524287 >>> 14 !== 31) { + throw new Test262Error('#482: 524287 >>> 14 === 31. Actual: ' + (524287 >>> 14)); +} + + +if (1048575 >>> 14 !== 63) { + throw new Test262Error('#483: 1048575 >>> 14 === 63. Actual: ' + (1048575 >>> 14)); +} + + +if (2097151 >>> 14 !== 127) { + throw new Test262Error('#484: 2097151 >>> 14 === 127. Actual: ' + (2097151 >>> 14)); +} + + +if (4194303 >>> 14 !== 255) { + throw new Test262Error('#485: 4194303 >>> 14 === 255. Actual: ' + (4194303 >>> 14)); +} + + +if (8388607 >>> 14 !== 511) { + throw new Test262Error('#486: 8388607 >>> 14 === 511. Actual: ' + (8388607 >>> 14)); +} + + +if (16777215 >>> 14 !== 1023) { + throw new Test262Error('#487: 16777215 >>> 14 === 1023. Actual: ' + (16777215 >>> 14)); +} + + +if (33554431 >>> 14 !== 2047) { + throw new Test262Error('#488: 33554431 >>> 14 === 2047. Actual: ' + (33554431 >>> 14)); +} + + +if (67108863 >>> 14 !== 4095) { + throw new Test262Error('#489: 67108863 >>> 14 === 4095. Actual: ' + (67108863 >>> 14)); +} + + +if (134217727 >>> 14 !== 8191) { + throw new Test262Error('#490: 134217727 >>> 14 === 8191. Actual: ' + (134217727 >>> 14)); +} + + +if (268435455 >>> 14 !== 16383) { + throw new Test262Error('#491: 268435455 >>> 14 === 16383. Actual: ' + (268435455 >>> 14)); +} + + +if (536870911 >>> 14 !== 32767) { + throw new Test262Error('#492: 536870911 >>> 14 === 32767. Actual: ' + (536870911 >>> 14)); +} + + +if (1073741823 >>> 14 !== 65535) { + throw new Test262Error('#493: 1073741823 >>> 14 === 65535. Actual: ' + (1073741823 >>> 14)); +} + + +if (2147483647 >>> 14 !== 131071) { + throw new Test262Error('#494: 2147483647 >>> 14 === 131071. Actual: ' + (2147483647 >>> 14)); +} + + +if (4294967295 >>> 14 !== 262143) { + throw new Test262Error('#495: 4294967295 >>> 14 === 262143. Actual: ' + (4294967295 >>> 14)); +} + + +if (0 >>> 15 !== 0) { + throw new Test262Error('#496: 0 >>> 15 === 0. Actual: ' + (0 >>> 15)); +} + + +if (1 >>> 15 !== 0) { + throw new Test262Error('#497: 1 >>> 15 === 0. Actual: ' + (1 >>> 15)); +} + + +if (3 >>> 15 !== 0) { + throw new Test262Error('#498: 3 >>> 15 === 0. Actual: ' + (3 >>> 15)); +} + + +if (7 >>> 15 !== 0) { + throw new Test262Error('#499: 7 >>> 15 === 0. Actual: ' + (7 >>> 15)); +} + + +if (15 >>> 15 !== 0) { + throw new Test262Error('#500: 15 >>> 15 === 0. Actual: ' + (15 >>> 15)); +} + + +if (31 >>> 15 !== 0) { + throw new Test262Error('#501: 31 >>> 15 === 0. Actual: ' + (31 >>> 15)); +} + + +if (63 >>> 15 !== 0) { + throw new Test262Error('#502: 63 >>> 15 === 0. Actual: ' + (63 >>> 15)); +} + + +if (127 >>> 15 !== 0) { + throw new Test262Error('#503: 127 >>> 15 === 0. Actual: ' + (127 >>> 15)); +} + + +if (255 >>> 15 !== 0) { + throw new Test262Error('#504: 255 >>> 15 === 0. Actual: ' + (255 >>> 15)); +} + + +if (511 >>> 15 !== 0) { + throw new Test262Error('#505: 511 >>> 15 === 0. Actual: ' + (511 >>> 15)); +} + + +if (1023 >>> 15 !== 0) { + throw new Test262Error('#506: 1023 >>> 15 === 0. Actual: ' + (1023 >>> 15)); +} + + +if (2047 >>> 15 !== 0) { + throw new Test262Error('#507: 2047 >>> 15 === 0. Actual: ' + (2047 >>> 15)); +} + + +if (4095 >>> 15 !== 0) { + throw new Test262Error('#508: 4095 >>> 15 === 0. Actual: ' + (4095 >>> 15)); +} + + +if (8191 >>> 15 !== 0) { + throw new Test262Error('#509: 8191 >>> 15 === 0. Actual: ' + (8191 >>> 15)); +} + + +if (16383 >>> 15 !== 0) { + throw new Test262Error('#510: 16383 >>> 15 === 0. Actual: ' + (16383 >>> 15)); +} + + +if (32767 >>> 15 !== 0) { + throw new Test262Error('#511: 32767 >>> 15 === 0. Actual: ' + (32767 >>> 15)); +} + + +if (65535 >>> 15 !== 1) { + throw new Test262Error('#512: 65535 >>> 15 === 1. Actual: ' + (65535 >>> 15)); +} + + +if (131071 >>> 15 !== 3) { + throw new Test262Error('#513: 131071 >>> 15 === 3. Actual: ' + (131071 >>> 15)); +} + + +if (262143 >>> 15 !== 7) { + throw new Test262Error('#514: 262143 >>> 15 === 7. Actual: ' + (262143 >>> 15)); +} + + +if (524287 >>> 15 !== 15) { + throw new Test262Error('#515: 524287 >>> 15 === 15. Actual: ' + (524287 >>> 15)); +} + + +if (1048575 >>> 15 !== 31) { + throw new Test262Error('#516: 1048575 >>> 15 === 31. Actual: ' + (1048575 >>> 15)); +} + + +if (2097151 >>> 15 !== 63) { + throw new Test262Error('#517: 2097151 >>> 15 === 63. Actual: ' + (2097151 >>> 15)); +} + + +if (4194303 >>> 15 !== 127) { + throw new Test262Error('#518: 4194303 >>> 15 === 127. Actual: ' + (4194303 >>> 15)); +} + + +if (8388607 >>> 15 !== 255) { + throw new Test262Error('#519: 8388607 >>> 15 === 255. Actual: ' + (8388607 >>> 15)); +} + + +if (16777215 >>> 15 !== 511) { + throw new Test262Error('#520: 16777215 >>> 15 === 511. Actual: ' + (16777215 >>> 15)); +} + + +if (33554431 >>> 15 !== 1023) { + throw new Test262Error('#521: 33554431 >>> 15 === 1023. Actual: ' + (33554431 >>> 15)); +} + + +if (67108863 >>> 15 !== 2047) { + throw new Test262Error('#522: 67108863 >>> 15 === 2047. Actual: ' + (67108863 >>> 15)); +} + + +if (134217727 >>> 15 !== 4095) { + throw new Test262Error('#523: 134217727 >>> 15 === 4095. Actual: ' + (134217727 >>> 15)); +} + + +if (268435455 >>> 15 !== 8191) { + throw new Test262Error('#524: 268435455 >>> 15 === 8191. Actual: ' + (268435455 >>> 15)); +} + + +if (536870911 >>> 15 !== 16383) { + throw new Test262Error('#525: 536870911 >>> 15 === 16383. Actual: ' + (536870911 >>> 15)); +} + + +if (1073741823 >>> 15 !== 32767) { + throw new Test262Error('#526: 1073741823 >>> 15 === 32767. Actual: ' + (1073741823 >>> 15)); +} + + +if (2147483647 >>> 15 !== 65535) { + throw new Test262Error('#527: 2147483647 >>> 15 === 65535. Actual: ' + (2147483647 >>> 15)); +} + + +if (4294967295 >>> 15 !== 131071) { + throw new Test262Error('#528: 4294967295 >>> 15 === 131071. Actual: ' + (4294967295 >>> 15)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T4.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T4.js new file mode 100644 index 0000000000..4cc58ac7f1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A4_T4.js @@ -0,0 +1,2651 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Check operator x >>> y in distinct points +es5id: 11.7.3_A4_T4 +description: ShiftExpression = 2^n - 1, n = 16...31 +---*/ + +//CHECK + +if (0 >>> 16 !== 0) { + throw new Test262Error('#529: 0 >>> 16 === 0. Actual: ' + (0 >>> 16)); +} + + +if (1 >>> 16 !== 0) { + throw new Test262Error('#530: 1 >>> 16 === 0. Actual: ' + (1 >>> 16)); +} + + +if (3 >>> 16 !== 0) { + throw new Test262Error('#531: 3 >>> 16 === 0. Actual: ' + (3 >>> 16)); +} + + +if (7 >>> 16 !== 0) { + throw new Test262Error('#532: 7 >>> 16 === 0. Actual: ' + (7 >>> 16)); +} + + +if (15 >>> 16 !== 0) { + throw new Test262Error('#533: 15 >>> 16 === 0. Actual: ' + (15 >>> 16)); +} + + +if (31 >>> 16 !== 0) { + throw new Test262Error('#534: 31 >>> 16 === 0. Actual: ' + (31 >>> 16)); +} + + +if (63 >>> 16 !== 0) { + throw new Test262Error('#535: 63 >>> 16 === 0. Actual: ' + (63 >>> 16)); +} + + +if (127 >>> 16 !== 0) { + throw new Test262Error('#536: 127 >>> 16 === 0. Actual: ' + (127 >>> 16)); +} + + +if (255 >>> 16 !== 0) { + throw new Test262Error('#537: 255 >>> 16 === 0. Actual: ' + (255 >>> 16)); +} + + +if (511 >>> 16 !== 0) { + throw new Test262Error('#538: 511 >>> 16 === 0. Actual: ' + (511 >>> 16)); +} + + +if (1023 >>> 16 !== 0) { + throw new Test262Error('#539: 1023 >>> 16 === 0. Actual: ' + (1023 >>> 16)); +} + + +if (2047 >>> 16 !== 0) { + throw new Test262Error('#540: 2047 >>> 16 === 0. Actual: ' + (2047 >>> 16)); +} + + +if (4095 >>> 16 !== 0) { + throw new Test262Error('#541: 4095 >>> 16 === 0. Actual: ' + (4095 >>> 16)); +} + + +if (8191 >>> 16 !== 0) { + throw new Test262Error('#542: 8191 >>> 16 === 0. Actual: ' + (8191 >>> 16)); +} + + +if (16383 >>> 16 !== 0) { + throw new Test262Error('#543: 16383 >>> 16 === 0. Actual: ' + (16383 >>> 16)); +} + + +if (32767 >>> 16 !== 0) { + throw new Test262Error('#544: 32767 >>> 16 === 0. Actual: ' + (32767 >>> 16)); +} + + +if (65535 >>> 16 !== 0) { + throw new Test262Error('#545: 65535 >>> 16 === 0. Actual: ' + (65535 >>> 16)); +} + + +if (131071 >>> 16 !== 1) { + throw new Test262Error('#546: 131071 >>> 16 === 1. Actual: ' + (131071 >>> 16)); +} + + +if (262143 >>> 16 !== 3) { + throw new Test262Error('#547: 262143 >>> 16 === 3. Actual: ' + (262143 >>> 16)); +} + + +if (524287 >>> 16 !== 7) { + throw new Test262Error('#548: 524287 >>> 16 === 7. Actual: ' + (524287 >>> 16)); +} + + +if (1048575 >>> 16 !== 15) { + throw new Test262Error('#549: 1048575 >>> 16 === 15. Actual: ' + (1048575 >>> 16)); +} + + +if (2097151 >>> 16 !== 31) { + throw new Test262Error('#550: 2097151 >>> 16 === 31. Actual: ' + (2097151 >>> 16)); +} + + +if (4194303 >>> 16 !== 63) { + throw new Test262Error('#551: 4194303 >>> 16 === 63. Actual: ' + (4194303 >>> 16)); +} + + +if (8388607 >>> 16 !== 127) { + throw new Test262Error('#552: 8388607 >>> 16 === 127. Actual: ' + (8388607 >>> 16)); +} + + +if (16777215 >>> 16 !== 255) { + throw new Test262Error('#553: 16777215 >>> 16 === 255. Actual: ' + (16777215 >>> 16)); +} + + +if (33554431 >>> 16 !== 511) { + throw new Test262Error('#554: 33554431 >>> 16 === 511. Actual: ' + (33554431 >>> 16)); +} + + +if (67108863 >>> 16 !== 1023) { + throw new Test262Error('#555: 67108863 >>> 16 === 1023. Actual: ' + (67108863 >>> 16)); +} + + +if (134217727 >>> 16 !== 2047) { + throw new Test262Error('#556: 134217727 >>> 16 === 2047. Actual: ' + (134217727 >>> 16)); +} + + +if (268435455 >>> 16 !== 4095) { + throw new Test262Error('#557: 268435455 >>> 16 === 4095. Actual: ' + (268435455 >>> 16)); +} + + +if (536870911 >>> 16 !== 8191) { + throw new Test262Error('#558: 536870911 >>> 16 === 8191. Actual: ' + (536870911 >>> 16)); +} + + +if (1073741823 >>> 16 !== 16383) { + throw new Test262Error('#559: 1073741823 >>> 16 === 16383. Actual: ' + (1073741823 >>> 16)); +} + + +if (2147483647 >>> 16 !== 32767) { + throw new Test262Error('#560: 2147483647 >>> 16 === 32767. Actual: ' + (2147483647 >>> 16)); +} + + +if (4294967295 >>> 16 !== 65535) { + throw new Test262Error('#561: 4294967295 >>> 16 === 65535. Actual: ' + (4294967295 >>> 16)); +} + + +if (0 >>> 17 !== 0) { + throw new Test262Error('#562: 0 >>> 17 === 0. Actual: ' + (0 >>> 17)); +} + + +if (1 >>> 17 !== 0) { + throw new Test262Error('#563: 1 >>> 17 === 0. Actual: ' + (1 >>> 17)); +} + + +if (3 >>> 17 !== 0) { + throw new Test262Error('#564: 3 >>> 17 === 0. Actual: ' + (3 >>> 17)); +} + + +if (7 >>> 17 !== 0) { + throw new Test262Error('#565: 7 >>> 17 === 0. Actual: ' + (7 >>> 17)); +} + + +if (15 >>> 17 !== 0) { + throw new Test262Error('#566: 15 >>> 17 === 0. Actual: ' + (15 >>> 17)); +} + + +if (31 >>> 17 !== 0) { + throw new Test262Error('#567: 31 >>> 17 === 0. Actual: ' + (31 >>> 17)); +} + + +if (63 >>> 17 !== 0) { + throw new Test262Error('#568: 63 >>> 17 === 0. Actual: ' + (63 >>> 17)); +} + + +if (127 >>> 17 !== 0) { + throw new Test262Error('#569: 127 >>> 17 === 0. Actual: ' + (127 >>> 17)); +} + + +if (255 >>> 17 !== 0) { + throw new Test262Error('#570: 255 >>> 17 === 0. Actual: ' + (255 >>> 17)); +} + + +if (511 >>> 17 !== 0) { + throw new Test262Error('#571: 511 >>> 17 === 0. Actual: ' + (511 >>> 17)); +} + + +if (1023 >>> 17 !== 0) { + throw new Test262Error('#572: 1023 >>> 17 === 0. Actual: ' + (1023 >>> 17)); +} + + +if (2047 >>> 17 !== 0) { + throw new Test262Error('#573: 2047 >>> 17 === 0. Actual: ' + (2047 >>> 17)); +} + + +if (4095 >>> 17 !== 0) { + throw new Test262Error('#574: 4095 >>> 17 === 0. Actual: ' + (4095 >>> 17)); +} + + +if (8191 >>> 17 !== 0) { + throw new Test262Error('#575: 8191 >>> 17 === 0. Actual: ' + (8191 >>> 17)); +} + + +if (16383 >>> 17 !== 0) { + throw new Test262Error('#576: 16383 >>> 17 === 0. Actual: ' + (16383 >>> 17)); +} + + +if (32767 >>> 17 !== 0) { + throw new Test262Error('#577: 32767 >>> 17 === 0. Actual: ' + (32767 >>> 17)); +} + + +if (65535 >>> 17 !== 0) { + throw new Test262Error('#578: 65535 >>> 17 === 0. Actual: ' + (65535 >>> 17)); +} + + +if (131071 >>> 17 !== 0) { + throw new Test262Error('#579: 131071 >>> 17 === 0. Actual: ' + (131071 >>> 17)); +} + + +if (262143 >>> 17 !== 1) { + throw new Test262Error('#580: 262143 >>> 17 === 1. Actual: ' + (262143 >>> 17)); +} + + +if (524287 >>> 17 !== 3) { + throw new Test262Error('#581: 524287 >>> 17 === 3. Actual: ' + (524287 >>> 17)); +} + + +if (1048575 >>> 17 !== 7) { + throw new Test262Error('#582: 1048575 >>> 17 === 7. Actual: ' + (1048575 >>> 17)); +} + + +if (2097151 >>> 17 !== 15) { + throw new Test262Error('#583: 2097151 >>> 17 === 15. Actual: ' + (2097151 >>> 17)); +} + + +if (4194303 >>> 17 !== 31) { + throw new Test262Error('#584: 4194303 >>> 17 === 31. Actual: ' + (4194303 >>> 17)); +} + + +if (8388607 >>> 17 !== 63) { + throw new Test262Error('#585: 8388607 >>> 17 === 63. Actual: ' + (8388607 >>> 17)); +} + + +if (16777215 >>> 17 !== 127) { + throw new Test262Error('#586: 16777215 >>> 17 === 127. Actual: ' + (16777215 >>> 17)); +} + + +if (33554431 >>> 17 !== 255) { + throw new Test262Error('#587: 33554431 >>> 17 === 255. Actual: ' + (33554431 >>> 17)); +} + + +if (67108863 >>> 17 !== 511) { + throw new Test262Error('#588: 67108863 >>> 17 === 511. Actual: ' + (67108863 >>> 17)); +} + + +if (134217727 >>> 17 !== 1023) { + throw new Test262Error('#589: 134217727 >>> 17 === 1023. Actual: ' + (134217727 >>> 17)); +} + + +if (268435455 >>> 17 !== 2047) { + throw new Test262Error('#590: 268435455 >>> 17 === 2047. Actual: ' + (268435455 >>> 17)); +} + + +if (536870911 >>> 17 !== 4095) { + throw new Test262Error('#591: 536870911 >>> 17 === 4095. Actual: ' + (536870911 >>> 17)); +} + + +if (1073741823 >>> 17 !== 8191) { + throw new Test262Error('#592: 1073741823 >>> 17 === 8191. Actual: ' + (1073741823 >>> 17)); +} + + +if (2147483647 >>> 17 !== 16383) { + throw new Test262Error('#593: 2147483647 >>> 17 === 16383. Actual: ' + (2147483647 >>> 17)); +} + + +if (4294967295 >>> 17 !== 32767) { + throw new Test262Error('#594: 4294967295 >>> 17 === 32767. Actual: ' + (4294967295 >>> 17)); +} + + +if (0 >>> 18 !== 0) { + throw new Test262Error('#595: 0 >>> 18 === 0. Actual: ' + (0 >>> 18)); +} + + +if (1 >>> 18 !== 0) { + throw new Test262Error('#596: 1 >>> 18 === 0. Actual: ' + (1 >>> 18)); +} + + +if (3 >>> 18 !== 0) { + throw new Test262Error('#597: 3 >>> 18 === 0. Actual: ' + (3 >>> 18)); +} + + +if (7 >>> 18 !== 0) { + throw new Test262Error('#598: 7 >>> 18 === 0. Actual: ' + (7 >>> 18)); +} + + +if (15 >>> 18 !== 0) { + throw new Test262Error('#599: 15 >>> 18 === 0. Actual: ' + (15 >>> 18)); +} + + +if (31 >>> 18 !== 0) { + throw new Test262Error('#600: 31 >>> 18 === 0. Actual: ' + (31 >>> 18)); +} + + +if (63 >>> 18 !== 0) { + throw new Test262Error('#601: 63 >>> 18 === 0. Actual: ' + (63 >>> 18)); +} + + +if (127 >>> 18 !== 0) { + throw new Test262Error('#602: 127 >>> 18 === 0. Actual: ' + (127 >>> 18)); +} + + +if (255 >>> 18 !== 0) { + throw new Test262Error('#603: 255 >>> 18 === 0. Actual: ' + (255 >>> 18)); +} + + +if (511 >>> 18 !== 0) { + throw new Test262Error('#604: 511 >>> 18 === 0. Actual: ' + (511 >>> 18)); +} + + +if (1023 >>> 18 !== 0) { + throw new Test262Error('#605: 1023 >>> 18 === 0. Actual: ' + (1023 >>> 18)); +} + + +if (2047 >>> 18 !== 0) { + throw new Test262Error('#606: 2047 >>> 18 === 0. Actual: ' + (2047 >>> 18)); +} + + +if (4095 >>> 18 !== 0) { + throw new Test262Error('#607: 4095 >>> 18 === 0. Actual: ' + (4095 >>> 18)); +} + + +if (8191 >>> 18 !== 0) { + throw new Test262Error('#608: 8191 >>> 18 === 0. Actual: ' + (8191 >>> 18)); +} + + +if (16383 >>> 18 !== 0) { + throw new Test262Error('#609: 16383 >>> 18 === 0. Actual: ' + (16383 >>> 18)); +} + + +if (32767 >>> 18 !== 0) { + throw new Test262Error('#610: 32767 >>> 18 === 0. Actual: ' + (32767 >>> 18)); +} + + +if (65535 >>> 18 !== 0) { + throw new Test262Error('#611: 65535 >>> 18 === 0. Actual: ' + (65535 >>> 18)); +} + + +if (131071 >>> 18 !== 0) { + throw new Test262Error('#612: 131071 >>> 18 === 0. Actual: ' + (131071 >>> 18)); +} + + +if (262143 >>> 18 !== 0) { + throw new Test262Error('#613: 262143 >>> 18 === 0. Actual: ' + (262143 >>> 18)); +} + + +if (524287 >>> 18 !== 1) { + throw new Test262Error('#614: 524287 >>> 18 === 1. Actual: ' + (524287 >>> 18)); +} + + +if (1048575 >>> 18 !== 3) { + throw new Test262Error('#615: 1048575 >>> 18 === 3. Actual: ' + (1048575 >>> 18)); +} + + +if (2097151 >>> 18 !== 7) { + throw new Test262Error('#616: 2097151 >>> 18 === 7. Actual: ' + (2097151 >>> 18)); +} + + +if (4194303 >>> 18 !== 15) { + throw new Test262Error('#617: 4194303 >>> 18 === 15. Actual: ' + (4194303 >>> 18)); +} + + +if (8388607 >>> 18 !== 31) { + throw new Test262Error('#618: 8388607 >>> 18 === 31. Actual: ' + (8388607 >>> 18)); +} + + +if (16777215 >>> 18 !== 63) { + throw new Test262Error('#619: 16777215 >>> 18 === 63. Actual: ' + (16777215 >>> 18)); +} + + +if (33554431 >>> 18 !== 127) { + throw new Test262Error('#620: 33554431 >>> 18 === 127. Actual: ' + (33554431 >>> 18)); +} + + +if (67108863 >>> 18 !== 255) { + throw new Test262Error('#621: 67108863 >>> 18 === 255. Actual: ' + (67108863 >>> 18)); +} + + +if (134217727 >>> 18 !== 511) { + throw new Test262Error('#622: 134217727 >>> 18 === 511. Actual: ' + (134217727 >>> 18)); +} + + +if (268435455 >>> 18 !== 1023) { + throw new Test262Error('#623: 268435455 >>> 18 === 1023. Actual: ' + (268435455 >>> 18)); +} + + +if (536870911 >>> 18 !== 2047) { + throw new Test262Error('#624: 536870911 >>> 18 === 2047. Actual: ' + (536870911 >>> 18)); +} + + +if (1073741823 >>> 18 !== 4095) { + throw new Test262Error('#625: 1073741823 >>> 18 === 4095. Actual: ' + (1073741823 >>> 18)); +} + + +if (2147483647 >>> 18 !== 8191) { + throw new Test262Error('#626: 2147483647 >>> 18 === 8191. Actual: ' + (2147483647 >>> 18)); +} + + +if (4294967295 >>> 18 !== 16383) { + throw new Test262Error('#627: 4294967295 >>> 18 === 16383. Actual: ' + (4294967295 >>> 18)); +} + + +if (0 >>> 19 !== 0) { + throw new Test262Error('#628: 0 >>> 19 === 0. Actual: ' + (0 >>> 19)); +} + + +if (1 >>> 19 !== 0) { + throw new Test262Error('#629: 1 >>> 19 === 0. Actual: ' + (1 >>> 19)); +} + + +if (3 >>> 19 !== 0) { + throw new Test262Error('#630: 3 >>> 19 === 0. Actual: ' + (3 >>> 19)); +} + + +if (7 >>> 19 !== 0) { + throw new Test262Error('#631: 7 >>> 19 === 0. Actual: ' + (7 >>> 19)); +} + + +if (15 >>> 19 !== 0) { + throw new Test262Error('#632: 15 >>> 19 === 0. Actual: ' + (15 >>> 19)); +} + + +if (31 >>> 19 !== 0) { + throw new Test262Error('#633: 31 >>> 19 === 0. Actual: ' + (31 >>> 19)); +} + + +if (63 >>> 19 !== 0) { + throw new Test262Error('#634: 63 >>> 19 === 0. Actual: ' + (63 >>> 19)); +} + + +if (127 >>> 19 !== 0) { + throw new Test262Error('#635: 127 >>> 19 === 0. Actual: ' + (127 >>> 19)); +} + + +if (255 >>> 19 !== 0) { + throw new Test262Error('#636: 255 >>> 19 === 0. Actual: ' + (255 >>> 19)); +} + + +if (511 >>> 19 !== 0) { + throw new Test262Error('#637: 511 >>> 19 === 0. Actual: ' + (511 >>> 19)); +} + + +if (1023 >>> 19 !== 0) { + throw new Test262Error('#638: 1023 >>> 19 === 0. Actual: ' + (1023 >>> 19)); +} + + +if (2047 >>> 19 !== 0) { + throw new Test262Error('#639: 2047 >>> 19 === 0. Actual: ' + (2047 >>> 19)); +} + + +if (4095 >>> 19 !== 0) { + throw new Test262Error('#640: 4095 >>> 19 === 0. Actual: ' + (4095 >>> 19)); +} + + +if (8191 >>> 19 !== 0) { + throw new Test262Error('#641: 8191 >>> 19 === 0. Actual: ' + (8191 >>> 19)); +} + + +if (16383 >>> 19 !== 0) { + throw new Test262Error('#642: 16383 >>> 19 === 0. Actual: ' + (16383 >>> 19)); +} + + +if (32767 >>> 19 !== 0) { + throw new Test262Error('#643: 32767 >>> 19 === 0. Actual: ' + (32767 >>> 19)); +} + + +if (65535 >>> 19 !== 0) { + throw new Test262Error('#644: 65535 >>> 19 === 0. Actual: ' + (65535 >>> 19)); +} + + +if (131071 >>> 19 !== 0) { + throw new Test262Error('#645: 131071 >>> 19 === 0. Actual: ' + (131071 >>> 19)); +} + + +if (262143 >>> 19 !== 0) { + throw new Test262Error('#646: 262143 >>> 19 === 0. Actual: ' + (262143 >>> 19)); +} + + +if (524287 >>> 19 !== 0) { + throw new Test262Error('#647: 524287 >>> 19 === 0. Actual: ' + (524287 >>> 19)); +} + + +if (1048575 >>> 19 !== 1) { + throw new Test262Error('#648: 1048575 >>> 19 === 1. Actual: ' + (1048575 >>> 19)); +} + + +if (2097151 >>> 19 !== 3) { + throw new Test262Error('#649: 2097151 >>> 19 === 3. Actual: ' + (2097151 >>> 19)); +} + + +if (4194303 >>> 19 !== 7) { + throw new Test262Error('#650: 4194303 >>> 19 === 7. Actual: ' + (4194303 >>> 19)); +} + + +if (8388607 >>> 19 !== 15) { + throw new Test262Error('#651: 8388607 >>> 19 === 15. Actual: ' + (8388607 >>> 19)); +} + + +if (16777215 >>> 19 !== 31) { + throw new Test262Error('#652: 16777215 >>> 19 === 31. Actual: ' + (16777215 >>> 19)); +} + + +if (33554431 >>> 19 !== 63) { + throw new Test262Error('#653: 33554431 >>> 19 === 63. Actual: ' + (33554431 >>> 19)); +} + + +if (67108863 >>> 19 !== 127) { + throw new Test262Error('#654: 67108863 >>> 19 === 127. Actual: ' + (67108863 >>> 19)); +} + + +if (134217727 >>> 19 !== 255) { + throw new Test262Error('#655: 134217727 >>> 19 === 255. Actual: ' + (134217727 >>> 19)); +} + + +if (268435455 >>> 19 !== 511) { + throw new Test262Error('#656: 268435455 >>> 19 === 511. Actual: ' + (268435455 >>> 19)); +} + + +if (536870911 >>> 19 !== 1023) { + throw new Test262Error('#657: 536870911 >>> 19 === 1023. Actual: ' + (536870911 >>> 19)); +} + + +if (1073741823 >>> 19 !== 2047) { + throw new Test262Error('#658: 1073741823 >>> 19 === 2047. Actual: ' + (1073741823 >>> 19)); +} + + +if (2147483647 >>> 19 !== 4095) { + throw new Test262Error('#659: 2147483647 >>> 19 === 4095. Actual: ' + (2147483647 >>> 19)); +} + + +if (4294967295 >>> 19 !== 8191) { + throw new Test262Error('#660: 4294967295 >>> 19 === 8191. Actual: ' + (4294967295 >>> 19)); +} + + +if (0 >>> 20 !== 0) { + throw new Test262Error('#661: 0 >>> 20 === 0. Actual: ' + (0 >>> 20)); +} + + +if (1 >>> 20 !== 0) { + throw new Test262Error('#662: 1 >>> 20 === 0. Actual: ' + (1 >>> 20)); +} + + +if (3 >>> 20 !== 0) { + throw new Test262Error('#663: 3 >>> 20 === 0. Actual: ' + (3 >>> 20)); +} + + +if (7 >>> 20 !== 0) { + throw new Test262Error('#664: 7 >>> 20 === 0. Actual: ' + (7 >>> 20)); +} + + +if (15 >>> 20 !== 0) { + throw new Test262Error('#665: 15 >>> 20 === 0. Actual: ' + (15 >>> 20)); +} + + +if (31 >>> 20 !== 0) { + throw new Test262Error('#666: 31 >>> 20 === 0. Actual: ' + (31 >>> 20)); +} + + +if (63 >>> 20 !== 0) { + throw new Test262Error('#667: 63 >>> 20 === 0. Actual: ' + (63 >>> 20)); +} + + +if (127 >>> 20 !== 0) { + throw new Test262Error('#668: 127 >>> 20 === 0. Actual: ' + (127 >>> 20)); +} + + +if (255 >>> 20 !== 0) { + throw new Test262Error('#669: 255 >>> 20 === 0. Actual: ' + (255 >>> 20)); +} + + +if (511 >>> 20 !== 0) { + throw new Test262Error('#670: 511 >>> 20 === 0. Actual: ' + (511 >>> 20)); +} + + +if (1023 >>> 20 !== 0) { + throw new Test262Error('#671: 1023 >>> 20 === 0. Actual: ' + (1023 >>> 20)); +} + + +if (2047 >>> 20 !== 0) { + throw new Test262Error('#672: 2047 >>> 20 === 0. Actual: ' + (2047 >>> 20)); +} + + +if (4095 >>> 20 !== 0) { + throw new Test262Error('#673: 4095 >>> 20 === 0. Actual: ' + (4095 >>> 20)); +} + + +if (8191 >>> 20 !== 0) { + throw new Test262Error('#674: 8191 >>> 20 === 0. Actual: ' + (8191 >>> 20)); +} + + +if (16383 >>> 20 !== 0) { + throw new Test262Error('#675: 16383 >>> 20 === 0. Actual: ' + (16383 >>> 20)); +} + + +if (32767 >>> 20 !== 0) { + throw new Test262Error('#676: 32767 >>> 20 === 0. Actual: ' + (32767 >>> 20)); +} + + +if (65535 >>> 20 !== 0) { + throw new Test262Error('#677: 65535 >>> 20 === 0. Actual: ' + (65535 >>> 20)); +} + + +if (131071 >>> 20 !== 0) { + throw new Test262Error('#678: 131071 >>> 20 === 0. Actual: ' + (131071 >>> 20)); +} + + +if (262143 >>> 20 !== 0) { + throw new Test262Error('#679: 262143 >>> 20 === 0. Actual: ' + (262143 >>> 20)); +} + + +if (524287 >>> 20 !== 0) { + throw new Test262Error('#680: 524287 >>> 20 === 0. Actual: ' + (524287 >>> 20)); +} + + +if (1048575 >>> 20 !== 0) { + throw new Test262Error('#681: 1048575 >>> 20 === 0. Actual: ' + (1048575 >>> 20)); +} + + +if (2097151 >>> 20 !== 1) { + throw new Test262Error('#682: 2097151 >>> 20 === 1. Actual: ' + (2097151 >>> 20)); +} + + +if (4194303 >>> 20 !== 3) { + throw new Test262Error('#683: 4194303 >>> 20 === 3. Actual: ' + (4194303 >>> 20)); +} + + +if (8388607 >>> 20 !== 7) { + throw new Test262Error('#684: 8388607 >>> 20 === 7. Actual: ' + (8388607 >>> 20)); +} + + +if (16777215 >>> 20 !== 15) { + throw new Test262Error('#685: 16777215 >>> 20 === 15. Actual: ' + (16777215 >>> 20)); +} + + +if (33554431 >>> 20 !== 31) { + throw new Test262Error('#686: 33554431 >>> 20 === 31. Actual: ' + (33554431 >>> 20)); +} + + +if (67108863 >>> 20 !== 63) { + throw new Test262Error('#687: 67108863 >>> 20 === 63. Actual: ' + (67108863 >>> 20)); +} + + +if (134217727 >>> 20 !== 127) { + throw new Test262Error('#688: 134217727 >>> 20 === 127. Actual: ' + (134217727 >>> 20)); +} + + +if (268435455 >>> 20 !== 255) { + throw new Test262Error('#689: 268435455 >>> 20 === 255. Actual: ' + (268435455 >>> 20)); +} + + +if (536870911 >>> 20 !== 511) { + throw new Test262Error('#690: 536870911 >>> 20 === 511. Actual: ' + (536870911 >>> 20)); +} + + +if (1073741823 >>> 20 !== 1023) { + throw new Test262Error('#691: 1073741823 >>> 20 === 1023. Actual: ' + (1073741823 >>> 20)); +} + + +if (2147483647 >>> 20 !== 2047) { + throw new Test262Error('#692: 2147483647 >>> 20 === 2047. Actual: ' + (2147483647 >>> 20)); +} + + +if (4294967295 >>> 20 !== 4095) { + throw new Test262Error('#693: 4294967295 >>> 20 === 4095. Actual: ' + (4294967295 >>> 20)); +} + + +if (0 >>> 21 !== 0) { + throw new Test262Error('#694: 0 >>> 21 === 0. Actual: ' + (0 >>> 21)); +} + + +if (1 >>> 21 !== 0) { + throw new Test262Error('#695: 1 >>> 21 === 0. Actual: ' + (1 >>> 21)); +} + + +if (3 >>> 21 !== 0) { + throw new Test262Error('#696: 3 >>> 21 === 0. Actual: ' + (3 >>> 21)); +} + + +if (7 >>> 21 !== 0) { + throw new Test262Error('#697: 7 >>> 21 === 0. Actual: ' + (7 >>> 21)); +} + + +if (15 >>> 21 !== 0) { + throw new Test262Error('#698: 15 >>> 21 === 0. Actual: ' + (15 >>> 21)); +} + + +if (31 >>> 21 !== 0) { + throw new Test262Error('#699: 31 >>> 21 === 0. Actual: ' + (31 >>> 21)); +} + + +if (63 >>> 21 !== 0) { + throw new Test262Error('#700: 63 >>> 21 === 0. Actual: ' + (63 >>> 21)); +} + + +if (127 >>> 21 !== 0) { + throw new Test262Error('#701: 127 >>> 21 === 0. Actual: ' + (127 >>> 21)); +} + + +if (255 >>> 21 !== 0) { + throw new Test262Error('#702: 255 >>> 21 === 0. Actual: ' + (255 >>> 21)); +} + + +if (511 >>> 21 !== 0) { + throw new Test262Error('#703: 511 >>> 21 === 0. Actual: ' + (511 >>> 21)); +} + + +if (1023 >>> 21 !== 0) { + throw new Test262Error('#704: 1023 >>> 21 === 0. Actual: ' + (1023 >>> 21)); +} + + +if (2047 >>> 21 !== 0) { + throw new Test262Error('#705: 2047 >>> 21 === 0. Actual: ' + (2047 >>> 21)); +} + + +if (4095 >>> 21 !== 0) { + throw new Test262Error('#706: 4095 >>> 21 === 0. Actual: ' + (4095 >>> 21)); +} + + +if (8191 >>> 21 !== 0) { + throw new Test262Error('#707: 8191 >>> 21 === 0. Actual: ' + (8191 >>> 21)); +} + + +if (16383 >>> 21 !== 0) { + throw new Test262Error('#708: 16383 >>> 21 === 0. Actual: ' + (16383 >>> 21)); +} + + +if (32767 >>> 21 !== 0) { + throw new Test262Error('#709: 32767 >>> 21 === 0. Actual: ' + (32767 >>> 21)); +} + + +if (65535 >>> 21 !== 0) { + throw new Test262Error('#710: 65535 >>> 21 === 0. Actual: ' + (65535 >>> 21)); +} + + +if (131071 >>> 21 !== 0) { + throw new Test262Error('#711: 131071 >>> 21 === 0. Actual: ' + (131071 >>> 21)); +} + + +if (262143 >>> 21 !== 0) { + throw new Test262Error('#712: 262143 >>> 21 === 0. Actual: ' + (262143 >>> 21)); +} + + +if (524287 >>> 21 !== 0) { + throw new Test262Error('#713: 524287 >>> 21 === 0. Actual: ' + (524287 >>> 21)); +} + + +if (1048575 >>> 21 !== 0) { + throw new Test262Error('#714: 1048575 >>> 21 === 0. Actual: ' + (1048575 >>> 21)); +} + + +if (2097151 >>> 21 !== 0) { + throw new Test262Error('#715: 2097151 >>> 21 === 0. Actual: ' + (2097151 >>> 21)); +} + + +if (4194303 >>> 21 !== 1) { + throw new Test262Error('#716: 4194303 >>> 21 === 1. Actual: ' + (4194303 >>> 21)); +} + + +if (8388607 >>> 21 !== 3) { + throw new Test262Error('#717: 8388607 >>> 21 === 3. Actual: ' + (8388607 >>> 21)); +} + + +if (16777215 >>> 21 !== 7) { + throw new Test262Error('#718: 16777215 >>> 21 === 7. Actual: ' + (16777215 >>> 21)); +} + + +if (33554431 >>> 21 !== 15) { + throw new Test262Error('#719: 33554431 >>> 21 === 15. Actual: ' + (33554431 >>> 21)); +} + + +if (67108863 >>> 21 !== 31) { + throw new Test262Error('#720: 67108863 >>> 21 === 31. Actual: ' + (67108863 >>> 21)); +} + + +if (134217727 >>> 21 !== 63) { + throw new Test262Error('#721: 134217727 >>> 21 === 63. Actual: ' + (134217727 >>> 21)); +} + + +if (268435455 >>> 21 !== 127) { + throw new Test262Error('#722: 268435455 >>> 21 === 127. Actual: ' + (268435455 >>> 21)); +} + + +if (536870911 >>> 21 !== 255) { + throw new Test262Error('#723: 536870911 >>> 21 === 255. Actual: ' + (536870911 >>> 21)); +} + + +if (1073741823 >>> 21 !== 511) { + throw new Test262Error('#724: 1073741823 >>> 21 === 511. Actual: ' + (1073741823 >>> 21)); +} + + +if (2147483647 >>> 21 !== 1023) { + throw new Test262Error('#725: 2147483647 >>> 21 === 1023. Actual: ' + (2147483647 >>> 21)); +} + + +if (4294967295 >>> 21 !== 2047) { + throw new Test262Error('#726: 4294967295 >>> 21 === 2047. Actual: ' + (4294967295 >>> 21)); +} + + +if (0 >>> 22 !== 0) { + throw new Test262Error('#727: 0 >>> 22 === 0. Actual: ' + (0 >>> 22)); +} + + +if (1 >>> 22 !== 0) { + throw new Test262Error('#728: 1 >>> 22 === 0. Actual: ' + (1 >>> 22)); +} + + +if (3 >>> 22 !== 0) { + throw new Test262Error('#729: 3 >>> 22 === 0. Actual: ' + (3 >>> 22)); +} + + +if (7 >>> 22 !== 0) { + throw new Test262Error('#730: 7 >>> 22 === 0. Actual: ' + (7 >>> 22)); +} + + +if (15 >>> 22 !== 0) { + throw new Test262Error('#731: 15 >>> 22 === 0. Actual: ' + (15 >>> 22)); +} + + +if (31 >>> 22 !== 0) { + throw new Test262Error('#732: 31 >>> 22 === 0. Actual: ' + (31 >>> 22)); +} + + +if (63 >>> 22 !== 0) { + throw new Test262Error('#733: 63 >>> 22 === 0. Actual: ' + (63 >>> 22)); +} + + +if (127 >>> 22 !== 0) { + throw new Test262Error('#734: 127 >>> 22 === 0. Actual: ' + (127 >>> 22)); +} + + +if (255 >>> 22 !== 0) { + throw new Test262Error('#735: 255 >>> 22 === 0. Actual: ' + (255 >>> 22)); +} + + +if (511 >>> 22 !== 0) { + throw new Test262Error('#736: 511 >>> 22 === 0. Actual: ' + (511 >>> 22)); +} + + +if (1023 >>> 22 !== 0) { + throw new Test262Error('#737: 1023 >>> 22 === 0. Actual: ' + (1023 >>> 22)); +} + + +if (2047 >>> 22 !== 0) { + throw new Test262Error('#738: 2047 >>> 22 === 0. Actual: ' + (2047 >>> 22)); +} + + +if (4095 >>> 22 !== 0) { + throw new Test262Error('#739: 4095 >>> 22 === 0. Actual: ' + (4095 >>> 22)); +} + + +if (8191 >>> 22 !== 0) { + throw new Test262Error('#740: 8191 >>> 22 === 0. Actual: ' + (8191 >>> 22)); +} + + +if (16383 >>> 22 !== 0) { + throw new Test262Error('#741: 16383 >>> 22 === 0. Actual: ' + (16383 >>> 22)); +} + + +if (32767 >>> 22 !== 0) { + throw new Test262Error('#742: 32767 >>> 22 === 0. Actual: ' + (32767 >>> 22)); +} + + +if (65535 >>> 22 !== 0) { + throw new Test262Error('#743: 65535 >>> 22 === 0. Actual: ' + (65535 >>> 22)); +} + + +if (131071 >>> 22 !== 0) { + throw new Test262Error('#744: 131071 >>> 22 === 0. Actual: ' + (131071 >>> 22)); +} + + +if (262143 >>> 22 !== 0) { + throw new Test262Error('#745: 262143 >>> 22 === 0. Actual: ' + (262143 >>> 22)); +} + + +if (524287 >>> 22 !== 0) { + throw new Test262Error('#746: 524287 >>> 22 === 0. Actual: ' + (524287 >>> 22)); +} + + +if (1048575 >>> 22 !== 0) { + throw new Test262Error('#747: 1048575 >>> 22 === 0. Actual: ' + (1048575 >>> 22)); +} + + +if (2097151 >>> 22 !== 0) { + throw new Test262Error('#748: 2097151 >>> 22 === 0. Actual: ' + (2097151 >>> 22)); +} + + +if (4194303 >>> 22 !== 0) { + throw new Test262Error('#749: 4194303 >>> 22 === 0. Actual: ' + (4194303 >>> 22)); +} + + +if (8388607 >>> 22 !== 1) { + throw new Test262Error('#750: 8388607 >>> 22 === 1. Actual: ' + (8388607 >>> 22)); +} + + +if (16777215 >>> 22 !== 3) { + throw new Test262Error('#751: 16777215 >>> 22 === 3. Actual: ' + (16777215 >>> 22)); +} + + +if (33554431 >>> 22 !== 7) { + throw new Test262Error('#752: 33554431 >>> 22 === 7. Actual: ' + (33554431 >>> 22)); +} + + +if (67108863 >>> 22 !== 15) { + throw new Test262Error('#753: 67108863 >>> 22 === 15. Actual: ' + (67108863 >>> 22)); +} + + +if (134217727 >>> 22 !== 31) { + throw new Test262Error('#754: 134217727 >>> 22 === 31. Actual: ' + (134217727 >>> 22)); +} + + +if (268435455 >>> 22 !== 63) { + throw new Test262Error('#755: 268435455 >>> 22 === 63. Actual: ' + (268435455 >>> 22)); +} + + +if (536870911 >>> 22 !== 127) { + throw new Test262Error('#756: 536870911 >>> 22 === 127. Actual: ' + (536870911 >>> 22)); +} + + +if (1073741823 >>> 22 !== 255) { + throw new Test262Error('#757: 1073741823 >>> 22 === 255. Actual: ' + (1073741823 >>> 22)); +} + + +if (2147483647 >>> 22 !== 511) { + throw new Test262Error('#758: 2147483647 >>> 22 === 511. Actual: ' + (2147483647 >>> 22)); +} + + +if (4294967295 >>> 22 !== 1023) { + throw new Test262Error('#759: 4294967295 >>> 22 === 1023. Actual: ' + (4294967295 >>> 22)); +} + + +if (0 >>> 23 !== 0) { + throw new Test262Error('#760: 0 >>> 23 === 0. Actual: ' + (0 >>> 23)); +} + + +if (1 >>> 23 !== 0) { + throw new Test262Error('#761: 1 >>> 23 === 0. Actual: ' + (1 >>> 23)); +} + + +if (3 >>> 23 !== 0) { + throw new Test262Error('#762: 3 >>> 23 === 0. Actual: ' + (3 >>> 23)); +} + + +if (7 >>> 23 !== 0) { + throw new Test262Error('#763: 7 >>> 23 === 0. Actual: ' + (7 >>> 23)); +} + + +if (15 >>> 23 !== 0) { + throw new Test262Error('#764: 15 >>> 23 === 0. Actual: ' + (15 >>> 23)); +} + + +if (31 >>> 23 !== 0) { + throw new Test262Error('#765: 31 >>> 23 === 0. Actual: ' + (31 >>> 23)); +} + + +if (63 >>> 23 !== 0) { + throw new Test262Error('#766: 63 >>> 23 === 0. Actual: ' + (63 >>> 23)); +} + + +if (127 >>> 23 !== 0) { + throw new Test262Error('#767: 127 >>> 23 === 0. Actual: ' + (127 >>> 23)); +} + + +if (255 >>> 23 !== 0) { + throw new Test262Error('#768: 255 >>> 23 === 0. Actual: ' + (255 >>> 23)); +} + + +if (511 >>> 23 !== 0) { + throw new Test262Error('#769: 511 >>> 23 === 0. Actual: ' + (511 >>> 23)); +} + + +if (1023 >>> 23 !== 0) { + throw new Test262Error('#770: 1023 >>> 23 === 0. Actual: ' + (1023 >>> 23)); +} + + +if (2047 >>> 23 !== 0) { + throw new Test262Error('#771: 2047 >>> 23 === 0. Actual: ' + (2047 >>> 23)); +} + + +if (4095 >>> 23 !== 0) { + throw new Test262Error('#772: 4095 >>> 23 === 0. Actual: ' + (4095 >>> 23)); +} + + +if (8191 >>> 23 !== 0) { + throw new Test262Error('#773: 8191 >>> 23 === 0. Actual: ' + (8191 >>> 23)); +} + + +if (16383 >>> 23 !== 0) { + throw new Test262Error('#774: 16383 >>> 23 === 0. Actual: ' + (16383 >>> 23)); +} + + +if (32767 >>> 23 !== 0) { + throw new Test262Error('#775: 32767 >>> 23 === 0. Actual: ' + (32767 >>> 23)); +} + + +if (65535 >>> 23 !== 0) { + throw new Test262Error('#776: 65535 >>> 23 === 0. Actual: ' + (65535 >>> 23)); +} + + +if (131071 >>> 23 !== 0) { + throw new Test262Error('#777: 131071 >>> 23 === 0. Actual: ' + (131071 >>> 23)); +} + + +if (262143 >>> 23 !== 0) { + throw new Test262Error('#778: 262143 >>> 23 === 0. Actual: ' + (262143 >>> 23)); +} + + +if (524287 >>> 23 !== 0) { + throw new Test262Error('#779: 524287 >>> 23 === 0. Actual: ' + (524287 >>> 23)); +} + + +if (1048575 >>> 23 !== 0) { + throw new Test262Error('#780: 1048575 >>> 23 === 0. Actual: ' + (1048575 >>> 23)); +} + + +if (2097151 >>> 23 !== 0) { + throw new Test262Error('#781: 2097151 >>> 23 === 0. Actual: ' + (2097151 >>> 23)); +} + + +if (4194303 >>> 23 !== 0) { + throw new Test262Error('#782: 4194303 >>> 23 === 0. Actual: ' + (4194303 >>> 23)); +} + + +if (8388607 >>> 23 !== 0) { + throw new Test262Error('#783: 8388607 >>> 23 === 0. Actual: ' + (8388607 >>> 23)); +} + + +if (16777215 >>> 23 !== 1) { + throw new Test262Error('#784: 16777215 >>> 23 === 1. Actual: ' + (16777215 >>> 23)); +} + + +if (33554431 >>> 23 !== 3) { + throw new Test262Error('#785: 33554431 >>> 23 === 3. Actual: ' + (33554431 >>> 23)); +} + + +if (67108863 >>> 23 !== 7) { + throw new Test262Error('#786: 67108863 >>> 23 === 7. Actual: ' + (67108863 >>> 23)); +} + + +if (134217727 >>> 23 !== 15) { + throw new Test262Error('#787: 134217727 >>> 23 === 15. Actual: ' + (134217727 >>> 23)); +} + + +if (268435455 >>> 23 !== 31) { + throw new Test262Error('#788: 268435455 >>> 23 === 31. Actual: ' + (268435455 >>> 23)); +} + + +if (536870911 >>> 23 !== 63) { + throw new Test262Error('#789: 536870911 >>> 23 === 63. Actual: ' + (536870911 >>> 23)); +} + + +if (1073741823 >>> 23 !== 127) { + throw new Test262Error('#790: 1073741823 >>> 23 === 127. Actual: ' + (1073741823 >>> 23)); +} + + +if (2147483647 >>> 23 !== 255) { + throw new Test262Error('#791: 2147483647 >>> 23 === 255. Actual: ' + (2147483647 >>> 23)); +} + + +if (4294967295 >>> 23 !== 511) { + throw new Test262Error('#792: 4294967295 >>> 23 === 511. Actual: ' + (4294967295 >>> 23)); +} + + +if (0 >>> 24 !== 0) { + throw new Test262Error('#793: 0 >>> 24 === 0. Actual: ' + (0 >>> 24)); +} + + +if (1 >>> 24 !== 0) { + throw new Test262Error('#794: 1 >>> 24 === 0. Actual: ' + (1 >>> 24)); +} + + +if (3 >>> 24 !== 0) { + throw new Test262Error('#795: 3 >>> 24 === 0. Actual: ' + (3 >>> 24)); +} + + +if (7 >>> 24 !== 0) { + throw new Test262Error('#796: 7 >>> 24 === 0. Actual: ' + (7 >>> 24)); +} + + +if (15 >>> 24 !== 0) { + throw new Test262Error('#797: 15 >>> 24 === 0. Actual: ' + (15 >>> 24)); +} + + +if (31 >>> 24 !== 0) { + throw new Test262Error('#798: 31 >>> 24 === 0. Actual: ' + (31 >>> 24)); +} + + +if (63 >>> 24 !== 0) { + throw new Test262Error('#799: 63 >>> 24 === 0. Actual: ' + (63 >>> 24)); +} + + +if (127 >>> 24 !== 0) { + throw new Test262Error('#800: 127 >>> 24 === 0. Actual: ' + (127 >>> 24)); +} + + +if (255 >>> 24 !== 0) { + throw new Test262Error('#801: 255 >>> 24 === 0. Actual: ' + (255 >>> 24)); +} + + +if (511 >>> 24 !== 0) { + throw new Test262Error('#802: 511 >>> 24 === 0. Actual: ' + (511 >>> 24)); +} + + +if (1023 >>> 24 !== 0) { + throw new Test262Error('#803: 1023 >>> 24 === 0. Actual: ' + (1023 >>> 24)); +} + + +if (2047 >>> 24 !== 0) { + throw new Test262Error('#804: 2047 >>> 24 === 0. Actual: ' + (2047 >>> 24)); +} + + +if (4095 >>> 24 !== 0) { + throw new Test262Error('#805: 4095 >>> 24 === 0. Actual: ' + (4095 >>> 24)); +} + + +if (8191 >>> 24 !== 0) { + throw new Test262Error('#806: 8191 >>> 24 === 0. Actual: ' + (8191 >>> 24)); +} + + +if (16383 >>> 24 !== 0) { + throw new Test262Error('#807: 16383 >>> 24 === 0. Actual: ' + (16383 >>> 24)); +} + + +if (32767 >>> 24 !== 0) { + throw new Test262Error('#808: 32767 >>> 24 === 0. Actual: ' + (32767 >>> 24)); +} + + +if (65535 >>> 24 !== 0) { + throw new Test262Error('#809: 65535 >>> 24 === 0. Actual: ' + (65535 >>> 24)); +} + + +if (131071 >>> 24 !== 0) { + throw new Test262Error('#810: 131071 >>> 24 === 0. Actual: ' + (131071 >>> 24)); +} + + +if (262143 >>> 24 !== 0) { + throw new Test262Error('#811: 262143 >>> 24 === 0. Actual: ' + (262143 >>> 24)); +} + + +if (524287 >>> 24 !== 0) { + throw new Test262Error('#812: 524287 >>> 24 === 0. Actual: ' + (524287 >>> 24)); +} + + +if (1048575 >>> 24 !== 0) { + throw new Test262Error('#813: 1048575 >>> 24 === 0. Actual: ' + (1048575 >>> 24)); +} + + +if (2097151 >>> 24 !== 0) { + throw new Test262Error('#814: 2097151 >>> 24 === 0. Actual: ' + (2097151 >>> 24)); +} + + +if (4194303 >>> 24 !== 0) { + throw new Test262Error('#815: 4194303 >>> 24 === 0. Actual: ' + (4194303 >>> 24)); +} + + +if (8388607 >>> 24 !== 0) { + throw new Test262Error('#816: 8388607 >>> 24 === 0. Actual: ' + (8388607 >>> 24)); +} + + +if (16777215 >>> 24 !== 0) { + throw new Test262Error('#817: 16777215 >>> 24 === 0. Actual: ' + (16777215 >>> 24)); +} + + +if (33554431 >>> 24 !== 1) { + throw new Test262Error('#818: 33554431 >>> 24 === 1. Actual: ' + (33554431 >>> 24)); +} + + +if (67108863 >>> 24 !== 3) { + throw new Test262Error('#819: 67108863 >>> 24 === 3. Actual: ' + (67108863 >>> 24)); +} + + +if (134217727 >>> 24 !== 7) { + throw new Test262Error('#820: 134217727 >>> 24 === 7. Actual: ' + (134217727 >>> 24)); +} + + +if (268435455 >>> 24 !== 15) { + throw new Test262Error('#821: 268435455 >>> 24 === 15. Actual: ' + (268435455 >>> 24)); +} + + +if (536870911 >>> 24 !== 31) { + throw new Test262Error('#822: 536870911 >>> 24 === 31. Actual: ' + (536870911 >>> 24)); +} + + +if (1073741823 >>> 24 !== 63) { + throw new Test262Error('#823: 1073741823 >>> 24 === 63. Actual: ' + (1073741823 >>> 24)); +} + + +if (2147483647 >>> 24 !== 127) { + throw new Test262Error('#824: 2147483647 >>> 24 === 127. Actual: ' + (2147483647 >>> 24)); +} + + +if (4294967295 >>> 24 !== 255) { + throw new Test262Error('#825: 4294967295 >>> 24 === 255. Actual: ' + (4294967295 >>> 24)); +} + + +if (0 >>> 25 !== 0) { + throw new Test262Error('#826: 0 >>> 25 === 0. Actual: ' + (0 >>> 25)); +} + + +if (1 >>> 25 !== 0) { + throw new Test262Error('#827: 1 >>> 25 === 0. Actual: ' + (1 >>> 25)); +} + + +if (3 >>> 25 !== 0) { + throw new Test262Error('#828: 3 >>> 25 === 0. Actual: ' + (3 >>> 25)); +} + + +if (7 >>> 25 !== 0) { + throw new Test262Error('#829: 7 >>> 25 === 0. Actual: ' + (7 >>> 25)); +} + + +if (15 >>> 25 !== 0) { + throw new Test262Error('#830: 15 >>> 25 === 0. Actual: ' + (15 >>> 25)); +} + + +if (31 >>> 25 !== 0) { + throw new Test262Error('#831: 31 >>> 25 === 0. Actual: ' + (31 >>> 25)); +} + + +if (63 >>> 25 !== 0) { + throw new Test262Error('#832: 63 >>> 25 === 0. Actual: ' + (63 >>> 25)); +} + + +if (127 >>> 25 !== 0) { + throw new Test262Error('#833: 127 >>> 25 === 0. Actual: ' + (127 >>> 25)); +} + + +if (255 >>> 25 !== 0) { + throw new Test262Error('#834: 255 >>> 25 === 0. Actual: ' + (255 >>> 25)); +} + + +if (511 >>> 25 !== 0) { + throw new Test262Error('#835: 511 >>> 25 === 0. Actual: ' + (511 >>> 25)); +} + + +if (1023 >>> 25 !== 0) { + throw new Test262Error('#836: 1023 >>> 25 === 0. Actual: ' + (1023 >>> 25)); +} + + +if (2047 >>> 25 !== 0) { + throw new Test262Error('#837: 2047 >>> 25 === 0. Actual: ' + (2047 >>> 25)); +} + + +if (4095 >>> 25 !== 0) { + throw new Test262Error('#838: 4095 >>> 25 === 0. Actual: ' + (4095 >>> 25)); +} + + +if (8191 >>> 25 !== 0) { + throw new Test262Error('#839: 8191 >>> 25 === 0. Actual: ' + (8191 >>> 25)); +} + + +if (16383 >>> 25 !== 0) { + throw new Test262Error('#840: 16383 >>> 25 === 0. Actual: ' + (16383 >>> 25)); +} + + +if (32767 >>> 25 !== 0) { + throw new Test262Error('#841: 32767 >>> 25 === 0. Actual: ' + (32767 >>> 25)); +} + + +if (65535 >>> 25 !== 0) { + throw new Test262Error('#842: 65535 >>> 25 === 0. Actual: ' + (65535 >>> 25)); +} + + +if (131071 >>> 25 !== 0) { + throw new Test262Error('#843: 131071 >>> 25 === 0. Actual: ' + (131071 >>> 25)); +} + + +if (262143 >>> 25 !== 0) { + throw new Test262Error('#844: 262143 >>> 25 === 0. Actual: ' + (262143 >>> 25)); +} + + +if (524287 >>> 25 !== 0) { + throw new Test262Error('#845: 524287 >>> 25 === 0. Actual: ' + (524287 >>> 25)); +} + + +if (1048575 >>> 25 !== 0) { + throw new Test262Error('#846: 1048575 >>> 25 === 0. Actual: ' + (1048575 >>> 25)); +} + + +if (2097151 >>> 25 !== 0) { + throw new Test262Error('#847: 2097151 >>> 25 === 0. Actual: ' + (2097151 >>> 25)); +} + + +if (4194303 >>> 25 !== 0) { + throw new Test262Error('#848: 4194303 >>> 25 === 0. Actual: ' + (4194303 >>> 25)); +} + + +if (8388607 >>> 25 !== 0) { + throw new Test262Error('#849: 8388607 >>> 25 === 0. Actual: ' + (8388607 >>> 25)); +} + + +if (16777215 >>> 25 !== 0) { + throw new Test262Error('#850: 16777215 >>> 25 === 0. Actual: ' + (16777215 >>> 25)); +} + + +if (33554431 >>> 25 !== 0) { + throw new Test262Error('#851: 33554431 >>> 25 === 0. Actual: ' + (33554431 >>> 25)); +} + + +if (67108863 >>> 25 !== 1) { + throw new Test262Error('#852: 67108863 >>> 25 === 1. Actual: ' + (67108863 >>> 25)); +} + + +if (134217727 >>> 25 !== 3) { + throw new Test262Error('#853: 134217727 >>> 25 === 3. Actual: ' + (134217727 >>> 25)); +} + + +if (268435455 >>> 25 !== 7) { + throw new Test262Error('#854: 268435455 >>> 25 === 7. Actual: ' + (268435455 >>> 25)); +} + + +if (536870911 >>> 25 !== 15) { + throw new Test262Error('#855: 536870911 >>> 25 === 15. Actual: ' + (536870911 >>> 25)); +} + + +if (1073741823 >>> 25 !== 31) { + throw new Test262Error('#856: 1073741823 >>> 25 === 31. Actual: ' + (1073741823 >>> 25)); +} + + +if (2147483647 >>> 25 !== 63) { + throw new Test262Error('#857: 2147483647 >>> 25 === 63. Actual: ' + (2147483647 >>> 25)); +} + + +if (4294967295 >>> 25 !== 127) { + throw new Test262Error('#858: 4294967295 >>> 25 === 127. Actual: ' + (4294967295 >>> 25)); +} + + +if (0 >>> 26 !== 0) { + throw new Test262Error('#859: 0 >>> 26 === 0. Actual: ' + (0 >>> 26)); +} + + +if (1 >>> 26 !== 0) { + throw new Test262Error('#860: 1 >>> 26 === 0. Actual: ' + (1 >>> 26)); +} + + +if (3 >>> 26 !== 0) { + throw new Test262Error('#861: 3 >>> 26 === 0. Actual: ' + (3 >>> 26)); +} + + +if (7 >>> 26 !== 0) { + throw new Test262Error('#862: 7 >>> 26 === 0. Actual: ' + (7 >>> 26)); +} + + +if (15 >>> 26 !== 0) { + throw new Test262Error('#863: 15 >>> 26 === 0. Actual: ' + (15 >>> 26)); +} + + +if (31 >>> 26 !== 0) { + throw new Test262Error('#864: 31 >>> 26 === 0. Actual: ' + (31 >>> 26)); +} + + +if (63 >>> 26 !== 0) { + throw new Test262Error('#865: 63 >>> 26 === 0. Actual: ' + (63 >>> 26)); +} + + +if (127 >>> 26 !== 0) { + throw new Test262Error('#866: 127 >>> 26 === 0. Actual: ' + (127 >>> 26)); +} + + +if (255 >>> 26 !== 0) { + throw new Test262Error('#867: 255 >>> 26 === 0. Actual: ' + (255 >>> 26)); +} + + +if (511 >>> 26 !== 0) { + throw new Test262Error('#868: 511 >>> 26 === 0. Actual: ' + (511 >>> 26)); +} + + +if (1023 >>> 26 !== 0) { + throw new Test262Error('#869: 1023 >>> 26 === 0. Actual: ' + (1023 >>> 26)); +} + + +if (2047 >>> 26 !== 0) { + throw new Test262Error('#870: 2047 >>> 26 === 0. Actual: ' + (2047 >>> 26)); +} + + +if (4095 >>> 26 !== 0) { + throw new Test262Error('#871: 4095 >>> 26 === 0. Actual: ' + (4095 >>> 26)); +} + + +if (8191 >>> 26 !== 0) { + throw new Test262Error('#872: 8191 >>> 26 === 0. Actual: ' + (8191 >>> 26)); +} + + +if (16383 >>> 26 !== 0) { + throw new Test262Error('#873: 16383 >>> 26 === 0. Actual: ' + (16383 >>> 26)); +} + + +if (32767 >>> 26 !== 0) { + throw new Test262Error('#874: 32767 >>> 26 === 0. Actual: ' + (32767 >>> 26)); +} + + +if (65535 >>> 26 !== 0) { + throw new Test262Error('#875: 65535 >>> 26 === 0. Actual: ' + (65535 >>> 26)); +} + + +if (131071 >>> 26 !== 0) { + throw new Test262Error('#876: 131071 >>> 26 === 0. Actual: ' + (131071 >>> 26)); +} + + +if (262143 >>> 26 !== 0) { + throw new Test262Error('#877: 262143 >>> 26 === 0. Actual: ' + (262143 >>> 26)); +} + + +if (524287 >>> 26 !== 0) { + throw new Test262Error('#878: 524287 >>> 26 === 0. Actual: ' + (524287 >>> 26)); +} + + +if (1048575 >>> 26 !== 0) { + throw new Test262Error('#879: 1048575 >>> 26 === 0. Actual: ' + (1048575 >>> 26)); +} + + +if (2097151 >>> 26 !== 0) { + throw new Test262Error('#880: 2097151 >>> 26 === 0. Actual: ' + (2097151 >>> 26)); +} + + +if (4194303 >>> 26 !== 0) { + throw new Test262Error('#881: 4194303 >>> 26 === 0. Actual: ' + (4194303 >>> 26)); +} + + +if (8388607 >>> 26 !== 0) { + throw new Test262Error('#882: 8388607 >>> 26 === 0. Actual: ' + (8388607 >>> 26)); +} + + +if (16777215 >>> 26 !== 0) { + throw new Test262Error('#883: 16777215 >>> 26 === 0. Actual: ' + (16777215 >>> 26)); +} + + +if (33554431 >>> 26 !== 0) { + throw new Test262Error('#884: 33554431 >>> 26 === 0. Actual: ' + (33554431 >>> 26)); +} + + +if (67108863 >>> 26 !== 0) { + throw new Test262Error('#885: 67108863 >>> 26 === 0. Actual: ' + (67108863 >>> 26)); +} + + +if (134217727 >>> 26 !== 1) { + throw new Test262Error('#886: 134217727 >>> 26 === 1. Actual: ' + (134217727 >>> 26)); +} + + +if (268435455 >>> 26 !== 3) { + throw new Test262Error('#887: 268435455 >>> 26 === 3. Actual: ' + (268435455 >>> 26)); +} + + +if (536870911 >>> 26 !== 7) { + throw new Test262Error('#888: 536870911 >>> 26 === 7. Actual: ' + (536870911 >>> 26)); +} + + +if (1073741823 >>> 26 !== 15) { + throw new Test262Error('#889: 1073741823 >>> 26 === 15. Actual: ' + (1073741823 >>> 26)); +} + + +if (2147483647 >>> 26 !== 31) { + throw new Test262Error('#890: 2147483647 >>> 26 === 31. Actual: ' + (2147483647 >>> 26)); +} + + +if (4294967295 >>> 26 !== 63) { + throw new Test262Error('#891: 4294967295 >>> 26 === 63. Actual: ' + (4294967295 >>> 26)); +} + + +if (0 >>> 27 !== 0) { + throw new Test262Error('#892: 0 >>> 27 === 0. Actual: ' + (0 >>> 27)); +} + + +if (1 >>> 27 !== 0) { + throw new Test262Error('#893: 1 >>> 27 === 0. Actual: ' + (1 >>> 27)); +} + + +if (3 >>> 27 !== 0) { + throw new Test262Error('#894: 3 >>> 27 === 0. Actual: ' + (3 >>> 27)); +} + + +if (7 >>> 27 !== 0) { + throw new Test262Error('#895: 7 >>> 27 === 0. Actual: ' + (7 >>> 27)); +} + + +if (15 >>> 27 !== 0) { + throw new Test262Error('#896: 15 >>> 27 === 0. Actual: ' + (15 >>> 27)); +} + + +if (31 >>> 27 !== 0) { + throw new Test262Error('#897: 31 >>> 27 === 0. Actual: ' + (31 >>> 27)); +} + + +if (63 >>> 27 !== 0) { + throw new Test262Error('#898: 63 >>> 27 === 0. Actual: ' + (63 >>> 27)); +} + + +if (127 >>> 27 !== 0) { + throw new Test262Error('#899: 127 >>> 27 === 0. Actual: ' + (127 >>> 27)); +} + + +if (255 >>> 27 !== 0) { + throw new Test262Error('#900: 255 >>> 27 === 0. Actual: ' + (255 >>> 27)); +} + + +if (511 >>> 27 !== 0) { + throw new Test262Error('#901: 511 >>> 27 === 0. Actual: ' + (511 >>> 27)); +} + + +if (1023 >>> 27 !== 0) { + throw new Test262Error('#902: 1023 >>> 27 === 0. Actual: ' + (1023 >>> 27)); +} + + +if (2047 >>> 27 !== 0) { + throw new Test262Error('#903: 2047 >>> 27 === 0. Actual: ' + (2047 >>> 27)); +} + + +if (4095 >>> 27 !== 0) { + throw new Test262Error('#904: 4095 >>> 27 === 0. Actual: ' + (4095 >>> 27)); +} + + +if (8191 >>> 27 !== 0) { + throw new Test262Error('#905: 8191 >>> 27 === 0. Actual: ' + (8191 >>> 27)); +} + + +if (16383 >>> 27 !== 0) { + throw new Test262Error('#906: 16383 >>> 27 === 0. Actual: ' + (16383 >>> 27)); +} + + +if (32767 >>> 27 !== 0) { + throw new Test262Error('#907: 32767 >>> 27 === 0. Actual: ' + (32767 >>> 27)); +} + + +if (65535 >>> 27 !== 0) { + throw new Test262Error('#908: 65535 >>> 27 === 0. Actual: ' + (65535 >>> 27)); +} + + +if (131071 >>> 27 !== 0) { + throw new Test262Error('#909: 131071 >>> 27 === 0. Actual: ' + (131071 >>> 27)); +} + + +if (262143 >>> 27 !== 0) { + throw new Test262Error('#910: 262143 >>> 27 === 0. Actual: ' + (262143 >>> 27)); +} + + +if (524287 >>> 27 !== 0) { + throw new Test262Error('#911: 524287 >>> 27 === 0. Actual: ' + (524287 >>> 27)); +} + + +if (1048575 >>> 27 !== 0) { + throw new Test262Error('#912: 1048575 >>> 27 === 0. Actual: ' + (1048575 >>> 27)); +} + + +if (2097151 >>> 27 !== 0) { + throw new Test262Error('#913: 2097151 >>> 27 === 0. Actual: ' + (2097151 >>> 27)); +} + + +if (4194303 >>> 27 !== 0) { + throw new Test262Error('#914: 4194303 >>> 27 === 0. Actual: ' + (4194303 >>> 27)); +} + + +if (8388607 >>> 27 !== 0) { + throw new Test262Error('#915: 8388607 >>> 27 === 0. Actual: ' + (8388607 >>> 27)); +} + + +if (16777215 >>> 27 !== 0) { + throw new Test262Error('#916: 16777215 >>> 27 === 0. Actual: ' + (16777215 >>> 27)); +} + + +if (33554431 >>> 27 !== 0) { + throw new Test262Error('#917: 33554431 >>> 27 === 0. Actual: ' + (33554431 >>> 27)); +} + + +if (67108863 >>> 27 !== 0) { + throw new Test262Error('#918: 67108863 >>> 27 === 0. Actual: ' + (67108863 >>> 27)); +} + + +if (134217727 >>> 27 !== 0) { + throw new Test262Error('#919: 134217727 >>> 27 === 0. Actual: ' + (134217727 >>> 27)); +} + + +if (268435455 >>> 27 !== 1) { + throw new Test262Error('#920: 268435455 >>> 27 === 1. Actual: ' + (268435455 >>> 27)); +} + + +if (536870911 >>> 27 !== 3) { + throw new Test262Error('#921: 536870911 >>> 27 === 3. Actual: ' + (536870911 >>> 27)); +} + + +if (1073741823 >>> 27 !== 7) { + throw new Test262Error('#922: 1073741823 >>> 27 === 7. Actual: ' + (1073741823 >>> 27)); +} + + +if (2147483647 >>> 27 !== 15) { + throw new Test262Error('#923: 2147483647 >>> 27 === 15. Actual: ' + (2147483647 >>> 27)); +} + + +if (4294967295 >>> 27 !== 31) { + throw new Test262Error('#924: 4294967295 >>> 27 === 31. Actual: ' + (4294967295 >>> 27)); +} + + +if (0 >>> 28 !== 0) { + throw new Test262Error('#925: 0 >>> 28 === 0. Actual: ' + (0 >>> 28)); +} + + +if (1 >>> 28 !== 0) { + throw new Test262Error('#926: 1 >>> 28 === 0. Actual: ' + (1 >>> 28)); +} + + +if (3 >>> 28 !== 0) { + throw new Test262Error('#927: 3 >>> 28 === 0. Actual: ' + (3 >>> 28)); +} + + +if (7 >>> 28 !== 0) { + throw new Test262Error('#928: 7 >>> 28 === 0. Actual: ' + (7 >>> 28)); +} + + +if (15 >>> 28 !== 0) { + throw new Test262Error('#929: 15 >>> 28 === 0. Actual: ' + (15 >>> 28)); +} + + +if (31 >>> 28 !== 0) { + throw new Test262Error('#930: 31 >>> 28 === 0. Actual: ' + (31 >>> 28)); +} + + +if (63 >>> 28 !== 0) { + throw new Test262Error('#931: 63 >>> 28 === 0. Actual: ' + (63 >>> 28)); +} + + +if (127 >>> 28 !== 0) { + throw new Test262Error('#932: 127 >>> 28 === 0. Actual: ' + (127 >>> 28)); +} + + +if (255 >>> 28 !== 0) { + throw new Test262Error('#933: 255 >>> 28 === 0. Actual: ' + (255 >>> 28)); +} + + +if (511 >>> 28 !== 0) { + throw new Test262Error('#934: 511 >>> 28 === 0. Actual: ' + (511 >>> 28)); +} + + +if (1023 >>> 28 !== 0) { + throw new Test262Error('#935: 1023 >>> 28 === 0. Actual: ' + (1023 >>> 28)); +} + + +if (2047 >>> 28 !== 0) { + throw new Test262Error('#936: 2047 >>> 28 === 0. Actual: ' + (2047 >>> 28)); +} + + +if (4095 >>> 28 !== 0) { + throw new Test262Error('#937: 4095 >>> 28 === 0. Actual: ' + (4095 >>> 28)); +} + + +if (8191 >>> 28 !== 0) { + throw new Test262Error('#938: 8191 >>> 28 === 0. Actual: ' + (8191 >>> 28)); +} + + +if (16383 >>> 28 !== 0) { + throw new Test262Error('#939: 16383 >>> 28 === 0. Actual: ' + (16383 >>> 28)); +} + + +if (32767 >>> 28 !== 0) { + throw new Test262Error('#940: 32767 >>> 28 === 0. Actual: ' + (32767 >>> 28)); +} + + +if (65535 >>> 28 !== 0) { + throw new Test262Error('#941: 65535 >>> 28 === 0. Actual: ' + (65535 >>> 28)); +} + + +if (131071 >>> 28 !== 0) { + throw new Test262Error('#942: 131071 >>> 28 === 0. Actual: ' + (131071 >>> 28)); +} + + +if (262143 >>> 28 !== 0) { + throw new Test262Error('#943: 262143 >>> 28 === 0. Actual: ' + (262143 >>> 28)); +} + + +if (524287 >>> 28 !== 0) { + throw new Test262Error('#944: 524287 >>> 28 === 0. Actual: ' + (524287 >>> 28)); +} + + +if (1048575 >>> 28 !== 0) { + throw new Test262Error('#945: 1048575 >>> 28 === 0. Actual: ' + (1048575 >>> 28)); +} + + +if (2097151 >>> 28 !== 0) { + throw new Test262Error('#946: 2097151 >>> 28 === 0. Actual: ' + (2097151 >>> 28)); +} + + +if (4194303 >>> 28 !== 0) { + throw new Test262Error('#947: 4194303 >>> 28 === 0. Actual: ' + (4194303 >>> 28)); +} + + +if (8388607 >>> 28 !== 0) { + throw new Test262Error('#948: 8388607 >>> 28 === 0. Actual: ' + (8388607 >>> 28)); +} + + +if (16777215 >>> 28 !== 0) { + throw new Test262Error('#949: 16777215 >>> 28 === 0. Actual: ' + (16777215 >>> 28)); +} + + +if (33554431 >>> 28 !== 0) { + throw new Test262Error('#950: 33554431 >>> 28 === 0. Actual: ' + (33554431 >>> 28)); +} + + +if (67108863 >>> 28 !== 0) { + throw new Test262Error('#951: 67108863 >>> 28 === 0. Actual: ' + (67108863 >>> 28)); +} + + +if (134217727 >>> 28 !== 0) { + throw new Test262Error('#952: 134217727 >>> 28 === 0. Actual: ' + (134217727 >>> 28)); +} + + +if (268435455 >>> 28 !== 0) { + throw new Test262Error('#953: 268435455 >>> 28 === 0. Actual: ' + (268435455 >>> 28)); +} + + +if (536870911 >>> 28 !== 1) { + throw new Test262Error('#954: 536870911 >>> 28 === 1. Actual: ' + (536870911 >>> 28)); +} + + +if (1073741823 >>> 28 !== 3) { + throw new Test262Error('#955: 1073741823 >>> 28 === 3. Actual: ' + (1073741823 >>> 28)); +} + + +if (2147483647 >>> 28 !== 7) { + throw new Test262Error('#956: 2147483647 >>> 28 === 7. Actual: ' + (2147483647 >>> 28)); +} + + +if (4294967295 >>> 28 !== 15) { + throw new Test262Error('#957: 4294967295 >>> 28 === 15. Actual: ' + (4294967295 >>> 28)); +} + + +if (0 >>> 29 !== 0) { + throw new Test262Error('#958: 0 >>> 29 === 0. Actual: ' + (0 >>> 29)); +} + + +if (1 >>> 29 !== 0) { + throw new Test262Error('#959: 1 >>> 29 === 0. Actual: ' + (1 >>> 29)); +} + + +if (3 >>> 29 !== 0) { + throw new Test262Error('#960: 3 >>> 29 === 0. Actual: ' + (3 >>> 29)); +} + + +if (7 >>> 29 !== 0) { + throw new Test262Error('#961: 7 >>> 29 === 0. Actual: ' + (7 >>> 29)); +} + + +if (15 >>> 29 !== 0) { + throw new Test262Error('#962: 15 >>> 29 === 0. Actual: ' + (15 >>> 29)); +} + + +if (31 >>> 29 !== 0) { + throw new Test262Error('#963: 31 >>> 29 === 0. Actual: ' + (31 >>> 29)); +} + + +if (63 >>> 29 !== 0) { + throw new Test262Error('#964: 63 >>> 29 === 0. Actual: ' + (63 >>> 29)); +} + + +if (127 >>> 29 !== 0) { + throw new Test262Error('#965: 127 >>> 29 === 0. Actual: ' + (127 >>> 29)); +} + + +if (255 >>> 29 !== 0) { + throw new Test262Error('#966: 255 >>> 29 === 0. Actual: ' + (255 >>> 29)); +} + + +if (511 >>> 29 !== 0) { + throw new Test262Error('#967: 511 >>> 29 === 0. Actual: ' + (511 >>> 29)); +} + + +if (1023 >>> 29 !== 0) { + throw new Test262Error('#968: 1023 >>> 29 === 0. Actual: ' + (1023 >>> 29)); +} + + +if (2047 >>> 29 !== 0) { + throw new Test262Error('#969: 2047 >>> 29 === 0. Actual: ' + (2047 >>> 29)); +} + + +if (4095 >>> 29 !== 0) { + throw new Test262Error('#970: 4095 >>> 29 === 0. Actual: ' + (4095 >>> 29)); +} + + +if (8191 >>> 29 !== 0) { + throw new Test262Error('#971: 8191 >>> 29 === 0. Actual: ' + (8191 >>> 29)); +} + + +if (16383 >>> 29 !== 0) { + throw new Test262Error('#972: 16383 >>> 29 === 0. Actual: ' + (16383 >>> 29)); +} + + +if (32767 >>> 29 !== 0) { + throw new Test262Error('#973: 32767 >>> 29 === 0. Actual: ' + (32767 >>> 29)); +} + + +if (65535 >>> 29 !== 0) { + throw new Test262Error('#974: 65535 >>> 29 === 0. Actual: ' + (65535 >>> 29)); +} + + +if (131071 >>> 29 !== 0) { + throw new Test262Error('#975: 131071 >>> 29 === 0. Actual: ' + (131071 >>> 29)); +} + + +if (262143 >>> 29 !== 0) { + throw new Test262Error('#976: 262143 >>> 29 === 0. Actual: ' + (262143 >>> 29)); +} + + +if (524287 >>> 29 !== 0) { + throw new Test262Error('#977: 524287 >>> 29 === 0. Actual: ' + (524287 >>> 29)); +} + + +if (1048575 >>> 29 !== 0) { + throw new Test262Error('#978: 1048575 >>> 29 === 0. Actual: ' + (1048575 >>> 29)); +} + + +if (2097151 >>> 29 !== 0) { + throw new Test262Error('#979: 2097151 >>> 29 === 0. Actual: ' + (2097151 >>> 29)); +} + + +if (4194303 >>> 29 !== 0) { + throw new Test262Error('#980: 4194303 >>> 29 === 0. Actual: ' + (4194303 >>> 29)); +} + + +if (8388607 >>> 29 !== 0) { + throw new Test262Error('#981: 8388607 >>> 29 === 0. Actual: ' + (8388607 >>> 29)); +} + + +if (16777215 >>> 29 !== 0) { + throw new Test262Error('#982: 16777215 >>> 29 === 0. Actual: ' + (16777215 >>> 29)); +} + + +if (33554431 >>> 29 !== 0) { + throw new Test262Error('#983: 33554431 >>> 29 === 0. Actual: ' + (33554431 >>> 29)); +} + + +if (67108863 >>> 29 !== 0) { + throw new Test262Error('#984: 67108863 >>> 29 === 0. Actual: ' + (67108863 >>> 29)); +} + + +if (134217727 >>> 29 !== 0) { + throw new Test262Error('#985: 134217727 >>> 29 === 0. Actual: ' + (134217727 >>> 29)); +} + + +if (268435455 >>> 29 !== 0) { + throw new Test262Error('#986: 268435455 >>> 29 === 0. Actual: ' + (268435455 >>> 29)); +} + + +if (536870911 >>> 29 !== 0) { + throw new Test262Error('#987: 536870911 >>> 29 === 0. Actual: ' + (536870911 >>> 29)); +} + + +if (1073741823 >>> 29 !== 1) { + throw new Test262Error('#988: 1073741823 >>> 29 === 1. Actual: ' + (1073741823 >>> 29)); +} + + +if (2147483647 >>> 29 !== 3) { + throw new Test262Error('#989: 2147483647 >>> 29 === 3. Actual: ' + (2147483647 >>> 29)); +} + + +if (4294967295 >>> 29 !== 7) { + throw new Test262Error('#990: 4294967295 >>> 29 === 7. Actual: ' + (4294967295 >>> 29)); +} + + +if (0 >>> 30 !== 0) { + throw new Test262Error('#991: 0 >>> 30 === 0. Actual: ' + (0 >>> 30)); +} + + +if (1 >>> 30 !== 0) { + throw new Test262Error('#992: 1 >>> 30 === 0. Actual: ' + (1 >>> 30)); +} + + +if (3 >>> 30 !== 0) { + throw new Test262Error('#993: 3 >>> 30 === 0. Actual: ' + (3 >>> 30)); +} + + +if (7 >>> 30 !== 0) { + throw new Test262Error('#994: 7 >>> 30 === 0. Actual: ' + (7 >>> 30)); +} + + +if (15 >>> 30 !== 0) { + throw new Test262Error('#995: 15 >>> 30 === 0. Actual: ' + (15 >>> 30)); +} + + +if (31 >>> 30 !== 0) { + throw new Test262Error('#996: 31 >>> 30 === 0. Actual: ' + (31 >>> 30)); +} + + +if (63 >>> 30 !== 0) { + throw new Test262Error('#997: 63 >>> 30 === 0. Actual: ' + (63 >>> 30)); +} + + +if (127 >>> 30 !== 0) { + throw new Test262Error('#998: 127 >>> 30 === 0. Actual: ' + (127 >>> 30)); +} + + +if (255 >>> 30 !== 0) { + throw new Test262Error('#999: 255 >>> 30 === 0. Actual: ' + (255 >>> 30)); +} + + +if (511 >>> 30 !== 0) { + throw new Test262Error('#1000: 511 >>> 30 === 0. Actual: ' + (511 >>> 30)); +} + + +if (1023 >>> 30 !== 0) { + throw new Test262Error('#1001: 1023 >>> 30 === 0. Actual: ' + (1023 >>> 30)); +} + + +if (2047 >>> 30 !== 0) { + throw new Test262Error('#1002: 2047 >>> 30 === 0. Actual: ' + (2047 >>> 30)); +} + + +if (4095 >>> 30 !== 0) { + throw new Test262Error('#1003: 4095 >>> 30 === 0. Actual: ' + (4095 >>> 30)); +} + + +if (8191 >>> 30 !== 0) { + throw new Test262Error('#1004: 8191 >>> 30 === 0. Actual: ' + (8191 >>> 30)); +} + + +if (16383 >>> 30 !== 0) { + throw new Test262Error('#1005: 16383 >>> 30 === 0. Actual: ' + (16383 >>> 30)); +} + + +if (32767 >>> 30 !== 0) { + throw new Test262Error('#1006: 32767 >>> 30 === 0. Actual: ' + (32767 >>> 30)); +} + + +if (65535 >>> 30 !== 0) { + throw new Test262Error('#1007: 65535 >>> 30 === 0. Actual: ' + (65535 >>> 30)); +} + + +if (131071 >>> 30 !== 0) { + throw new Test262Error('#1008: 131071 >>> 30 === 0. Actual: ' + (131071 >>> 30)); +} + + +if (262143 >>> 30 !== 0) { + throw new Test262Error('#1009: 262143 >>> 30 === 0. Actual: ' + (262143 >>> 30)); +} + + +if (524287 >>> 30 !== 0) { + throw new Test262Error('#1010: 524287 >>> 30 === 0. Actual: ' + (524287 >>> 30)); +} + + +if (1048575 >>> 30 !== 0) { + throw new Test262Error('#1011: 1048575 >>> 30 === 0. Actual: ' + (1048575 >>> 30)); +} + + +if (2097151 >>> 30 !== 0) { + throw new Test262Error('#1012: 2097151 >>> 30 === 0. Actual: ' + (2097151 >>> 30)); +} + + +if (4194303 >>> 30 !== 0) { + throw new Test262Error('#1013: 4194303 >>> 30 === 0. Actual: ' + (4194303 >>> 30)); +} + + +if (8388607 >>> 30 !== 0) { + throw new Test262Error('#1014: 8388607 >>> 30 === 0. Actual: ' + (8388607 >>> 30)); +} + + +if (16777215 >>> 30 !== 0) { + throw new Test262Error('#1015: 16777215 >>> 30 === 0. Actual: ' + (16777215 >>> 30)); +} + + +if (33554431 >>> 30 !== 0) { + throw new Test262Error('#1016: 33554431 >>> 30 === 0. Actual: ' + (33554431 >>> 30)); +} + + +if (67108863 >>> 30 !== 0) { + throw new Test262Error('#1017: 67108863 >>> 30 === 0. Actual: ' + (67108863 >>> 30)); +} + + +if (134217727 >>> 30 !== 0) { + throw new Test262Error('#1018: 134217727 >>> 30 === 0. Actual: ' + (134217727 >>> 30)); +} + + +if (268435455 >>> 30 !== 0) { + throw new Test262Error('#1019: 268435455 >>> 30 === 0. Actual: ' + (268435455 >>> 30)); +} + + +if (536870911 >>> 30 !== 0) { + throw new Test262Error('#1020: 536870911 >>> 30 === 0. Actual: ' + (536870911 >>> 30)); +} + + +if (1073741823 >>> 30 !== 0) { + throw new Test262Error('#1021: 1073741823 >>> 30 === 0. Actual: ' + (1073741823 >>> 30)); +} + + +if (2147483647 >>> 30 !== 1) { + throw new Test262Error('#1022: 2147483647 >>> 30 === 1. Actual: ' + (2147483647 >>> 30)); +} + + +if (4294967295 >>> 30 !== 3) { + throw new Test262Error('#1023: 4294967295 >>> 30 === 3. Actual: ' + (4294967295 >>> 30)); +} + + +if (0 >>> 31 !== 0) { + throw new Test262Error('#1024: 0 >>> 31 === 0. Actual: ' + (0 >>> 31)); +} + + +if (1 >>> 31 !== 0) { + throw new Test262Error('#1025: 1 >>> 31 === 0. Actual: ' + (1 >>> 31)); +} + + +if (3 >>> 31 !== 0) { + throw new Test262Error('#1026: 3 >>> 31 === 0. Actual: ' + (3 >>> 31)); +} + + +if (7 >>> 31 !== 0) { + throw new Test262Error('#1027: 7 >>> 31 === 0. Actual: ' + (7 >>> 31)); +} + + +if (15 >>> 31 !== 0) { + throw new Test262Error('#1028: 15 >>> 31 === 0. Actual: ' + (15 >>> 31)); +} + + +if (31 >>> 31 !== 0) { + throw new Test262Error('#1029: 31 >>> 31 === 0. Actual: ' + (31 >>> 31)); +} + + +if (63 >>> 31 !== 0) { + throw new Test262Error('#1030: 63 >>> 31 === 0. Actual: ' + (63 >>> 31)); +} + + +if (127 >>> 31 !== 0) { + throw new Test262Error('#1031: 127 >>> 31 === 0. Actual: ' + (127 >>> 31)); +} + + +if (255 >>> 31 !== 0) { + throw new Test262Error('#1032: 255 >>> 31 === 0. Actual: ' + (255 >>> 31)); +} + + +if (511 >>> 31 !== 0) { + throw new Test262Error('#1033: 511 >>> 31 === 0. Actual: ' + (511 >>> 31)); +} + + +if (1023 >>> 31 !== 0) { + throw new Test262Error('#1034: 1023 >>> 31 === 0. Actual: ' + (1023 >>> 31)); +} + + +if (2047 >>> 31 !== 0) { + throw new Test262Error('#1035: 2047 >>> 31 === 0. Actual: ' + (2047 >>> 31)); +} + + +if (4095 >>> 31 !== 0) { + throw new Test262Error('#1036: 4095 >>> 31 === 0. Actual: ' + (4095 >>> 31)); +} + + +if (8191 >>> 31 !== 0) { + throw new Test262Error('#1037: 8191 >>> 31 === 0. Actual: ' + (8191 >>> 31)); +} + + +if (16383 >>> 31 !== 0) { + throw new Test262Error('#1038: 16383 >>> 31 === 0. Actual: ' + (16383 >>> 31)); +} + + +if (32767 >>> 31 !== 0) { + throw new Test262Error('#1039: 32767 >>> 31 === 0. Actual: ' + (32767 >>> 31)); +} + + +if (65535 >>> 31 !== 0) { + throw new Test262Error('#1040: 65535 >>> 31 === 0. Actual: ' + (65535 >>> 31)); +} + + +if (131071 >>> 31 !== 0) { + throw new Test262Error('#1041: 131071 >>> 31 === 0. Actual: ' + (131071 >>> 31)); +} + + +if (262143 >>> 31 !== 0) { + throw new Test262Error('#1042: 262143 >>> 31 === 0. Actual: ' + (262143 >>> 31)); +} + + +if (524287 >>> 31 !== 0) { + throw new Test262Error('#1043: 524287 >>> 31 === 0. Actual: ' + (524287 >>> 31)); +} + + +if (1048575 >>> 31 !== 0) { + throw new Test262Error('#1044: 1048575 >>> 31 === 0. Actual: ' + (1048575 >>> 31)); +} + + +if (2097151 >>> 31 !== 0) { + throw new Test262Error('#1045: 2097151 >>> 31 === 0. Actual: ' + (2097151 >>> 31)); +} + + +if (4194303 >>> 31 !== 0) { + throw new Test262Error('#1046: 4194303 >>> 31 === 0. Actual: ' + (4194303 >>> 31)); +} + + +if (8388607 >>> 31 !== 0) { + throw new Test262Error('#1047: 8388607 >>> 31 === 0. Actual: ' + (8388607 >>> 31)); +} + + +if (16777215 >>> 31 !== 0) { + throw new Test262Error('#1048: 16777215 >>> 31 === 0. Actual: ' + (16777215 >>> 31)); +} + + +if (33554431 >>> 31 !== 0) { + throw new Test262Error('#1049: 33554431 >>> 31 === 0. Actual: ' + (33554431 >>> 31)); +} + + +if (67108863 >>> 31 !== 0) { + throw new Test262Error('#1050: 67108863 >>> 31 === 0. Actual: ' + (67108863 >>> 31)); +} + + +if (134217727 >>> 31 !== 0) { + throw new Test262Error('#1051: 134217727 >>> 31 === 0. Actual: ' + (134217727 >>> 31)); +} + + +if (268435455 >>> 31 !== 0) { + throw new Test262Error('#1052: 268435455 >>> 31 === 0. Actual: ' + (268435455 >>> 31)); +} + + +if (536870911 >>> 31 !== 0) { + throw new Test262Error('#1053: 536870911 >>> 31 === 0. Actual: ' + (536870911 >>> 31)); +} + + +if (1073741823 >>> 31 !== 0) { + throw new Test262Error('#1054: 1073741823 >>> 31 === 0. Actual: ' + (1073741823 >>> 31)); +} + + +if (2147483647 >>> 31 !== 0) { + throw new Test262Error('#1055: 2147483647 >>> 31 === 0. Actual: ' + (2147483647 >>> 31)); +} + + +if (4294967295 >>> 31 !== 1) { + throw new Test262Error('#1056: 4294967295 >>> 31 === 1. Actual: ' + (4294967295 >>> 31)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.1_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.1_T1.js new file mode 100644 index 0000000000..0b57b65461 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.1_T1.js @@ -0,0 +1,60 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y uses ToUint32(ShiftExpression) +es5id: 11.7.3_A5.1_T1 +description: Checking boundary points +---*/ + +//CHECK#1 +if (2147483648.1 >>> 0 !== 2147483648) { + throw new Test262Error('#1: 2147483648.1 >>> 0 === 2147483648. Actual: ' + (2147483648.1 >>> 0)); +} + +//CHECK#2 +if (4294967296.1 >>> 0 !== 0) { + throw new Test262Error('#2: 4294967296.1 >>> 0 === 0. Actual: ' + (4294967296.1 >>> 0)); +} + +//CHECK#3 +if (6442450944.1 >>> 0 !== 2147483648) { + throw new Test262Error('#3: 6442450944.1 >>> 0 === 2147483648. Actual: ' + (6442450944.1 >>> 0)); +} + +//CHECK#4 +if (4294967295.1 >>> 0 !== 4294967295) { + throw new Test262Error('#4: 4294967295.1 >>> 0 === 4294967295. Actual: ' + (4294967295.1 >>> 0)); +} + +//CHECK#5 +if (6442450943.1 >>> 0 !== 2147483647) { + throw new Test262Error('#5: 6442450943.1 >>> 0 === 2147483647. Actual: ' + (6442450943.1 >>> 0)); +} + +//CHECK#6 +if (-2147483649.1 >>> 0 !== 2147483647) { + throw new Test262Error('#6: -2147483649.1 >>> 0 === 2147483647. Actual: ' + (-2147483649.1 >>> 0)); +} + +//CHECK#7 +if (-4294967297.1 >>> 0 !== 4294967295) { + throw new Test262Error('#7: -4294967297.1 >>> 0 === 4294967295. Actual: ' + (-4294967297.1 >>> 0)); +} + +//CHECK#8 +if (-6442450945.1 >>> 0 !== 2147483647) { + throw new Test262Error('#8: -6442450945.1 >>> 0 === 2147483647. Actual: ' + (-6442450945.1 >>> 0)); +} + +//CHECK#9 +if (-4294967296.1 >>> 0 !== 0) { + throw new Test262Error('#9: -4294967296.1 >>> 0 === 0 . Actual: ' + (-4294967296.1 >>> 0)); +} + +//CHECK#10 +if (-6442450944.1 >>> 0 !== 2147483648) { + throw new Test262Error('#10: -6442450944.1 >>> 0 === 2147483648. Actual: ' + (-6442450944.1 >>> 0)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.2_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.2_T1.js new file mode 100644 index 0000000000..5c6567ed09 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S11.7.3_A5.2_T1.js @@ -0,0 +1,330 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator x >>> y uses ToUint32(AdditiveExpression) & 31 +es5id: 11.7.3_A5.2_T1 +description: Checking distinct points +---*/ + +//CHECK#1 +if (4294967295 >>> -32.1 !== 4294967295) { + throw new Test262Error('#1: 4294967295 >>> -32.1 === 4294967295. Actual: ' + (4294967295 >>> -32.1)); +} + +//CHECK#2 +if (4294967295 >>> -31.1 !== 2147483647) { + throw new Test262Error('#2: 4294967295 >>> -31.1 === 2147483647. Actual: ' + (4294967295 >>> -31.1)); +} + +//CHECK#3 +if (4294967295 >>> -30.1 !== 1073741823) { + throw new Test262Error('#3: 4294967295 >>> -30.1 === 1073741823. Actual: ' + (4294967295 >>> -30.1)); +} + +//CHECK#4 +if (4294967295 >>> -29.1 !== 536870911) { + throw new Test262Error('#4: 4294967295 >>> -29.1 === 536870911. Actual: ' + (4294967295 >>> -29.1)); +} + +//CHECK#5 +if (4294967295 >>> -28.1 !== 268435455) { + throw new Test262Error('#5: 4294967295 >>> -28.1 === 268435455. Actual: ' + (4294967295 >>> -28.1)); +} + +//CHECK#6 +if (4294967295 >>> -27.1 !== 134217727) { + throw new Test262Error('#6: 4294967295 >>> -27.1 === 134217727. Actual: ' + (4294967295 >>> -27.1)); +} + +//CHECK#7 +if (4294967295 >>> -26.1 !== 67108863) { + throw new Test262Error('#7: 4294967295 >>> -26.1 === 67108863. Actual: ' + (4294967295 >>> -26.1)); +} + +//CHECK#8 +if (4294967295 >>> -25.1 !== 33554431) { + throw new Test262Error('#8: 4294967295 >>> -25.1 === 33554431. Actual: ' + (4294967295 >>> -25.1)); +} + +//CHECK#9 +if (4294967295 >>> -24.1 !== 16777215) { + throw new Test262Error('#9: 4294967295 >>> -24.1 === 16777215. Actual: ' + (4294967295 >>> -24.1)); +} + +//CHECK#10 +if (4294967295 >>> -23.1 !== 8388607) { + throw new Test262Error('#10: 4294967295 >>> -23.1 === 8388607. Actual: ' + (4294967295 >>> -23.1)); +} + +//CHECK#11 +if (4294967295 >>> -22.1 !== 4194303) { + throw new Test262Error('#11: 4294967295 >>> -22.1 === 4194303. Actual: ' + (4294967295 >>> -22.1)); +} + +//CHECK#12 +if (4294967295 >>> -21.1 !== 2097151) { + throw new Test262Error('#12: 4294967295 >>> -21.1 === 2097151. Actual: ' + (4294967295 >>> -21.1)); +} + +//CHECK#13 +if (4294967295 >>> -20.1 !== 1048575) { + throw new Test262Error('#13: 4294967295 >>> -20.1 === 1048575. Actual: ' + (4294967295 >>> -20.1)); +} + +//CHECK#14 +if (4294967295 >>> -19.1 !== 524287) { + throw new Test262Error('#14: 4294967295 >>> -19.1 === 524287. Actual: ' + (4294967295 >>> -19.1)); +} + +//CHECK#15 +if (4294967295 >>> -18.1 !== 262143) { + throw new Test262Error('#15: 4294967295 >>> -18.1 === 262143. Actual: ' + (4294967295 >>> -18.1)); +} + +//CHECK#16 +if (4294967295 >>> -17.1 !== 131071) { + throw new Test262Error('#16: 4294967295 >>> -17.1 === 131071. Actual: ' + (4294967295 >>> -17.1)); +} + +//CHECK#17 +if (4294967295 >>> -16.1 !== 65535) { + throw new Test262Error('#17: 4294967295 >>> -16.1 === 65535. Actual: ' + (4294967295 >>> -16.1)); +} + +//CHECK#18 +if (4294967295 >>> -15.1 !== 32767) { + throw new Test262Error('#18: 4294967295 >>> -15.1 === 32767. Actual: ' + (4294967295 >>> -15.1)); +} + +//CHECK#19 +if (4294967295 >>> -14.1 !== 16383) { + throw new Test262Error('#19: 4294967295 >>> -14.1 === 16383. Actual: ' + (4294967295 >>> -14.1)); +} + +//CHECK#20 +if (4294967295 >>> -13.1 !== 8191) { + throw new Test262Error('#20: 4294967295 >>> -13.1 === 8191. Actual: ' + (4294967295 >>> -13.1)); +} + +//CHECK#21 +if (4294967295 >>> -12.1 !== 4095) { + throw new Test262Error('#21: 4294967295 >>> -12.1 === 4095. Actual: ' + (4294967295 >>> -12.1)); +} + +//CHECK#22 +if (4294967295 >>> -11.1 !== 2047) { + throw new Test262Error('#22: 4294967295 >>> -11.1 === 2047. Actual: ' + (4294967295 >>> -11.1)); +} + +//CHECK#23 +if (4294967295 >>> -10.1 !== 1023) { + throw new Test262Error('#23: 4294967295 >>> -10.1 === 1023. Actual: ' + (4294967295 >>> -10.1)); +} + +//CHECK#24 +if (4294967295 >>> -9.1 !== 511) { + throw new Test262Error('#24: 4294967295 >>> -9.1 === 511. Actual: ' + (4294967295 >>> -9.1)); +} + +//CHECK#25 +if (4294967295 >>> -8.1 !== 255) { + throw new Test262Error('#25: 4294967295 >>> -8.1 === 255. Actual: ' + (4294967295 >>> -8.1)); +} + +//CHECK#26 +if (4294967295 >>> -7.1 !== 127) { + throw new Test262Error('#26: 4294967295 >>> -7.1 === 127. Actual: ' + (4294967295 >>> -7.1)); +} + +//CHECK#27 +if (4294967295 >>> -6.1 !== 63) { + throw new Test262Error('#27: 4294967295 >>> -6.1 === 63. Actual: ' + (4294967295 >>> -6.1)); +} + +//CHECK#28 +if (4294967295 >>> -5.1 !== 31) { + throw new Test262Error('#28: 4294967295 >>> -5.1 === 31. Actual: ' + (4294967295 >>> -5.1)); +} + +//CHECK#29 +if (4294967295 >>> -4.1 !== 15) { + throw new Test262Error('#29: 4294967295 >>> -4.1 === 15. Actual: ' + (4294967295 >>> -4.1)); +} + +//CHECK#30 +if (4294967295 >>> -3.1 !== 7) { + throw new Test262Error('#30: 4294967295 >>> -3.1 === 7. Actual: ' + (4294967295 >>> -3.1)); +} + +//CHECK#31 +if (4294967295 >>> -2.1 !== 3) { + throw new Test262Error('#31: 4294967295 >>> -2.1 === 3. Actual: ' + (4294967295 >>> -2.1)); +} + +//CHECK#32 +if (4294967295 >>> -1.1 !== 1) { + throw new Test262Error('#32: 4294967295 >>> -1.1 === 1. Actual: ' + (4294967295 >>> -1.1)); +} + +//CHECK#33 +if (4294967295 >>> 32.1 !== 4294967295) { + throw new Test262Error('#33: 4294967295 >>> 32.1 === 4294967295. Actual: ' + (4294967295 >>> 32.1)); +} + +//CHECK#34 +if (4294967295 >>> 33.1 !== 2147483647) { + throw new Test262Error('#34: 4294967295 >>> 33.1 === 2147483647. Actual: ' + (4294967295 >>> 33.1)); +} + +//CHECK#35 +if (4294967295 >>> 34.1 !== 1073741823) { + throw new Test262Error('#35: 4294967295 >>> 34.1 === 1073741823. Actual: ' + (4294967295 >>> 34.1)); +} + +//CHECK#36 +if (4294967295 >>> 35.1 !== 536870911) { + throw new Test262Error('#36: 4294967295 >>> 35.1 === 536870911. Actual: ' + (4294967295 >>> 35.1)); +} + +//CHECK#37 +if (4294967295 >>> 36.1 !== 268435455) { + throw new Test262Error('#37: 4294967295 >>> 36.1 === 268435455. Actual: ' + (4294967295 >>> 36.1)); +} + +//CHECK#38 +if (4294967295 >>> 37.1 !== 134217727) { + throw new Test262Error('#38: 4294967295 >>> 37.1 === 134217727. Actual: ' + (4294967295 >>> 37.1)); +} + +//CHECK#39 +if (4294967295 >>> 38.1 !== 67108863) { + throw new Test262Error('#39: 4294967295 >>> 38.1 === 67108863. Actual: ' + (4294967295 >>> 38.1)); +} + +//CHECK#40 +if (4294967295 >>> 39.1 !== 33554431) { + throw new Test262Error('#40: 4294967295 >>> 39.1 === 33554431. Actual: ' + (4294967295 >>> 39.1)); +} + +//CHECK#41 +if (4294967295 >>> 40.1 !== 16777215) { + throw new Test262Error('#41: 4294967295 >>> 40.1 === 16777215. Actual: ' + (4294967295 >>> 40.1)); +} + +//CHECK#42 +if (4294967295 >>> 41.1 !== 8388607) { + throw new Test262Error('#42: 4294967295 >>> 41.1 === 8388607. Actual: ' + (4294967295 >>> 41.1)); +} + +//CHECK#43 +if (4294967295 >>> 42.1 !== 4194303) { + throw new Test262Error('#43: 4294967295 >>> 42.1 === 4194303. Actual: ' + (4294967295 >>> 42.1)); +} + +//CHECK#44 +if (4294967295 >>> 43.1 !== 2097151) { + throw new Test262Error('#44: 4294967295 >>> 43.1 === 2097151. Actual: ' + (4294967295 >>> 43.1)); +} + +//CHECK#45 +if (4294967295 >>> 44.1 !== 1048575) { + throw new Test262Error('#45: 4294967295 >>> 44.1 === 1048575. Actual: ' + (4294967295 >>> 44.1)); +} + +//CHECK#46 +if (4294967295 >>> 45.1 !== 524287) { + throw new Test262Error('#46: 4294967295 >>> 45.1 === 524287. Actual: ' + (4294967295 >>> 45.1)); +} + +//CHECK#47 +if (4294967295 >>> 46.1 !== 262143) { + throw new Test262Error('#47: 4294967295 >>> 46.1 === 262143. Actual: ' + (4294967295 >>> 46.1)); +} + +//CHECK#48 +if (4294967295 >>> 47.1 !== 131071) { + throw new Test262Error('#48: 4294967295 >>> 47.1 === 131071. Actual: ' + (4294967295 >>> 47.1)); +} + +//CHECK#49 +if (4294967295 >>> 48.1 !== 65535) { + throw new Test262Error('#49: 4294967295 >>> 48.1 === 65535. Actual: ' + (4294967295 >>> 48.1)); +} + +//CHECK#50 +if (4294967295 >>> 49.1 !== 32767) { + throw new Test262Error('#50: 4294967295 >>> 49.1 === 32767. Actual: ' + (4294967295 >>> 49.1)); +} + +//CHECK#51 +if (4294967295 >>> 50.1 !== 16383) { + throw new Test262Error('#51: 4294967295 >>> 50.1 === 16383. Actual: ' + (4294967295 >>> 50.1)); +} + +//CHECK#52 +if (4294967295 >>> 51.1 !== 8191) { + throw new Test262Error('#52: 4294967295 >>> 51.1 === 8191. Actual: ' + (4294967295 >>> 51.1)); +} + +//CHECK#53 +if (4294967295 >>> 52.1 !== 4095) { + throw new Test262Error('#53: 4294967295 >>> 52.1 === 4095. Actual: ' + (4294967295 >>> 52.1)); +} + +//CHECK#54 +if (4294967295 >>> 53.1 !== 2047) { + throw new Test262Error('#54: 4294967295 >>> 53.1 === 2047. Actual: ' + (4294967295 >>> 53.1)); +} + +//CHECK#55 +if (4294967295 >>> 54.1 !== 1023) { + throw new Test262Error('#55: 4294967295 >>> 54.1 === 1023. Actual: ' + (4294967295 >>> 54.1)); +} + +//CHECK#56 +if (4294967295 >>> 55.1 !== 511) { + throw new Test262Error('#56: 4294967295 >>> 55.1 === 511. Actual: ' + (4294967295 >>> 55.1)); +} + +//CHECK#57 +if (4294967295 >>> 56.1 !== 255) { + throw new Test262Error('#57: 4294967295 >>> 56.1 === 255. Actual: ' + (4294967295 >>> 56.1)); +} + +//CHECK#58 +if (4294967295 >>> 57.1 !== 127) { + throw new Test262Error('#58: 4294967295 >>> 57.1 === 127. Actual: ' + (4294967295 >>> 57.1)); +} + +//CHECK#59 +if (4294967295 >>> 58.1 !== 63) { + throw new Test262Error('#59: 4294967295 >>> 58.1 === 63. Actual: ' + (4294967295 >>> 58.1)); +} + +//CHECK#60 +if (4294967295 >>> 59.1 !== 31) { + throw new Test262Error('#60: 4294967295 >>> 59.1 === 31. Actual: ' + (4294967295 >>> 59.1)); +} + +//CHECK#61 +if (4294967295 >>> 60.1 !== 15) { + throw new Test262Error('#61: 4294967295 >>> 60.1 === 15. Actual: ' + (4294967295 >>> 60.1)); +} + +//CHECK#62 +if (4294967295 >>> 61.1 !== 7) { + throw new Test262Error('#62: 4294967295 >>> 61.1 === 7. Actual: ' + (4294967295 >>> 61.1)); +} + +//CHECK#63 +if (4294967295 >>> 62.1 !== 3) { + throw new Test262Error('#63: 4294967295 >>> 62.1 === 3. Actual: ' + (4294967295 >>> 62.1)); +} + +//CHECK#64 +if (4294967295 >>> 63.1 !== 1) { + throw new Test262Error('#64: 4294967295 >>> 63.1 === 1. Actual: ' + (4294967295 >>> 63.1)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A1.js new file mode 100644 index 0000000000..39f7bfc2a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A1.js @@ -0,0 +1,52 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: If value is NaN, +0, -0, +Infinity, or -Infinity, return +0 +es5id: 9.6_A1 +description: For testing use operator >>>0 +---*/ + +// CHECK#1 +if ((Number.NaN >>> 0) !== +0) { + throw new Test262Error('#1.1: (Number.NaN >>> 0) === 0. Actual: ' + ((Number.NaN >>> 0))); +} else if (1/(Number.NaN >>> 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#1.2: (Number.NaN >>> 0) === +0. Actual: -0'); +} + +// CHECK#2 +if ((Number("abc") >>> 0) !== +0) { + throw new Test262Error('#2.1: (Number("abc") >>> 0) === 0. Actual: ' + ((Number("abc") >>> 0))); +} else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#2.2: (0 >>> 0) === +0. Actual: -0'); +} + +// CHECK#3 +if ((0 >>> 0) !== +0) { + throw new Test262Error('#3.1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0))); +} else if (1/(0 >>> 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#3.2: (0 >>> 0) === +0. Actual: -0'); +} + +// CHECK#4 +if ((-0 >>> 0) !== +0) { + throw new Test262Error("#4.1: (-0 >>> 0) === 0"); +} else if (1/(-0 >>> 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error("#4.2: (-0 >>> 0) === +0. Actual: -0"); +} + +// CHECK#5 +if ((Number.POSITIVE_INFINITY >>> 0) !== +0) { + throw new Test262Error('#5.1: (Number.POSITIVE_INFINITY >>> 0) === 0. Actual: ' + ((Number.POSITIVE_INFINITY >>> 0))); +} else if (1/(Number.POSITIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error('#5.2: (Number.POSITIVE_INFINITY >>> 0) === +0. Actual: -0'); +} + +// CHECK#6 +if ((Number.NEGATIVE_INFINITY >>> 0) !== +0) { + throw new Test262Error("#6.1: (Number.NEGATIVE_INFINITY >>> 0) === 0"); +} else if (1/(Number.NEGATIVE_INFINITY >>> 0) !== Number.POSITIVE_INFINITY) { + throw new Test262Error("#6.2: (Number.NEGATIVE_INFINITY >>> 0) === +0. Actual: -0"); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.1.js new file mode 100644 index 0000000000..7c2686b390 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.1.js @@ -0,0 +1,42 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: ToUint32 returns values between 0 and 2^32-1 +es5id: 9.6_A2.1 +description: > + Converting numbers, which are in\outside of Uint32 scopes, with + >>>0 operator +---*/ + +// CHECK#1 +if ((0 >>> 0) !== 0) { + throw new Test262Error('#1: (0 >>> 0) === 0. Actual: ' + ((0 >>> 0))); +} + +// CHECK#2 +if ((1 >>> 0) !== 1) { + throw new Test262Error('#2: (1 >>> 0) === 1. Actual: ' + ((1 >>> 0))); +} + +// CHECK#3 +if ((-1 >>> 0) !== 4294967295) { + throw new Test262Error('#3: (-1 >>> 0) === 4294967295. Actual: ' + ((-1 >>> 0))); +} + +// CHECK#4 +if ((4294967295 >>> 0) !== 4294967295) { + throw new Test262Error('#4: (4294967295 >>> 0) === 4294967295. Actual: ' + ((4294967295 >>> 0))); +} + +// CHECK#5 +if ((4294967294 >>> 0) !== 4294967294) { + throw new Test262Error('#5: (4294967294 >>> 0) === 4294967294. Actual: ' + ((4294967294 >>> 0))); +} + +// CHECK#6 +if ((4294967296 >>> 0) !== 0) { + throw new Test262Error('#6: (4294967296 >>> 0) === 0. Actual: ' + ((4294967296 >>> 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.2.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.2.js new file mode 100644 index 0000000000..6ea7ecb198 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A2.2.js @@ -0,0 +1,70 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Compute result modulo 2^32 +es5id: 9.6_A2.2 +description: Use operator >>>0 +---*/ + +// CHECK#1 +if ((-2147483647 >>> 0) !== 2147483649) { + throw new Test262Error('#1: (-2147483647 >>> 0) === 2147483649. Actual: ' + ((-2147483647 >>> 0))); +} + +// CHECK#2 +if ((-2147483648 >>> 0) !== 2147483648) { + throw new Test262Error('#2: (-2147483648 >>> 0) === 2147483648. Actual: ' + ((-2147483648 >>> 0))); +} + +// CHECK#3 +if ((-2147483649 >>> 0) !== 2147483647) { + throw new Test262Error('#3: (-2147483649 >>> 0) === 2147483647. Actual: ' + ((-2147483649 >>> 0))); +} + +// CHECK#4 +if ((-4294967295 >>> 0) !== 1) { + throw new Test262Error('#4: (-4294967295 >>> 0) === 1. Actual: ' + ((-4294967295 >>> 0))); +} + +// CHECK#5 +if ((-4294967296 >>> 0) !== 0) { + throw new Test262Error('#5: (-4294967296 >>> 0) === 0. Actual: ' + ((-4294967296 >>> 0))); +} + +// CHECK#6 +if ((-4294967297 >>> 0) !== 4294967295) { + throw new Test262Error('#6: (-4294967297 >>> 0) === 4294967295. Actual: ' + ((-4294967297 >>> 0))); +} + +// CHECK#7 +if ((4294967295 >>> 0) !== 4294967295) { + throw new Test262Error('#7: (4294967295 >>> 0) === 4294967295. Actual: ' + ((4294967295 >>> 0))); +} + +// CHECK#8 +if ((4294967296 >>> 0) !== 0) { + throw new Test262Error('#8: (4294967296 >>> 0) === 0. Actual: ' + ((4294967296 >>> 0))); +} + +// CHECK#9 +if ((4294967297 >>> 0) !== 1) { + throw new Test262Error('#9: (4294967297 >>> 0) === 1. Actual: ' + ((4294967297 >>> 0))); +} + +// CHECK#10 +if ((8589934591 >>> 0) !== 4294967295) { + throw new Test262Error('#10: (8589934591 >>> 0) === 4294967295. Actual: ' + ((8589934591 >>> 0))); +} + +// CHECK#11 +if ((8589934592 >>> 0) !== 0) { + throw new Test262Error('#11: (8589934592 >>> 0) === 0. Actual: ' + ((8589934592 >>> 0))); +} + +// CHECK#12 +if ((8589934593 >>> 0) !== 1) { + throw new Test262Error('#12: (8589934593 >>> 0) === 1. Actual: ' + ((8589934593 >>> 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T1.js new file mode 100644 index 0000000000..c942c7eb84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.6_A3.1_T1 +description: Type(x) is Boolean +---*/ + +// CHECK#1 +if ((new Boolean(true) >>> 0) !== 1) { + throw new Test262Error('#1: (new Boolean(true) >>> 0) === 1. Actual: ' + ((new Boolean(true) >>> 0))); +} + +// CHECK#2 +if ((false >>> 0) !== 0) { + throw new Test262Error('#2: (false >>> 0) === 0. Actual: ' + ((false >>> 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T2.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T2.js new file mode 100644 index 0000000000..fdf42a0533 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.6_A3.1_T2 +description: Type(x) is Number +---*/ + +// CHECK#1 +if ((new Number(1) >>> 0) !== 1) { + throw new Test262Error('#1: (new Number(1) >>> 0) === 1. Actual: ' + ((new Number(1) >>> 0))); +} + +// CHECK#2 +if ((-1.234 >>> 0) !== 4294967295) { + throw new Test262Error('#2: (-1.234 >>> 0) === 4294967295. Actual: ' + ((-1.234 >>> 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T3.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T3.js new file mode 100644 index 0000000000..83ad455932 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.6_A3.1_T3 +description: Type(x) is String +---*/ + +// CHECK#1 +if ((new String(1) >>> 0) !== 1) { + throw new Test262Error('#1: (new String(1) >>> 0) === 1. Actual: ' + ((new String(1) >>> 0))); +} + +// CHECK#2 +if (("-1.234" >>> 0) !== 4294967295) { + throw new Test262Error('#2: ("-1.234" >>> 0) === 4294967295. Actual: ' + (("-1.234" >>> 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T4.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T4.js new file mode 100644 index 0000000000..06141295e9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.1_T4.js @@ -0,0 +1,79 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses ToNumber +es5id: 9.6_A3.1_T4 +description: Type(x) is Object +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if ((object >>> 0) !== 1) { + throw new Test262Error('#1: var object = {valueOf: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if ((object >>> 0) !== 1) { + throw new Test262Error('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if ((object >>> 0) !== 1) { + throw new Test262Error('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#4 +try { + var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; + if ((object >>> 0) !== 1) { + throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); + } +} +catch (e) { + if (e === "error") { + throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object not throw "error"'); + } else { + throw new Test262Error('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; object not throw Error. Actual: ' + (e)); + } +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if ((object >>> 0) !== 1) { + throw new Test262Error('#5: var object = {toString: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if ((object >>> 0) !== 1) { + throw new Test262Error('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; (object >>> 0) === 1. Actual: ' + ((object >>> 0))); +} + +//CHECK#7 +try { + var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; + object >>> 0; + throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object throw "error". Actual: ' + (object >>> 0)); +} +catch (e) { + if (e !== "error") { + throw new Test262Error('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; object throw "error". Actual: ' + (e)); + } +} + +//CHECK#8 +try { + var object = {valueOf: function() {return {}}, toString: function() {return {}}}; + object >>> 0; + throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object throw TypeError. Actual: ' + (object >>> 0)); +} +catch (e) { + if ((e instanceof TypeError) !== true) { + throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; object throw TypeError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.2_T1.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.2_T1.js new file mode 100644 index 0000000000..b9b254eab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/S9.6_A3.2_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator uses floor, abs +es5id: 9.6_A3.2_T1 +description: Use operator >>>0 +---*/ + +// CHECK#1 +if ((1.2345 >>> 0) !== 1) { + throw new Test262Error('#1: (1.2345 >>> 0) === 1. Actual: ' + ((1.2345 >>> 0))); +} + +// CHECK#2 +if ((-5.4321 >>> 0) !== 4294967291) { + throw new Test262Error('#2: (-5.4321 >>> 0) === 4294967291. Actual: ' + ((-5.4321 >>> 0))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-and-number.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-and-number.js new file mode 100644 index 0000000000..32ccc1a7ba --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-and-number.js @@ -0,0 +1,92 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation +description: Mixing BigInt and Number produces a TypeError for unsigned-right-shift operator +features: [BigInt] +info: | + Let lnum be ? ToNumeric(leftValue). + Let rnum be ? ToNumeric(rightValue). + If Type(lnum) does not equal Type(rnum), throw a TypeError exception. +---*/ +assert.throws(TypeError, function() { + 1n >>> 1; +}, '1n >>> 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 >>> 1n; +}, '1 >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >>> 1; +}, 'Object(1n) >>> 1 throws TypeError'); + +assert.throws(TypeError, function() { + 1 >>> Object(1n); +}, '1 >>> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> Object(1); +}, '1n >>> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >>> 1n; +}, 'Object(1) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(1n) >>> Object(1); +}, 'Object(1n) >>> Object(1) throws TypeError'); + +assert.throws(TypeError, function() { + Object(1) >>> Object(1n); +}, 'Object(1) >>> Object(1n) throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> NaN; +}, '1n >>> NaN throws TypeError'); + +assert.throws(TypeError, function() { + NaN >>> 1n; +}, 'NaN >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> Infinity; +}, '1n >>> Infinity throws TypeError'); + +assert.throws(TypeError, function() { + Infinity >>> 1n; +}, 'Infinity >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> true; +}, '1n >>> true throws TypeError'); + +assert.throws(TypeError, function() { + true >>> 1n; +}, 'true >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> '1'; +}, '1n >>> "1" throws TypeError'); + +assert.throws(TypeError, function() { + '1' >>> 1n; +}, '"1" >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> null; +}, '1n >>> null throws TypeError'); + +assert.throws(TypeError, function() { + null >>> 1n; +}, 'null >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 1n >>> undefined; +}, '1n >>> undefined throws TypeError'); + +assert.throws(TypeError, function() { + undefined >>> 1n; +}, 'undefined >>> 1n throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-errors.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-errors.js new file mode 100644 index 0000000000..1f38751c11 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-errors.js @@ -0,0 +1,73 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: unsigned-right-shift operator ToNumeric with BigInt operands +esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation +info: After ToNumeric type coercion, unsigned-right-shift always throws for BigInt operands +features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Symbol('1') >>> 0n; +}, 'Symbol("1") >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> Symbol('1'); +}, '0n >>> Symbol("1") throws TypeError'); + +assert.throws(TypeError, function() { + Object(Symbol('1')) >>> 0n; +}, 'Object(Symbol("1")) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> Object(Symbol('1')); +}, '0n >>> Object(Symbol("1")) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }) >>> 0n; +}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: function() { + return Symbol('1'); + } + }; +}, '0n >>> {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Symbol('1'); + } + }) >>> 0n; +}, '({valueOf: function() {return Symbol("1");}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: function() { + return Symbol('1'); + } + }; +}, '0n >>> {valueOf: function() {return Symbol("1");}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return Symbol('1'); + } + }) >>> 0n; +}, '({toString: function() {return Symbol("1");}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + toString: function() { + return Symbol('1'); + } + }; +}, '0n >>> {toString: function() {return Symbol("1");}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-non-primitive.js new file mode 100644 index 0000000000..ec4b7811c9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-non-primitive.js @@ -0,0 +1,105 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Unsigned right shift always throws for non-primitive BigInt values +esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation +info: | + ShiftExpression : ShiftExpression >>> AdditiveExpression + + 1. Let lref be the result of evaluating ShiftExpression. + 2. Let lval be ? GetValue(lref). + 3. Let rref be the result of evaluating AdditiveExpression. + 4. Let rval be ? GetValue(rref). + 5. Let lnum be ? ToNumeric(lval). + 6. Let rnum be ? ToNumeric(rval). + 7. If Type(lnum) does not equal Type(rnum), throw a TypeError exception. + 8. Let T be Type(lnum). + 9. Return T::unsignedRightShift(lnum, rnum). + + Note: BigInt::unsignedRightShift always throws a TypeError + +features: [BigInt, Symbol.toPrimitive] +---*/ +assert.throws(TypeError, function() { + Object(0b101n) >>> 1n; +}, 'Object(0b101n) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + Object(0b101n) >>> Object(1n); +}, 'Object(0b101n) >>> Object(1n) throws TypeError'); + +function err() { + throw new Test262Error(); +} + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return 0b101n; + }, + + valueOf: err, + toString: err + }) >>> 1n; +}, '({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return 0b101n; + }, + + toString: err + }) >>> 1n; +}, '({valueOf: function() {return 0b101n;}, toString: err}) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return 0b101n; + } + }) >>> 1n; +}, '({toString: function() {return 0b101n;}}) >>> 1n throws TypeError'); + +assert.throws(TypeError, function() { + 0b101n >>> { + [Symbol.toPrimitive]: function() { + return 1n; + }, + + valueOf: err, + toString: err + }; +}, '0b101n >>> {[Symbol.toPrimitive]: function() {return 1n;}, valueOf: err, toString: err} throws TypeError'); + +assert.throws(TypeError, function() { + 0b101n >>> { + valueOf: function() { + return 1n; + }, + + toString: err + }; +}, '0b101n >>> {valueOf: function() {return 1n;}, toString: err} throws TypeError'); + +assert.throws(TypeError, function() { + 0b101n >>> { + toString: function() { + return 1n; + } + }; +}, '0b101n >>> {toString: function() {return 1n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return 0b101n; + } + }) >>> { + valueOf: function() { + return 1n; + } + }; +}, '({valueOf: function() {return 0b101n;}}) >>> {valueOf: function() {return 1n;}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-toprimitive.js new file mode 100644 index 0000000000..257bb6435a --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-toprimitive.js @@ -0,0 +1,415 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: unsigned-right-shift operator ToNumeric with BigInt operands +esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation +info: After ToNumeric type coercion, unsigned-right-shift always throws for BigInt operands +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +function err() { + throw new Test262Error(); +} + +function MyError() {} + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err + }) >>> 0n; +}, '({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: function() { + return 2n; + }, + + valueOf: err, + toString: err + }; +}, '0n >>> {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return 2n; + }, + + toString: err + }) >>> 0n; +}, '({valueOf: function() {return 2n;}, toString: err}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: function() { + return 2n; + }, + + toString: err + }; +}, '0n >>> {valueOf: function() {return 2n;}, toString: err} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return 2n; + } + }) >>> 0n; +}, '({toString: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + toString: function() { + return 2n; + } + }; +}, '0n >>> {toString: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } + }) >>> 0n; +}, '({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: undefined, + + valueOf: function() { + return 2n; + } + }; +}, '0n >>> {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } + }) >>> 0n; +}, '({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: null, + + valueOf: function() { + return 2n; + } + }; +}, '0n >>> {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + + toString: function() { + return 2n; + } + }) >>> 0n; +}, '({valueOf: null, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: null, + + toString: function() { + return 2n; + } + }; +}, '0n >>> {valueOf: null, toString: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + + toString: function() { + return 2n; + } + }) >>> 0n; +}, '({valueOf: 1, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: 1, + + toString: function() { + return 2n; + } + }; +}, '0n >>> {valueOf: 1, toString: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + + toString: function() { + return 2n; + } + }) >>> 0n; +}, '({valueOf: {}, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: {}, + + toString: function() { + return 2n; + } + }; +}, '0n >>> {valueOf: {}, toString: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } + }) >>> 0n; +}, '({valueOf: function() {return {};}, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: function() { + return {}; + }, + + toString: function() { + return 2n; + } + }; +}, '0n >>> {valueOf: function() {return {};}, toString: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } + }) >>> 0n; +}, '({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: function() { + return Object(12345); + }, + + toString: function() { + return 2n; + } + }; +}, '0n >>> {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: 1 + }) >>> 0n; +}, '({[Symbol.toPrimitive]: 1}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: 1 + }; +}, '0n >>> {[Symbol.toPrimitive]: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: {} + }) >>> 0n; +}, '({[Symbol.toPrimitive]: {}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: {} + }; +}, '0n >>> {[Symbol.toPrimitive]: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return Object(1); + } + }) >>> 0n; +}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: function() { + return Object(1); + } + }; +}, '0n >>> {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return {}; + } + }) >>> 0n; +}, '({[Symbol.toPrimitive]: function() {return {};}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: function() { + return {}; + } + }; +}, '0n >>> {[Symbol.toPrimitive]: function() {return {};}} throws TypeError'); + +assert.throws(MyError, function() { + ({ + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }) >>> 0n; +}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) >>> 0n throws MyError'); + +assert.throws(MyError, function() { + 0n >>> { + [Symbol.toPrimitive]: function() { + throw new MyError(); + } + }; +}, '0n >>> {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + valueOf: function() { + throw new MyError(); + } + }) >>> 0n; +}, '({valueOf: function() {throw new MyError();}}) >>> 0n throws MyError'); + +assert.throws(MyError, function() { + 0n >>> { + valueOf: function() { + throw new MyError(); + } + }; +}, '0n >>> {valueOf: function() {throw new MyError();}} throws MyError'); + +assert.throws(MyError, function() { + ({ + toString: function() { + throw new MyError(); + } + }) >>> 0n; +}, '({toString: function() {throw new MyError();}}) >>> 0n throws MyError'); + +assert.throws(MyError, function() { + 0n >>> { + toString: function() { + throw new MyError(); + } + }; +}, '0n >>> {toString: function() {throw new MyError();}} throws MyError'); + +assert.throws(TypeError, function() { + ({ + valueOf: null, + toString: null + }) >>> 0n; +}, '({valueOf: null, toString: null}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: null, + toString: null + }; +}, '0n >>> {valueOf: null, toString: null} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: 1, + toString: 1 + }) >>> 0n; +}, '({valueOf: 1, toString: 1}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: 1, + toString: 1 + }; +}, '0n >>> {valueOf: 1, toString: 1} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: {}, + toString: {} + }) >>> 0n; +}, '({valueOf: {}, toString: {}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: {}, + toString: {} + }; +}, '0n >>> {valueOf: {}, toString: {}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }) >>> 0n; +}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: function() { + return Object(1); + }, + + toString: function() { + return Object(1); + } + }; +}, '0n >>> {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }) >>> 0n; +}, '({valueOf: function() {return {};}, toString: function() {return {};}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: function() { + return {}; + }, + + toString: function() { + return {}; + } + }; +}, '0n >>> {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-wrapped-values.js new file mode 100644 index 0000000000..5a6cde64d2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint-wrapped-values.js @@ -0,0 +1,65 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: unsigned-right-shift operator ToNumeric with BigInt operands +esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation +info: After ToNumeric type coercion, unsigned-right-shift always throws for BigInt operands +features: [BigInt, Symbol.toPrimitive, computed-property-names] +---*/ +assert.throws(TypeError, function() { + Object(2n) >>> 0n; +}, 'Object(2n) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> Object(2n); +}, '0n >>> Object(2n) throws TypeError'); + +assert.throws(TypeError, function() { + ({ + [Symbol.toPrimitive]: function() { + return 2n; + } + }) >>> 0n; +}, '({[Symbol.toPrimitive]: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + [Symbol.toPrimitive]: function() { + return 2n; + } + }; +}, '0n >>> {[Symbol.toPrimitive]: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + valueOf: function() { + return 2n; + } + }) >>> 0n; +}, '({valueOf: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + valueOf: function() { + return 2n; + } + }; +}, '0n >>> {valueOf: function() {return 2n;}} throws TypeError'); + +assert.throws(TypeError, function() { + ({ + toString: function() { + return 2n; + } + }) >>> 0n; +}, '({toString: function() {return 2n;}}) >>> 0n throws TypeError'); + +assert.throws(TypeError, function() { + 0n >>> { + toString: function() { + return 2n; + } + }; +}, '0n >>> {toString: function() {return 2n;}} throws TypeError'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint.js new file mode 100644 index 0000000000..1943d1109b --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/bigint.js @@ -0,0 +1,66 @@ +// Copyright (C) 2017 Josh Wolfe. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Unsigned right shift always throws for BigInt values +esid: sec-numeric-types-bigint-unsignedRightShift +info: | + BigInt::unsignedRightShift (x, y) + + The abstract operation BigInt::unsignedRightShift with two arguments x and y of type BigInt: + + 1. Throw a TypeError exception. + +features: [BigInt] +---*/ + +assert.throws(TypeError, function() { 0n >>> 0n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 5n >>> 1n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 5n >>> 2n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 5n >>> 3n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 5n >>> -1n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 5n >>> -2n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 5n >>> -3n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 0n >>> 128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 0n >>> -128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 582n >>> 0n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 582n >>> 127n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 582n >>> 128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 582n >>> 129n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 582n >>> -128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> 64n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> 32n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> 16n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> 0n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> -16n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> -32n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> -64n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> -127n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> -128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { 405972677036361916727469983882855107238581880n >>> -129n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -5n >>> 1n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -5n >>> 2n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -5n >>> 3n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -5n >>> -1n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -5n >>> -2n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -5n >>> -3n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -1n >>> 128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -1n >>> 0n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -1n >>> -128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -582n >>> 0n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -582n >>> 127n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -582n >>> 128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -582n >>> 129n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -582n >>> -128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> 64n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> 32n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> 16n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> 0n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> -16n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> -32n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> -64n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> -127n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> -128n; }, "bigint >>> bigint throws a TypeError"); +assert.throws(TypeError, function() { -405972677036361916727469983882855107238581880n >>> -129n; }, "bigint >>> bigint throws a TypeError"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/browser.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/order-of-evaluation.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/order-of-evaluation.js new file mode 100644 index 0000000000..0ce8ffeb82 --- /dev/null +++ b/js/src/tests/test262/language/expressions/unsigned-right-shift/order-of-evaluation.js @@ -0,0 +1,140 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation +description: Type coercion order of operations for unsigned-right-shift operator +features: [Symbol] +info: | + Evaluate lhs + Evaluate rhs + ToNumeric(lhs) + ToNumeric(rhs) +---*/ + +function MyError() {} +var trace; + +// ?GetValue(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + throw new MyError(); + })() >>> (function() { + trace += "2"; + throw new Test262Error("should not be evaluated"); + })(); +}, "?GetValue(lhs) throws."); +assert.sameValue(trace, "1", "?GetValue(lhs) throws."); + +// ?GetValue(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new Test262Error("should not be evaluated"); + } + }; + })() >>> (function() { + trace += "2"; + throw new MyError(); + })(); +}, "?GetValue(rhs) throws."); +assert.sameValue(trace, "12", "?GetValue(rhs) throws."); + +// ?ToPrimive(lhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + throw new MyError(); + } + }; + })() >>> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToPrimive(lhs) throws."); +assert.sameValue(trace, "123", "?ToPrimive(lhs) throws."); + +// ?ToPrimive(rhs) throws. +trace = ""; +assert.throws(MyError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() >>> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new MyError(); + } + }; + })(); +}, "?ToPrimive(rhs) throws."); +assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws."); + +// ?ToNumeric(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return Symbol("1"); + } + }; + })() >>> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + throw new Test262Error("should not be evaluated"); + } + }; + })(); +}, "?ToNumeric(lhs) throws."); +assert.sameValue(trace, "123", "?ToNumeric(lhs) throws."); + +// GetValue(lhs) throws. +trace = ""; +assert.throws(TypeError, function() { + (function() { + trace += "1"; + return { + valueOf: function() { + trace += "3"; + return 1; + } + }; + })() >>> (function() { + trace += "2"; + return { + valueOf: function() { + trace += "4"; + return Symbol("1"); + } + }; + })(); +}, "GetValue(lhs) throws."); +assert.sameValue(trace, "1234", "GetValue(lhs) throws."); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/unsigned-right-shift/shell.js b/js/src/tests/test262/language/expressions/unsigned-right-shift/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A1.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A1.js new file mode 100644 index 0000000000..3b2c7661ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "void" and UnaryExpression are + allowed +es5id: 11.4.2_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("void\u00090") !== undefined) { + throw new Test262Error('#1: void\\u00090 === undefined'); +} + +//CHECK#2 +if (eval("void\u000B0") !== undefined) { + throw new Test262Error('#2: void\\u000B0 === undefined'); +} + +//CHECK#3 +if (eval("void\u000C0") !== undefined) { + throw new Test262Error('#3: void\\u000C0 === undefined'); +} + +//CHECK#4 +if (eval("void\u00200") !== undefined) { + throw new Test262Error('#4: void\\u00200 === undefined'); +} + +//CHECK#5 +if (eval("void\u00A00") !== undefined) { + throw new Test262Error('#5: void\\u00A00 === undefined'); +} + +//CHECK#6 +if (eval("void\u000A0") !== undefined) { + throw new Test262Error('#6: void\\u000A0 === undefined'); +} + +//CHECK#7 +if (eval("void\u000D0") !== undefined) { + throw new Test262Error('#7: void\\u000D0 === undefined'); +} + +//CHECK#8 +if (eval("void\u20280") !== undefined) { + throw new Test262Error('#8: void\\u20280 === undefined'); +} + +//CHECK#9 +if (eval("void\u20290") !== undefined) { + throw new Test262Error('#9: void\\u20290 === undefined'); +} + +//CHECK#10 +if (eval("void\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20290") !== undefined) { + throw new Test262Error('#10: void\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20290 === undefined'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A2_T1.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A2_T1.js new file mode 100644 index 0000000000..70f142615d --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A2_T1.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" uses GetValue +es5id: 11.4.2_A2_T1 +description: Either Type(x) is not Reference or GetBase(x) is not null +---*/ + +//CHECK#1 +if (void 0 !== undefined) { + throw new Test262Error('#1: void 0 === undefined. Actual: ' + (void 0)); +} + +//CHECK#2 +var x = 0; +if (void x !== undefined) { + throw new Test262Error('#2: var x = 0; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#3 +var x = new Object(); +if (void x !== undefined) { + throw new Test262Error('#3: var x = new Object(); void x === undefined. Actual: ' + (void x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A2_T2.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A2_T2.js new file mode 100644 index 0000000000..b561464a98 --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A2_T2.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" uses GetValue +es5id: 11.4.2_A2_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +assert.throws(ReferenceError, function() { + void x; +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T1.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T1.js new file mode 100644 index 0000000000..081a64421b --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" evaluates UnaryExpression and returns undefined +es5id: 11.4.2_A4_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +var x = false; +if (void x !== undefined) { + throw new Test262Error('#1: var x = false; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = new Boolean(true); +if (void x !== undefined) { + throw new Test262Error('#2: var x = new Boolean(true); void x === undefined. Actual: ' + (void x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T2.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T2.js new file mode 100644 index 0000000000..8fc64e42b0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T2.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" evaluates UnaryExpression and returns undefined +es5id: 11.4.2_A4_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +var x = 0.1; +if (void x !== undefined) { + throw new Test262Error('#1: var x = 0.1; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = new Number(-1.1); +if (void x !== undefined) { + throw new Test262Error('#2: var x = new Number(-1.1); void x === undefined. Actual: ' + (void x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T3.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T3.js new file mode 100644 index 0000000000..2339a07c0f --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" evaluates UnaryExpression and returns undefined +es5id: 11.4.2_A4_T3 +description: Type(x) is string primitive of String object +---*/ + +//CHECK#1 +var x = "1"; +if (void x !== undefined) { + throw new Test262Error('#1: var x = "1"; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = "x"; +if (isNaN(void x) !== true) { + throw new Test262Error('#2: var x = "x"; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#3 +var x = new String("-1"); +if (void x !== undefined) { + throw new Test262Error('#3: var x = new String("-1"); void x === undefined. Actual: ' + (void x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T4.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T4.js new file mode 100644 index 0000000000..8aeb99a2c0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T4.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" evaluates UnaryExpression and returns undefined +es5id: 11.4.2_A4_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +var x; +if (isNaN(void x) !== true) { + throw new Test262Error('#1: var x; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = null; +if (void x !== undefined) { + throw new Test262Error('#2: var x = null; void x === undefined. Actual: ' + (void x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T5.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T5.js new file mode 100644 index 0000000000..14d02a101b --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T5.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" evaluates UnaryExpression and returns undefined +es5id: 11.4.2_A4_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +var x = {}; +if (isNaN(void x) !== true) { + throw new Test262Error('#1: var x = {}; void x === undefined. Actual: ' + (void x)); +} + +//CHECK#2 +var x = function(){return 1}; +if (isNaN(void x) !== true) { + throw new Test262Error('#2: var x = function(){return 1}; void x === undefined. Actual: ' + (void x)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T6.js b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T6.js new file mode 100644 index 0000000000..e936bed38c --- /dev/null +++ b/js/src/tests/test262/language/expressions/void/S11.4.2_A4_T6.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator "void" evaluates UnaryExpression and returns undefined +es5id: 11.4.2_A4_T6 +description: Checking Simple Assignment operator +---*/ + +//CHECK#1 +var x = 0; +if (void (x = 1) !== undefined) { + throw new Test262Error('#1: var x = 0; void (x = 1) === undefined. Actual: ' + (void (x = 1))); +} else { + if (x !== 1) { + throw new Test262Error('#1: var x = 0; void (x = 1); x === 1. Actual: ' + (x)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/void/browser.js b/js/src/tests/test262/language/expressions/void/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/void/shell.js b/js/src/tests/test262/language/expressions/void/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/yield/arguments-object-attributes.js b/js/src/tests/test262/language/expressions/yield/arguments-object-attributes.js new file mode 100644 index 0000000000..d6db638781 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/arguments-object-attributes.js @@ -0,0 +1,43 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + Attributes of the `arguments` object are valid yield expression operands. +features: [generators] +---*/ + +function* g() { + yield arguments[0]; + yield arguments[1]; + yield arguments[2]; + yield arguments[3]; +} +var iter = g(23, 45, 33); +var result; + +result = iter.next(); +assert.sameValue(result.value, 23, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 45, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 33, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Fourth result `value` (unspecified parameter)' +); +assert.sameValue( + result.done, false, 'Fourth result `done` flag (unspecified parameter)' +); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/browser.js b/js/src/tests/test262/language/expressions/yield/browser.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/yield/captured-free-vars.js b/js/src/tests/test262/language/expressions/yield/captured-free-vars.js new file mode 100644 index 0000000000..569cfba77c --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/captured-free-vars.js @@ -0,0 +1,38 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + Free variables captured within the GeneratorFunction closure are valid + yield expression operands. +features: [generators] +---*/ + +var a = 1; +var b = 2; +var c = 3; +function* g() { + yield a; + yield b; + yield c; +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 2, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 3, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-non-strict.js b/js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-non-strict.js new file mode 100644 index 0000000000..b79ec78a6b --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-non-strict.js @@ -0,0 +1,47 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + Formal parameters are valid yield expression operands. +flags: [noStrict] +features: [generators] +---*/ + +function* g(a, b, c, d) { + arguments[0] = 32; + arguments[1] = 54; + arguments[2] = 333; + yield a; + yield b; + yield c; + yield d; +} +var iter = g(23, 45, 33); +var result; + +result = iter.next(); +assert.sameValue(result.value, 32, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 54, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 333, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Fourth result `value` (unspecified parameter)' +); +assert.sameValue( + result.done, false, 'Fourth result `done` flag (unspecified parameter)' +); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-strict-strict.js b/js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-strict-strict.js new file mode 100644 index 0000000000..aa5c3a1b1e --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/formal-parameters-after-reassignment-strict-strict.js @@ -0,0 +1,48 @@ +'use strict'; +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + Formal parameters are valid yield expression operands. +flags: [onlyStrict] +features: [generators] +---*/ + +function* g(a, b, c, d) { + arguments[0] = 32; + arguments[1] = 54; + arguments[2] = 333; + yield a; + yield b; + yield c; + yield d; +} +var iter = g(23, 45, 33); +var result; + +result = iter.next(); +assert.sameValue(result.value, 23, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 45, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 33, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Fourth result `value` (unspecified parameter)' +); +assert.sameValue( + result.done, false, 'Fourth result `done` flag (unspecified parameter)' +); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/formal-parameters.js b/js/src/tests/test262/language/expressions/yield/formal-parameters.js new file mode 100644 index 0000000000..83467fc2b9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/formal-parameters.js @@ -0,0 +1,43 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + Formal parameters are valid yield expression operands. +features: [generators] +---*/ + +function* g(a, b, c, d) { + yield a; + yield b; + yield c; + yield d; +} +var iter = g(23, 45, 33); +var result; + +result = iter.next(); +assert.sameValue(result.value, 23, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 45, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 33, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Fourth result `value` (unspecified parameter)' +); +assert.sameValue( + result.done, false, 'Fourth result `done` flag (unspecified parameter)' +); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/from-catch.js b/js/src/tests/test262/language/expressions/yield/from-catch.js new file mode 100644 index 0000000000..a90a9ae34e --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/from-catch.js @@ -0,0 +1,29 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + The behavior of `yield` expressions should not be affected when they appear + within the `catch` block of `try` statements. +features: [generators] +---*/ + +function* g() { + try { + throw new Error(); + } catch (err) { + yield 1; + } +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done`flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/from-try.js b/js/src/tests/test262/language/expressions/yield/from-try.js new file mode 100644 index 0000000000..732ff70b78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/from-try.js @@ -0,0 +1,29 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + The behavior of `yield` expressions should not be affected when they appear + within the `try` block of `try` statements. +features: [generators] +---*/ + +function* g() { + try { + yield 1; + } catch (err) { + throw err; + } +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done`flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/from-with.js b/js/src/tests/test262/language/expressions/yield/from-with.js new file mode 100644 index 0000000000..6d30c8ecaf --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/from-with.js @@ -0,0 +1,42 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + The operand to a `yield` expression should honor the semantics of the + `with` statement. +flags: [noStrict] +features: [generators] +---*/ + +function* g() { + var x = 1; + + yield x; + + with ({ x: 2 }) { + yield x; + } + + yield x; +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 2, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 1, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/in-iteration-stmt.js b/js/src/tests/test262/language/expressions/yield/in-iteration-stmt.js new file mode 100644 index 0000000000..f85781f867 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/in-iteration-stmt.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression operand may not include the `in` keyword in contexts where it + is disallowed +info: | + Syntax + + yield [no LineTerminator here] AssignmentExpression[?In, +Yield] +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +function* g() { + for (yield '' in {}; ; ) ; +} diff --git a/js/src/tests/test262/language/expressions/yield/in-rltn-expr.js b/js/src/tests/test262/language/expressions/yield/in-rltn-expr.js new file mode 100644 index 0000000000..1d1e69ceb5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/in-rltn-expr.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression contextually recognizes the `in` keyword as part of a + RelationalExpression +info: | + Syntax + + yield [no LineTerminator here] AssignmentExpression[?In, +Yield] +features: [generators] +---*/ + +var obj = Object.create(null); +var iter, iterResult, value; +function* g() { + value = yield 'hit' in obj; + value = yield 'miss' in obj; +} +obj.hit = true; + +iter = g(); + +iterResult = iter.next('first'); + +assert.sameValue(iterResult.done, false, '`done` property (first iteration)'); +assert.sameValue(iterResult.value, true, '`value` property (first iteration)'); +assert.sameValue( + value, undefined, 'generator paused prior to evaluating AssignmentExpression' +); + +iterResult = iter.next('second'); + +assert.sameValue(iterResult.done, false, '`done` property (second iteration)'); +assert.sameValue( + iterResult.value, false, '`value` property (second iteration)' +); +assert.sameValue(value, 'second', 'value of first AssignmentExpression'); + +iterResult = iter.next('third'); + +assert.sameValue(iterResult.done, true, '`done` property (third iteration)'); +assert.sameValue( + iterResult.value, undefined, '`value` property (third iteration)' +); +assert.sameValue(value, 'third', 'value of second AssignmentExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/invalid-left-hand-side.js b/js/src/tests/test262/language/expressions/yield/invalid-left-hand-side.js new file mode 100644 index 0000000000..656e27d75f --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/invalid-left-hand-side.js @@ -0,0 +1,29 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: A YieldExpression is not a valid LeftHandSideExpression +info: | + AssignmentExpression[In, Yield] : + ConditionalExpression[?In, ?Yield] + [+Yield]YieldExpression[?In] + ArrowFunction[?In, ?Yield] + LeftHandSideExpression[?Yield] = AssignmentExpression[?In, ?Yield] + LeftHandSideExpression[?Yield] AssignmentOperator AssignmentExpression[?In, ?Yield] + + LeftHandSideExpression[Yield] : + NewExpression[?Yield] + CallExpression[?Yield] +features: [generators] +negative: + phase: parse + type: SyntaxError +---*/ + +$DONOTEVALUATE(); + +function* g() { + yield = 1; +} diff --git a/js/src/tests/test262/language/expressions/yield/iter-value-specified.js b/js/src/tests/test262/language/expressions/yield/iter-value-specified.js new file mode 100644 index 0000000000..cd5355f6d0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/iter-value-specified.js @@ -0,0 +1,31 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + When the `next` method of a generator-produced iterable is invoked without + an argument, the corresponding `yield` expression should be evaluated as + `undefined`. +features: [generators] +---*/ + +function* g() { actual = yield; } +var expected = {}; +var iter = g(); +var actual, result; + +result = iter.next(); +assert.sameValue(result.value, undefined, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); +assert.sameValue( + actual, undefined, 'Value of `yield` expression (prior to continuation)' +); + +result = iter.next(expected); +assert.sameValue(result.value, undefined, 'Second result `value`'); +assert.sameValue(result.done, true, 'Second result `done` flag'); +assert.sameValue( + actual, expected, 'Value of `yield` expression (following continuation)' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/iter-value-unspecified.js b/js/src/tests/test262/language/expressions/yield/iter-value-unspecified.js new file mode 100644 index 0000000000..97a0c7522d --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/iter-value-unspecified.js @@ -0,0 +1,26 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + When the `next` method of a generator-produced iterable is invoked without + an argument, the corresponding `yield` expression should be evaluated as + `undefined`. +features: [generators] +---*/ + +function* g() { actual = yield; } +var iter = g(); +var actual, result; + +result = iter.next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, false); +assert.sameValue(actual, undefined); + +result = iter.next(); +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(actual, undefined); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/rhs-iter.js b/js/src/tests/test262/language/expressions/yield/rhs-iter.js new file mode 100644 index 0000000000..c837ba837a --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/rhs-iter.js @@ -0,0 +1,41 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Iteration protocol is not initiated for non-delegating YieldExpression +info: | + YieldExpression:yieldAssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Return ? GeneratorYield(CreateIterResultObject(value, false)). +features: [generators, Symbol.iterator] +---*/ + +var callCount = 0; +var iterSpy = Object.defineProperty({}, Symbol.iterator, { + get: function() { + callCount += 1; + } +}); +function* g() { + yield iterSpy; +} +var iter = g(); +var result; + +result = iter.next(); + +assert.sameValue(result.value, iterSpy); +assert.sameValue(result.done, false); +assert.sameValue(callCount, 0); + +result = iter.next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(callCount, 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/rhs-omitted.js b/js/src/tests/test262/language/expressions/yield/rhs-omitted.js new file mode 100644 index 0000000000..23c3f710ff --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/rhs-omitted.js @@ -0,0 +1,128 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` is a valid expression within generator function bodies. +es6id: 14.4 +features: [generators] +---*/ + +var iter, result; +function* g1() { (yield) } +function* g2() { [yield] } +function* g3() { {yield} } +function* g4() { yield, yield; } +function* g5() { (yield) ? yield : yield; } + +iter = g1(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Within grouping operator: result `value`' +); +assert.sameValue( + result.done, false, 'Within grouping operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following grouping operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following grouping operator: result `done` flag' +); + +iter = g2(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Within array literal: result `value`' +); +assert.sameValue( + result.done, false, 'Within array literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following array literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following array literal: result `done` flag' +); + +iter = g3(); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Within object literal: result `value`' +); +assert.sameValue( + result.done, false, 'Within object literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following object literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following object literal: result `done` flag' +); + +iter = g4(); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'First expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'First expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'Second expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'Second expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following comma expression: result `value`' +); +assert.sameValue( + result.done, true, 'Following comma expression: result `done` flag' +); + +iter = g5(); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'Conditional expression in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Conditional expression in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, + undefined, + 'Branch in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Branch in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following conditional operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following conditional operator: result `done` flag' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/rhs-primitive.js b/js/src/tests/test262/language/expressions/yield/rhs-primitive.js new file mode 100644 index 0000000000..bde90dfbd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/rhs-primitive.js @@ -0,0 +1,118 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: > + `yield` is a valid expression within generator function bodies. +es6id: 14.4 +features: [generators] +---*/ + +var result, iter; +function* g1() { (yield 1) } +function* g2() { [yield 1] } +function* g3() { {yield 1} } +function* g4() { yield 1, yield 2; } +function* g5() { (yield 1) ? yield 2 : yield 3; } + +iter = g1(); +result = iter.next(); +assert.sameValue(result.value, 1, 'Within grouping operator: result `value`'); +assert.sameValue( + result.done, false, 'Within grouping operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following grouping operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following grouping operator: result `done` flag' +); + +iter = g2(); +result = iter.next(); +assert.sameValue(result.value, 1, 'Within array literal: result `value`'); +assert.sameValue( + result.done, false, 'Within array literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following array literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following array literal: result `done` flag' +); + +iter = g3(); +result = iter.next(); +assert.sameValue(result.value, 1, 'Within object literal: result `value`'); +assert.sameValue( + result.done, false, 'Within object literal: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following object literal: result `value`' +); +assert.sameValue( + result.done, true, 'Following object literal: result `done` flag' +); + +iter = g4(); +result = iter.next(); +assert.sameValue( + result.value, 1, 'First expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'First expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, 2, 'Second expression in comma expression: result `value`' +); +assert.sameValue( + result.done, + false, + 'Second expression in comma expression: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following comma expression: result `value`' +); +assert.sameValue( + result.done, true, 'Following comma expression: result `done` flag' +); + +iter = g5(); +result = iter.next(); +assert.sameValue( + result.value, + 1, + 'Conditional expression in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Conditional expression in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, + 3, + 'Branch in conditional operator: result `value`' +); +assert.sameValue( + result.done, + false, + 'Branch in conditional operator: result `done` flag' +); +result = iter.next(); +assert.sameValue( + result.value, undefined, 'Following conditional operator: result `value`' +); +assert.sameValue( + result.done, true, 'Following conditional operator: result `done` flag' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/rhs-regexp.js b/js/src/tests/test262/language/expressions/yield/rhs-regexp.js new file mode 100644 index 0000000000..96ee0985ed --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/rhs-regexp.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression accepts a regular expression literal as its right-hand side +info: | + The syntactic context immediately following yield requires use of the + InputElementRegExpOrTemplateTail lexical goal. +features: [generators] +---*/ + +var complete = false; +var sent = {}; +var iter, iterResult, received; +// Unused variables declared to improve error messages in incorrect parsing +// scenarios. +var abc, i; +function* g() { + received = yield/abc/i; + complete = true; +} + +iter = g(); + +assert.sameValue(complete, false, 'generator initially paused'); +assert.sameValue(received, undefined, 'first statement no executed'); + +iterResult = iter.next(); + +assert.sameValue(complete, false, 'generator paused following expression'); +assert.sameValue(received, undefined, 'first statement not executed'); + +assert.sameValue(iterResult.done, false, 'iteration not complete'); +assert.sameValue(iterResult.value.test('ABC'), true, 'first iterated value'); + +iterResult = iter.next(sent); + +assert.sameValue(received, sent, 'YieldExpression value'); +assert.sameValue(complete, true, 'generator correctly re-started'); +assert.sameValue(iterResult.done, true, 'iteration complete'); +assert.sameValue(iterResult.value, undefined, 'second iterated value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/rhs-template-middle.js b/js/src/tests/test262/language/expressions/yield/rhs-template-middle.js new file mode 100644 index 0000000000..051e6dbab0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/rhs-template-middle.js @@ -0,0 +1,40 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: YieldExpression may be followed by a TemplateMiddle construct +info: | + The syntactic context immediately following yield requires use of the + InputElementRegExpOrTemplateTail lexical goal. +features: [generators] +---*/ + +var complete = false; +var iter, iterResult, str; +function* g() { + str = `1${ yield }3${ 4 }5`; + complete = true; +} + +iter = g(); + +assert.sameValue(complete, false, 'generator initially paused'); +assert.sameValue(str, undefined, 'first statement not executed'); + +iterResult = iter.next(); + +assert.sameValue(complete, false, 'generator paused following expression'); +assert.sameValue(str, undefined, 'first statement not executed'); + +assert.sameValue(iterResult.done, false, 'iteration not complete'); +assert.sameValue(iterResult.value, undefined, 'first iterated value'); + +iterResult = iter.next(2); + +assert.sameValue(str, '12345', 'YieldExpression value'); +assert.sameValue(complete, true, 'generator correctly re-started'); +assert.sameValue(iterResult.done, true, 'iteration complete'); +assert.sameValue(iterResult.value, undefined, 'second iterated value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/rhs-unresolvable.js b/js/src/tests/test262/language/expressions/yield/rhs-unresolvable.js new file mode 100644 index 0000000000..b20f397850 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/rhs-unresolvable.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: GetValue invoked on Reference value +info: | + YieldExpression : yield AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). +features: [generators] +---*/ + +var err; +function* g() { + try { + yield test262unresolvable; + } catch (_err) { + err = _err; + } +} +var iter = g(); +var result; + +result = iter.next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(typeof err, 'object'); +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/rhs-yield.js b/js/src/tests/test262/language/expressions/yield/rhs-yield.js new file mode 100644 index 0000000000..1962517b83 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/rhs-yield.js @@ -0,0 +1,28 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + Yield expressions are valid yield expression operands. +features: [generators] +---*/ + +function* g() { + yield yield 1; +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(3); +assert.sameValue(result.value, 3, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done`flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/shell.js b/js/src/tests/test262/language/expressions/yield/shell.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/js/src/tests/test262/language/expressions/yield/star-array.js b/js/src/tests/test262/language/expressions/yield/star-array.js new file mode 100644 index 0000000000..8e85b126e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-array.js @@ -0,0 +1,33 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + When an array is the operand of a `yield *` expression, the generator + should produce an iterator that visits each element in order. +features: [generators] +---*/ + +function* g() { + yield* [1, 2, 3]; +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 2, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 3, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-in-iteration-stmt.js b/js/src/tests/test262/language/expressions/yield/star-in-iteration-stmt.js new file mode 100644 index 0000000000..4511806e2f --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-in-iteration-stmt.js @@ -0,0 +1,24 @@ +// |reftest| error:SyntaxError +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression operand may not include the `in` keyword in contexts where it + is disallowed +info: | + Syntax + + yield [no LineTerminator here] * AssignmentExpression[?In, +Yield] +negative: + phase: parse + type: SyntaxError +features: [generators] +---*/ + +$DONOTEVALUATE(); + +function* g() { + for (yield * '' in {}; ; ) ; +} diff --git a/js/src/tests/test262/language/expressions/yield/star-in-rltn-expr.js b/js/src/tests/test262/language/expressions/yield/star-in-rltn-expr.js new file mode 100644 index 0000000000..3aa00be2b2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-in-rltn-expr.js @@ -0,0 +1,50 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions +es6id: 14.4 +description: > + YieldExpression contextually recognizes the `in` keyword as part of a + RelationalExpression +info: | + Syntax + + yield [no LineTerminator here] AssignmentExpression[?In, +Yield] +features: [generators, Symbol.iterator] +---*/ + +var obj = Object.create({ hit: true }); +var iter, iterResult, value; +Boolean.prototype[Symbol.iterator] = function* () { yield this.valueOf(); }; +function* g() { + value = yield * 'hit' in obj; + value = yield * 'miss' in obj; +} + +iter = g(); + +iterResult = iter.next('first'); + +assert.sameValue(iterResult.done, false, '`done` property (first iteration)'); +assert.sameValue(iterResult.value, true, '`value` property (first iteration)'); +assert.sameValue( + value, undefined, 'generator paused prior to evaluating AssignmentExpression' +); + +iterResult = iter.next('second'); + +assert.sameValue(iterResult.done, false, '`done` property (second iteration)'); +assert.sameValue( + iterResult.value, false, '`value` property (second iteration)' +); +assert.sameValue(value, undefined, 'value of first AssignmentExpression'); + +iterResult = iter.next('third'); + +assert.sameValue(iterResult.done, true, '`done` property (third iteration)'); +assert.sameValue( + iterResult.value, undefined, '`value` property (third iteration)' +); +assert.sameValue(value, undefined, 'value of second AssignmentExpression'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-iterable.js b/js/src/tests/test262/language/expressions/yield/star-iterable.js new file mode 100644 index 0000000000..4c00f343ca --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-iterable.js @@ -0,0 +1,42 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + When an iterator is the operand of a `yield *` expression, the generator + should produce an iterator that visits each iterated item. +features: [generators, Symbol.iterator] +---*/ + +var results = [{ value: 1 }, { value: 8 }, { value: 34, done: true }]; +var idx = 0; +var iterator = {}; +var iterable = { + next: function() { + var result = results[idx]; + idx += 1; + return result; + } +}; +iterator[Symbol.iterator] = function() { + return iterable; +}; +function* g() { + yield* iterator; +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, undefined, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 8, 'Third result `value`'); +assert.sameValue(result.done, undefined, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-return-is-null.js b/js/src/tests/test262/language/expressions/yield/star-return-is-null.js new file mode 100644 index 0000000000..3b703ee5f8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-return-is-null.js @@ -0,0 +1,57 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + If iterator's "return" method is `null`, + received completion is forwarded to the runtime. +info: | + YieldExpression : yield * AssignmentExpression + + [...] + 7. Repeat, + [...] + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). + iii. If return is undefined, then + [...] + 2. Return Completion(received). + + GetMethod ( V, P ) + + [...] + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. +features: [generators, Symbol.iterator] +---*/ + +var returnGets = 0; +var iterable = { + next: function() { + return {value: 1, done: false}; + }, + get return() { + returnGets += 1; + return null; + }, +}; + +iterable[Symbol.iterator] = function() { + return iterable; +}; + +function* generator() { + yield* iterable; +} + +var iterator = generator(); +iterator.next(); + +var result = iterator.return(2); +assert.sameValue(result.value, 2); +assert.sameValue(result.done, true); + +assert.sameValue(returnGets, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-err.js new file mode 100644 index 0000000000..74a20e2a24 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-err.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when invoking the @@iterator method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + + 7.4.1 GetIterator + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). + 2. Let iterator be ? Call(method, obj). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +badIter[Symbol.iterator] = function() { + throw thrown; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +assert.sameValue(caught, undefined, 'method is not invoked eagerly'); + +result = iter.next(); + +assert.sameValue(result.value, undefined, 'iteration value'); +assert.sameValue(result.done, true, 'iteration status'); +assert.sameValue(caught, thrown, 'error value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-non-obj.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-non-obj.js new file mode 100644 index 0000000000..65fa89f754 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-call-non-obj.js @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: TypeError thrown when @@iterator method returns a non-object value +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + + 7.4.1 GetIterator + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). + 2. Let iterator be ? Call(method, obj). + 3. If Type(iterator) is not Object, throw a TypeError exception. +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +badIter[Symbol.iterator] = function() { + return 7; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +result = iter.next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-get-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-get-err.js new file mode 100644 index 0000000000..b9ededfdd7 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-get-get-err.js @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when accessing the @@iterator property +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + + 7.4.1 GetIterator + + 1. If method was not passed, then + a. Let method be ? GetMethod(obj, @@iterator). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var poisonedIter = Object.defineProperty({}, Symbol.iterator, { + get: function() { + throw thrown; + } +}); +function* g() { + try { + yield * poisonedIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +assert.sameValue(caught, undefined, 'property is not accessed eagerly'); + +result = iter.next(); + +assert.sameValue(result.value, undefined, 'iteration value'); +assert.sameValue(result.done, true, 'iteration status'); +assert.sameValue(caught, thrown, 'error value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-err.js new file mode 100644 index 0000000000..bfacb141ef --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-err.js @@ -0,0 +1,52 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when invoking iterator `next` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + + 7.4.2 IteratorNext + + 1. If value was not passed, then + [...] + 2. Else, + a. Let result be ? Invoke(iterator, "next", « value »). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + throw thrown; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +result = iter.next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-non-obj.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-non-obj.js new file mode 100644 index 0000000000..8d0e27e212 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-call-non-obj.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + TypeError thrown when iterator `next` method returns a non-object value +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + + 7.4.2 IteratorNext + + 1. If value was not passed, then + [...] + 2. Else, + a. Let result be ? Invoke(iterator, "next", « value »). +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + return 8; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +result = iter.next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-get-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-get-err.js new file mode 100644 index 0000000000..3da74f2671 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-get-err.js @@ -0,0 +1,53 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when accessing iterator `next` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + + 7.4.2 IteratorNext + + 1. If value was not passed, then + [...] + 2. Else, + a. Let result be ? Invoke(iterator, "next", « value »). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedNext = Object.defineProperty({}, 'next', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return poisonedNext; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +result = iter.next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-invoke.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-invoke.js new file mode 100644 index 0000000000..50fc345659 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-next-invoke.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Invocation of iterator `next` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + + 7.4.2 IteratorNext + + 1. If value was not passed, then + [...] + 2. Else, + a. Let result be ? Invoke(iterator, "next", « value »). + [...] +features: [generators, Symbol.iterator] +---*/ + +var args, thisValue; +var callCount = 0; +var spyIterator = { + next: function() { + callCount += 1; + args = arguments; + thisValue = this; + return { done: true }; + } +}; +var spyIterable = {}; +spyIterable[Symbol.iterator] = function() { + return spyIterator; +}; +function* g() { + yield * spyIterable; +} +var iter = g(); + +iter.next(9876); + +assert.sameValue(callCount, 1); +assert.sameValue(args.length, 1); +assert.sameValue(args[0], undefined); +assert.sameValue(thisValue, spyIterator); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-err.js new file mode 100644 index 0000000000..8888b974f3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-err.js @@ -0,0 +1,55 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when accessing `done` property of iteration result +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + ii. Let done be ? IteratorComplete(innerResult). + + 7.4.3 IteratorComplete + + 1. Assert: Type(iterResult) is Object. + 2. Return ToBoolean(? Get(iterResult, "done")). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedDone = Object.defineProperty({}, 'done', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedDone; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +result = iter.next(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-no-value.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-no-value.js new file mode 100644 index 0000000000..2450ad2884 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-done-no-value.js @@ -0,0 +1,62 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + `value` property is not accessed when iteration is incomplete +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + ii. Let done be ? IteratorComplete(innerResult). + iii. If done is true, then + 1. Return ? IteratorValue(innerResult). +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +var callCount = 0; +var spyValue = Object.defineProperty({ done: false }, 'value', { + get: function() { + callCount += 1; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return spyValue; + } + }; +}; +var delegationComplete = false; +function* g() { + yield * badIter; + delegationComplete = true; +} +var iter = g(); + +iter.next(); +assert.sameValue(callCount, 0, 'access count (first iteration)'); +assert.sameValue( + delegationComplete, false, 'delegation ongoing (first iteration)' +); + +iter.next(); +assert.sameValue(callCount, 0, 'access count (second iteration)'); +assert.sameValue( + delegationComplete, false, 'delegation ongoing (second iteration)' +); + +spyValue.done = true; +iter.next(); +assert.sameValue(callCount, 1, 'access count (final iteration)'); +assert.sameValue(delegationComplete, true, 'delegation complete'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-err.js new file mode 100644 index 0000000000..efe0206098 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-err.js @@ -0,0 +1,58 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when accessing `value` property of iteration + result +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + ii. Let done be ? IteratorComplete(innerResult). + iii. If done is true, then + 1. Return ? IteratorValue(innerResult). + + 7.4.4 IteratorValue + + 1. Assert: Type(iterResult) is Object. + 2. Return ? Get(iterResult, "value"). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedValue = Object.defineProperty({ done: true }, 'value', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return poisonedValue; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +result = iter.next(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-final.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-final.js new file mode 100644 index 0000000000..3068878530 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-nrml-res-value-final.js @@ -0,0 +1,64 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Value received from invocation of generator's `next` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]). + ii. Let done be ? IteratorComplete(innerResult). + iii. If done is true, then + 1. Return ? IteratorValue(innerResult). + + 7.4.4 IteratorValue + + 1. Assert: Type(iterResult) is Object. + 2. Return ? Get(iterResult, "value"). +features: [generators, Symbol.iterator] +---*/ + +var quickIter = {}; +var exprValue, nextReceived, done, iter; +quickIter[Symbol.iterator] = function() { + return { + next: function(x) { + nextReceived = x; + return { + done: done, + value: 3333 + }; + } + }; +}; +function* g() { + exprValue = yield * quickIter; +} + +done = true; +iter = g(); +iter.next(4444); + +assert.sameValue( + nextReceived, undefined, 'received value (previously-exhausted iterator)' +); +assert.sameValue(exprValue, 3333, 'expression value (previously-exhausted iterator)'); + +done = false; +exprValue = null; +iter = g(); +iter.next(2222); +done = true; +iter.next(5555); + +assert.sameValue(nextReceived, 5555, 'received value'); +assert.sameValue(exprValue, 3333, 'expression value'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-no-rtrn.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-no-rtrn.js new file mode 100644 index 0000000000..8c2dd1bba9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-no-rtrn.js @@ -0,0 +1,78 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + "Return" completion returned when `return` method is not defined +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). + iii. If return is undefined, return Completion(received). +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +var throwCount = 0; +var returnCount = 0; +var hitNextStatement = false; +var hitCatch = false; +var hitFinally = false; +var spyResult = { + next: function() { + return { done: false }; + } +}; +Object.defineProperty(spyResult, 'throw', { + get: function() { + throwCount += 1; + } +}); +Object.defineProperty(spyResult, 'return', { + get: function() { + returnCount += 1; + } +}); +badIter[Symbol.iterator] = function() { + return spyResult; +}; +function* g() { + try { + yield * badIter; + hitNextStatement = true; + } catch (_) { + hitCatch = true; + } finally { + hitFinally = true; + } +} +var iter = g(); + +iter.next(); +iter.return(); + +assert.sameValue(throwCount, 0, '`throw` property access'); +assert.sameValue(returnCount, 1, '`return` property access'); +assert.sameValue( + hitFinally, true, 'Generator execution was resumed' +); +assert.sameValue( + hitNextStatement, false, 'Abrupt completion interrupted control flow' +); +assert.sameValue( + hitCatch, false, 'Abrupt completion not interpreted as "throw"' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-err.js new file mode 100644 index 0000000000..52d4b145e1 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-err.js @@ -0,0 +1,69 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when accessing `done` property of iteration result +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + 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 Type(innerReturnResult) is not Object, throw a TypeError + exception. + vi. Let done be ? IteratorComplete(innerReturnResult). + + 7.4.3 IteratorComplete + + 1. Assert: Type(iterResult) is Object. + 2. Return ToBoolean(? Get(iterResult, "done")). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedDone = Object.defineProperty({}, 'done', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function() { + return poisonedDone; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.return(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-no-value.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-no-value.js new file mode 100644 index 0000000000..b34b87dfd8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-done-no-value.js @@ -0,0 +1,93 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + `value` property is not accessed when iteration is incomplete +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + 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 Type(innerReturnResult) is not Object, throw a TypeError + exception. + vi. Let done be ? IteratorComplete(innerReturnResult). + vii. If done is true, then + 1. Let value be ? IteratorValue(innerReturnResult). + 2. Return Completion{[[Type]]: return, [[Value]]: value, + [[Target]]: empty}. + viii. Let received be GeneratorYield(innerReturnResult). + + 7.4.3 IteratorComplete + + 1. Assert: Type(iterResult) is Object. + 2. Return ToBoolean(? Get(iterResult, "done")). +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +var callCount = 0; +var spyValue = Object.defineProperty({ done: false }, 'value', { + get: function() { + callCount += 1; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function() { + return spyValue; + } + }; +}; +var normalCompletion = false; +var errorCompletion = false; +var delegationComplete = false; +function* g() { + try { + yield * badIter; + normalCompletion = true; + } catch (_) { + errorCompletion = true; + } finally { + delegationComplete = true; + } +} +var iter = g(); + +iter.next(); +assert.sameValue(callCount, 0, 'access count (first iteration)'); +assert.sameValue( + delegationComplete, false, 'delegation ongoing (first iteration)' +); + +iter.return(); +assert.sameValue(callCount, 0, 'access count (second iteration)'); +assert.sameValue( + delegationComplete, false, 'delegation ongoing (second iteration)' +); + +spyValue.done = true; +iter.return(); +assert.sameValue(callCount, 1, 'access count (final iteration)'); +assert.sameValue(delegationComplete, true, 'delegation complete'); +assert.sameValue(normalCompletion, false, 'completion was abrupt'); +assert.sameValue(errorCompletion, false, 'completion was not of type "throw"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-err.js new file mode 100644 index 0000000000..269dfe7cad --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-err.js @@ -0,0 +1,72 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when accessing `value` property of iteration + result +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + 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 Type(innerReturnResult) is not Object, throw a TypeError + exception. + vi. Let done be ? IteratorComplete(innerReturnResult). + vii. If done is true, then + 1. Let value be ? IteratorValue(innerReturnResult). + + 7.4.4 IteratorValue + + 1. Assert: Type(iterResult) is Object. + 2. Return ? Get(iterResult, "value"). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedValue = Object.defineProperty({ done: true }, 'value', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function() { + return poisonedValue; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.return(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-final.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-final.js new file mode 100644 index 0000000000..878450d948 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-res-value-final.js @@ -0,0 +1,73 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Value received from invocation of generator's `return` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + 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 Type(innerReturnResult) is not Object, throw a TypeError + exception. + vi. Let done be ? IteratorComplete(innerReturnResult). + vii. If done is true, then + 1. Let value be ? IteratorValue(innerReturnResult). + 2. Return Completion{[[Type]]: return, [[Value]]: value, + [[Target]]: empty}. + viii. Let received be GeneratorYield(innerReturnResult). + +features: [generators, Symbol.iterator] +---*/ + +var quickIter = {}; +var normalCompletion = false; +var errorCompletion = false; +var delegationComplete = false; +var iter, returnReceived; +quickIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function(x) { + returnReceived = x; + return { done: true, value: 3333 }; + } + }; +}; +function* g() { + try { + yield * quickIter; + normalCompletion = true; + } catch (e) { + errorCompletion = true; + } finally { + delegationComplete = true; + } +} + +iter = g(); + +iter.next(); +iter.return(2222); +assert.sameValue(returnReceived, 2222); +assert.sameValue(delegationComplete, true, 'delegation complete'); +assert.sameValue(normalCompletion, false, 'completion was abrupt'); +assert.sameValue(errorCompletion, false, 'completion was not of type "throw"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-err.js new file mode 100644 index 0000000000..9f16505ebf --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-err.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when invoking iterator `return` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + 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]] »). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function() { + throw thrown; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +iter.next(); +result = iter.return(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-non-obj.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-non-obj.js new file mode 100644 index 0000000000..53f2a56680 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-call-non-obj.js @@ -0,0 +1,60 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + TypeError thrown when iterator `return` method returns a non-object value +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + 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 Type(innerReturnResult) is not Object, throw a TypeError + exception. +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function() { + return 23; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +iter.next(); +result = iter.return(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-get-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-get-err.js new file mode 100644 index 0000000000..0f5450df23 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-get-err.js @@ -0,0 +1,67 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when accessing iterator `return` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + c. Else, + i. Assert: received.[[Type]] is return. + ii. Let return be ? GetMethod(iterator, "return"). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var callCount = 0; +var poisonedReturn = { + next: function() { + return { done: false }; + } +}; +Object.defineProperty(poisonedReturn, 'throw', { + get: function() { + callCount += 1; + } +}); +Object.defineProperty(poisonedReturn, 'return', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return poisonedReturn; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +iter.next(); + +assert.sameValue(caught, undefined, '`return` property not accessed eagerly'); + +result = iter.return(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(caught, thrown); +assert.sameValue(callCount, 0, 'iterator `throw` property is not accessed'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-invoke.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-invoke.js new file mode 100644 index 0000000000..88d9a4786c --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-rtrn-rtrn-invoke.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Invocation of iterator `return` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + [...] + 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]] »). + [...] +features: [generators, Symbol.iterator] +---*/ + +var args, thisValue; +var callCount = 0; +var spyIterator = { + next: function() { + return { done: false }; + }, + return: function() { + callCount += 1; + args = arguments; + thisValue = this; + return { done: true }; + } +}; +var spyIterable = {}; +spyIterable[Symbol.iterator] = function() { + return spyIterator; +}; +function* g() { + yield * spyIterable; +} +var iter = g(); + +iter.next(8888); +iter.return(7777); + +assert.sameValue(callCount, 1); +assert.sameValue(args.length, 1); +assert.sameValue(args[0], 7777); +assert.sameValue(thisValue, spyIterator); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-err.js new file mode 100644 index 0000000000..f1352e5789 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-err.js @@ -0,0 +1,68 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when accessing `done` property of iteration result +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + 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. NOTE: Exceptions from the inner iterator throw method are + propagated. Normal completions from an inner throw method are + processed similarly to an inner next. + 3. If Type(innerResult) is not Object, throw a TypeError exception. + 4. Let done be ? IteratorComplete(innerResult). + + 7.4.3 IteratorComplete + + 1. Assert: Type(iterResult) is Object. + 2. Return ToBoolean(? Get(iterResult, "done")). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedDone = Object.defineProperty({}, 'done', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + throw: function() { + return poisonedDone; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.throw(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-no-value.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-no-value.js new file mode 100644 index 0000000000..ef844d38a8 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-done-no-value.js @@ -0,0 +1,78 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + `value` property is not accessed when iteration is complete +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + 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. NOTE: Exceptions from the inner iterator throw method are + propagated. Normal completions from an inner throw method are + processed similarly to an inner next. + 3. If Type(innerResult) is not Object, throw a TypeError exception. + 4. Let done be ? IteratorComplete(innerResult). + 5. If done is true, then + a. Return ? IteratorValue(innerResult). + + 7.4.3 IteratorComplete + + 1. Assert: Type(iterResult) is Object. + 2. Return ToBoolean(? Get(iterResult, "done")). +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +var callCount = 0; +var spyValue = Object.defineProperty({ done: false }, 'value', { + get: function() { + callCount += 1; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + throw: function() { + return spyValue; + } + }; +}; +var delegationComplete = false; +function* g() { + yield * badIter; + delegationComplete = true; +} +var iter = g(); + +iter.next(); +assert.sameValue(callCount, 0, 'access count (first iteration)'); +assert.sameValue( + delegationComplete, false, 'delegation ongoing (first iteration)' +); + +iter.throw(); +assert.sameValue(callCount, 0, 'access count (second iteration)'); +assert.sameValue( + delegationComplete, false, 'delegation ongoing (second iteration)' +); + +spyValue.done = true; +iter.throw(); +assert.sameValue(callCount, 1, 'access count (final iteration)'); +assert.sameValue(delegationComplete, true, 'delegation complete'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-err.js new file mode 100644 index 0000000000..5ee80aed9a --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-err.js @@ -0,0 +1,71 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when accessing `value` property of iteration + result +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + 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. NOTE: Exceptions from the inner iterator throw method are + propagated. Normal completions from an inner throw method are + processed similarly to an inner next. + 3. If Type(innerResult) is not Object, throw a TypeError exception. + 4. Let done be ? IteratorComplete(innerResult). + 5. If done is true, then + a. Return ? IteratorValue(innerResult). + + 7.4.4 IteratorValue + + 1. Assert: Type(iterResult) is Object. + 2. Return ? Get(iterResult, "value"). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedValue = Object.defineProperty({ done: true }, 'value', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + throw: function() { + return poisonedValue; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.throw(); + +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-final.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-final.js new file mode 100644 index 0000000000..7101f1bcfa --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-res-value-final.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: Value received from invocation of generator's `throw` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + 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. NOTE: Exceptions from the inner iterator throw method are + propagated. Normal completions from an inner throw method are + processed similarly to an inner next. + 3. If Type(innerResult) is not Object, throw a TypeError exception. + 4. Let done be ? IteratorComplete(innerResult). + 5. If done is true, then + [...] + 6. Let received be GeneratorYield(innerResult). +features: [generators, Symbol.iterator] +---*/ + +var quickIter = {}; +var iter, exprValue, throwReceived; +quickIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + throw: function(x) { + throwReceived = x; + return { done: true, value: 3333 }; + } + }; +}; +function* g() { + exprValue = yield * quickIter; +} + +iter = g(); + +iter.next(); +iter.throw(2222); +assert.sameValue(throwReceived, 2222); +assert.sameValue(exprValue, 3333); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-err.js new file mode 100644 index 0000000000..5f588eefa6 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-err.js @@ -0,0 +1,54 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when invoking iterator `throw` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + 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]] + »). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + throw: function() { + throw thrown; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +iter.next(); +result = iter.throw(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-non-obj.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-non-obj.js new file mode 100644 index 0000000000..bbb7245e78 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-call-non-obj.js @@ -0,0 +1,59 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + TypeError thrown when iterator `throw` method returns a non-object value +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + 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. NOTE: Exceptions from the inner iterator throw method are + propagated. Normal completions from an inner throw method are + processed similarly to an inner next. + 3. If Type(innerResult) is not Object, throw a TypeError exception. +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + throw: function() { + return 23; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +iter.next(); +result = iter.throw(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-get-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-get-err.js new file mode 100644 index 0000000000..23d11ba8dc --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-get-err.js @@ -0,0 +1,57 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Abrupt completion returned when accessing iterator `throw` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var poisonedThrow = { + next: function() { + return { done: false }; + } +}; +Object.defineProperty(poisonedThrow, 'throw', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return poisonedThrow; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var result, caught; + +iter.next(); + +assert.sameValue(caught, undefined, '`throw` property not accesed eagerly'); + +result = iter.throw(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-invoke.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-invoke.js new file mode 100644 index 0000000000..5db1533f5f --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-thrw-invoke.js @@ -0,0 +1,56 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: Invocation of iterator `throw` method +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + 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]] + »). + [...] +features: [generators, Symbol.iterator] +---*/ + +var args, thisValue; +var callCount = 0; +var spyIterator = { + next: function() { + return { done: false }; + }, + throw: function() { + callCount += 1; + args = arguments; + thisValue = this; + return { done: true }; + } +}; +var spyIterable = {}; +spyIterable[Symbol.iterator] = function() { + return spyIterator; +}; +function* g() { + yield * spyIterable; +} +var iter = g(); + +iter.next(8888); +iter.throw(7777); + +assert.sameValue(callCount, 1); +assert.sameValue(args.length, 1); +assert.sameValue(args[0], 7777); +assert.sameValue(thisValue, spyIterator); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-no-rtrn.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-no-rtrn.js new file mode 100644 index 0000000000..a32cee1265 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-no-rtrn.js @@ -0,0 +1,82 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned after protocol violation (and a `return` method + is not defined) +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + [...] + iii. Else, + 1. NOTE: If iterator does not have a throw method, this throw is + going to terminate the yield* loop. But first we need to give + iterator a chance to clean up. + 2. Perform ? IteratorClose(iterator, Completion{[[Type]]: normal, + [[Value]]: empty, [[Target]]: empty}). + 3. NOTE: The next step throws a TypeError to indicate that there + was a yield* protocol violation: iterator does not have a throw + method. + 4. Throw a TypeError exception. + + 7.4.6 IteratorClose + + 1. Assert: Type(iterator) is Object. + 2. Assert: completion is a Completion Record. + 3. Let return be ? GetMethod(iterator, "return"). + 4. If return is undefined, return Completion(completion). +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +var throwCount = 0; +var returnCount = 0; +var spyResult = { + next: function() { + return { done: false }; + } +}; +Object.defineProperty(spyResult, 'throw', { + get: function() { + throwCount += 1; + } +}); +Object.defineProperty(spyResult, 'return', { + get: function() { + returnCount += 1; + } +}); +badIter[Symbol.iterator] = function() { + return spyResult; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.throw(); + +assert.sameValue(throwCount, 1, '`throw` property access'); +assert.sameValue(returnCount, 1, '`return` property access'); +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-err.js new file mode 100644 index 0000000000..8f6062bd4d --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-err.js @@ -0,0 +1,73 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when invoking iterator `return` method following + protocol violation +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + [...] + iii. Else, + 1. NOTE: If iterator does not have a throw method, this throw is + going to terminate the yield* loop. But first we need to give + iterator a chance to clean up. + 2. Perform ? IteratorClose(iterator, Completion{[[Type]]: normal, + [[Value]]: empty, [[Target]]: empty}). + + 7.4.6 IteratorClose + + 1. Assert: Type(iterator) is Object. + 2. Assert: completion is a Completion Record. + 3. Let return be ? GetMethod(iterator, "return"). + 4. If return is undefined, return Completion(completion). + 5. Let innerResult be Call(return, iterator, « »). + 6. If completion.[[Type]] is throw, return Completion(completion). + 7. If innerResult.[[Type]] is throw, return Completion(innerResult). + 8. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception. +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function() { + // Using a primitive completion value ensures that the check for the type + // of the completion value (and resulting TypeError) occurs *after* the + // check for the type of the completion itself (which is the behavior + // under test). + throw 87; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.throw(); + +assert.sameValue(caught, 87); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-non-obj.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-non-obj.js new file mode 100644 index 0000000000..8a8ac0314e --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-call-non-obj.js @@ -0,0 +1,70 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Non-object value returned by iterator `return` method following protocol + violation +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + [...] + iii. Else, + 1. NOTE: If iterator does not have a throw method, this throw is + going to terminate the yield* loop. But first we need to give + iterator a chance to clean up. + 2. Perform ? IteratorClose(iterator, Completion{[[Type]]: normal, + [[Value]]: empty, [[Target]]: empty}). + + 7.4.6 IteratorClose + + 1. Assert: Type(iterator) is Object. + 2. Assert: completion is a Completion Record. + 3. Let return be ? GetMethod(iterator, "return"). + 4. If return is undefined, return Completion(completion). + 5. Let innerResult be Call(return, iterator, « »). + 6. If completion.[[Type]] is throw, return Completion(completion). + 7. If innerResult.[[Type]] is throw, return Completion(innerResult). + 8. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception. +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +badIter[Symbol.iterator] = function() { + return { + next: function() { + return { done: false }; + }, + return: function() { + return 87; + } + }; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.throw(); + +assert.sameValue(typeof caught, 'object'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-get-err.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-get-err.js new file mode 100644 index 0000000000..be98f16ef9 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-get-err.js @@ -0,0 +1,75 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned when accessing iterator `return` property after + protocol violation +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + [...] + iii. Else, + 1. NOTE: If iterator does not have a throw method, this throw is + going to terminate the yield* loop. But first we need to give + iterator a chance to clean up. + 2. Perform ? IteratorClose(iterator, Completion{[[Type]]: normal, + [[Value]]: empty, [[Target]]: empty}). + + 7.4.6 IteratorClose + + 1. Assert: Type(iterator) is Object. + 2. Assert: completion is a Completion Record. + 3. Let return be ? GetMethod(iterator, "return"). +features: [generators, Symbol.iterator] +---*/ + +var thrown = new Test262Error(); +var badIter = {}; +var callCount = 0; +var poisonedReturn = { + next: function() { + return { done: false }; + } +}; +Object.defineProperty(poisonedReturn, 'throw', { + get: function() { + callCount += 1; + } +}); +Object.defineProperty(poisonedReturn, 'return', { + get: function() { + throw thrown; + } +}); +badIter[Symbol.iterator] = function() { + return poisonedReturn; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.throw(); + +assert.sameValue(callCount, 1); +assert.sameValue(caught, thrown); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-invoke.js b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-invoke.js new file mode 100644 index 0000000000..f6bcff0a05 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-iter-thrw-violation-rtrn-invoke.js @@ -0,0 +1,91 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: > + Abrupt completion returned after protocol violation (and a `return` method + is defined) +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). + 3. Let iterator be ? GetIterator(value). + 4. Let received be NormalCompletion(undefined). + 5. Repeat + a. If received.[[Type]] is normal, then + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + [...] + iii. Else, + 1. NOTE: If iterator does not have a throw method, this throw is + going to terminate the yield* loop. But first we need to give + iterator a chance to clean up. + 2. Perform ? IteratorClose(iterator, Completion{[[Type]]: normal, + [[Value]]: empty, [[Target]]: empty}). + 3. NOTE: The next step throws a TypeError to indicate that there + was a yield* protocol violation: iterator does not have a throw + method. + 4. Throw a TypeError exception. + + 7.4.6 IteratorClose + + 1. Assert: Type(iterator) is Object. + 2. Assert: completion is a Completion Record. + 3. Let return be ? GetMethod(iterator, "return"). + 4. If return is undefined, return Completion(completion). + 5. Let innerResult be Call(return, iterator, « »). + 6. If completion.[[Type]] is throw, return Completion(completion). + 7. If innerResult.[[Type]] is throw, return Completion(innerResult). + 8. If Type(innerResult.[[Value]]) is not Object, throw a TypeError exception. + 9. Return Completion(completion). +features: [generators, Symbol.iterator] +---*/ + +var badIter = {}; +var throwCount = 0; +var thisValue, args; +var poisonedReturn = { + next: function() { + return { done: false }; + }, + return: function() { + thisValue = this; + args = arguments; + return 'this value has no effect on the protocol'; + } +}; +Object.defineProperty(poisonedReturn, 'throw', { + get: function() { + throwCount += 1; + } +}); +badIter[Symbol.iterator] = function() { + return poisonedReturn; +}; +function* g() { + try { + yield * badIter; + } catch (err) { + caught = err; + } +} +var iter = g(); +var caught; + +iter.next(); +iter.throw(); + +assert.sameValue(throwCount, 1); +assert.sameValue(thisValue, poisonedReturn, '"this" value'); +assert.sameValue( + typeof args, 'object', 'method invoked, arguments object provided' +); +assert.sameValue(args.length, 0); +assert.sameValue(typeof caught, 'object', 'object value thrown'); +assert.sameValue(caught.constructor, TypeError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-rhs-unresolvable.js b/js/src/tests/test262/language/expressions/yield/star-rhs-unresolvable.js new file mode 100644 index 0000000000..a5687a94c4 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-rhs-unresolvable.js @@ -0,0 +1,33 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +description: GetValue invoked on Reference value +info: | + YieldExpression : yield * AssignmentExpression + + 1. Let exprRef be the result of evaluating AssignmentExpression. + 2. Let value be ? GetValue(exprRef). +features: [generators] +---*/ + +var err; +function* g() { + try { + yield * test262unresolvable; + } catch (_err) { + err = _err; + } +} +var iter = g(); +var result; + +result = iter.next(); + +assert.sameValue(result.value, undefined); +assert.sameValue(result.done, true); +assert.sameValue(typeof err, 'object'); +assert.sameValue(err.constructor, ReferenceError); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-string.js b/js/src/tests/test262/language/expressions/yield/star-string.js new file mode 100644 index 0000000000..b2fc8c536d --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-string.js @@ -0,0 +1,33 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + When a string is the operand of a `yield *` expression, the generator + should produce an iterator that visits each character in order. +features: [generators] +---*/ + +function* g() { + yield* 'abc'; +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 'a', 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 'b', 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 'c', 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/star-throw-is-null.js b/js/src/tests/test262/language/expressions/yield/star-throw-is-null.js new file mode 100644 index 0000000000..90c5c5de41 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/star-throw-is-null.js @@ -0,0 +1,73 @@ +// Copyright (C) 2020 Alexey Shvayka. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-generator-function-definitions-runtime-semantics-evaluation +description: > + If iterator's "throw" method is `null`, + IteratorClose is called before rising TypeError. +info: | + YieldExpression : yield * AssignmentExpression + + [...] + 7. Repeat, + [...] + b. Else if received.[[Type]] is throw, then + i. Let throw be ? GetMethod(iterator, "throw"). + ii. If throw is not undefined, then + [...] + iii. Else, + [...] + 4. Else, perform ? IteratorClose(iteratorRecord, closeCompletion). + [...] + 6. Throw a TypeError exception. + + GetMethod ( V, P ) + + [...] + 2. Let func be ? GetV(V, P). + 3. If func is either undefined or null, return undefined. + + IteratorClose ( iteratorRecord, completion ) + + [...] + 4. Let innerResult be GetMethod(iterator, "return"). + 5. If innerResult.[[Type]] is normal, then + a. Let return be innerResult.[[Value]]. + b. If return is undefined, return Completion(completion). +features: [generators, Symbol.iterator] +---*/ + +var throwGets = 0; +var returnGets = 0; +var iterable = { + next: function() { + return {value: 1, done: false}; + }, + get throw() { + throwGets += 1; + return null; + }, + get return() { + returnGets += 1; + }, +}; + +iterable[Symbol.iterator] = function() { + return iterable; +}; + +function* generator() { + yield* iterable; +} + +var iterator = generator(); +iterator.next(); + +assert.throws(TypeError, function() { + iterator.throw(); +}); + +assert.sameValue(throwGets, 1); +assert.sameValue(returnGets, 1); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/then-return.js b/js/src/tests/test262/language/expressions/yield/then-return.js new file mode 100644 index 0000000000..5ec10fac84 --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/then-return.js @@ -0,0 +1,24 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + When a generator body contains a yield statement followed by a return + statement, it should produce an iterator that visits the yieled value and + completes on the returned value. +features: [generators] +---*/ + +function* g() { yield 1; return 2; } +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 1, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 2, 'Second result `value`'); +assert.sameValue(result.done, true, 'Second result `done` flag'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/yield/within-for.js b/js/src/tests/test262/language/expressions/yield/within-for.js new file mode 100644 index 0000000000..ddc98c63cd --- /dev/null +++ b/js/src/tests/test262/language/expressions/yield/within-for.js @@ -0,0 +1,34 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 25.2 +description: > + `yield` expressions should suspend `for` loop iteration. +features: [generators] +---*/ + +function* g() { + for (var idx = 0; idx < 3; idx++) { + yield idx; + } +} +var iter = g(); +var result; + +result = iter.next(); +assert.sameValue(result.value, 0, 'First result `value`'); +assert.sameValue(result.done, false, 'First result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 1, 'Second result `value`'); +assert.sameValue(result.done, false, 'Second result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, 2, 'Third result `value`'); +assert.sameValue(result.done, false, 'Third result `done` flag'); + +result = iter.next(); +assert.sameValue(result.value, undefined, 'Final result `value`'); +assert.sameValue(result.done, true, 'Final result `done` flag'); + +reportCompare(0, 0); -- cgit v1.2.3